How can I measure how many pixels a single irregular object has?
1 回表示 (過去 30 日間)
古いコメントを表示
I have an image with many irregular objects. How can I measure how many pixels each irregular object has? The image is shown as the follows. Thanks a lot!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154357/image.jpeg)
0 件のコメント
回答 (2 件)
Ben11
2014 年 8 月 13 日
If you have the Image Processing Toolbox it looks like this link might answer your question. It's an example from The Mathworks showing how to treshold an image and identify objects in it (steps 5 and further) as well as how to compute their area, which is what you want.
0 件のコメント
Ahmet Cecen
2014 年 8 月 13 日
編集済み: Ahmet Cecen
2014 年 8 月 13 日
I assume the sea of blue there are all 0s, so I would do image(image~=0)=1, and you will have a black and white image of only 1s and 0s.
You can use bwconncomp after the above thresholding. It will give a list of every individual object and a list of each objects pixels.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!