62 m_pColorParameterSet = 0;
107 m_pROIList = pROIList;
109 if (m_pROIList && m_pROIList->size() != 0)
111 const int nSize = (int) m_pROIList->size();
112 for (
int i = 0; i < nSize; i++)
121 m_pColorParameterSet = pColorParameterSet;
128 printf(
"error: call CObjectColorSegmenter::SetImage first and do not use optimizer\n");
143 if (!m_pColorParameterSet)
145 printf(
"error: color parameter set has not been set\n");
151 printf(
"error: call CObjectColorSegmenter::SetImage first\n");
159 printf(
"error: could not load parameters for segmenting color\n");
163 if (m_pROIList && m_pROIList->size() != 0)
167 const int nSize = (int) m_pROIList->size();
168 for (
int i = 0; i < nSize; i++)
172 if (entry.
color == color)
173 ImageProcessor::FilterHSV(m_pHSVImage, pResultImage, pParameters[0], pParameters[1], pParameters[2], pParameters[3], pParameters[4], pParameters[5], &entry.
region);
178 ImageProcessor::FilterHSV(m_pHSVImage, pResultImage, pParameters[0], pParameters[1], pParameters[2], pParameters[3], pParameters[4], pParameters[5]);
187 if (m_pROIList && m_pROIList->size() != 0)
189 const int nSize = (int) m_pROIList->size();
190 for (
int i = 0; i < nSize; i++)
194 if (entry.
color == color)
214 printf(
"error: call CObjectColorSegmenter::SetImage first\n");
218 if (m_pROIList && m_pROIList->size() != 0)
222 const int nSize = (int) m_pROIList->size();
223 for (
int i = 0; i < nSize; i++)
227 if (entry.
color == color)
void SetImage(const CByteImage *pImage, const Object2DList *pROIList=0)
void Zero(CByteImage *pImage, const MyRegion *pROI=0)
Sets all values in a CByteImage to zero.
bool CalculateSaturationImage(const CByteImage *pInputImage, CByteImage *pOutputImage)
Calculates the saturation image for an RGB CByteImage and writes the result to a CByteImage.
std::vector< Object2DEntry > Object2DList
void FindColoredRegions(CByteImage *pResultImage, RegionList ®ionList, int nMinPointsPerRegion)
std::vector< MyRegion > RegionList
bool Erode(const CByteImage *pInputImage, CByteImage *pOutputImage, int nMaskSize=3, const MyRegion *pROI=0)
Applies a morphological erode operation to a binary CByteImage and writes the result to a binary CByt...
void FindRegionsOfGivenColor(CByteImage *pResultImage, ObjectColor color, RegionList ®ionList, int nMinPointsPerRegion)
int width
The width of the image in pixels.
bool FilterHSV(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char hue, unsigned char tol_hue, unsigned char min_sat, unsigned char max_sat, unsigned char min_v, unsigned char max_v, const MyRegion *pROI=0)
Performs color filtering with binarization for an HSV CByteImage and writes the result to a grayscale...
int height
The height of the image in pixels.
void SetColorParameterSet(const CColorParameterSet *pColorParameterSet)
bool CalculateHSVImage(const CByteImage *pInputImage, CByteImage *pOutputImage, const MyRegion *pROI=0)
Computes the HSV image for a RGB CByteImage and writes the result to a CByteImage.
const int * GetColorParameters(ObjectColor color) const
void CalculateSegmentedImage(CByteImage *pResultImage, ObjectColor color)
bool IsCompatible(const CByteImage *pImage) const
Checks whether two images are compatible or not.
bool Dilate(const CByteImage *pInputImage, CByteImage *pOutputImage, int nMaskSize=3, const MyRegion *pROI=0)
Applies a morphological dilate operation to a binary CByteImage and writes the result to a binary CBy...
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
bool ThresholdBinarize(const CByteImage *pInputImage, CByteImage *pOutputImage, unsigned char nThreshold)
Performs threshold binarization to a CByteImage and writes the result to a CByteImage.
bool FindRegions(const CByteImage *pImage, RegionList ®ionList, int nMinimumPointsPerRegion=0, int nMaximumPointsPerRegion=0, bool bCalculateBoundingBox=true, bool bStorePixels=false)
Performs region growing on a binary CByteImage, segmenting all regions in the image.