I have this imageand I want to compute the affine rectification using the line at infinity and then the metric rectification on the affine rectified image using the conic dual to the circular points.First of all, this is my function that I use to compute a projection:function Ip = projection( img, H )[h,w,d]=size(img);% warp incoming corners to determine the size of the output imagecp=H*[1 1 w w; 1 h 1 h; 1 1 1 1];% we find the canvas of the image starting from the 'left' corner to the 'right corner'Xpr=min(cp(1,:)):max(cp(1,:));Ypr=min(cp(2,:)):max(cp(2,:));% we find a rectangular grid defined by Xpr and Ypr[Xp,Yp]=ndgrid(Xpr,Ypr);[wp,hp]=size(Xp);% performing inverse warping n=wp*hp;X=H\[Xp(:) Yp(:) ones(n,1)]';% resample pixel values with bilinear interpolationxI = reshape( X(1,:),wp,hp)';yI = reshape( X(2,:),wp,hp)';Ip(:,:,1) = interp2(img(:,:,1), xI, yI,'*bilinear'); % redIp(:,:,2) = interp2(img(:,:,2), xI, yI, '*bilinear'); % greenIp(:,:,3) = interp2(img(:,:,3), xI, yI, '*bilinear'); % blueIp=Ip/255;endThen, I wrote this script to compute the affine rectification:im='tilef.jpg';Im=imread(im);I=double(imread(im));figure(1);imshow(Im)%Let's read two parallel lines [x,y]=ginput(2)A=[x(1),y(1),1];B=[x(2),y(2),1];C=cross(A,B);[x1,y1]=ginput(2)A1=[x1(1),y1(1),1];B1=[x1(2),y1(2),1];C1=cross(A1,B1);%Let's find their intersectionint_1=cross(C,C1);int_1=int_1/int_1(3);%Let's find other two parallel lines[x2,y2]=ginput(2)A2=[x2(1) y2(1) 1];B2=[x2(2) y2(2) 1];C2=cross(A2,B2);[x3,y3]=ginput(2)A3=[x3(1) y3(1) 1];B3=[x3(2) y3(2) 1];C3=cross(A3,B3);%Let's find their intersectionint_2=cross(C2,C3);int_2=int_2/int_2(3);%Let's find the line at infinityl_inf=cross(int_1,int_2);%Affine rectificationH=[1 0 0; 0 1 0; l_inf(1) l_inf(2) l_inf(3)];Ip=projection(I,H);figure(2);imshow(Ip)Then I wrote the scipt to compute the metric rectification on the affine rectified image:im='affrect.png';Im=imread(im);I=double(imread(im));figure(1);imshow(Im)%Let's find two orthogonal lines[x4 y4]=ginput(2)A4=[x4(1) y4(1) 1];B4=[x4(2) y4(2) 1];C4=cross(A4,B4);[x5 y5]=ginput(2)A5=[x5(1) y5(1) 1];B5=[x5(2) y5(2) 1];C5=cross(A5,B5);%Let's find the dual conicM1=[C4(1)*C5(1) C4(1)*C5(2)+C5(1)*C4(2)];M2=-C4(2)*C5(2);X=linsolve(M1,M2);X=X';Con=[X(1) X(2) 0; X(2) 1 0; 0 0 0];%Metric rectification[U,S,V] = svd(Con);Ip=projection(I,U);figure(2);imshow(Ip)and those are the rectifications I get:The affine rectification is equal to the original image so why that? Where am I wrong?For the metric rectification, for the properties of a similarity this does not seem a good rectification to me. Once again, why? 
Affine and metric rectification on Matlab
affine transformations;matlab