Wednesday, July 30, 2008

A11 – Camera Calibration

An image is a projection of brightness values from surfaces existing in 3D world space to 2D sensor space. The aim of this activity is to be able to model the physical processes involved in the geometric aspects of image formation.


Procedure:
1.Mount a 3D calibration checkerboard (to be provided) onto a surface and steady your camera with a tripod. Take an image of the checkerboard.
2. Pick an origin and a right-handed coordinate system in the grid and measure coordinates of around 20 to 25 corners of the squares of the checkerboard pattern.

I picked 23 corners.
3.From the image of the same points, find their [xi,yi] coordinates in image space. Use locate to get the coordinates in the image figure window using a mouse.

we have two coodinates since the image is flat. We will have two equations.
The o subscript corresponds to the object and i subscript corresponds to image.
finding the coordinates of selected points.

4. From Lecture 2, rederive Equation 13 this time with the z or Z axis as the camera axis, and x,y as the planar coordinates. Using all the points you've selected, set up the left and right-hand side matrices in Equation 13. Compute the elements of the matrix A using Equation 15.

Equation 13.
Thus,
5. To verify if you got the calibration correctly, predict the image coordinates of some cornerpoints of the checkerboard which were not used in the calibration. Overlay the predicted cornerpoints on the image. Comment on the accuracy of your prediction.
I found out that the average error for yi is 0.016708 and for zi is 0.0045 . And I think it this is accurate.

Using points that are not used in finding a
average error:
yi = 0.013684
zi = 0.010258

I think this is still acccurate.

--------------------------------------------------------------------
codes

stacksize(20000000);
img = imread('rix.jpg');
imshow(img);
x = locate(23);

yi = [326.66667 357.77778 424.66667 300.22222b 356.22222 393.55556 497.77778 508.66667 491.55556 150.88889 217.77778 113.55556 183.55556 118.22222 185.11111 88.666667 301.77778 241.11111 32.666667 28 147.77778 336 326.66667];
zi = [340.44444 184.88889 251.77778 161.55556 111.77778 500.66667 328 550.44444 158.44444 331.11111 178.66667 461.77778 373.11111 194.22222 505.33333 58.888889 419.77778 295.33333 366.88889 564.44444 552 534.88889 265.77778];
xo = [0 0 0 0 0 0 0 0 0 5 3 6 4 6 4 7 0 2 8 8 5 0 0];
yo = [1 2 4 1 2 3 6 6 6 0 0 0 0 0 0 0 0 0 0 0 0 1 1];
zo = [7 3 5 2 1 11 7 12 3 7 3 10 8 4 11 1 9 6 8 12 12 12 5];

//finding a
for i = 1:length(xo)
O((2*i)+1) = [xo(i) yo(i) zo(i) 1 0 0 0 0 -(yi(i)*xo(i)) -(yi(i)*yo(i)) -(yi(i)*zo(i))];
O((2*i)+2) = [0 0 0 0 xo(i) yo(i) zo(i) 1 -(zi(i)*xo(i)) -(zi(i)*yo(i)) -(zi(i)*zo(i))];
I((2*i)+1) = yi(i);
I((2*i)+2) = zi(i);
end

a = inv(O'*O)*O'*I;

//prediction
for j = 1:length(xo)
yinew(j) = ((a(1,1)*xo(j))+(a(1,2)*yo(j))+(a(1,3)*zo(j))+a(1,4))/((a(3,1)*xo(j))+(a(3,2)*yo(j))+(a(3,3)*zo(j))+1);
zinew(j) = ((a(2,1)*xo(j))+(a(2,2)*yo(j))+(a(2,3)*zo(j))+a(2,4))/((a(3,1)*xo(j))+(a(3,2)*yo(j))+(a(3,3)*zo(j))+1);
end

Acknowledgements:
Activity 11 manual.

Beth, Aiyin, Lei
- for answering my questions

Grade :
10/10 because I think that my data is accurate and I did what the activity asked. :)

0 comments:

 
template by suckmylolly.com