Need a good edge detection routine for overlapped objects
I need to define an edge to define a shape in my project. I am currently using MATLAB, but I comfertable with openCV if it gives better performance. So that's the problem. The sample image I have has overlapping objects with a rough surface. I use this code and get good results, but the surface roughness is still degrading me. I am tinkering with this code in MATLAB:
a = imread('D:\images\wheatstarch.jpg'); I = rgb2gray(a); imshow(I) thresold = graythresh(I); se1=strel('diamond',2); I1=imerode(I,se1); bw = edge(I1,'canny'); figure; imshow(bw);
I am getting this output: http://i49.tinypic.com/vg7fns.png
Ined the best output so that I can use the output to define the shape.
input image for download http://www.profimedia.si/photo/wheat-starch-granules/profimedia-0035237439.jpg
source to share
By playing with the file in Photoshop, Photoshop finds the edge edges followed by a level command, giving a result much more as you are looking for. I do not suggest using Photoshop, Photoshop is a convenient tool for visualizing methods of processing graphic files. I always write my own code, so I cannot offer a solution off the shelf.
What I see is a photoshop search paint that produces a grayscale result, and the objects you are looking for are the ones with the most difficult edges.
It looks like you are getting an image first converted to b & w (like a level command) and then searching for edges. Converting to b & w creates arbitrary lines in the shadows which are then tracked. This results in what appears in the original image as a smooth transition of grays in the shadows to an artificial line in the tracing.
By creating the edges in grayscale, then converting the grayscale faces to b & w, smooth grayscale shifts do not create any edges.
source to share