How to find the dimensions of a specific area in an existing image?
2 ビュー (過去 30 日間)
古いコメントを表示
Say I'm given an image with a rectangular space made entirely of green pixels. I want to find the dimension of that area that is made entirely of green pixels.
This is what I have so far:
numGreenPixels=img(:,:,1)==0 & img(:,:,2)==255 & img(:,:,3)==0
numGreenPixels = sum(numGreenPixels(:));
this would only given me the total number of green pixels, when I need to find the dimension of said space. How do I go about this?
2 件のコメント
KSSV
2019 年 4 月 9 日
when I need to find the dimension of said space.
YOu can find the dimensions if you can arrange the data into a matrix form......is your green region a square/ rectangle? If it is taking some other irregular shape, how you will specify the dimensions?
参考
カテゴリ
Help Center および File Exchange で Read, Write, and Modify Image についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!