imread() cannot read jpeg files in a particular environment (Bug #69)


Added by Junichi Ido about 15 years ago. Updated about 15 years ago.


Status:Done Start date:
Priority:High Due date:
Assignee:- % Done:

0%

Category:highgui-images
Target version:-
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

The function imread() doesn't work well in a particular environment.
The following example, for instance, doesn't work.
-----
#include "cv.h"
#include "highgui.h"

using namespace cv;

int main( int argc, char** argv ) {
Mat img = imread("lena.jpg");
if( !img.data ) return 1;
namedWindow("src");
imshow("src", img);
waitKey(0);
return 0;
}
----

For example, the problem occurs on Ubuntu9.10 with libjpeg and without libjasper.
(When the Linux environment has both libjpeg and libjasper, there is no problem.)
The opencv-svn (r2490 or later) tries to build the libjasper, if the library are not found.
In that case, "boolean" type is defined as "unsigned char" in jconfig.h, because "+RPCNDR_H+" are not defined on Linux.
However libjpeg (binary for Ubuntu9.10) expects boolean defined as "int".

The difference of the definition of boolean makes the difference of "sizeof(struct jpeg_decompress_struct))".
Then it causes the problem that imread("hoge.jpg") doesn't work.

Could you try attached patch?
It looks like the patch works well in my environment; opencv(r2573) and
- Ubuntu9.10, gcc-4.4.1, libjpeg62, and without libjasper,
- WindowsXP+sp3, VC++2008 Express


jconfig.h.patch (703 Bytes) Junichi Ido, 2010-01-15 11:50 pm


Associated revisions

Revision ef6a6cfb
Added by Andrey Kamaev over 12 years ago

Merge pull request #69 from mdim/core_tests

History

Updated by anonymous - about 15 years ago

I have confirmed that the problem was fixed in r2582.

Updated by anonymous - about 15 years ago

thanks! The bug was independently found by one of our team members.
It should have been fixed in r2582

  • Status changed from Open to Done
  • (deleted custom field) set to fixed

Also available in: Atom PDF