Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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 !
Posted
Comments
Code-o-mat 2-Jul-12 6:30am    
Where do you get that exception?

1 solution

I think you must find out where is your image.jpg & where is your application


C#
if((img = cvLoadImage("image.jpg")) == 0){
        cout<<"image load failed";
    }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900