How do I detect and find the discolored area as a percentage of selected area

1 visualización (últimos 30 días)
please could you help me to find the discolored area (dark gray) as a percentage. (Compared to the full area of the sample - inner circle)

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 22 de Feb. de 2021
Editada: KALYAN ACHARJYA el 22 de Feb. de 2021
rgbImage=imread('image_file_name');
[r,c]=size(rgbImage);
grayImage=rgb2gray(rgbImage);
bwImage=~bwareafilt(~imbinarize(grayImage),1);
figure,imshow(bwImage); title('Region of Interest');
%% Pixels Area Calculation in Percentage
data1=bwImage(:);
pix_counts=sum(data1);
fprintf('The Approx Percentage area (Pixel Counts): %f',pix_counts/length(data1)*100);
disp('%');
Result:
The Approx Percentage area (Pixel Counts): 70.739068%
  2 comentarios
Dinuka Ratnasinghe
Dinuka Ratnasinghe el 24 de Feb. de 2021
I'm very thankful for your comment and support.
It seems like this counts the circular area? What I wanted is detect the darken patch inside the circle and calculate the percentage by comparing it with the area of inner circle. I'm new to matlab and sorry If I'm wrong.
KALYAN ACHARJYA
KALYAN ACHARJYA el 24 de Feb. de 2021
@Dinuka Ratnasinghe This is also possible with the addition of just one or 2 lines in my code. I have answered the question based on your original question "How do I detect and find the discolored area as a percentage of selected area"
Steps:
  1. The Larger Section is already extracted (Done)
  2. Get the inner circle with considering different threshold value, here you need to segment the inner circle only (Or you may consider the edges and consider largest blobs only)
  3. Once done calculate the percentage of pixels as you want.
Good Luck!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by