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

조회 수: 10 (최근 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