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

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by