I’ve been experiencing an issue with OpenCV lately which I wasn’t able to google a solution for. Now I solved it and want to share the solution.
So I use OpenCV to work with a webcam in Linux. I built and installed OpenCV 2.4.2 and run my program. It opened the camera (the LED on it turned on) but it never got to read any frame from it. It freezes on the line
capture.grab();
It just never returns from that method. Also applies to the >> operator which uses grab() internally.
This happens only if I set desired frame width/height to some non-default values.
I found some people with a similar problem but their solutions didn’t help me.
The solution was to install
libjpeg-devand rebuild (and reinstall) OpenCV.