Find the percentage of area occupied by an object
Mostra commenti meno recenti
From the below image, how can I find - what percentage of the yellow region does the total pink region occupy?

1 Commento
Risposta accettata
Più risposte (1)
Adam Danz
il 28 Dic 2022
1 voto
Assuming that this is an image and that the pink color is a single RGB color value, you could compute the number of pixels with that pink color and the size of the yellow rectangle to compute the percent area of the pink within the yellow.
percentArea = pinkPixelCount / yellowPixelCount * 100;
where yellowPixelCount is the height*width of the yellow rectangle. Compute the pinkPixelCount from the image data. If you need guidance with that, please provide more info about your image or upload a mat file containing your image data.
Categorie
Scopri di più su Image Arithmetic in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
