Find location of cross in image.

14 ビュー (過去 30 日間)
Hans Dohse
Hans Dohse 2019 年 12 月 23 日
回答済み: Rajani Mishra 2020 年 1 月 8 日
I have an image that contains a cross in it. It also also has circles, squares and other features.
How can I detect the location of the cross to sub pixel accuracy?
Matrox MIL has a Geometric Model Finder which works very well. Does Matlab have anything similar?
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 12 月 27 日
Can you share a sample image?

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

回答 (1 件)

Rajani Mishra
Rajani Mishra 2020 年 1 月 8 日
I have tried below code on an image containing a cross in it, it detects the center location of the cross.
Please refer below for the code:
  1. Convert image to grayscale image and then binarization
img = imread('test.jpg');
I = rgb2gray(img);
BW = imbinarize(I,0.25);
2. As the result may have missing parts dilate the image to join the parts
se = strel('line',11,90);
BW2 = imdilate(BW,se);
3. Use morphological ‘shrink’ operation to shrink image to a point
BW3 = bwmorph(BW2,'shrink',Inf);
4. Find the position of the point
[row,col] = find(BW3);
Hope this helps.

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by