Opened 9 years ago

Closed 3 years ago

#47549 closed defect (worksforme)

opencv @2.4.11_0 - fails to load tiff files

Reported by: jmgoicolea (Jose Goicolea) Owned by: stromnov (Andrey Stromnov)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: akimd (Akim Demaille)
Port: opencv

Description

The latest version of opencv @2.4.11_0 fails when loading .tiff files. However, if I activate the previous version @2.4.10 _0 it runs ok.

My operating system is mac OS X 10.7.5, xcode version 4.6.2

I noticed the problem when running auto-multiple-choice, which uses the opencv libraries. With the help of the auto-multiple-choice developer, we have spotted the problem and reproduced it in a basic example. This example includes a simple load.c file and a tiff file, included.

The compilation and execution commands for the test case I provide are

gcc -I/opt/local/include/opencv -I/opt/local/include -L/opt/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc load.c -o load
./load  t6_0000.tif

Under opencv @2.4.10_0 it compiles and runs ok (no output expected). Under opencv @2.4.11_1 it fails with "Segmentation fault: 11". I have run it with gdb and backtrace, the output is:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000010720e180
0x000000010060dadc in put1bitbwtile ()
(gdb) backtrace
#0  0x000000010060dadc in put1bitbwtile ()
#1  0x000000010060b7b0 in gtStripContig ()
#2  0x000000010060953d in TIFFReadRGBAStrip ()
#3  0x000000010027f264 in cv::TiffDecoder::readData ()
#4  0x0000000100262a9a in cv::imread_ ()
#5  0x000000010026651f in cvLoadImage ()
#6  0x000000010000322b in main ()
(gdb) 

Regards

Attachments (2)

opencv-bug.zip (24.6 KB) - added by jmgoicolea (Jose Goicolea) 9 years ago.
load.c program and t6_0000.tif file for reproducing problem
k.tif (490.0 KB) - added by jmgoicolea (Jose Goicolea) 9 years ago.
tiff file which seems to work

Download all attachments as: .zip

Change History (14)

Changed 9 years ago by jmgoicolea (Jose Goicolea)

Attachment: opencv-bug.zip added

load.c program and t6_0000.tif file for reproducing problem

comment:1 Changed 9 years ago by larryv (Lawrence Velázquez)

Owner: changed from macports-tickets@… to stromnov@…

Thanks for the report. In future tickets, please Cc any port maintainers (port info --maintainers opencv).

Changed 9 years ago by jmgoicolea (Jose Goicolea)

Attachment: k.tif added

tiff file which seems to work

comment:2 Changed 9 years ago by akimd (Akim Demaille)

Cc: akim.demaille@… added

Cc Me!

comment:3 Changed 9 years ago by akimd (Akim Demaille)

Do we have news about this issue?

comment:4 Changed 9 years ago by akimd (Akim Demaille)

For the records, because of this bug, auto-multiple-choice fails to work properly on TIFF files (http://project.auto-multiple-choice.net/issues/348). There a workaround is proposed: to install the previous versions of OpenCV that worked properly for TIFF.

Unfortunately, as of today, this procedure no longer works: the rest of the ports have advanced, and the build of auto-multiple-choice now fails with the old OpenCV.

However, AMC works properly if one does _not_ use TIFF files. This is the information I meant to display somewhere, as I was worried not to have any workaround. I repeat: the workaround is, don't use TIFF.

comment:5 Changed 9 years ago by stromnov (Andrey Stromnov)

It looks like bug in OpenCV TIFF reader implementation and heavily depends on exact format of the TIFF file (non-tiled, monochrome, etc.).

comment:6 Changed 9 years ago by go@…

I encountered the same bug. Here's my fix for opencv: https://github.com/Itseez/opencv/pull/5352/files

I also confirmed that opencv 2.4.11 with my patches will correctly load your t6_0000.tif example file, whereas the unpatched opencv 2.4.11 crashes.

comment:7 Changed 9 years ago by stromnov (Andrey Stromnov)

Committed at r140315 (for opencv 3.0.0).

comment:8 Changed 9 years ago by akimd (Akim Demaille)

I confirm that it fixes the problem with auto-multiple-choice. AFAIC, this ticket can be closed.

comment:9 Changed 3 years ago by mascguy (Christopher Nielsen)

Given that we don't support opencv 2.x, can this be closed?

comment:10 Changed 3 years ago by akimd (Akim Demaille)

No problem on my side, I'm no longer using these tools.

comment:11 in reply to:  10 Changed 3 years ago by mascguy (Christopher Nielsen)

Replying to akimd:

No problem on my side, I'm no longer using these tools.

Sounds good. Can someone close this?

comment:12 Changed 3 years ago by raimue (Rainer Müller)

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.