Mark Wang
CS 223B
March 15, 2000
We test our implementation on both synthetic and acquired images from a variety of viewpoints. The initial results we obtained, while needing improvement in some areas such as robustness in the face of error and uncertainty, indicated the potential for the algorithm to form the nucleus for several applications, such as object location or tracking. Coupled with automatic methods for feature detection and point matching, we believe that this camera calibration will have many practical uses.
Input/Output and Restrictions
As input, we read in a grayscale image, as well as a list of world points which are predetermined and reflect the world coordinates of the test object. As output, we produce the 3x3 rotation matrix R which, together with the translation vector T, form the transformation between camera and world coordinate systems. R is graphically visualized as a set of orthonormal coordinate axes in an isometric view.
In addition, we also determine alpha, the aspect ratio of pixels, and f, the focal length along the camera's optical axis.
Assumptions we make about the viewpoint -- there are restrictions we place on it -- in particular, that the directions of all three principal orthonormal axes in the image can be ascertained, and that they are reasonably distinct, which implies that all three sides of the cube should be visible. This is so that our experimental method for automated point-matching (detailed below) can work.
For the matching to work we need at least eight points in our matrix. Furthermore, the image points that we match to known world points must reside on at least two different planes in order to have a non-singular matrix.
Specifically, to simplify the implementation, we extensively leveraged and utilized pre-existing source code freely available for edge detection and line detection and segmentation, found in Horatio, as well as its general matrix and vector arithmetic facilities, including SVD and least-squares.
Threshold the image
Binary-thresholding the image using a cutoff of 100 seems to give better
results for edge detection, and hence line generation and
junction-finding.
Edge detection
We apply an implementation of Canny's algorithm on the thresholded image
to give us an edge map.
Line detection
We use a provided orthogonal-regression line detector to turn our edge
map into lines, with suitable cutoffs for minimum length to filter out
must spurious candidates.
Junction finding
We find intersections of the lines using a provided junction finding
algorithm. The main consideration in this stage was to balance the
search window size used in finding a neighboring endpoint, given a
line segment. We need to find junctions of disjoint line
segments that should be together, such as two lines coming together to
create a corner. At the same time, we do not want false positives,
which would result if our window was set too high.
Image->World coordinate mapping
Currently, this is still a
manual process involving clicking each junction and selecting from a list
of 3-D world points that have been previously read in from
worldpoints.txt. While it would have been much more desirable to
have automatic matching, there are many complexities behind this, which
are detailed in the future work section, and we
felt that this would detract us from our core focus on the calibration
algorithm itself.
(excerpt from text window)
46: (2.812500, 0.500000, -0.500000) 47: (2.812500, 0.500000, -1.500000) Enter ID of world point to map to (-1 for no mapping): 30 **** Mapped world point id 30 (0.500000, 0.500000, 2.750000) to image point (-32.771388, -7.026902)
Figure: All the points on the calibration pattern box used in
matching,
along with their ID numbers, used during the manual process
of specifying world-to-image point mappings.
We expect rotation matrices to exhibit autocorrelation -- ie, they should not change too much from the previous value. This characteristic holds for intervals of consecutive images, but not the entire sequence: the computed matrices will abruptly "flip" at certain points in both sequences. As can be seen in the visualizations of the rotation matrix, they seem to belong to one of two "groups", switching back and forth between them. Note how the ordering of the color-coded axes abruptly changes in the visualizations of R -- for instance, the green Y' axis goes from pointing upward to pointing below the XZ plane.
Our other characteristics, such as our focal length f and our translation vector T also exhibited this bimodal distribution.
After analysis of the raw data, this is most likely due to the sign-reversal step (see Eqn. 6.12 of Trucco and Verri) occuring at some points, but not others. This reverses the signs of the first two components of T and the first two rows of R. Currently, we arbitrarily pick the first point we mapped as the point to apply the test of 6.12 to.
In theory, it should not matter which point we apply (6.12) to, as the signs should stay the same, but measurement error may cause this to not be true in practice. This hypothesis is further strengthed by the fact that "incomplete" mappings (ones where not all visible points were used, due to inability to find a function) would often lead to the sign reversal. A possible solution would be to apply the inequality of (6.12) over all mapped points, and see if more points are negative or positive.
Establishing correspondences between world points and image points
The main time-consuming step for us, as we ran our experiments, was matching image points found to world points -- which points belong to what? Having an automatic point matching system would be a significant reduction in the effort needed to utilize the algorithm.
We have begun looking into preliminary problems in addressing this issue for our specific calibration pattern and its geometric structure.
Essentially, we would like to first determine, based on the slope of its associated line, where a point might be matched with. We assume that, since the depth of our image is much greater than the relative distance between any two salient points in our scene, our image is close to the perfect case of isometric projection -- that is, parallel lines on a line will stay parallel under our perspective projection. In practice, this ideal case doesn't hold, but it should be enough for our cases. There are three principal directions. We can find those slopes by collecting the slopes of the received lines and doing k-means clustering on this set, with k = 3.
We know that each junction point is associated with the intersection of two lines -- we note their slopes, and see which of the three slopes the lines of the point are associated with. We can then see which of the 3 clusters the slope falls under.
One issue is that the pattern on each side of the cube is the same. One possible solution in the future is have unique patterns for each side so that we can differentiate between them.
Other possible differentiation methods for points that might be investigated in the future include:
Trucco, Emanuele and Verri, Alessandro. Introductory Techniques for 3-D
Computer Vision
Horatio
http://www.ee.surrey.ac.uk/Personal/P.McLauchlan/horatio/html/index.html
K-means algorithm: http://www.ece.neu.edu/groups/rpl/kmeans/
CLAPACK: http://www.netlib.org/clapack/index.html
Tsai, R. Y. A Versatile Camera Calibration Technique for High Accuracy 3D
Machine Vision Metrology Using Off-the-Shelf TV Cameras and Lenses,
IEEE Journal of Robotics and Automation Vol RA-3, No 4, pp. 323-344
(1987)
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
C source code and other necessary data files
Source code in C | worldpoints.txt | test.cfg
Notes: This needs the Horatio libraries and header files to compile, but
it doesn't involve any modifications to the library itself. All three
files should go in the horatio/src/lib/improc directory; the
ip_test.c default test program is replaced.
Mark Wang <mwang@cs.stanford.edu>