Hi everyone;
I want to measure the distance in mm so i use tform and invtform matrix to exchange the image and world data units. However, i have this error after running my code. Here is the code:
PS: First i calibrate my camera and then i run these codes…
a=imread('calib8.jpg');>> im = undistortImage(a, cameraParameters);>> figure; imshow(im);>> [x,y] = ginput(2)>> [imagePoints, boardSize] = detectCheckerboardPoints(im); >> Ainv=inv(cameraParameters.IntrinsicMatrix); >> squareSize=9;>> worldPoints = generateCheckerboardPoints(boardSize, squareSize);>> H=fitgeotrans(worldPoints, imagePoints, 'projective');>> H=H.T;>> h1=H(1,:);>> h2=H(2,:);>> h3=H(3,:);>> lambda=1/norm(h1*Ainv);>> r1=lambda*h1*Ainv;>> r2=lambda*h2*Ainv;>> r3=cross(r1,r2);>> R=[r1; r2; r3];>> [U,~,V]=svd(R);>> R=U*V';>> t= lambda*h3*Ainvt = -18.7109 11.7857 150.6906>> T = [R(1, :); R(2, :); t] * cameraParameters.IntrinsicMatrix;>> tform = projective2d(T);>> imagePoints1=[x;y]imagePoints1 = 106.0000 104.0000 132.0000 55.0000>> worldPoints1 = transformPointsInverse(tform, imagePoints1);Error using projective2d/transformPointsInverse (line 189)transformPointsInverse requires that X is an Nx2 matrix.
Best Answer