Expressing every point of my image in polar coordinates, where the origin is a point that was chosen from the image
1 回表示 (過去 30 日間)
古いコメントを表示
Hi guys. I have an image with a circle at the centre of it. Now, I want to express every point in my image in terms of polar coordinates ( I am more interested in evaluating the angles ) the origin being the centre of the circle. So far I've done this:
if true
I = imread ( Image );
I1 = size ( I );
R = ( I1 ( 1 ) ) ;
C = ( I1 ( 2 ) ) ;
[ Rv , Cv ] = ndgrid ( 1:R , 1:C ) ;
% I've already calculated the location of the circle using imfindcircles
Rv_transla = Rv - centres ( 2 );
Cv_transla = Cv - centres ( 1 );
% and then this horrible loop to account for all the cases
for c = 1:C ;
for r = 1:R ;
if Cv_transla ( r , c ) > 0;
angle ( r , c ) = atand ( Rv_transla ( r , c ) / Cv_transla ( r , c ));
else if ( Cv_transla ( r , c ) < 0 & Rv_transla ( r , c ) < 0 );
angle ( r , c ) = atand ( (Rv_transla ( r , c ) / Cv_transla ( r , c )) - 180 );
else if ( Cv_transla ( r , c ) == 0 & Rv_transla > 0 );
angle ( r , c ) = 90;
else if ( Cv_transla ( r , c ) == 0 & Rv_transla < 0 );
angle ( r , c ) = -90;
else if ( Cv_transla ( r , c ) == 0 & Rv_transla == 0 );
angle ( r , c ) = 'undefined'
end
end
end
end
end
end
end
% which does not give me the expected results. I know it's really messy, but any help would be much appreciated. I've attached the image just to give you a better idea.

Thanks.
0 件のコメント
採用された回答
その他の回答 (1 件)
Image Analyst
2017 年 7 月 24 日
Why do you have all these cases? Simply scan the image pixel-by-pixel computing the radius and angle (using the atan2d function) of each pixel from the circle center.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!