/
ColorImage.h
68 lines (62 loc) · 2.93 KB
/
ColorImage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#ifndef __COLOR_IMAGE_H__
#define __COLOR_IMAGE_H__
#include "ImageBase.h"
#include "BinaryImage.h"
#include "Threshold.h"
class ColorImage : public ImageBase
{
public:
ColorImage(ImageType type);
virtual ~ColorImage();
BinaryImage *ThresholdRGB(int redLow, int redHigh, int greenLow, int greenHigh, int blueLow, int blueHigh);
BinaryImage *ThresholdHSL(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int luminenceLow, int luminenceHigh);
BinaryImage *ThresholdHSV(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int valueHigh, int valueLow);
BinaryImage *ThresholdHSI(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int intensityLow, int intensityHigh);
BinaryImage *ThresholdRGB(Threshold &threshold);
BinaryImage *ThresholdHSL(Threshold &threshold);
BinaryImage *ThresholdHSV(Threshold &threshold);
BinaryImage *ThresholdHSI(Threshold &threshold);
MonoImage *GetRedPlane();
MonoImage *GetGreenPlane();
MonoImage *GetBluePlane();
MonoImage *GetHSLHuePlane();
MonoImage *GetHSVHuePlane();
MonoImage *GetHSIHuePlane();
MonoImage *GetHSLSaturationPlane();
MonoImage *GetHSVSaturationPlane();
MonoImage *GetHSISaturationPlane();
MonoImage *GetLuminancePlane();
MonoImage *GetValuePlane();
MonoImage *GetIntensityPlane();
void ReplaceRedPlane(MonoImage *plane);
void ReplaceGreenPlane(MonoImage *plane);
void ReplaceBluePlane(MonoImage *plane);
void ReplaceHSLHuePlane(MonoImage *plane);
void ReplaceHSVHuePlane(MonoImage *plane);
void ReplaceHSIHuePlane(MonoImage *plane);
void ReplaceHSLSaturationPlane(MonoImage *plane);
void ReplaceHSVSaturationPlane(MonoImage *plane);
void ReplaceHSISaturationPlane(MonoImage *plane);
void ReplaceLuminancePlane(MonoImage *plane);
void ReplaceValuePlane(MonoImage *plane);
void ReplaceIntensityPlane(MonoImage *plane);
void ColorEqualize();
void LuminanceEqualize();
private:
BinaryImage *ComputeThreshold(ColorMode colorMode, int low1, int high1, int low2, int high2, int low3, int high3);
void Equalize(bool allPlanes);
MonoImage * ExtractColorPlane(ColorMode mode, int planeNumber);
MonoImage * ExtractFirstColorPlane(ColorMode mode);
MonoImage * ExtractSecondColorPlane(ColorMode mode);
MonoImage * ExtractThirdColorPlane(ColorMode mode);
void ReplacePlane(ColorMode mode, MonoImage *plane, int planeNumber);
void ReplaceFirstColorPlane(ColorMode mode, MonoImage *plane);
void ReplaceSecondColorPlane(ColorMode mode, MonoImage *plane);
void ReplaceThirdColorPlane(ColorMode mode, MonoImage *plane);
};
#endif