フィルターのクリア

How to find out the image center?

2 ビュー (過去 30 日間)
Naresh Naik
Naresh Naik 2012 年 12 月 31 日
コメント済み: Ram KARSH 2015 年 3 月 4 日
How to find out the image center and its x,y co-ordinate with out using [x,y]=ginput(n) matlab command?
How to import these data into matlab work space?
  2 件のコメント
Image Analyst
Image Analyst 2012 年 12 月 31 日
Ram KARSH
Ram KARSH 2015 年 3 月 4 日
How to write code for Euclidean distance between image pixel p(x,y) and the image center (xc, yc).

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

採用された回答

Matt J
Matt J 2012 年 12 月 31 日
編集済み: Matt J 2012 年 12 月 31 日
A=rgb2gray(imread('bull1.jpg'));
center=size(A)/2+.5;

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 12 月 31 日
imfill(), then regionprops() the Centroid
  6 件のコメント
Walter Roberson
Walter Roberson 2012 年 12 月 31 日
Not me. I suggested the no-mouse-click version that finds all of the information at the same time. I also showed how to select the information for a single one out of that: namely, use label the binary image, regionprops() the information out, then use ginput() on the original image to select a point, look up that point in the label image to find the index into the regionprops struct() information, return the appropriate result.
Image Analyst
Image Analyst 2012 年 12 月 31 日
編集済み: Image Analyst 2012 年 12 月 31 日
You need to invert that image. The foreground has to be white, not black.
FYI, in the duplicate question here, Naresh first asked for a method using ginput(). Walter suggested an automated way using regionprops(), but then Naresh again asked for a manual method using ginput(), which I gave. Now I guess Naresh is willing to consider the automatic method again, for which code is in the first question. An example of finding centroids of round objects (coins, not rings) can be found in BlobsDemo image segmentation tutorial in my File Exchange.

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by