필터 지우기
필터 지우기

What does the following code do?

조회 수: 2 (최근 30일)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 10월 1일
댓글: Ba Ba Black Sheep! 2017년 10월 1일
If we have,
[row_num, col_num] = size(img);
What does the following code do?
function length_vec = compute_angular_length(row_num, col_num, amplitude_ang)
% function that calculates the maximum size in a diagonal image with
% inclination from 0 to 180° for each amp_ang degrees.
%
% length_vec = compute_angular_length (row_num, col_num, amplitude_ang)
%
% calculate the value of the angle for which I have the main diagonal
alpha_rad = atan2( row_num, col_num );
alpha = rad2deg(alpha_rad);
n_ang = floor(180/amplitude_ang);
length_vec = zeros(1, n_ang);
for i=1:n_ang
ang = (i-1)*amplitude_ang;
if (ang <= alpha || ang >= 180 - alpha )
length_vec(1,i)= abs(col_num / cos( deg2rad(ang)));
else
length_vec(1,i)= abs(row_num / cos( deg2rad(90 - ang)));
end;
end;
What does it mean by angular length?
  댓글 수: 2
Cedric
Cedric 2017년 10월 1일
What is it that you don't understand?
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 10월 1일
What does this code accomplish?

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

채택된 답변

Walter Roberson
Walter Roberson 2017년 10월 1일
Imagine that you are starting from one corner of a rectangular matrix, and you are drawing a line from there to somewhere on one of the opposite edges. What is the length of the angled line segment? This routine computes that, in increments of amplitude_ang degrees.

추가 답변 (0개)

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by