Transforming a square image to an image of curved sides

2 views (last 30 days)
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

Accepted Answer

Sean de Wolski
Sean de Wolski on 16 Mar 2012
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 Comments
Luis
Luis on 16 Mar 2012
the 1024x1024 is not accurate since I had to remove some lines of pixels.
Luis
Luis on 16 Mar 2012
oh and mapexgeo, I've been there but with the kind of data I have I don't see much use for it.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!