我是OpenCV的新手,正在尝试捕获一张图片并将其保存到文件中。下面是我发布的参考代码。
jpg文件已经被保存了,但是它是黑色的。
// Capture the Image from the webcam
CvCapture *pCapturedImage = cvCreateCameraCapture(0);
// Get the frame
IplImage *pSaveImg = cvQueryFrame(pCapturedImage);
// Save the frame into a file
cvSaveImage("test.jpg". ,pSaveImg); // A JPG FILE IS BEING SAVED
// OF 6KB , BUT IT IS BLACK
所有功能都是成功的。我已经在XP和Vista上尝试了上述代码 - 结果在两者上都是黑色图像。请告诉我我错过了什么。