View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Canny Edge Detector

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

3.5 | 6 ratings Rate this file 9 Downloads (last 30 days) File Size: 3.75 KB File ID: #22714 Version: 1.1
image thumbnail

Canny Edge Detector



18 Jan 2009 (Updated )

Performs Canny Edge Detector with some additional features.

| Watch this File

File Information

It was my course project for Machine Vision, so do not expect something quite professional. I think it performs quite nicely already, so I don't think any of you will have any problems. It has quite a description in the beginning of the code, also suitable for

help CannyEdgeDetector


Some methods and usages may not be preferably feasible, but they had to be included in the program, in order to provide the code working just like it is told in the original paper of Canny's. So it is quite suitable for also gaining the understanding of the concept, I suppose. I also tried to include as much feasible usages as I could, like the use of morphological operations.

Have fun, hope it works for you...

Required Products Fuzzy Logic Toolbox
Image Processing Toolbox
MATLAB release MATLAB 7.5 (R2007b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (18)
11 Aug 2010 Karthik Divakaruni

The result for my image can be seen here

Comment only
11 Aug 2010 Karthik Divakaruni

Does the job , well enough !! Thanks a lot for sharing.

12 Feb 2010 Halim Can

khader Mohammad, please make sure you included "image processing toolbox" in your matlab installation.

Comment only
12 Feb 2010 khader Mohammad


Comment only
15 Dec 2009 Erhan Go

Translation: Code proved to be useful for one of our assignments, Thanks...

Comment only
15 Dec 2009 Erhan Go

Ödevlerimizden birinde sorulardan biri buydu, teşekkürler...

Comment only
15 Dec 2009 Erhan Go  
17 May 2009 Johnny Sandaire


When I run this m file, I get the following errors:

??? Index exceeds matrix dimensions.

Error in ==> CannyEdgeDetector>parse_inputs at 222
imi = varargin{1};

Error in ==> CannyEdgeDetector at 60
[imi,sigma,method,Th,Tl,feature] = parse_inputs (varargin{:});

Any ideas how to get it to run?

Comment only
25 Mar 2009 talha

talha (view profile)

ahh, sorry. its my fault. it takes the data as input, not the file path.

25 Mar 2009 talha

talha (view profile)

hi! I got a blank rectangle as a result.

Comment only
26 Jan 2009 us

us (view profile)

1) i only rated this submission once, which hardly qualifies as 'permanent low rate'...
2) the image processing tbx (already) comes with EDGE, which does pretty much the same stuff (and some more) - but does not require the fuzzy logic tbx... it would have been prudent to (at least) mention the function in the help section as 'see also edge'...

Comment only
25 Jan 2009 Halim Can

So, after all these downloaders, no new feedbacks ?? Well, I hope it is not because the permanent low rates (specially given by us) for errors that are fixed SO easily.. Even not by editting the m-file, but only the requirements section.

Or should I and other people interpret this no comment situation as "there is no problem at all, this works flawlessly.."

Please give feedbacks, negative or positive, so that everyone knows if this function works, and if this was useful for you..


Comment only
21 Jan 2009 Halim Can

Fuzzy Logic Toolbox is going to be listed in the requirements list once the reviewing is done. I already posted the update. So, pls let's not worry about this anymore..

Comment only
21 Jan 2009 us

us (view profile)

the function gaussmf is part of the fuzzy tbx, which you do not mention as a requirement...
therefore, a lot of people will get frustrated after downloading your submission...

Comment only
20 Jan 2009 Halim Can

1) I wasn't aware of what i was doing. It accidentally happened, tried to reverse it, but I think there is no option like that... anyway, thanks for compensating...

2) I couldn't find any missing functions. It works with me. But if you can give a little more detail about the error you encountered, maybe we will be able to diagnose...

Comment only
20 Jan 2009 us

us (view profile)

1) authors must not rate their own submissions...
2) function missing...

19 Jan 2009 Halim Can

Well, gaussmf is the gauss membership function, which does nothing but returning a gaussian shape. Or at least I used it for that purpose :).

It is included in Fuzzy Logic Toolbox, as far as I remember. It did not catch my attention when I was defining the "Required Products" section, sorry for that. But once you gain access to this fuzzy logic toolbox, this problem should not show up anymore.

19 Jan 2009 Brandon

??? Undefined function or method 'gaussmf' for input arguments of type 'double'.

Error in ==> CannyEdgeDetector at 67
G = gaussmf(-10:10,[sigma 0]);

21 Jan 2009 1.1

Discovered lately that I used the gaussmf function somewhere in the code by the help of the comments, and this function is located in Fuzzy Logic Toolbox, which at first I forgot to mention as a requirement. So I added it in the list...

Contact us