Results 1 to 4 of 4

Thread: Qt OpenCV SIGSEGV error help

  1. #1
    Join Date
    Jun 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Unhappy Qt OpenCV SIGSEGV error help

    I am using OpenCV to develop a retinal recognition application. Initially I was using VS2010 but had to switch because of problems with integrating OpenCV with Windows Forms. Now the same source code which works as a VS2010 console app gives me a SIGSEGV error on Qt. The error always occurs on the following line

    Qt Code:
    1. scalaire_moy=cvGet2D(MOY, y, x);
    To copy to clipboard, switch view to plain text mode 

    where scalaire_moy is a cvScalar which holds the value of the pixel x,y in IplImage MOY. I have checked and x, y are well within bounds, and the error always occurs at pixel 560x400 i.e the code works up to a certain point. Commenting out the function only generates the same error with another cvScalar down the line ad infinitum. The code works fine in VS2010 Please help this project is due in ten days and I don't know what to do!!!

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Qt OpenCV SIGSEGV error help

    I don't know anything about OpenCV, but I would do this:
    * You write that the x and y are within bounds, but is the image also valid? Does OpenCV have a function to check the validity of the image?
    * Double check the creation of the image
    * Check that you have all possible warnings enabled in your current compiler, whatever it is
    * Go back to VS2010. VS traditionally doesn't have its warning level set to the maximum. Set its warning level to maximum and see whether it would give information of som subtle problems in the code (that just do not, by luck, stop that compiler from producing code that works -- perhaps just by chance)
    * Due to the nature of C++, the problem might be anywhere else, so check all code again
    * There might be a bug in the compiler and just changing the order or some preceding lines of code might help; or any other change that doesn't seem to make any sense...

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt OpenCV SIGSEGV error help

    This is not a Qt question. Qt is not a compiler it is a set of libraries.

    We need to know what compiler you are using now and see more of your OpenCV program for a precise response. You are probably doing one of:
    • Accessing through a null pointer.
    • Accessing through a pointer to a block that has been deleted.
    • Accessing beyond the memory allocated in the block the pointer refers to. This option is promising given it works until you write pixel 560x400.

  4. #4
    Join Date
    Jun 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt OpenCV SIGSEGV error help

    Thank you mvuori and newt. As for the problem, I have circumvented it by donwloading Qt binaries and compiling and running Qt in VS2010. It works like a charm. Newt, I was using Mingw as my compiler. I still have no idea what the issue was but I did try all your recommendations and still came to a dead halt. Perhaps a Mingw problem? Thank you very much again, I appreciate the help.

Similar Threads

  1. Replies: 0
    Last Post: 10th May 2011, 15:58
  2. Sigsegv
    By babygal in forum Newbie
    Replies: 3
    Last Post: 2nd November 2010, 06:29
  3. sigsegv ?
    By mero in forum Qt Programming
    Replies: 1
    Last Post: 28th November 2009, 19:01
  4. Install opencv on ubuntu error, please help
    By cooper in forum General Programming
    Replies: 2
    Last Post: 16th July 2009, 13:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.