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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Matt J
Matt J am 6 Feb. 2021
Bearbeitet: Matt J am 6 Feb. 2021
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 Kommentar
Daniel Chou
Daniel Chou am 8 Feb. 2021
Dear Matt,
I really appreciate for your demonstration !!!
This is what I need.
Wish you have a good day :)
Sincerely
Daniel Chou

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by