Identifying the circle that fits the outer white pixels in a binary image (or make external mask)

B
Bouhadjra · Feb 15, 2022 · 2K views
Question
Hi all,   I want to process a series of images similar to the attached one in order to measure their porosities: V_pores / V_total. For my case, in a 2D context, V_total is the surface of circle containing all pores. It is important to know that the radius and center of the circle changes, and also many circular shapes can be identified in between, however, I am only interested, at this moment, in measuring the general surface of the circle (Vt).   Alernatively, I would be interested in applying a mask to the image. But it seems to be more difficult.
Expert Answer
Profile picture of Prashant Kumar
Prashant Kumar PhD Expert
Answered Aug 24, 2026
I = imread("SampleXRmorph.PNG");
[y,x] = find(I) ; 
% Get center of cricle 
C = [mean(x) mean(y)] ; 
% GEt raidus 
d = sqrt((C(1)-x).^2+(C(2)-y).^2) ; 
R = max(d) ;  
% plot circle 
th = linspace(0,2*pi) ; 
xc = C(1)+R*cos(th) ; 
yc = C(2)+R*sin(th) ; 
% 
imshow(I)
hold on
plot(xc,yc,'r')

 

100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!