Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Blue screen when using VideoCapture

$
0
0
I'm accessing the front and back cameras of my surface pro 4. When I run my code the program usually get stuck at the following line and I get a bluescreen after a while. std::VideoCapture vidCap(1); Strangely it doesn't always happen. Sometimes (about 1 out of 5 tries) the programm works perfectly fine and I can see my camera stream. Do you guys have ideas what I can do? #include #include #include #include int main() { const char* windowName = "Webcam Stream"; cv::namedWindow(windowName, CV_WINDOW_AUTOSIZE); cv::Mat frame; cv::VideoCapture vidCap(1); while (vidCap.isOpened()) { vidCap >> frame; cv::cvtColor(frame, frame, CV_BGR2GRAY); cv::imshow(windowName, frame); int k = cv::waitKey(33); if (k == 27) { break; } } return 0; }

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>