How to find x y coordinates of detected blobs

Dear All,
Do you know how to find the center coordinate of a blob. That means after detected blobs i need to assign variables to that blob locations.

 採用された回答

Image Analyst
Image Analyst 2013 年 9 月 16 日

0 投票

You need to ask regionprops for the Centroid or Weighted Centroid. See my Image Segmentation Tutorial for an example: Image Analyst's File Exchange It does exactly that.

その他の回答 (1 件)

Nuwan Dassanayake
Nuwan Dassanayake 2013 年 9 月 16 日

0 投票

Dear Image Analyst Thank You very much for help!

5 件のコメント

Nuwan Dassanayake
Nuwan Dassanayake 2013 年 9 月 17 日
I need another help! To assign centroid values to two variables! Like this (stats(n).Centroid) is equal to (x,y) i need to assign x and y value seperately
Image Analyst
Image Analyst 2013 年 9 月 17 日
xy = [stats.Centroid];
x = xy(:,1);
y = xy(:,2);
Nuwan Dassanayake
Nuwan Dassanayake 2013 年 9 月 20 日
編集済み: Nuwan Dassanayake 2013 年 9 月 20 日
Image analyst, I have tried to do something like this but it is not working! What is wrong with my program?
Thank you very much for your help!
xy = stats(16).Centroid;
x = xy(:,1);
y = xy(:,2);
if(45<xy(:,1)<40) && (50<xy(:,2)<55)
disp(x)
end
I cant get expected value ,it displays values outside the range also!
Image Analyst
Image Analyst 2013 年 9 月 20 日
You can't do things like a<x<b you need to do (a<x) && (x<b) .
Nuwan Dassanayake
Nuwan Dassanayake 2013 年 9 月 23 日
Thank You Sir It has worked !

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

Community Treasure Hunt

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

Start Hunting!

Translated by