필터 지우기
필터 지우기

Transforming a square image to an image of curved sides

조회 수: 1 (최근 30일)
Luis
Luis 2012년 3월 16일
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