How to revolve 1D vector into a 2D matrix with sub-pixel interpolation?

12 ビュー (過去 30 日間)
Matt Southwick
Matt Southwick 2020 年 7 月 30 日
回答済み: Matt Southwick 2020 年 7 月 30 日
Hi,
I would like take a 1D vector and revlove it about an endpoint to create a 2D image with the values of the original vector interpolated over the rotation.
This seems like a surface of revolution problem.
I tried to do this using the 2D filter tool ftrans2() as below:
N = 111;
a = zeros(N,1);
center = round(N/2);
offset = 30;
a([center-offset,center+offset]) = .25;
a([center-offset+1,center+offset-1]) = .75;
plot(a)
h = ftrans2(a');
imagesc(h)
Thanks for the help
Matt

採用された回答

Matt Southwick
Matt Southwick 2020 年 7 月 30 日
Found a solution from Pau GALLES in another thread
[rx,ry]=meshgrid( -order/2:order/2 , -order/2:order/2 );
r = hypot( rx , ry );
halfb = b((length(b)-1)/2 + 1 : end );
vq = interp1( 0:(length(halfb)-1) , halfb , r(:) , 'linear' , 0 );
W=r; W(:)=vq;
Thank you Pau.
Also works for 1D curve to 3D as follows
[rx,ry,rz]=meshgrid( -order/2:order/2 , -order/2:order/2,-order/2:order/2 );
r = sqrt(rx.^2+ry.^2+rz.^2);
halfb = b((length(b)-1)/2 + 1 : end );
vq = interp1( 0:(length(halfb)-1) , halfb , r(:) , 'linear' , 0 );
W=r; W(:)=vq;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by