PDA

View Full Version : Qt OpenCV SIGSEGV error help



bobo
11th June 2011, 19:55
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


scalaire_moy=cvGet2D(MOY, y, x);

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!!!

mvuori
11th June 2011, 23:29
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...

ChrisW67
12th June 2011, 09:42
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.

bobo
13th June 2011, 21:03
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.