EXCEPTION_ACCESS_VIOLATION Error for find contours function
Hi
I am using cvFindContours to find the contours of edge detected frames. First I use cvCanny to get the edges frame from actual frame. Then I am trying to find the contours.Here is my code structure
//used cvcanny to get cur and next frames
CvMemStorage curstorage=CvMemStorage.create();
CvMemStorage nextstorage=CvMemStorage.create();
CvSeq cursquares = new CvContour();
CvSeq nextsquares = new CvContour();
cvFindContours(cur, curstorage, cursquares, Loader.sizeof(CvContour.class),CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
cvFindContours(next, nextstorage, nextsquares, Loader.sizeof(CvContour.class),CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE);
When I run the code I get Access Violation Exception.Here is the exception details.
A fatal error has been detected by the Java Runtime Environment:
EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000062e3c320, pid=9184, tid=6236
JRE version: 7.0_17-b02 Java VM: Java HotSpot(TM) 64-Bit Server VM (23.7-b01 mixed mode windows-amd64 compressed oops) Problematic frame: C [msvcr100.dll+0x3c320] memset+0x80
Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
I am not sure where I am going wrong.Any suggestions regarding this will be helpful.Thank you.
It is completely normal that this doesnt work. You are passing memory storage elements to the CvContour without filling it with data. The create function creates the initial pointer to the elements data header, you still need to fill up data before processing.