Homographic image transformation issue for satteli

2019-07-12 02:24发布

I want to apply homography to the satellite images. I found this post quite helpful. So I decided to use the same Matlab code.

 im = imread('cameraman.tif');
 n = [0;0;-1];
 d = Inf

       theta = 60*pi/180;

       R = [ 1     0           0 ;
           0  cos(theta) -sin(theta);
           0  sin(theta)  cos(theta)];

       t = [0;0;0];

      K=[300 0    0;
            0    300 0;
            0    0    1];

      H=K*R/K-1/d*K*t*n'*K;

     img=imagehomog(im,H','c');
     figure;imshow(img)

but the output is just the small box. I am using MATLAB 2015b enter image description here

EDIT Homography using imtransform and maketform

n = [0;0;-1];
d = Inf;

im = imread('cameraman.tif');

   theta = 60*pi/180;

   R = [ 1     0           0 ;
       0  cos(theta) -sin(theta);
       0  sin(theta)  cos(theta)];

   t = [0;0;0];

  K=[300 0    0;
        0    300 0;
        0    0    1];

  H=K*R/K-1/d*K*t*n'*K;

  tform = maketform('projective',H');
  imT = imtransform(im,tform);

  imshow(imT)

Output enter image description here

How can I do it from the center. Something like this enter image description here

0条回答
登录 后发表回答