ASSIGMENT 1 (CAMERA INTERIOR ORIENTATION)
LOCATION
The exercise is located at the laboratory of NCKU Dept. of Geomatics Engineering building which is located at the basement of the building. The images were taken at Thursday, March 26^{th} 2016.
DATA COLLECTION
The images were taken by Sony NEX-5N. The detail description about parameters I used were camera focal length set to 16 mm, shutter speed to 1/50, aperture to F13 and the last ISO is set to 400. In order to calibrate the camera, we need about six photos minimum. But more is better. Then we organize the rotation about 45^{o} clockwise at every capture. See on the figure 1. And as the result of the images captured, we can look at all direction where the location of camera is. See on figure 2 opened from Australis software.
Figure 1. Captured Image Direction
Figure 2. Captured Image in all direction
ANALYSIS AND RESULT
For the result of calibrated camera using Australis Software, I attached it on the “last page”. Based on the result, there are many kind of distortions in the lens, such as radial distortion and tangential distortion usually called decentering distortion. We can know the each of characters from the histogram (plotting) in the Australis result.
Radial Distortion
Based on the Australis software, the computation is using Gaussian computation for Radial distortion. See on the figure 3 reveal that, for the center of the image, there are no distortion. At least the distortion is almost zero. But, when the radius of its image center become larger, the distortion is starting appear. When the radius is enlarged to at least 11 millimeter from the center of image, the distortion is experiencing ‘saturation’ and going down until negative. For the increasing curve, we could see the distortion is outward, keep away from its center of image. But when the curve is decreasing, the distortion is inward, the arrows lead to its center of image. See on the figure 5.
Radial distortion causes the position of the image distortion along the radius from the main point. Distortion outwards is considered positive and distortion inward is negative. Positive radial distortion often called pincushion distortion, the distortion is that original image becomes distorted square shaped on its sides curved toward the center of the image. While conversely, negative radial distortion is called barrel distortion, which is illustrated in the figure 4.
Figure 3. Gaussian Radial Distortion (Australis Software)
Figure 4. Distortion character
Figure 5. Gaussian Radial Distortion (Using matlab coding)
The coding I used here is ‘’QUIVER function”, the center of an image is practically undistorted. When we move outward of the image to the blue rectangle, it has a two kind of distortions (inwards and outward) in which the inward is from increasing of curve and outward is decreasing of curve see on figure 3. And I attached the coding of this model below:
K1 = 2.35369*10^(-4); K2 = -1.18567*10^(-6); K3 = -1.41643*10^(-48); K4 = -2.81086*10^(-56); K5 = -6.34561*10^(-62); [x,y] = meshgrid(-12.8:1:12.8,-8.16:1:8.16); r = sqrt((x.^2)+(y.^2)); dr = (K1.*r.^3)+(K2.*r.^5)+(K3.*r.^7)+(K4.*r.^9)+(K5.*r.^11); [px,py] = gradient(dr,1,1); quiver(x,y,px,py,'r-'), axis image title ('GAUSSIAN RADIAL DISTORTION PLOT'); xlabel ('milimeter'); ylabel ('milimeter');
And I also plot the Gaussian Radial Distortion as figure 3 using Matlab coding. By plotting the x-axis for radius and the y-axis for dr (distortion). The code is:
K1 = 2.35369*10^(-4); K2 = -1.18567*10^(-6); K3 = -1.41643*10^(-48); K4 = -2.81086*10^(-56); K5 = -6.34561*10^(-62); [x,y] = meshgrid(-12.8:1:12.8,-8.16:1:8.16); r = sqrt((x.^2)+(y.^2)); dr = (K1.*r.^3)+(K2.*r.^5)+(K3.*r.^7)+(K4.*r.^9)+(K5.*r.^11); Plot (r,dr, 'r-') title ('GAUSSIAN RADIAL DISTORTION PLOT'); xlabel ('milimeter'); ylabel ('micrometer');
And the image is shown bellow:
Figure 6. Gaussian radial distortion (Using Matlab coding)
Decentering distortion
Non-metric camera lens is a combination of several lenses having different center of point. Improper adjustment of the focal point on the combined lens (centering) cause happening tangential distortion is also called decentric distortion. Centering error of the lens from combined lens on non-metric image is illustrated on figure 7:
Figure 7. (Up) perfectly combined lens, and (down) imperfectly combined lens.
Here, is the result from Australis software of Decentering distortion figure 8.
Figure 8. Decentering Distortion Plot
And here I also attach the coding of Matlab below:
P1 = 4.2055*10^(-5); P2 = -6.0711*10^(-5); [x,y] = meshgrid(-12.8:1:12.8,-8.16:1:8.16); r = sqrt((x.^2)+(y.^2)); DD = ((sqrt(P1^2+P2^2)).*r.^2)*1000; plot (r,Pr, 'g-'); axis image title ('DECENTERING DISTORTION PLOT'); xlabel ('Radial Distance (r) (in milimeter)'); ylabel ('P(r) (in micrometer)');
For decentering distortion, it uses the formula of . We could rearrange the formula using Matlab language to be “DD”.
And for the image plotting, can see on figure 9. Here, the figure explains that when the radial distance is enlarged or far from the center of its image, the distortion is concurrently becoming large also.
Figure 9. Decentering Distortion Plot
Computation and program design and validated data.
As we know the images have many distortions which are caused by imperfectly camera lens shape and camera lens arrangement. So, after the distortion in the camera has calibrated, we could know the parameters. The parameters are shown on the table 1.
Tabel 1. Parameters of Calibration
METRIC CALIBRATION PARAMETERS | ||||
Resolution | 4912 x 3264 pixels | |||
Pixel width | 0.0050mm | Pixel height | 0.0050mm | |
PARAMETER | VALUE | STANDARD ERROR | ||
Principal distance c | 16.5229mm | 0.003mm | ||
Principal point offset in x-image coordinate xp | -0.1561mm | 0.003mm | ||
Principal point offset in y-image coordinate yp | 0.1847mm | 0.003mm | ||
3rd-order term of radial distortion correction K1 | 2.35369e-004 | 7.1991e-007 | ||
5th-order term of radial distortion correction K2 | -1.18567e-006 | 5.5116e-009 | ||
7th-order term of radial distortion correction K3 | -1.41643e-048 | 3.0777e-030 | ||
Coefficient of decentering distortion P1 | 4.2055e-005 | 1.951e-006 | ||
Coefficient of decentering distortion P2 | -6.0711e-005 | 8.276e-007 | ||
No significant differential scaling present B1 | 0.0000e+000 | 3.078e-020 | ||
No significant non-orthogonality present B2 | 0.0000e+000 | 3.078e-020 |
xp and yp is the error of principal point in the image coordinate. Its value reveal that the center of the image was different than before calibration procedure. Again, we found the K1, K2 and K3 that state the radial distortion correction due to the camera lens imperfectly shaped. For the quality of the camera lens arrangement, we can know based on the parameters P1 and P2 or called decentering distortion.
Correcting the Image coordinate
I test some points of the data provided in Australis software. See on the table 1. Based on the theory, the corrected image coordinates and can be calculated from the measured coordinates and by using the formula. However, we need to transform the xp and yp in (mm) to pixel (Cp and Cr) in order to transform the Image Coordinate to Camera coordinate.
X and Y are now respect to the principal points,
%Distortion Parameters xp = -0.1561*0.005; yp = 0.1847*0.005; K1 = 2.35369*10^(-4); K2 = -1.18567*10^(-6); K3 = -1.41643*10^(-48); K4 = -2.81086*10^(-56); K5 = -6.34561*10^(-62); P1 = 4.2055*10^(-5); P2 = -6.0711*10^(-5); %Coordinate of Points Cmeas = [962.301; 1865.707; 1544.668; 2501.580; 1197.849; 2541.048; 3274.365; 2198.468; 1363.712; 1159.154]; Rmeas = [2308.571; 593.363; 2956.671; 10.722; 2719.721; 2933.785; 247.508; 3209.994; 1352.201; 2030.220]; %Point respect to the principal point C = Cmeas - xp; R = Rmeas - yp; r = sqrt((C.^2)+(R.^2))*0.005; dr = (K1.*r.^3)+(K2.*r.^5)+(K3.*r.^7); %Corrected points Ccorr = C + (C.*dr./r + P1.*(r.^2 + 2*C.^2) + 2*P2.*C.*R)*0.005 Rcorr = R + (R.*dr./r + P2.*(r.^2 + 2*R.^2) + 2*P1.*C.*R)*0.005
For the result could see on the table 2 C and R corrected.
Table 2. Measured and Corrected Coordinate Points of Image (in pixel)
Point Label | Sample Points | |||
CODE15 | 962.301 | 2308.571 | 961.38 | 2306.4 |
CODE17 | 1865.707 | 593.363 | 1866.6 | 593.65 |
CODE20 | 1544.668 | 2956.671 | 1545.2 | 2952.9 |
CODE30 | 2501.580 | 10.722 | 2504.3 | 10.733 |
CODE32 | 1197.849 | 2719.721 | 1196.4 | 2716.5 |
CODE35 | 2541.048 | 2933.785 | 2538.2 | 2930.5 |
CODE44 | 3274.365 | 247.508 | 3278 | 247.78 |
CODE52 | 2198.468 | 3209.994 | 2195.3 | 3205.4 |
CODE58 | 1363.712 | 1352.201 | 1363.5 | 1352.4 |
CODE59 | 1159.154 | 2030.220 | 1158.3 | 2028.8 |
Coordinate System Transformation
And we need to transform them (points) to the camera coordinate system. The formula to transform the Camera coordinate to Image coordinate system is shown below.
However, before we obtain the points, we need to know the value of principal point (, ). Because of the image size are 4912 in width and 3264 in height, and are a half of them, respectively. The formula can be drawn to the Matlab language.
%Points coordinate of image system clear all; clc C = [962.301 1865.707 1544.668 2501.580 1197.849 2541.048 3274.365 2198.468 1363.712 1159.154 ]; R = [2308.571 593.363 2956.671 10.722 2719.721 2933.785 247.508 3209.994 1352.201 2030.220 ]; %Parameter of image coordinate system ds = 0.005; Cp = 2456; Rp = 1632; %Transformation of image to camera Xc = ds*C - ds*Cp Yc = -ds*R + ds*Rp %Backward transformation Ci = Xc/ds + Cp Ri = -Yc/ds + Rp
The result is shown in Table 3.
Table 3. Points Coordinates of Image to be transformed to Camera Coordinate System
Point Label | Sample Points (Computed in Matlab) | Points from Australis Software | ||||
CODE15 | 962.301 | 2308.571 | -7.4685 | -3.3829 | -7.4685 | -3.3829 |
CODE17 | 1865.707 | 593.363 | -2.9515 | 5.1918 | -2.9515 | 5.1932 |
CODE20 | 1544.668 | 2956.671 | -4.5567 | -6.6045 | -4.5567 | -6.6234 |
CODE30 | 2501.580 | 10.722 | 0.2279 | 8.1063 | 0.2279 | 8.1064 |
CODE32 | 1197.849 | 2719.721 | -6.2908 | -5.4386 | -6.2908 | -5.4386 |
CODE35 | 2541.048 | 2933.785 | 0.42524 | -6.5089 | 0.4252 | -6.5089 |
CODE44 | 3274.365 | 247.508 | 4.0918 | 6.9225 | 4.0918 | 6.9225 |
CODE52 | 2198.468 | 3209.994 | -1.2877 | -7.89 | -1.2877 | -7.8900 |
CODE58 | 1363.712 | 1352.201 | -5.4614 | 1.399 | -5.4614 | 1.3990 |
CODE59 | 1159.154 | 2030.220 | -6.4842 | -1.9911 | -6.4842 | -1.9911 |
And the result after transforming from Image coordinate to Camera coordinate by Matlab computation, I compare the transformed coordinate, coordinate camera by my own computation, with camera coordinate by Australis. But there are no significant different instead most of the values are the same.
And after successfully transform to camera system. Then, would be done to backward transformation to image system in the same script.
%Backward Transformation Ci = Xc/ds + Cp; Ri = -Yc/ds + Rp;
Table 4. Points Camera coordinate to be transformed to Image Coordinate System
Point Label | Sample Points (Backward Transformation) | |||
CODE15 | -7.4685 | -3.3829 | 962.301 | 2308.571 |
CODE17 | -2.9515 | 5.1918 | 1865.707 | 593.363 |
CODE20 | -4.5567 | -6.6045 | 1544.668 | 2956.671 |
CODE30 | 0.2279 | 8.1063 | 2501.58 | 10.7220 |
CODE32 | -6.2908 | -5.4386 | 1197.849 | 2719.721 |
CODE35 | 0.42524 | -6.5089 | 2541.048 | 2933.785 |
CODE44 | 4.0918 | 6.9225 | 3274.365 | 247.508 |
CODE52 | -1.2877 | -7.89 | 2198.468 | 3209.994 |
CODE58 | -5.4614 | 1.399 | 1363.712 | 1352.201 |
CODE59 | -6.4842 | -1.9911 | 1159.154 | 2030.22 |
And the result of the backward transformation are back to the initial values.