Find the percentage of area occupied by an object
古いコメントを表示
From the below image, how can I find - what percentage of the yellow region does the total pink region occupy?

1 件のコメント
採用された回答
その他の回答 (1 件)
Adam Danz
2022 年 12 月 28 日
1 投票
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.
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
