フィルターのクリア

Different results for centroids using regionprops and imtool for labeled images

4 ビュー (過去 30 日間)
Robert Dupont
Robert Dupont 2015 年 11 月 27 日
コメント済み: Robert Dupont 2015 年 12 月 11 日
Hello there,
I have found that I have different values for centers of points in an image when I measure it with imtool (so myself) and with regionprops.Centroid (automatic). Which is kind of troublesome for calculations ...
More precisely, I have a root image right here :
And I want to make it look like this one :
So I measure with imtool the 8 points around the images then use the function 'fitgeotrans' then 'imwarp'. It works fine. The problem is, there is a difference when I use a 'normal' image (like my root) or a labeled image (with bwlabel). The transformation goes well, and with 'imtool' I get the same centers. The difference is when I use 'regionprops.Centroid', THERE I have two totally different values between 'imtool' and 'regionprops.Centroid' for the same image (the transformed, labeled one).
Can anyone explain to me how can this be ? I precise, there is no difference between the two methods before the transformation. And yes, I need the labeled image.
For example here are the values I measure for the top left point :
root image, no transformation, imtool : 115,307
root image, no transformation, regionprops : 109,302
labeled image, no transformation, imtool : 115,303
labeled image, no transformation, regionprops : 109,302
root image, transformation, imtool : 102,551
root image, transformation, regionprops : 98,551
labeled image, transformation, imtool : 98, 555
labeled image, transformation, regionprops : 326,776
Thank you for your answer.

回答 (1 件)

Image Analyst
Image Analyst 2015 年 11 月 27 日
The first few I could just attribute to you not manually picking the same pixel with imtool as when regionprops() found it. However with the last case, the warped image, it's off by several hundred pixels, which can't be explained by just being off a pixel or two when manually specifying it. Please post the transformed/warped image. I don't think you posted that one yet.
  3 件のコメント
Robert Dupont
Robert Dupont 2015 年 11 月 30 日
Here to update. Did you find where the bug might come from ?
Robert Dupont
Robert Dupont 2015 年 12 月 11 日
So I've found some kind of answer. It looks like the "real" image is a bit different that what is shown. Meaning it isn't a square. So imtool just fill in the blanks to make it square. Regionprops doesn't. I managed to "correct" it, by saving the image displayed in imtool, then reopen it to be used by regionprops. Then, the problem is the number of labels. I have to save the image as a grey scale image, not a labeled image (couldn't find a way to save a label image). So I can only have 255 points at max.

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

カテゴリ

Help Center および File ExchangeExplore and Edit Images with Image Viewer App についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by