OpenCV cvSmooth内存异常 [英] OpenCV cvSmooth memory exception
本文介绍了OpenCV cvSmooth内存异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试做OpenCV书中的示例,并且我涉及到有关cvSmooth的部分.我正在尝试使用它,但是我不断收到
的内存异常错误
在smoothing.exe中0x757dd36f处未处理的异常:Microsoft C ++异常:内存位置0x0036f6d4处cv :: Exception.
我也看过另一篇与该问题类似的帖子,但对我没有帮助,因为每次我都会遇到相同的错误.非常感谢您的帮助,该功能的源代码位于下面.
#include"stdafx.h"
#include< cv.h>
#include< highgui.h>
#include"iostream"
使用命名空间std;
无效平滑(IplImage * image)
{
//创建一些窗口以显示输入和输出图像
cvNamedWindow("smoothing-in");
cvNamedWindow("smoothing-out");
//显示输入图片的窗口
cvShowImage("smoothing-in",image);
//创建图像以保留平滑的输出
IplImage *输出= cvCreateImage(
cvGetSize(image),
IPL_DEPTH_8U,
3
);
//进行平滑
cvSmooth(image,output,CV_GAUSSIAN,3,3);
//显示平滑的图像
cvShowImage("smoothing:",output);
cvReleaseImage(& output);
cvWaitKey(0);
cvDestroyWindow("smoothing-in");
cvDestroyWindow("smoothing-out");
}
int _tmain(int argc,_TCHAR * argv [])
{
IplImage * img = NULL;//cvLoadImage("image.jpg");
if((img = cvLoadImage("image.jpg"))== 0){
cout<<图像加载失败";
}
平滑(img);
cvReleaseImage(& img);
返回0;
}
谢谢!
解决方案
我认为您必须找出image.jpg&的位置.您的应用程序在哪里
如果((img = cvLoadImage(" ))== 0 ){
cout<< " ;
}
I am trying to do the examples in the OpenCV book and I got to the part regarding cvSmooth. I am trying to use it, but I keep getting a memory exception error of
Unhandled exception at 0x757dd36f in smoothing.exe: Microsoft C++ exception: cv::Exception at memory location 0x0036f6d4..
I have also looked at another post that was similar to this question, but it did not help for me as I got the same error each time. Any help is greatly appreciated and the source code for the function is located below.
#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
#include "iostream"
using namespace std;
void smoothing(IplImage *image)
{
//create some window to show the input and output image
cvNamedWindow("smoothing-in");
cvNamedWindow("smoothing-out");
//window that show our input image
cvShowImage("smoothing-in",image);
//create an image to hold smoothed output
IplImage *output = cvCreateImage(
cvGetSize(image),
IPL_DEPTH_8U,
3
);
//do the smoothing
cvSmooth(image,output,CV_GAUSSIAN,3,3);
//show the smoothed image
cvShowImage("smoothing:",output);
cvReleaseImage(&output);
cvWaitKey(0);
cvDestroyWindow("smoothing-in");
cvDestroyWindow("smoothing-out");
}
int _tmain(int argc, _TCHAR* argv[])
{
IplImage *img = NULL;//cvLoadImage("image.jpg");
if((img = cvLoadImage("image.jpg")) == 0){
cout<<"image load failed";
}
smoothing(img);
cvReleaseImage(&img);
return 0;
}
thank !
解决方案 I think you must find out where is your image.jpg & where is your application
if((img = cvLoadImage("image.jpg")) == 0){
cout<<"image load failed";
}
这篇关于OpenCV cvSmooth内存异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文