How to find the distance between two random selected blobs in an Image ?

1 回表示 (過去 30 日間)
Manoj Kumar
Manoj Kumar 2015 年 1 月 27 日
コメント済み: Manoj Kumar 2015 年 1 月 27 日
Hi, i have couple of Images in which I need to find the distance between the selected two blobs in an image. I have used "ginput(2)" to select the two blobs in the image.
I have used the following attached code but facing some errors in it. I used few lines of code from matlabcentral and added it to my code.
I am getting error as -
Index exceeds matrix dimensions.
Error in meandistanceSample (line 53)
boundary2 = boundaries{2};
Here are the two Images that I need to analyze. Can any one help me.
Thanks...

採用された回答

Image Analyst
Image Analyst 2015 年 1 月 27 日
The loop at the bottom should not find the distance of every blob to every other blob, but from every blob to the x,y points you clicked on. If you clicked near, or in, blobs #50 and #73, then you first need to get indexes 50 and 73 - you don't care how close blob #12 is to blob #98 or whatever. So you just see what's closest to where you clicked. Once you know that, that the user pointed to blob #50 and blob #73, then you can get the distance between them using their centroids. Give that a try and come back with your new code.
  3 件のコメント
Image Analyst
Image Analyst 2015 年 1 月 27 日
Just convert the binary image into RGB like this:
rgbImage = uint8(255 * cat(3, binaryImage, binaryImage, binaryImage));
Manoj Kumar
Manoj Kumar 2015 年 1 月 27 日
Thanks a lot....

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by