Ammar Husain
Ammar Husain

Reputation: 1849

OpenCV 2.4.9 reads blank image

Folks,

I am using imread to load a jpeg image into a cv::Mat data type. However, the function is unable to load the image and simply returns an empty matrix with 0 rows and 0 columns. It does not throw any exceptions or warnings. I have also verified that the image actually exists in the path specified. I have never seen this behaviour in OpenCV and am at a loss to figure out what is going on. Any help is appreciated

EDIT: After playing around, I discovered that it is able to read in PNG file formats with no problems.

Upvotes: 2

Views: 456

Answers (1)

Ammar Husain
Ammar Husain

Reputation: 1849

I found the solution to this problem. I had compiled OpenCV from source and when I had build and installed it initially, it was missing certain JPEG related libraries. In order to solve it I reconfigured the source directory (by running cmake) and manually installed libraries that it did not find. These are not critical for OpenCV so it does not block installation. Following that I recompiled and reinstalled OpenCV.

Upvotes: 2

Related Questions