今日、私は午前中、openCVのIplImage型の画像配列を保存する方法を探していましたが、失敗しました。戻り値の型はIPlImageの配列
これは私が何をしようとしていますものです:
IplImage* GetThresholdedImage(IplImage* img) {
IplImage* imageTest[2];
IplImage* imgHSV = cvCreateImage(cvGetSize(img), 8, 3); // hold the resulted HSV image
cvCvtColor(img, imgHSV, CV_BGR2HSV); // convert the coming image from the camera from RGB format to HSV (Hue, Saturation, Value)
imageTest[0] = cvCreateImage(cvGetSize(img), 8, 1); //hold the thresholded image of the yellow color
imageTest[1] = cvCreateImage(cvGetSize(img), 8, 1); //hold the thresholded image of the red color
cvSmooth(imgHSV, imgHSV, CV_GAUSSIAN, 11, 11); //smooth the image to remove the noise from the image
cvInRangeS(imgHSV, cvScalar(24, 100, 150), cvScalar(34, 255, 255),
imageTest[0]); //this function filter out the colors in this range (This is a yellow color)
cvInRangeS(imgHSV, cvScalar(172, 100, 150), cvScalar(179, 255, 255),
imageTest[1]); //this function filter out the colors in this range (This is a red color)
cvReleaseImage(&imgHSV);
return *imageTest;
}
今、私はそれを処理するために、メインの配列を返すようにしようとすると - >
IplImage *thresholdedImage;// = cvCreateImage(cvGetSize(frame), 8, 1); // to store the thresholded image
IplImage *yellow = cvCreateImage(cvGetSize(frame), 8, 1);
IplImage *red = cvCreateImage(cvGetSize(frame), 8, 1);
//===========================================
// start creating three windows to show the video after being thresholded, after it passes the contour function and the final video
cvNamedWindow("display", CV_WINDOW_AUTOSIZE);
cvNamedWindow("Threshold", CV_WINDOW_AUTOSIZE);
cvNamedWindow("contoured", CV_WINDOW_AUTOSIZE);
while (key != 'q') { // grab the video unless the user press q button
frame = cvQueryFrame(capture);
if (!frame) {
break;
}
//start the actual video processing on real-time frames
//first output of the threshold method
thresholdedImage = GetThresholdedImage(frame);
yellow = *thresholdedImage;
red = *thresholdedImage++;
//insert the resulted frame from the above function into the find contour function
cvFindContours(yellow, storage, &contours, sizeof(CvContour),
CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
cvFindContours(red, storage, &contours, sizeof(CvContour),
CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE, cvPoint(0, 0));
しかし、それは私にエラーを与える!
任意のヘルプは高く評価され、IplImage
へのポインタの配列がIplImage**
だろうあなたに
これは何のエラーですか? – karlphillip
C++を使うことができれば、それらを 'std :: vector'に保存して、仕事をより簡単にすることができます。 –
karlphillip