How can I detect the edges in an image without using method 'edge', with only using mathematical operations (matrix or Derived or div or any other)? Indeed, how can I rewrite the function edge
by using the algorithm Canny
or sobel
or any other?
For example:
pink rectangle 256*256 black rectangle 127*127
Answer:Canny Tutorial
You state that you wish to use Canny, Sobel or another algorithm. These can both be used in edge. Try for example:
BW = edge(I,'canny');
where I is your image matrix. If you are interested in finding out how edge
works, type
edit edge
into your command window. You will then get to see MATLAB's own implementation.
You may wish to reimplement edge
from scratch, to gain a good understanding of how image processing algorithms work. If so, I would direct you towards the following sources:
For your specific example with the rectangles, it is quite possible to use edge
to find the edges. The one trick you have to do is to convert the rgb image to a grayscale one, using rgb2gray
. Try for example:
rgb_image = imread('iarLe.png');
gray_image = rgb2gray(rgb_image);
edge_image = edge(gray_image);
imshow(edge_image);
edge
- Bill Cheatham 2012-04-04 17:51
edge
:- - Nathan Fellman 2012-04-04 18:01
edge
in some way? You can use both the canny and sobel algorithms withedge
- Bill Cheatham 2012-04-04 17:12