Profile of image in grey scales

1 view (last 30 days)
600Seat
600Seat on 23 Apr 2013
Good afternoon, I would really appreciate if you could help me with a particular issue related with image analysis. I have a set of images in grey scales. From the images I require to get an edge of the profile. I have tried different commands to get the profile or edge of the flow. Using canny and imerode and imdilate commands the best that I got is as shown in the image. However I need to get an edge of the whole profile as with the red line in image attached.
Any suggestions
Thanks a lot in advance
Best regards,
The script for this part is:
threshold = graythresh(MyImage); bw = im2bw(MyImage,threshold); se = strel('disk',2); bw = imclose(bw,se); BWsdil = imdilate(bw, se); BWsdil = bwperim(BWsdil); BWoutline=edge(BWsdil, 'canny',0,1);
Segout = MyImage; Segout(BWoutline) = 255;
figure(1), imshow(Segout)

Answers (2)

Image Analyst
Image Analyst on 23 Apr 2013
You don't need edge detection at all. Just threshold and go along column by column using find() to find the top row. Something like (untested)
binaryImage = grayImage > 50; % Adjust the value to eliminate dark background.
binaryImage = bwareaopen(binaryImage, 200); % Get rid of blobs smaller than 200
imshow(binaryImage);
[rows columns] = size(binaryImage);
topRows = rows * ones(rows, columns, 'int32'); % Initialize
for col = 1 : columns
topRows(col) = find(binaryImage(:, col), 1, 'first');
end
  4 Comments
600Seat
600Seat on 24 Apr 2013
<<i-imgbox-com-adiQ0Qj8-jpg.n>>

Sign in to comment.


600Seat
600Seat on 23 Apr 2013
Thanks for your reply. I have tried your suggestion. However I am not getting an edge similar to the red line edge as showed in my previous image.
I have tried using different values to eliminate dark background. Since with 50, I eliminate the background and mainly all the data that I need.
The second command to get rid ob blobs smaller than 200, I cannot used since again I loose all my data.
I am looking for some command to join the gaps between the white groups. It should be something as a curve with best fit. But I am not sure how to do it.
It could be that I am trying to do something that it is not possible... I dont know.
I would appreciate it if you could help me with this. Thanks

Community Treasure Hunt

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

Start Hunting!