Ask Your Question
0

unhandled exception when reading sequence using videocapture()

asked Mar 10 '16

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?

Preview: (hide)

1 answer

Sort by » oldest newest most voted
0

answered Mar 10 '16

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.

Preview: (hide)

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 (Mar 10 '16)edit

Question Tools

1 follower

Stats

Asked: Mar 10 '16

Seen: 740 times

Last updated: Mar 10 '16