66 pInputImage->
type != pOutputImage->
type)
72 cvFlip(pIplInputImage, pIplOutputImage);
74 cvReleaseImageHeader(&pIplInputImage);
75 cvReleaseImageHeader(&pIplOutputImage);
81 pInputImage->
type != pOutputImage->
type)
87 cvSmooth(pIplInputImage, pIplOutputImage, CV_GAUSSIAN, 3, 3);
89 cvReleaseImageHeader(&pIplInputImage);
90 cvReleaseImageHeader(&pIplOutputImage);
96 pInputImage->
type != pOutputImage->
type)
102 cvSmooth(pIplInputImage, pIplOutputImage, CV_GAUSSIAN, 5, 5);
104 cvReleaseImageHeader(&pIplInputImage);
105 cvReleaseImageHeader(&pIplOutputImage);
111 pInputImage->
type != pOutputImage->
type)
117 cvSmooth(pIplInputImage, pIplOutputImage, CV_BILATERAL, param1, param2);
119 cvReleaseImageHeader(&pIplInputImage);
120 cvReleaseImageHeader(&pIplOutputImage);
127 pInputImage->
type != pOutputImage->
type)
132 IplImage *pIplTempImage = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_16S, 1);
134 cvLaplace(pIplInputImage, pIplTempImage, 1);
135 cvConvertScaleAbs(pIplTempImage, pIplOutputImage);
137 cvReleaseImage(&pIplTempImage);
138 cvReleaseImageHeader(&pIplInputImage);
139 cvReleaseImageHeader(&pIplOutputImage);
150 IplImage *pIplTempImage = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_16S, 1);
152 cvLaplace(pIplInputImage, pIplTempImage, 5);
153 cvConvertScaleAbs(pIplTempImage, pIplOutputImage);
155 cvReleaseImage(&pIplTempImage);
156 cvReleaseImageHeader(&pIplInputImage);
157 cvReleaseImageHeader(&pIplOutputImage);
162 if (pInputImage->
type != pOutputImage->
type)
169 cvSetImageROI(pIplInputImage, cvRect(x, y, width, height));
171 cvResize(pIplInputImage, pIplOutputImage);
173 cvReleaseImageHeader(&pIplInputImage);
174 cvReleaseImageHeader(&pIplOutputImage);
188 IplImage *diff = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_16S, 1);
189 IplImage *abs = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_8U, 1);
191 cvSmooth(pIplInputImage, abs, CV_GAUSSIAN, 3, 3);
192 cvSobel(abs, diff, 1, 0, 3);
193 cvConvertScaleAbs(diff, pIplOutputImage);
194 cvSobel(abs, diff, 0, 1, 3);
195 cvConvertScaleAbs(diff, abs);
196 cvAdd(abs, pIplOutputImage, pIplOutputImage, 0);
198 cvReleaseImage(&diff);
199 cvReleaseImage(&abs);
205 IplImage *singleChannel0 = cvCreateImage(cvSize(pInputImage->
width,pInputImage->
height), IPL_DEPTH_8U, 1);
206 IplImage *singleChannel1 = cvCreateImage(cvSize(pInputImage->
width,pInputImage->
height), IPL_DEPTH_8U, 1);
207 IplImage *singleChannel2 = cvCreateImage(cvSize(pInputImage->
width,pInputImage->
height), IPL_DEPTH_8U, 1);
208 IplImage *diff = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_16S, 1);
209 IplImage *abs = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_8U, 1);
211 cvCvtPixToPlane(pIplInputImage, singleChannel0, singleChannel1, singleChannel2, NULL);
213 cvSmooth(singleChannel0, singleChannel0, CV_GAUSSIAN, 3, 3);
214 cvSobel(singleChannel0, diff, 1, 0, 3);
215 cvConvertScaleAbs(diff, abs);
216 cvSobel(singleChannel0, diff, 0, 1, 3);
217 cvConvertScaleAbs(diff, singleChannel0);
218 cvAdd(abs, singleChannel0, pIplOutputImage, 0);
220 cvSmooth(singleChannel1, singleChannel1, CV_GAUSSIAN, 3, 3);
221 cvSobel(singleChannel1, diff, 1, 0, 3);
222 cvConvertScaleAbs(diff, abs);
223 cvSobel(singleChannel1, diff, 0, 1, 3);
224 cvConvertScaleAbs(diff, singleChannel1);
225 cvAdd(abs, singleChannel1, singleChannel1, 0);
226 cvMax(pIplOutputImage, singleChannel1, pIplOutputImage);
228 cvSmooth(singleChannel2, singleChannel2, CV_GAUSSIAN, 3, 3);
229 cvSobel(singleChannel2, diff, 1, 0, 3);
230 cvConvertScaleAbs(diff, abs);
231 cvSobel(singleChannel2, diff, 0, 1, 3);
232 cvConvertScaleAbs(diff, singleChannel2);
233 cvAdd(abs, singleChannel2, singleChannel2, 0);
234 cvMax(pIplOutputImage, singleChannel2, pIplOutputImage);
236 cvReleaseImage(&singleChannel0);
237 cvReleaseImage(&singleChannel1);
238 cvReleaseImage(&singleChannel2);
239 cvReleaseImage(&diff);
240 cvReleaseImage(&abs);
243 cvReleaseImageHeader(&pIplInputImage);
244 cvReleaseImageHeader(&pIplOutputImage);
258 IplImage *singleChannel0 = cvCreateImage(cvSize(pInputImage->
width,pInputImage->
height), IPL_DEPTH_8U, 1);
259 IplImage *singleChannel1 = cvCreateImage(cvSize(pInputImage->
width,pInputImage->
height), IPL_DEPTH_8U, 1);
260 IplImage *singleChannel2 = cvCreateImage(cvSize(pInputImage->
width,pInputImage->
height), IPL_DEPTH_8U, 1);
261 IplImage *diff = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_16S, 1);
262 IplImage *abs = cvCreateImage(cvSize(pInputImage->
width, pInputImage->
height), IPL_DEPTH_8U, 1);
264 cvCvtPixToPlane(pIplInputImage, singleChannel0, singleChannel1, singleChannel2, NULL);
268 cvSobel(singleChannel1, diff, 1, 0, 3);
269 cvConvertScaleAbs(diff, abs);
270 cvSobel(singleChannel1, diff, 0, 1, 3);
271 cvConvertScaleAbs(diff, pIplOutputImage);
272 cvAdd(abs, pIplOutputImage, pIplOutputImage, 0);
275 cvThreshold(singleChannel1, singleChannel1, 60, 255, CV_THRESH_BINARY);
276 cvDilate(singleChannel1, singleChannel1);
280 cvSobel(singleChannel0, diff, 1, 0, 3);
281 cvConvertScaleAbs(diff, abs);
282 cvSobel(singleChannel0, diff, 0, 1, 3);
283 cvConvertScaleAbs(diff, singleChannel0);
284 cvAdd(abs, singleChannel0, singleChannel0, 0);
287 cvAnd(singleChannel0, singleChannel1, singleChannel0);
290 cvMax(pIplOutputImage, singleChannel0, pIplOutputImage);
293 cvReleaseImage(&singleChannel0);
294 cvReleaseImage(&singleChannel1);
295 cvReleaseImage(&singleChannel2);
296 cvReleaseImage(&diff);
297 cvReleaseImage(&abs);
299 cvReleaseImageHeader(&pIplInputImage);
300 cvReleaseImageHeader(&pIplOutputImage);
312 cvCanny(pIplInputImage, pIplOutputImage, nLowThreshold, nHighThreshold);
314 cvReleaseImageHeader(&pIplInputImage);
315 cvReleaseImageHeader(&pIplOutputImage);
327 cvDilate(pIplInputImage, pIplOutputImage);
329 cvReleaseImageHeader(&pIplInputImage);
330 cvReleaseImageHeader(&pIplOutputImage);
342 cvErode(pIplInputImage, pIplOutputImage);
344 cvReleaseImageHeader(&pIplInputImage);
345 cvReleaseImageHeader(&pIplOutputImage);
357 double dRet = cvMean(pIplImage1, pIplImage2);
359 cvReleaseImageHeader(&pIplImage1);
360 cvReleaseImageHeader(&pIplImage2);
370 printf(
"error: input and output image do not match for ImageProcessorCV::CalculateHSVImage\n");
377 cvCvtColor(pIplInputImage, pIplOutputImage, CV_RGB2HSV);
379 cvReleaseImageHeader(&pIplInputImage);
380 cvReleaseImageHeader(&pIplOutputImage);
388 printf(
"error: input and output image do not match for ImageProcessorCV::ConvertBayerPattern\n");
397 case eBG2BGR: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerBG2BGR);
break;
398 case eGB2BGR: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerGB2BGR);
break;
399 case eRG2BGR: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerRG2BGR);
break;
400 case eGR2BGR: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerGR2BGR);
break;
401 case eBG2RGB: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerBG2RGB);
break;
402 case eGB2RGB: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerGB2RGB);
break;
403 case eRG2RGB: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerRG2RGB);
break;
404 case eGR2RGB: cvCvtColor(pIplInputImage, pIplOutputImage, CV_BayerGR2RGB);
break;
407 cvReleaseImageHeader(&pIplInputImage);
408 cvReleaseImageHeader(&pIplOutputImage);
415 printf(
"error: input image is not grayscale in ImageProcessorCV::CalculateFeaturePoints\n");
420 IplImage *pEigenvalueImage = cvCreateImage(cvSize(pImage->
width, pImage->
height), IPL_DEPTH_32F, 1);
421 IplImage *pTempImage = cvCreateImage(cvSize(pImage->
width, pImage->
height), IPL_DEPTH_32F, 1);
423 CvPoint2D32f *pCorners =
new CvPoint2D32f[nMaxPoints];
424 int nCorners = nMaxPoints;
427 cvGoodFeaturesToTrack(pIplImage, pEigenvalueImage, pTempImage, pCorners, &nCorners, fQualityLevel, fMinDistance, 0, 3, 1, 0.04);
429 cvGoodFeaturesToTrack(pIplImage, pEigenvalueImage, pTempImage, pCorners, &nCorners, fQualityLevel, fMinDistance, 0, 3);
431 for (
int i = 0; i < nCorners; i++)
433 pFeaturePoints[i].
x = pCorners[i].x;
434 pFeaturePoints[i].
y = pCorners[i].y;
439 cvReleaseImageHeader(&pIplImage);
440 cvReleaseImage(&pTempImage);
441 cvReleaseImage(&pEigenvalueImage);
449 pInputImage->
type == pOutputImage->
type)
451 printf(
"error: input and output image do not match for ImageProcessorCV::ConvertImage\n");
459 cvCvtColor(pIplInputImage, pIplOutputImage, CV_RGB2GRAY);
461 cvCvtColor(pIplInputImage, pIplOutputImage, CV_GRAY2RGB);
463 cvReleaseImageHeader(&pIplInputImage);
464 cvReleaseImageHeader(&pIplOutputImage);
void GaussianSmooth5x5(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
Data structure for the representation of a 2D vector.
void CalculateGradientImageHSV(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
void Dilate(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
void FlipY(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
void BilateralSmooth(CByteImage *pInputImage, CByteImage *pOutputImage, int param1, int param2)
Calls cvSmooth with the parameter CV_BILATERAL.
void Canny(CByteImage *pInputImage, CByteImage *pOutputImage, int nLowThreshold, int nHighThreshold)
Deprecated.
void Laplacian5x5(CByteImage *pInputImage, CByteImage *pOutputImage)
Calls cvLaplace with size 5x5.
void CalculateHSVImage(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
double Mean(CByteImage *pImage1, CByteImage *pImage2)
Deprecated.
void ConvertImage(CByteImage *pInputImage, CByteImage *pOutputImage)
Image processing functions using OpenCV.
IplImage * Adapt(const CByteImage *pImage, bool bAllocateMemory=false)
Converts a CByteImage to an IplImage.
void CalculateGradientImage(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
void Laplacian3x3(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
void Resize(const CByteImage *pInputImage, CByteImage *pOutputImage, int x=-1, int y=-1, int width=-1, int height=-1)
Deprecated.
ImageType type
The type of the image.
int width
The width of the image in pixels.
int height
The height of the image in pixels.
void Erode(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
void ConvertBayerPattern(CByteImage *pInputImage, CByteImage *pOutputImage, BayerPatternType type=eRG2BGR)
Deprecated.
int CalculateFeaturePoints(const CByteImage *pImage, Vec2d *pFeaturePoints, int nMaxPoints, float fQualityLevel=0.01f, float fMinDistance=5.0f, bool bUseHarris=false)
Deprecated.
void GaussianSmooth3x3(CByteImage *pInputImage, CByteImage *pOutputImage)
Deprecated.
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...