Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Blank video and error message: [ WARN:0] cvCreateFileCaptureWithPreference: backend MSMF doesn't support legacy API anymore

Hi,

I am running windows 10 ( 64bit ) with openCV 3.3.0 with C++ code with Visual Studio 2018. I used the OpenCV pre-compiled code. I have tried using the laptop built-in webcam as well as an Intel RealSense RGB camera, and Intel RealSense Depth Camera, and have installed the Intel SDK 2.0 for the Intel cameras. All three cameras appear in the device manager. All of the cameras yield only a solid grey color in the output window. I have tried specifying the camera as '0', '1', and -1 in the command cvCreateCameraCapture(0), with the same result. The enclosed camera test software was downloaded from an OpenCV forum page as an example of camera operation. Upon running the code, the system asks which of the three recognized cameras are to be used. I always receive the following error message regardless of the camera selected: (( The OpenCV code is below the following error message)):

How can I get OpenCV to recognize the cameras? In advance, thank you for your kind assistance. I am a novice programmer, so if possible, please provide an answer in simple terms!

INFO:0- VIDEOIO: Enabled backends(6, sorted by priority): FFMPEG(1000); MSMF(990); DSHOW(980); VFW(970); CV_IMAGES(960); CV_MJPEG(950)  
WARN:0- cvCreateFileCaptureWithPreference: backend MSMF doesn't support legacy API anymore.
WARN:0- cvCreateFileCaptureWithPreference: backend DSHOW doesn't support legacy API anymore.
<-----

(( The OpenCV code follows):

#include<opencv2 opencv.hpp="">
#include<opencv2 core="" core.hpp=""> #include<opencv2 highgui="" highgui.hpp=""> #include<iostream> using namespace std; using namespace cv;

int main(int argc, char* argv) { cvNamedWindow("KillCam"); cvWaitKey(500); CvCapture capture = cvCreateCameraCapture(0); IplImage* frame;

while (1) {
    frame = cvQueryFrame(capture);

    cvShowImage("KillCam", frame);
    char c = cvWaitKey(33);
    if (c == 30) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("KillCam");

}