WPILib 2012
WPILibRoboticsLibraryforFRC
Vision/ColorImage.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2008. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __COLOR_IMAGE_H__
00008 #define __COLOR_IMAGE_H__
00009 
00010 #include "ImageBase.h"
00011 #include "BinaryImage.h"
00012 #include "Threshold.h"
00013 
00014 class ColorImage : public ImageBase
00015 {
00016 public:
00017         ColorImage(ImageType type);
00018         virtual ~ColorImage();
00019         BinaryImage *ThresholdRGB(int redLow, int redHigh, int greenLow, int greenHigh, int blueLow, int blueHigh);
00020         BinaryImage *ThresholdHSL(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int luminenceLow, int luminenceHigh);
00021         BinaryImage *ThresholdHSV(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int valueHigh, int valueLow);
00022         BinaryImage *ThresholdHSI(int hueLow, int hueHigh, int saturationLow, int saturationHigh, int intensityLow, int intensityHigh);
00023         BinaryImage *ThresholdRGB(Threshold &threshold);
00024         BinaryImage *ThresholdHSL(Threshold &threshold);
00025         BinaryImage *ThresholdHSV(Threshold &threshold);
00026         BinaryImage *ThresholdHSI(Threshold &threshold);
00027         MonoImage *GetRedPlane();
00028         MonoImage *GetGreenPlane();
00029         MonoImage *GetBluePlane();
00030         MonoImage *GetHSLHuePlane();
00031         MonoImage *GetHSVHuePlane();
00032         MonoImage *GetHSIHuePlane();
00033         MonoImage *GetHSLSaturationPlane();
00034         MonoImage *GetHSVSaturationPlane();
00035         MonoImage *GetHSISaturationPlane();
00036         MonoImage *GetLuminancePlane();
00037         MonoImage *GetValuePlane();
00038         MonoImage *GetIntensityPlane();
00039         void ReplaceRedPlane(MonoImage *plane);
00040         void ReplaceGreenPlane(MonoImage *plane);
00041         void ReplaceBluePlane(MonoImage *plane);
00042         void ReplaceHSLHuePlane(MonoImage *plane);
00043         void ReplaceHSVHuePlane(MonoImage *plane);
00044         void ReplaceHSIHuePlane(MonoImage *plane);
00045         void ReplaceHSLSaturationPlane(MonoImage *plane);
00046         void ReplaceHSVSaturationPlane(MonoImage *plane);
00047         void ReplaceHSISaturationPlane(MonoImage *plane);
00048         void ReplaceLuminancePlane(MonoImage *plane);
00049         void ReplaceValuePlane(MonoImage *plane);
00050         void ReplaceIntensityPlane(MonoImage *plane);
00051         void ColorEqualize();
00052         void LuminanceEqualize();
00053         
00054 private:
00055         BinaryImage *ComputeThreshold(ColorMode colorMode, int low1, int high1, int low2, int high2, int low3, int high3);
00056         void Equalize(bool allPlanes);
00057         MonoImage * ExtractColorPlane(ColorMode mode, int planeNumber);
00058         MonoImage * ExtractFirstColorPlane(ColorMode mode);
00059         MonoImage * ExtractSecondColorPlane(ColorMode mode);
00060         MonoImage * ExtractThirdColorPlane(ColorMode mode);
00061         void ReplacePlane(ColorMode mode, MonoImage *plane, int planeNumber);
00062         void ReplaceFirstColorPlane(ColorMode mode, MonoImage *plane);
00063         void ReplaceSecondColorPlane(ColorMode mode, MonoImage *plane);
00064         void ReplaceThirdColorPlane(ColorMode mode, MonoImage *plane);
00065 };
00066 
00067 #endif
00068 
 All Classes Functions Variables