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

12 次查看(过去 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 CenterFile Exchange 中查找有关 Geometric 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