Finding the width of a line and using it to select an ROI

1 view (last 30 days)
I would like to find the width of the black line in the attached image, I can so far select the line, and fill in any holes but I'm not sure what information regionprops is actually giving me (see code below).
I would then like to use this information to help me automate the selection of my ROI (highlighted in the attached image) by the following method; I would like it to recognise the outer limit of the black line, which circles the "ROI", and then reduce the radius by the width of the line, thereby only selecting the "inner circle".
Any help would be greatly appreciated!!
Thanks,
Naomi
clear
close all
ima = imread('image.png');
figure(1)
imagesc(ima)
axis equal
imabw = im2bw(ima,0.35);
figure(2)
imagesc(imabw)
colormap(gray)
axis equal
imabw = imfill(imabw,'holes');
figure(3)
imagesc(imabw)
colormap(gray)
axis equal
imabw = imcomplement(imabw);
figure(4)
imagesc(imabw)
colormap(gray)
axis equal
se = strel('disk',5);
imabw = imdilate(imabw,se);
figure(5)
imagesc(imabw)
colormap(gray)
axis equal
imabw = imfill(imabw,'holes');
figure(6)
imagesc(imabw)
colormap(gray)
axis equal
imabw = imcomplement(imabw);
figure(7)
imagesc(imabw)
colormap(gray)
axis equal
measurements = regionprops(imabw,'EquivDiameter');
allDiameters = [measurements.EquivDiameter]

Answers (0)

Community Treasure Hunt

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

Start Hunting!