Recovering the rings and measuring thier radius

Hello,
Here, I have Newton's Rings generated using FDTD (and then exported to MATLAB). I want to measure the radius of the rings but the Binary image is displaying some discontnuity. I have used "im_bin =
imbinarize(img_rgb,"adaptive","ForegroundPolarity","dark",'Sensitivity',0.25);
" this to binarize the image. your assitance is highly appreciated.

4 Comments

Attach your image nd code you have tried.
clc;
close all ;
I = imread('voidIntensity.png');
Error using imread>get_full_filename
File "voidIntensity.png" does not exist.

Error in imread (line 372)
fullname = get_full_filename(filename);
img_rgb = rgb2gray(I);
im_bin = imbinarize(img_rgb,"adaptive","ForegroundPolarity","dark",'Sensitivity',0.25);
SE = strel("disk",5);
im_dil = imdilate(im_bin,SE);
subplot(2,2,1), imshow(I), title('Original Image');
subplot(2,2,2), imshow(img_rgb), title('Gray Image');
subplot(2,2,3), imshow(im_bin), title('Binary Image');
%subplot(2,2,4), imshow(im_dil), title('Dilated Image');
CC = bwconncomp(im_bin);
% Measure the outer radius
BWout = ~BW;
BWout = imfill(BWout,'holes');
statOuter = regionprops(BWout,{'EquivDiameter','Centroid'});
outerRadius = statOuter.EquivDiameter;
% Measure the inner radius
BWin = imclearborder(BW);
BWin = imopen(BWin, strel('disk',5)); % Remove noise
statInner = regionprops(BWin,{'EquivDiameter','Centroid'});
innerDiameter = statInner.EquivDiameter;
Hey Biniam please attach the image file too. Cause the code looks good. if you could provide it then I can look further into it.
Hi Biniam,
It may be useful to attch the image file.
The "Sensitivity" parameter in the imbinarize function controls the thresholding sensitivity. It may be useful to experiment with different sensitivity values to find the optimal threshold that captures the rings without introducing excessive noise or discontinuity

Sign in to comment.

Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 16 May 2023

Edited:

on 7 Sep 2023

Community Treasure Hunt

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

Start Hunting!