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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Matt J
Matt J il 6 Feb 2021
Modificato: Matt J il 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 Commento
Daniel Chou
Daniel Chou il 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

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Images in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by