Transforming a square image to an image of curved sides

2 次查看(过去 30 天)
Hi all!
I'd be very thankful for any tip on this!
Challenge:
I have a square picture of the moon (1024x1024 pixels). The 4 corners all have different coordinates (latitude and longitude). I have interpolated the coordinates for the image every 8 pixels and I can creat a matrix with that info.
My solution:
I though of interpolating all the coordinates for all the pixels and then put the pixel in the coordinate matrix but that takes me an hour to compute an image... and I have several hundred thousands to process.
Question:
Is there any other method to transform a square image into another image with non linear sides?
Thank you all!
The code here:
for x=1:129
for y=1:121
inputPointsX(y,x)=(coords{(x-1)*121+y,4}-mapCoord(4,2))*xScale;
inputPointsY(y,x)=(coords{(x-1)*121+y,3}-mapCoord(4,1))*yScale;
end
end
xcoords = 1:129;
ycoords = 1:121;
[X,Y] = meshgrid(xcoords,ycoords);
try
for x=1:1024 % Interpolated version - SLOW!!!
for y=1:1024-64
xccc = interp2(X,Y,inputPointsX,x/8+1,y/8+1);
yccc = interp2(X,Y,inputPointsY,x/8+1,y/8+1);
Image(round(yccc),round(xccc))=I(y,x);
end
end

采纳的回答

Sean de Wolski
Sean de Wolski 2012-3-16
Part 5 of:
showdemo mapexgeo
Maybe? Does the code you have right now work as you expect but is just slow? If it is, post it, and maybe we can chop away at making it faster.
  3 个评论
Luis
Luis 2012-3-16
the 1024x1024 is not accurate since I had to remove some lines of pixels.
Luis
Luis 2012-3-16
oh and mapexgeo, I've been there but with the kind of data I have I don't see much use for it.

请先登录,再进行评论。

更多回答(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