Establishment of vectors in 2D coordinate system based on 2D image

1 回表示 (過去 30 日間)
Daniel Chou
Daniel Chou 2021 年 2 月 6 日
コメント済み: Daniel Chou 2021 年 2 月 8 日
Dear all, I wish I could construct the coordinate system based on 2D image in Matlab.
I have a image as attached:
I wish I could find the vector of long axis for each object, like attached:
My thought is to use the different pixel information to specify the objects, but I'm not sure how to implement it.
I established coordinate system via following command
clear
clc
close all
A=imread('2D_try.jpg')
A=gpuArray(A)
B=imshow(A)
C=impixelinfo(B)
Could you give me a comment or suggestion?
Wish all of you have a nice weekend!
Sincerely

採用された回答

Matt J
Matt J 2021 年 2 月 6 日
編集済み: Matt J 2021 年 2 月 6 日
load image
T=bwferet(B);
C=cell2mat(T.MaxCoordinates);
X1=C(1:2:end,1); Y1=C(1:2:end,2);
X2=C(2:2:end,1); Y2=C(2:2:end,2);
imshow(B);
hold on;
quiver(X1,Y1,X2-X1,Y2-Y1,'-y','AutoScale','off','LineWidth',3);
hold off
  1 件のコメント
Daniel Chou
Daniel Chou 2021 年 2 月 8 日
Dear Matt,
I really appreciate for your demonstration !!!
This is what I need.
Wish you have a good day :)
Sincerely
Daniel Chou

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

その他の回答 (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