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 CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by