To use functions in OpenCV like cvSmooth or cvAdaptiveThreshold you must have the data of your VideoCapture in an IplImage object.

VideoCapture capture;
Mat grayImage;
IplImage *imgSrc, *imgResult;

imgSrc = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 1);
imgResult = cvCreateImage(cvSize(640, 480), IPL_DEPTH_8U, 1);

capture.open(CV_CAP_OPENNI);
if (!capture.isOpened()) {
	cout << "Can not open a capture object." << endl;
	return -1;
}
capture.set(CV_CAP_OPENNI_IMAGE_GENERATOR_OUTPUT_MODE, CV_CAP_OPENNI_VGA_30HZ);

for(;;) {
	if (!capture.grab()) {
		cout << "Can not grab images." << endl;
		return -1;
	}
	else {
		if (capture.retrieve(grayImage, CV_CAP_OPENNI_GRAY_IMAGE)) {
			imgSrc->imageData = (char *) grayImage.data;
			cvShowImage("Source", imgSrc);

			cvSmooth(imgSrc, imgResult, CV_BLUR, 100, 100);
			cvShowImage("Result", imgResult);
		}
	}
	if (waitKey(30) >= 0)
		break;
}
VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
OpenCV :: Kinect VideoCapture data in IplImage, 5.0 out of 5 based on 1 rating

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.