edge detection

6 views (last 30 days)
Gova ReDDy
Gova ReDDy on 22 May 2011
how to find edge detection of image without using edge functions like canny, prewitt,sobel and others
Gova ReDDy
Gova ReDDy on 11 Jun 2011
How to write algorithm for edge detection without using these canny,prewitt sobel fucntions..

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 11 Jun 2011
Just construct your own Sobel kernel, which can be found in countless places on the web, and call imfilter(). Or you can write your own custom code and use nlfilter to call it.

praveen on 11 Jun 2011
hey! patan..
I can give you a simple algorithm for you purpose..
1. Convert the image to a grayscale image ( where each pixel is represented by a number between 0-255)
2. Convert the image to a binary image (you may use img=im2bw(img,graythresh(img)) (in which each pixel will be either 0 or 1 )
you can set the threshold, above which a pixel has to be 1. experiment with different values until you get your required object fully in black (or white)
3. Then, scan through the image part by part (either using a mask or you idea..) & find the coordinates of those points, whose pixel values of it's right side neighbour is different from it's left side neighbour .
for eg. suppose let's say you are scanning a mango, at the edge (boundary ) points, the pixel value on it's immediate right neighbour will be either 0 or 1 (in a boundary image) and it's immediate left neighbour's pixel will have opposite value.
4. When you are done with doing this for the whole image, you will end up with the coordinates of the edges of the objects that you wanted.
(Getting what i mean ?)
Or If you are quite advanced, you can study about the operation of either of the method (sobel's method for edge detection or prewitt's method) and then you can develop your algorithm based on that. You can refer here :<http://www.pages.drexel.edu/~weg22/edge.html>
or search on google yourself
  1 Comment
Image Analyst
Image Analyst on 12 Jun 2011
Uh, not really. Think about it. What you described is binarizing the image and then a manual method for finding edges on the binary image (not the original image) and that won't even find them all. You'd be better off using bwboundaries(), which will get all the edges including the top and bottom edges of a binary blob.
However the edge functions the original poster mentioned find edges in the grayscale image, not the binary image. He doesn't have a binary image yet, and simply thresholding on grayscale (to get the binary image) doesn't find edges, in general. Your edges are obtained by thresholding and these are often/usually in no way related to edges that someone would identify in the image. He's better off constructing the proper kernel and using imfilter(), conv2(), or using nlfilter if he wants to design his own non-linear filter.

Sign in to comment.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by