There was a need to process frames from the webcam, chose OpenCV . So, this reading program gives an error:

Unhandled exception at 0x00007FF959C7E5BC (ntdll.dll) in CaptureVideo.exe: 0xC000000D: Invalid parameter passed to the service or function.

The window can be seen instead of the image strip.

Code:

#include <opencv\cv.h> #include <opencv\highgui.h> int main() { cvNamedWindow("Output", 0); CvCapture* capture = cvCreateCameraCapture(0); //assert(capture != NULL); IplImage* frame = cvQueryFrame(capture); cvShowImage("Output", frame); //cvSaveImage("filename.png", frame); cvWaitKey (2000); cvDestroyWindow("Output"); return 0; } 

Problem in line:

 CvCapture* capture = cvCreateCameraCapture(0); 

With a zero value, an error occurs, and with other constants ( СV_CAP_* ) there is neither an image nor an error. For everyone: a laptop camera. In Skype as well as on the sites, the camera works.

  • and what version of openCV ??? - Alex.B
  • Version 3.1.0 (last) - Romeon0
  • I had questions for you, contact me - Alex.B
  • Yes, I am listening to you. - Romeon0
  • I have in the address of the litters write there. - Alex.B

1 answer 1

 #include <opencv2/opencv.hpp> using namespace cv; int main(int, char**) { VideoCapture cap(0); // открываем камеру if(!cap.isOpened()) // Mat edges; namedWindow("edges",1); for(;;) { Mat frame; cap >> frame; // получаем кадры от камеры cvtColor(frame, edges, COLOR_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3); imshow("edges", edges); if(waitKey(30) >= 0) break; } // деструктор return 0; }