Homography Matrix for Image Stitching in MATLAB -


ive been trying compute homography matrix in matlab using manually selected corresponding points 2 images. here code far:

    spoints = [330.756756756757,923.310810810811; %points source image     335.945945945946,1016.71621621622;     495.081081081081,771.094594594595;     498.540540540540,933.689189189189];     dpoints = [310.000000000000,477.040540540540; %points destination image     320.378378378378,558.337837837838;     462.216216216216,319.635135135135;     469.135135135135,471.851351351351];     %/////////////homography matrix///////////////////     n = size(spoints, 1);      = zeros(n*2,8);      b = zeros(n*2,1);      j=1;     i=1:n         a(j,:)=[dpoints(i,1) dpoints(i,2) 1 0 0 0 -spoints(i,1)*dpoints(i,1) - spoints(i,1)*dpoints(i,2)];         b(j,1)=spoints(i,1);         j=j+1;         a(j,:)=[0 0 0 dpoints(i,1) dpoints(i,2) 1 -spoints(i,2)*dpoints(i,1) -spoints(i,2)*dpoints(i,2)];         b(j,1)=spoints(i,2);         j=j+1;     end      x = (a\b);     h = [x(1,1) x(2,1) x(3,1);         x(4,1) x(5,1) x(6,1);         x(7,1) x(8,1) 1]; 

this not give right h matrix. checked via

    bla = zeros(4,3);     bla(1,:,:)=h*[dpoints(1,:),1]';     bla(2,:,:)=h*[dpoints(2,:),1]';     bla(3,:,:)=h*[dpoints(3,:),1]';     bla(4,:,:)=h*[dpoints(4,:),1]'; 

the bla matrix should equal spoints matrix not. doing wrong?

i wouldn't in first step. there algorithms dlt (direct linear transform) in 2d , 3d, doing consistently, of use svd singular value decomposition technique. svd implemented in matlab can read here. can use svd instead of a\b.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -