Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-27032

QImage fails to load jpeg when application is linked against opencv 2.4

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.1
    • Image formats
    • None
    • Ubuntu 12.04
      AMD A6 APU

    Description

      Loading a QImage object from a jpeg file fails when the application is linked against OpenCV 2.3 or 2.4.

      qt-cv-jpg-test.pro

      QT += core gui
      
      TARGET = qt-cv-jpg-test
      TEMPLATE = app
      
      INCLUDEPATH += /usr/local/include
      LIBS += -L/usr/local/lib -lopencv_highgui -lopencv_core
      
      SOURCES += main.cpp
      

      main.cpp

      #include <QImage>
      #include "opencv2/core/core.hpp"
      #include "opencv2/highgui/highgui.hpp"
      
      int main(int argc, char *argv[])
      {
          QString fileName = "/data/code/data/apple_strawberry_library/apple_0.jpg";
          cv::Mat cvImage = cv::imread( fileName.toStdString() );
          QImage qtImage( fileName );
          return 0;
      }
      

      Th program segfaults, but here is the stack:

      0	jpeg_CreateDecompress	/usr/local/lib/libopencv_highgui.so.2.4	0	0x7ffff7ae55fc	
      1	??	/usr/lib/x86_64-linux-gnu/qt4/plugins/imageformats/libqjpeg.so	0	0x7ffff0549ee7	
      2	??	/usr/lib/x86_64-linux-gnu/qt4/plugins/imageformats/libqjpeg.so	0	0x7ffff054a18f	
      3	QImageReader::read(QImage*)	/usr/lib/x86_64-linux-gnu/libQtGui.so.4	0	0x7ffff6c3f0c8	
      4	QImageReader::read()	/usr/lib/x86_64-linux-gnu/libQtGui.so.4	0	0x7ffff6c3f6f7	
      5	QImage::load(QString const&, char const*)	/usr/lib/x86_64-linux-gnu/libQtGui.so.4	0	0x7ffff6c348dc	
      6	QImage::QImage(QString const&, char const*)	/usr/lib/x86_64-linux-gnu/libQtGui.so.4	0	0x7ffff6c34a75	
      7	main	main.cpp	9	0x400d10	
      

      I don't really know why an opencv method is showing up at the bottom of the stack. I built opencv telling it to use the libjpeg on the file system. This is libjpeg8.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            dusktreader Tucker Beck
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes