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

13 vues (au cours des 30 derniers jours)
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

Réponse acceptée

Matt Southwick
Matt Southwick le 30 Juil 2020
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;

Plus de réponses (0)

Catégories

En savoir plus sur Geometric Transformation and Image Registration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by