关于IplImage*释放的问题.

cxfirefox cxfirefox 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面这个程序在释放img0和img的时候,会出现断言错误,为什么呢?
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
char* name[]={"./222.bmp","./11111.jpg"};

int main()
{
IplImage* img0;
IplImage* img;
int i;
cvNamedWindow( "image", 1 ); // create HighGUI window with name "image"

for( i = 0; i < 2; i++ )
{
img0 = cvLoadImage( name[i],-1 ); // load i-th image
img = cvCloneImage( img0 );
cvvShowImage( "image", img0 ); // show image in the window "image"
cvvWaitKey(0); // wait for key. The function has
// an event processing loop inside
cvReleaseImage( &img ); // release both images不能释放,否则会出现断言错误
cvReleaseImage( &img0 );
}

return 0;
}
...全文
评论 6
收藏 已收藏
分享
返回顶部
cxfirefox
图形处理/算法 19,463 成员 50,678 内容