11
14
2013
85

Some Interesting things with OpenCV 1.0[2] It doesn't matter if cvReleaseImage is before cvWaitKey?

It doesn't matter if cvReleaseImage is before cvWaitKey?

I change the order of cvReleaseImage and cvWaitKey, and it does work too.

#include "stdafx.h"

int main(int argc, char** argv)
{
	cvNamedWindow("testWindow",0);
	IplImage *img=cvLoadImage("E:/lena.jpg");
	cvShowImage("testWindow",img);
	Sleep(10);
        cvReleaseImage(&img);
	cvWaitKey(0);   
	cvDestroyWindow("testWindow");
	return 0;
}

 

Category: OpenCV | Tags: OpenCV1.0
11
14
2013
0

Some Interesting things with OpenCV 1.0[1] cvShowImage and cvWaitKey

If We use cvShowImage function, The image wouldn't be shown on the window until cvWaiKey is called.

I got this problem when I displayed a video sequence. It's interesting that the window showed nothing without cvWaitKey, while when I stepped into the program, I could see the image correctly with the tool Image Watch ,The following code could directly show that:

Category: OpenCV | Tags: OpenCV1.0
11
14
2013
0

visual leak detector doesn't work with OpenCV 1.0?

I'm trying to use visual leak detecor to detect memory leak caused by OpenCV programs.

A simple testing program is:

#include "stdafx.h"
#include <vld.h>

int main(int argc, char** argv)
{
	IplImage *img=cvLoadImage("E:/lena.jpg");
	char *pBuf = new char[200]; 
	return 0;
}

It's obviously that there are two memory leaks, while the result shows:

if I comment the 7th line, then the result is:

So, it seems that Visual Leak Detector doesn't work with OpenCV(at least OpenCV1.0)

http://www.codeproject.com/Articles/9815/Visual-Leak-Detector-Enhanced-Memory-Leak-Detectio may give us some information.

I guess the reason is that VLD haven't traced the memory of OpenCV functions.

Category: OpenCV | Tags: OpenCV VLD

| Theme: Aeros 2.0 by TheBuckmaker.com