OpenCV cvCanny memory exception?

You forgot to say if you are able to see the original image being displayed on the screen I never get tired of telling people that checking the return of functions is a must! Consider IplImage* img = cvLoadImage("images/00000038. Jpg") how can you tell if this function succeeded or not?

As far as I can tell, the error you are having might be from a function failing prior to cvCanny() being called Anyway, I recently posted a code that uses cvCanny to improve circle detection You can check that code and see what you are doing differently EDIT : Your problem in this case is that you are passing to cvCanny input and output as a 3 channel image, when it takes only a single channel image Check the docs : void cvCanny(const CvArr* image, CvArr* edges, double threshold1, double threshold2, int aperture_size=3) Implements the Canny algorithm for edge detection. Parameters: * image – Single-channel input image * edges – Single-channel image to store the edges found by the function * threshold1 – The first threshold * threshold2 – The second threshold * aperture_size – Aperture parameter for the Sobel operator (see Sobel) So, change your code to: Create an image to hold our modified input image IplImage* out = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1); // Do some smoothing //cvSmooth(img, out, CV_GAUSSIAN, 3, 3); IplImage* gray = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1); cvCvtColor(img, gray, CV_BGR2GRAY); // Do some Edge detection cvCanny(gray, out, 10, 20, 3).

You forgot to say if you are able to see the original image being displayed on the screen. I never get tired of telling people that checking the return of functions is a must! Consider IplImage* img = cvLoadImage("images/00000038.

Jpg"); , how can you tell if this function succeeded or not? As far as I can tell, the error you are having might be from a function failing prior to cvCanny() being called. Anyway, I recently posted a code that uses cvCanny to improve circle detection.

You can check that code and see what you are doing differently. EDIT: Your problem in this case is that you are passing to cvCanny input and output as a 3 channel image, when it takes only a single channel image. Check the docs: void cvCanny(const CvArr* image, CvArr* edges, double threshold1, double threshold2, int aperture_size=3) Implements the Canny algorithm for edge detection.

Parameters: * image – Single-channel input image * edges – Single-channel image to store the edges found by the function * threshold1 – The first threshold * threshold2 – The second threshold * aperture_size – Aperture parameter for the Sobel operator (see Sobel) So, change your code to: // Create an image to hold our modified input image IplImage* out = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1); // Do some smoothing //cvSmooth(img, out, CV_GAUSSIAN, 3, 3); IplImage* gray = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1); cvCvtColor(img, gray, CV_BGR2GRAY); // Do some Edge detection cvCanny(gray, out, 10, 20, 3).

My apologies. I have two windows being displayed and if I comment out cvCanny then I get the original image on screen. – Seb Jun 21 at 14:29 Updated answer.

Problem fixed. – karlphillip Jun 21 at 14:37 That did the trick. Thanks for the help.

– Seb Jun 21 at 18:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions