我是 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 中都尝试过上面的代码——结果都是黑色图像。请让我知道我错过了什么。