フィルターのクリア

How regionprops orders the regions ?

7 ビュー (過去 30 日間)
Tala Hed
Tala Hed 2017 年 6 月 1 日
コメント済み: Image Analyst 2020 年 10 月 24 日
Hello all,
I am confused how regionprops organizes the results? I have a picture that has 7 dark spots on it and need to calculate the area of each.Using regionprops, it shows the areas in pixels but in a confusing order! Is there anyway that I can get the results in an understandable order? like vertically or horizontally with the corresponding area?
Thank you Faraz

採用された回答

Image Analyst
Image Analyst 2017 年 6 月 1 日
The blobs are labeled/ordered/identified/numbered by bwconncomp() or bwlabel(). The order is column major order like most things in MATLAB.
So it goes down the image starting in the upper left pixel and goes down the first column. If it "sees" a pixel that's part of a blob that is not yet labeled, then it does a region growing to label that whole blob, even if it goes off into other rows and columns to the right or above. Then, once that blob is labeled, it continues on to find any other blobs. It proceeds like this top-to-bottom, left-to-right (i.e. column-by-column) until it has found and labeled every blob.
Does that explain it well enough?
  1 件のコメント
Tala Hed
Tala Hed 2017 年 6 月 2 日
編集済み: Walter Roberson 2020 年 8 月 30 日
yes. Thanks a lot. I also found a function online which labels the regions. The function exactly works as you explained. here is the function https://www.mathworks.com/matlabcentral/fileexchange/19665-visualize-output-of-bwlabel

サインインしてコメントする。

その他の回答 (1 件)

Sippapas Mongkoldao
Sippapas Mongkoldao 2020 年 8 月 29 日
Hi , Sorry for digging again .
I just wonder if I can order it by left-to-right , top-to-bottom and row-by-row instead of column-by-column ? So it can detect the top piece first , roll to the right and detect the next piece under it. Is it possible to use the regionprops on this condition or someone has an code to share with me ?
Thanks a lot
  5 件のコメント
Sippapas Mongkoldao
Sippapas Mongkoldao 2020 年 10 月 24 日
編集済み: Sippapas Mongkoldao 2020 年 10 月 24 日
This seem logically works. I'm trying now and facing some problems.
  1. This line is shown as error ''too few argument". What is happening?
thisBlob = ismember(labeledImage)
2. Do you have some ideas how to get rid of undesired blobs (the top-left one and the 2 in below-right)?
Appreciate!
Image Analyst
Image Analyst 2020 年 10 月 24 日
  1. You need to pass k into ismember(): thisBlob = ismember(labeledImage, k)
  2. If the bad blobs are in known rows, then you can erase them
% Erase top part
mask(1:topRow, :) = false;
% Erase bottom part.
mask(bottomRow : end, :) = false;

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by