4

Matlab Version : 7.8.0(R2009a)

I am getting edges from an image by using Canny edge detector using standard 'edge' function. But for my project I need to get intermediate Gradient Magnitude matrix. I.e. gradient magnitude values for each pixel.

I know we could do it using imgradientxy(), But I need exact result what canny would have given and I don't know the implementation used by Matlab for Canny. Is there any way to do it or do I have to implement canny from scratch?

Background: I am basically changing intensity values for some pixels on the edges as detected by canny. I need to know that after the change, when the gradient is calculated using new values, will they still come under Threshold values?

1 Answer 1

5

To find the implementation of the Canny edge detector in Matlab, you can simply open the file (edit edge), since the function isn't built-in. This way, you can check the filtering and gradient scheme that is used in your release of Matlab.

Sign up to request clarification or add additional context in comments.

5 Comments

@Andrey: thanks. I forgot that I had my own function canny on the path. :)
That was great. It solved my problem. I thought edge function is coded in C as library for matlab. Thanks a lot
@MangatRai: This may happen in the future, but certainly older versions of Matlab have a lot of functions still written in Matlab.
What does it mean that canny isn't built-in? Without doing any manipulations to the matlab path or files, edge(image, 'canny') seems to be valid (using matlab R2012b).
@solvingPuzzles: "built-in" in Matlab-speak means that the function has been compiled, which means that you can no longer see the source code. You can call built-in functions as builtin('fcnName'), which can be useful in overloading.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.