Remove everything outside of largest circle found by regionProps
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello!
So I followed this example here: RegionProps and I was wanting to take the largest circle found and to segment out / clear everything else from the image.
Is there a straight forward way to do this, or rather a Matlab method of doing it?
Many thanks for any help!
0 comentarios
Respuestas (2)
Walter Roberson
el 4 de Feb. de 2017
YourRGBImage = .... original image
ROI = .... after threshholding
props = regionprops(ROI, 'Area, 'PixelIdxList');
[~, idx] = max([props.Area]);
this_region = props(idx).PixelIdxList;
mask = zeros(size(ROI), class(YourRGBImage));
mask(this_region{:}) = 1;
mask = mask(:,:,[1 1 1]); %replicate to 3D
masked_Image = YourRGBImage .* mask;
0 comentarios
Image Analyst
el 4 de Feb. de 2017
Before you call regionprops, simply call bwareafilt() on bw:
bw = bwareafilt(bw, 1); % Extract largest blob.
This will keep (segment out) only the largest circle in the image.
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!