WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
ColorImage.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include "ImageBase.h"
11 #include "BinaryImage.h"
12 #include "Threshold.h"
13 
14 class ColorImage : public ImageBase {
15  public:
16  ColorImage(ImageType type);
17  virtual ~ColorImage() = default;
18  BinaryImage *ThresholdRGB(int redLow, int redHigh, int greenLow,
19  int greenHigh, int blueLow, int blueHigh);
20  BinaryImage *ThresholdHSL(int hueLow, int hueHigh, int saturationLow,
21  int saturationHigh, int luminenceLow,
22  int luminenceHigh);
23  BinaryImage *ThresholdHSV(int hueLow, int hueHigh, int saturationLow,
24  int saturationHigh, int valueHigh, int valueLow);
25  BinaryImage *ThresholdHSI(int hueLow, int hueHigh, int saturationLow,
26  int saturationHigh, int intensityLow,
27  int intensityHigh);
28  BinaryImage *ThresholdRGB(Threshold &threshold);
29  BinaryImage *ThresholdHSL(Threshold &threshold);
30  BinaryImage *ThresholdHSV(Threshold &threshold);
31  BinaryImage *ThresholdHSI(Threshold &threshold);
32  MonoImage *GetRedPlane();
33  MonoImage *GetGreenPlane();
34  MonoImage *GetBluePlane();
35  MonoImage *GetHSLHuePlane();
36  MonoImage *GetHSVHuePlane();
37  MonoImage *GetHSIHuePlane();
38  MonoImage *GetHSLSaturationPlane();
39  MonoImage *GetHSVSaturationPlane();
40  MonoImage *GetHSISaturationPlane();
41  MonoImage *GetLuminancePlane();
42  MonoImage *GetValuePlane();
43  MonoImage *GetIntensityPlane();
44  void ReplaceRedPlane(MonoImage *plane);
45  void ReplaceGreenPlane(MonoImage *plane);
46  void ReplaceBluePlane(MonoImage *plane);
47  void ReplaceHSLHuePlane(MonoImage *plane);
48  void ReplaceHSVHuePlane(MonoImage *plane);
49  void ReplaceHSIHuePlane(MonoImage *plane);
53  void ReplaceLuminancePlane(MonoImage *plane);
54  void ReplaceValuePlane(MonoImage *plane);
55  void ReplaceIntensityPlane(MonoImage *plane);
56  void ColorEqualize();
57  void LuminanceEqualize();
58 
59  private:
60  BinaryImage *ComputeThreshold(ColorMode colorMode, int low1, int high1,
61  int low2, int high2, int low3, int high3);
62  void Equalize(bool allPlanes);
63  MonoImage *ExtractColorPlane(ColorMode mode, int planeNumber);
64  MonoImage *ExtractFirstColorPlane(ColorMode mode);
65  MonoImage *ExtractSecondColorPlane(ColorMode mode);
66  MonoImage *ExtractThirdColorPlane(ColorMode mode);
67  void ReplacePlane(ColorMode mode, MonoImage *plane, int planeNumber);
68  void ReplaceFirstColorPlane(ColorMode mode, MonoImage *plane);
69  void ReplaceSecondColorPlane(ColorMode mode, MonoImage *plane);
70  void ReplaceThirdColorPlane(ColorMode mode, MonoImage *plane);
71 };
void ReplaceHSIHuePlane(MonoImage *plane)
Replace the first Hue plane in a HSI image with a MonoImage.
Definition: ColorImage.cpp:368
void ReplaceRedPlane(MonoImage *plane)
Replace the red color plane with a MonoImage.
Definition: ColorImage.cpp:318
void ReplaceHSVHuePlane(MonoImage *plane)
Replace the Hue color plane in a HSV image with a MonoImage.
Definition: ColorImage.cpp:358
void ReplaceIntensityPlane(MonoImage *plane)
Replace the Intensity color plane in a HSI image with a MonoImage.
Definition: ColorImage.cpp:428
void ReplaceGreenPlane(MonoImage *plane)
Replace the green color plane with a MonoImage.
Definition: ColorImage.cpp:328
void ReplaceHSVSaturationPlane(MonoImage *plane)
Replace the Saturation color plane in a HSV image with a MonoImage.
Definition: ColorImage.cpp:388
void ReplaceBluePlane(MonoImage *plane)
Replace the blue color plane with a MonoImage.
Definition: ColorImage.cpp:338
void ReplaceLuminancePlane(MonoImage *plane)
Replace the Luminance color plane in an HSL image with a MonoImage.
Definition: ColorImage.cpp:408
Definition: MonoImage.h:14
Definition: ColorImage.h:14
BinaryImage * ThresholdHSV(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int valueHigh, int valueLow)
Perform a threshold in HSV space.
Definition: ColorImage.cpp:102
BinaryImage * ThresholdHSI(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int intensityLow, int intensityHigh)
Perform a threshold in HSI space.
Definition: ColorImage.cpp:131
BinaryImage * ThresholdHSL(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int luminenceLow, int luminenceHigh)
Perform a threshold in HSL space.
Definition: ColorImage.cpp:73
Definition: ImageBase.h:16
void ReplaceHSLSaturationPlane(MonoImage *plane)
Replace the Saturation color plane in an HSL image with a MonoImage.
Definition: ColorImage.cpp:378
void ReplaceHSISaturationPlane(MonoImage *plane)
Replace the Saturation color plane in a HSI image with a MonoImage.
Definition: ColorImage.cpp:398
void ReplaceHSLHuePlane(MonoImage *plane)
Replace the Hue color plane in a HSL image with a MonoImage.
Definition: ColorImage.cpp:348
void ReplaceValuePlane(MonoImage *plane)
Replace the Value color plane in an HSV with a MonoImage.
Definition: ColorImage.cpp:418
Color threshold values.
Definition: Threshold.h:16
BinaryImage * ThresholdRGB(int redLow, int redHigh, int greenLow, int greenHigh, int blueLow, int blueHigh)
Perform a threshold in RGB space.
Definition: ColorImage.cpp:44
Included for ParticleAnalysisReport definition TODO: Eliminate this dependency!
Definition: BinaryImage.h:20