Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

OpenCV 2.4.9 on linux can not read jpeg image

asked 2014-06-29 19:59:07 -0500

stansy gravatar image

updated 2014-06-30 11:15:03 -0500

Please help me how to read a jpeg image. I have no problem reading the images in tif format. I used the example OpenCV-2.4.9/sources/samples/cpp/image.cpp for testing.

Thanks Stan

Media I/O: ZLib: build (ver 1.2.7) JPEG: libjpeg (ver 62) PNG: build (ver 1.5.12) TIFF: build (ver 42 - 4.0.2) JPEG 2000: build (ver 1.900.1) OpenEXR: build (ver 1.7.1)

try {
            Mat img = imread(fname); 
                fprintf(stderr, "Can not load image %s\n", fname);
                return -1;
    catch(cv::Exception& e )
        fprintf(stderr, "Error: %s\n", e.what());
        return -2;

message: Can not load image: lena.jpg. Program works well for lena.png, lena.tif, lena.bmp

edit retag flag offensive close merge delete



What is your error message?

unxnut gravatar imageunxnut ( 2014-06-29 22:37:59 -0500 )edit

The program returns no error.

stansy gravatar imagestansy ( 2014-06-30 11:02:04 -0500 )edit

Could you check that the JPEG image is in appropriate directory? You are not getting an exception which could imply that your code was unable to find the image.

unxnut gravatar imageunxnut ( 2014-06-30 11:11:22 -0500 )edit

haha no solution. I already did. Thanks unxnut

stansy gravatar imagestansy ( 2014-06-30 11:19:32 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-07-03 04:15:08 -0500

stansy gravatar image

The problem has been resolved. I use libjpeg 8.0 instead of 6.2

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-06-29 19:59:07 -0500

Seen: 586 times

Last updated: Jul 03 '14