Ask Your Question

using 3rd party jasper library fails in openCV 2.4.6 but works in 2.4.2

asked 2013-08-01 10:02:43 -0500

gaurav_kl gravatar image

updated 2013-08-01 17:45:46 -0500

I was trying open a "jp2" image file and tried using the inbuilt jasperd.lib file in my library dependencies.I am getting the error "unable to decode code stream".

But when I was using 2.4.2 library it worked fine and I didn't even need to specify any library dependencies.But this one seems to be very slow as loading 1 image takes about a copuple of seconds.

What might be the issue with 2.4.6?I trued using 2.4.3-2.4.5 also but didn't work. EDIT: the image can be downloaded from this url -

edit retag flag offensive close merge delete


could you attach the offending pic, so that others can test, too ?

berak gravatar imageberak ( 2013-08-01 10:14:16 -0500 )edit

hi.I edited my post.. I cant attach the image here as ".jp2" isn't allowed.Also couldn't upload it to "imgur". But I have obtained the images from here .So you can download the * file to test any of the images.Thanks

gaurav_kl gravatar imagegaurav_kl ( 2013-08-01 13:57:13 -0500 )edit

oh, 190 mb. i'm sorr<

berak gravatar imageberak ( 2013-08-01 14:29:54 -0500 )edit

@berak did it work for you ?if it didn't,I can create an issue on the Opencv Tracker.

gaurav_kl gravatar imagegaurav_kl ( 2013-08-02 11:22:59 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2013-08-02 06:53:54 -0500

It looks like some OpenCV bug. I recommend you to create issue on OpenCV tracker and attach images there.

edit flag offensive delete link more


did it not work for you also?in that case,I can create an issue on the Opencv Tracker.

gaurav_kl gravatar imagegaurav_kl ( 2013-08-02 11:21:57 -0500 )edit

No, I do not check it. Ticket is good solution to not forget about the problem and to add it to plan. Also, you can investigate the issue and propose your solution.

Alexander Smorkalov gravatar imageAlexander Smorkalov ( 2013-08-03 12:37:39 -0500 )edit

answered 2014-07-15 00:09:25 -0500

darryln gravatar image

Hi gaurav_kl,

I am not sure if you have solved the problem or raised a ticket for it. I believe I have just asked a related question here.

I looks to be caused by 2012's commit to libjasper's jas_stream.c line 389 which has caused encoding to JPEG2000 to fail in Windows.

A few lines before that, tmpname() and open() opens up a temporary file but calling unlink() in windows when the file is opened will fail. I have resorted to reverting commit on 29/8/2012 to OpenCV's source master and build my own opencv_highguiXXX.dll which then allows me to call imencode or imwrite to JPEG2000 without failure.

If a ticket hasn't been raised, I hope this can help the dev people fix the issue in the new branch of OpenCV.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-08-01 10:02:43 -0500

Seen: 777 times

Last updated: Jul 15 '14