4 Attachment(s)
exited with code -1073741819 error
Hi.
I am writing a program which replaces detected face with replace image, the command line version works fine, but the gui just messes up, i dont know how.. I have compiled the command line one with Eclipse/MinGW/OpenCV2.0 and trying to compile GUI version with QT creator/OpenCV2.0/MinGW. the compile part work fine.. After select a input image and replace image, when i press the deanerize button the gui stops responding and gives "exited with code -1073741819 error". I tried the debugger and found nothing. mr. google said that i had an uninitialised value which i am trying to access and so it gives me error. I have written my code nearly 4-5 times from the working command line version but it just doesnt want to work. i have attached the code to work with please if you find anything even a small bit. it wil be very helpful. u can use any image for input/replace..
Thank you very much
Arps
Steps to Use:
1. Open Input Image
2. Open Replace Image
3. Deanerize button
Re: exited with code -1073741819 error
Quote:
I tried the debugger and found nothing.
Use the debugger to get the line which crashes, and post the code around it, or the whole function which contains that line.
Re: exited with code -1073741819 error
using the debugger, the line with cvColor(...) gives error.
Quote:
void theGui::slDeanerize(){
if(inName->isEmpty() || repName->isEmpty()){
QMessageBox::information(this,tr("ReplaceWithDeane r"),tr("Parameters:\tInput/Replace Image File Missing, Open and Try Again"));
return;
}
//Init Application
Mat img;
String cascadeName = "./cascadeMain.xml";
CascadeClassifier cascade;
double scale = 1;
if( !cascade.load( cascadeName ) )
{
QBoxError("Cascade Error: Could not load cascade file, please check the path");
}
img = imread(inName->toStdString() , 1 );
vector<Rect> faces;
//Detect Faces Here ------------
Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
cvtColor( img, gray, CV_BGR2GRAY ); The debugger shows this line, but i use the same method in command line version and it works fine
cv::resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
equalizeHist( smallImg, smallImg );
cascade.detectMultiScale( smallImg, faces,
1.1, 2, 0
//|CV_HAAR_FIND_BIGGEST_OBJECT
//|CV_HAAR_DO_ROUGH_SEARCH
|CV_HAAR_SCALE_IMAGE
,
Size(30, 30) );
//----------------END
//Replace Faces Here ------------
int replaceMode = checkRadioButtons();
int facesTotal = faces.size();
int replaceTotal = replaceCountCalc(replaceMode, facesTotal);
outMat = img;
Mat crImgMat = imread(repName->toStdString(),1);
for (int i=0; i < replaceTotal; i++){
Mat roi(outMat,faces.at(i));
if((faces.at(i).size() != crImgMat.size())){
//IplImage *newImage = cvCreateImage(cvSize(faces.at(i).width,faces.at(i) .height), replaceImage->depth, replaceImage->nChannels);
Mat newMat(crImgMat.size(), crImgMat.type());
cv::resize(crImgMat,newMat,faces.at(i).size());
//cvResize(replaceImage, newImage, CV_INTER_CUBIC);
crImgMat = newMat;
}
roi = crImgMat;
}
//----------------End
IplImage outImg = outMat;
//setImageLabel(outputImageLabel, outImg);
outName = new QString(QFileInfo(inName->toStdString().c_str()).absolutePath() + "/deaner" + QFileInfo(inName->toStdString().c_str()).fileName());
}
Thanks
Arpit
Re: exited with code -1073741819 error
Quote:
Originally Posted by
arpspatel
Hi.
"exited with code -1073741819 error". I tried the debugger and found nothing. mr. google said that i had an uninitialised value which i am trying to access and so it gives me error. I have written my code nearly 4-5 times from the working command line version but it just doesnt want to work.
-1073741819 - 0xC0000005 - STATUS_ACCESS_VIOLATION
Test what return imread():
Code:
img = imread(inName->toStdString() , 1 );
Q_ASSERT(img.data);
Re: exited with code -1073741819 error
what do you mean by test return?
i tried Q_ASSERT(img.data);
same 1073641819 error.. and i dont think its imread as i can read the image fine.
1 Attachment(s)
Re: exited with code -1073741819 error
I have attached the output of the debugger where the program stops responding.
Thanks
Arps
Re: exited with code -1073741819 error
This line:
Code:
Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
Should not even compile!
Should it be maybe?:
Code:
Mat gray;
smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
In addition, put a break point on the crashing line:
Code:
cvtColor( img, gray, CV_BGR2GRAY );
And look at 'img' if it is valid.
Re: exited with code -1073741819 error
Quote:
Originally Posted by
high_flyer
This line:
Code:
Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
Should not even compile!
Should it be maybe?:
Code:
Mat gray;
smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
In addition, put a break point on the crashing line:
Code:
cvtColor( img, gray, CV_BGR2GRAY );
And look at 'img' if it is valid.
Code:
Mat gray, smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
This line compiles fine..
Code:
cvtColor( img, gray, CV_BGR2GRAY );
It was this line which was causing problems, don't know why? I couldn't even get an answer from OpenCV forums. I just changed the coding myself to convert img to grayscale manually with direct pixel access..
I probably think this is issue with Qt+OpenCV2.0, not working together with certain functions.. (maybe overloaded somewhere)
Thanks for your help.
Re: exited with code -1073741819 error
Quote:
It was this line which was causing problems, don't know why?
May be you need to initialize 'gray' to be the same size as smallImg.
What happens if you do:
Code:
Mat gray( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 /*or what ever format that makes sense*/ );
Mat smallImg( cvRound (img.rows/scale), cvRound(img.cols/scale), CV_8UC1 );
...
cvtColor( img, gray, CV_BGR2GRAY );
Also, in the documentation fo cvtColor here:
http://www710.univ-lyon1.fr/~bouakaz...ecl_cvCvtColor
CV_8UC1 is not specified, are you sure it is a legal parameter?