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

how to close and reopen videoCapture

$
0
0
Hi, I want to open and close and open again VideoCapture. I have modify example starter_video.cpp : int main(int ac, char** av) { if (ac != 2) { help(av); return 1; } std::string arg = av[1]; { // First open VideoCapture capture(arg); if (!capture.isOpened()) capture.open(atoi(arg.c_str())); if (!capture.isOpened()) { cerr << "Failed to open the video device, video file or image sequence!\n" << endl; help(av); return 1; } process(capture); } // First Videocapture must be destroyed here {//Second Open new object videocapture is allocated here VideoCapture capture(arg); if (!capture.isOpened()) capture.open(atoi(arg.c_str())); if (!capture.isOpened()) { cerr << "Failed to open the video device, video file or image sequence!\n" << endl; help(av); return 1; } return process(capture); } I can see capture in a window for first opening. For second I have got an error message. Warning and Error message for program : VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP press space to save a picture. q or esc to quit Corrupt JPEG data: 1 extraneous bytes before marker 0xd7 Corrupt JPEG data: 1 extraneous bytes before marker 0xd4 Corrupt JPEG data: 2 extraneous bytes before marker 0xd5 ... Corrupt JPEG data: 2 extraneous bytes before marker 0xd7 > I press ESC Here VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV press space to save a picture. q or esc to quit VIDIOC_STREAMON: Bad file descriptor Unable to stop the stream.: Bad file descriptor What's wrong in my program or may be in my linux mint with cinamon install? Version control: 3.0.0-beta-21-g4b97e8c Thanks for yours helps

Viewing all articles
Browse latest Browse all 19555

Trending Articles



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