Edge detection and cropping out region of higer intensity of Grayscale images

1 vue (au cours des 30 derniers jours)
Hi all,
Please find attached image that I am working on. The region of interest that I intend to crop out (and to keep values of x & y )is shown to be the parabolic fluid profile of higher intensity than its background.
I have tried Edge of 'zero crossing' and 'canny', which are able to standout the ROI by slightly. I am however more interested in a total cropping of the ROI leaving all background as 0 in binary. I suppose my images are not like most of the examples used for edge where there is a clear distinction/ continuous distinction between edges, rather mine are dotted. I came across someone else did a median filter then a std deviation filter then only "canny" edge.
I have been able to use improfile to have a look at those intensities values, and the first and the last peak across the X -direction marks the boundary of the ROI.
I could it dot or outline the interface manually using data cursor, but it is definitely not ideal. I could it for just 1 frame manually, however not with a moving interface with each frame.
Please advice what others method should I try or use? Much appreciated for any inputs or assistance.
Colin
  2 commentaires
Colin Ng
Colin Ng le 26 Juin 2015
Hi Mukul,
Thanks for the response.
I came across this error when running through your code.
Undefined function 'bwareafilt' for input arguments of type 'double'.
I have also tried other 'bwareafilt' stock example which is available online, to no avail. I have image processing toolbox ver 9.0 with Matlab R2014a installed.
Your code seems fine to me, I am sure I just needed to get the function sorted. Thanks, Colin
Image Analyst
Image Analyst le 26 Juin 2015
bwareafilt() is a fairly new addition to the Image Processing Toolbox - you must have an old version. I am almost an expert in image processing (at least I'm still trying after 36 years of doing nothing else but image processing), but I can't do much with your stuff because your BMP image is corrupted (it says so when I click on it) and you forgot to attach your script.

Connectez-vous pour commenter.

Réponse acceptée

Mukul Rao
Mukul Rao le 25 Juin 2015
Hi , I am no expert in image processing but here is what I came up with after playing around with some of the tools, I hope this helps! I believe the method I have used should be evident from the commands and code comments:
%Read the image
I = imread('1405ExpIP20895.bmp');
%Convert to binary based on a threshold
BW = im2bw(I, 0.1);
%Improve connectivity
fillBW = imfill(BW,'holes');
%Select the largest object
BWfilt = bwareafilt(fillBW,1,'largest');
figure
imshow(BWfilt)
%Smoothen the boundaries
BWfinal = imopen(BWfilt, strel('disk',9));
figure
imshow(BWfinal)
%Index into original image
I(~BWfinal) = 0;
figure
imshow(I)
  2 commentaires
Colin Ng
Colin Ng le 26 Juin 2015
To update on my situation, I tried it on 2011b and 2014a, bwareafilt still can't be loaded. I have then tried it out with 2015a, and it is working fine.
I am trying to fine tune the process, as some of the images are not being cropped out appropriately. Thanks for your help, Mukul.
Colin
Colin Ng
Colin Ng le 26 Juin 2015
Hi Mukul,
I have had some success with your code, thanks again. These 2 images attached show that some region could not be cropped out as per desired. It is to do with the imfill function, I believe. Maybe it needs some kind of manual intervention. I am looking into imfill.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by