Transforming a square image to an image of curved sides
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponse acceptée
Sean de Wolski
le 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 commentaires
Plus de réponses (0)
Voir également
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!