How do I detect and find the discolored area as a percentage of selected area
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dinuka Ratnasinghe
am 22 Feb. 2021
Kommentiert: KALYAN ACHARJYA
am 24 Feb. 2021
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)
0 Kommentare
Akzeptierte Antwort
KALYAN ACHARJYA
am 22 Feb. 2021
Bearbeitet: KALYAN ACHARJYA
am 22 Feb. 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 Kommentare
KALYAN ACHARJYA
am 24 Feb. 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:
- The Larger Section is already extracted (Done)
- 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)
- Once done calculate the percentage of pixels as you want.
Good Luck!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Segmentation and Analysis finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!