필터 지우기
필터 지우기

Angle recognition of objects in the image

조회 수: 17 (최근 30일)
tao wang
tao wang 2022년 3월 2일
댓글: tao wang 2022년 3월 2일
Like this picture
I want to calculate the angle of the line represented by the two red arrow strips,I want to calculate the angle of the line represented by the two red arrow strips
I have used the program to get the black-and-white picture. I want to know how to get the angle through the black-and-white picture below
Is there any way to get the desired results after getting such pictures,thanks
(edited by DGM to move comment-as-answer into the question body)
  댓글 수: 3
tao wang
tao wang 2022년 3월 2일
thank you
tao wang
tao wang 2022년 3월 2일

댓글을 달려면 로그인하십시오.

채택된 답변

DGM
DGM 2022년 3월 2일
편집: DGM 2022년 3월 2일
This might be a start. This uses the Hough transform tools from IPT.
A = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/911775/image.png');
A = rgb2gray(A);
B = A<128;
% find angle of dominant line
[H,T,R] = hough(B);
P = houghpeaks(H,1,'threshold',ceil(0.3*max(H(:))));
lines = houghlines(B,T,R,P,'FillGap',50,'MinLength',10);
% show line
imshow(B); hold on;
plot([lines.point1(1) lines.point2(1)],[lines.point1(2) lines.point2(2)])
% estimated rotation angle
rotangle = lines.theta
rotangle = -39
This might take some tweaking to work more generally with other images. It might be necessary to get more than the dominant line in the call to houghpeaks() and then try to find some common angle between those. Bear in mind that the angles returned may be complements of each other, so it may be necessary to conditionally complement them in order to compare/winnow/average them.
  댓글 수: 1
tao wang
tao wang 2022년 3월 2일
Thank you very much for your patience. I'll take a look at this program first

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Feature Detection and Extraction에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by