Ask Your Question
0

unhandled exception when reading sequence using videocapture()

asked 2016-03-09 23:10:14 -0500

Aj-611 gravatar image

I test my code with .png format it run as I wish. But when I run with .jpg, the program break. My jpg images have 24-bit depth, while my png images are 16-bit depth. I guess this is related to the problem. Any solution?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-03-10 08:58:17 -0500

Aj-611 gravatar image

I just found the solution since I found the error is develop at imshow();. So, to avoid this error I include the code as follow:

if (!frame.empty())
{
cv::imshow("image", frame);
}

I'm not sure why, btw. If someone can explain this.

edit flag offensive delete link more

Comments

2

"I'm not sure why," - it means, that one of your jpg images was invalid, and did not load before.

and yes, adding a sanity check is essential, when reading anything from disk.

berak gravatar imageberak ( 2016-03-10 09:07:13 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-03-09 23:10:14 -0500

Seen: 124 times

Last updated: Mar 10 '16