PDA

View Full Version : exe exited with code -1073741819



bajoelkid12
1st November 2011, 18:13
Hi,

I'm having a problem when i tried to execute my program.. I have met the same problem before and i can solve it. My problem before is some kind of missing .dll.. But now, i don't know what kind of problem is this.. I know this is an access violation, but i just don't know where.. Could you please help me ?
Here is my code and the debugger result..



#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "opencv2/opencv.hpp"
#include "stdio.h"
#include <opencv/cvaux.h>
#include <opencv/cxcore.h>

int main(int argc, char **argv)
{
CvCapture capture1;
IplImage *frame;

double t,ms = 0;
int key = 0;

capture1 = cvCaptureFromFile("chi-tabaywatch.avi");
cvNamedWindow("JCXSUPERTAMARK5",1);

while (key != 'q')
{
t = (double)cvGetTickCount();

frame = cvQueryFrame(capture1);
cvShowImage("JCXSUPERTAMARK5",frame);
key = cvWaitKey(1);

t = (double)cvGetTickCount() -t;
ms += t / ((double)cvGetTickFrequency() * 1000.0);

if (ceil(ms) >= 1000)
{
cvSaveImage("img.jpg",frame);
ms = 0;
}
}

cvReleaseCapture(capture1);
cvDestroyWindow("JCXSUPERTAMARK5");

return 0;
}




Dump of assembler code from 0x9cfffe to 0x9d0076:
0x009cfffe: add %al,(%eax)
0x009d0000: add %al,0x0(%eax)
0x009d0003: add %al,(%ecx)
0x009d0005: add %al,(%eax)
0x009d0007: add %ah,%dl
0x009d0009: add %eax,(%eax)
0x009d000b: add %cl,(%edi)
0x009d000d: add %eax,(%eax)
0x009d000f: add %ah,0x5a(%esi)
0x009d0012: pop %es //here is where the arrow pointing at//
0x009d0013: add %dl,0x22(%ebp)
0x009d0016: add $0x0,%al
0x009d0018: push %esi
0x009d0019: add $0x3000000,%eax
0x009d001e: add %al,(%eax)
0x009d0020: and %al,(%eax)
0x009d0022: add %al,(%eax)
0x009d0024: add %eax,(%eax)
0x009d0026: add %al,(%eax)
0x009d0028: (bad)
0x009d0029: (bad)
0x009d002a: (bad)
0x009d002b: incl (%eax)
0x009d002d: add %al,(%eax)
0x009d002f: add %bh,%bh
0x009d0031: (bad)
0x009d0032: (bad)
0x009d0033: lcall *0x2400007e(%ecx)
0x009d0039: add %al,(%eax)
0x009d003b: add %ah,(%eax,%eax,1)
0x009d003e: add %al,(%eax)
0x009d0040: xor (%eax),%eax
0x009d0042: add %al,(%eax)
0x009d0044: pusha
0x009d0045: add %al,(%eax)
0x009d0047: add %ah,0x0(%eax)
0x009d004a: add %al,(%eax)
0x009d004c: add %al,(%eax)
0x009d004e: add %al,(%eax)
0x009d0050: sbb %al,(%eax)
0x009d0052: add %al,(%eax)
0x009d0054: add %al,(%eax)
0x009d0056: add %al,(%eax)
0x009d0058: add %al,(%eax)
0x009d005a: add %al,(%eax)
0x009d005c: add %al,(%eax)
0x009d005e: add %al,(%eax)
0x009d0060: add %al,(%eax)
0x009d0062: add %al,(%eax)
0x009d0064: pop %es
0x009d0065: js 0x9d0067
0x009d0067: add %bh,(%eax,%eax,1)
0x009d006a: add %al,(%eax)
0x009d006c: push %esi
0x009d006d: add $0x3000000,%eax
0x009d0072: add %al,(%eax)
0x009d0074: add %eax,(%eax)
End of assembler dump.

ChrisW67
1st November 2011, 22:49
Do you have a question related to Qt, because this isn't?

The assembler output you have above is not useful. Do yourself a favour:

build a debug version of the program, run it in your debugger and look at the backtrace when it crashes; and
read the error messages that OpenCV outputs to the console from the program.

More than likely the file you are opening does not exist or cannot be interpreted and the attempt to get a frame returns a null pointer that you blindly use.

BTW: The code you posted does not compile. cvCaptureFromFile() returns CvCapture* not a CvCapture structure and cvReleaseCapture() takes a **CvCapture argument. After fixing and running it I find very informative error messages from OpenCV.

bajoelkid12
2nd November 2011, 04:28
thanks a lot for the explanation.. i'm writing this code in Qt Creator..


BTW: The code you posted does not compile. cvCaptureFromFile() returns CvCapture* not a CvCapture structure and cvReleaseCapture() takes a **CvCapture argument. After fixing and running it I find very informative error messages from OpenCV.

Could you please tell me, how can i fix it ?

ChrisW67
2nd November 2011, 04:54
Could you please tell me, how can i fix it ?
I thought I already had ;) Surely you managed to compile it so you must have fixed it also!



#include "opencv/cv.h"
#include "opencv/highgui.h"
#include "opencv2/opencv.hpp"
#include "stdio.h"
#include <opencv/cvaux.h>
#include <opencv/cxcore.h>

int main(int argc, char **argv)
{
CvCapture *capture1; // <<<<<<<<<<<<<<<<<<<<<<<<<
IplImage *frame;

...

cvReleaseCapture(&capture1); // <<<<<<<<<<<<<<<<<<<<<<<<<
cvDestroyWindow("JCXSUPERTAMARK5");

return 0;
}

bajoelkid12
2nd November 2011, 05:28
ofcourse.. i'm sorry for asking a ridiculous question..
btw.. could you please take a look at this
7062

here is the screenshot, when i use the debugger to my program.. In my opinion, this is a problem about .dll.. am i correct ?

ChrisW67
2nd November 2011, 05:45
Your program (with corrections) works correctly here provided the avi file exists.

Does yours ever get into the main() function? If not then you need to make sure the OpenCV DLLs are where the operating system can find them.

bajoelkid12
2nd November 2011, 06:56
i have placed the dlls at the windows system32 directory.. how can the OS cannot find them ? i have also adding them on the system path.. Geez, is this somekind of bug ?
when i try to use different function (e.g. cvCameraCapture(0)), it works fine, without having the dlls be placed at the windows system32 directory.

ChrisW67
2nd November 2011, 08:05
Make sure that the file you are trying to open exists in the current working directory of the program (i.e. where it is going to look) or use a full path.
Single step you program until it fails then analyse the line that that causes it. Thrashing about trying to guess is not going to get you anywhere.