官术网_书友最值得收藏!

Estimating the camera motion from a pair of images

Before we set out to actually find the motion between two cameras, let's examine the inputs and the tools we have at hand to perform this operation. First, we have two images of the same scene from (hopefully not extremely) different positions in space. This is a powerful asset, and we will make sure that we use it. As for tools, we should take a look at mathematical objects that impose constraints over our images, cameras, and the scene.

Two very useful mathematical objects are the fundamental matrix (denoted by F) and the essential matrix (denoted by E), which impose a constraint over corresponding 2D points in two images of the scene. They are mostly similar, except that the essential matrix is assuming usage of calibrated cameras; this is the case for us, so we will choose it. OpenCV allows us to find the fundamental matrix via the findFundamentalMat function and the essential matrix via the findEssentialMatrix function. Finding the essential matrix can be done as follows:

    Mat E = findEssentialMat(leftPoints, rightPoints, focal, pp);

This function makes use of matching points in the left-hand side image, leftPoints, and right-hand side image, rightPoints, which we will discuss shortly, as well as two additional pieces of information from the camera's calibration: the focal length, focal, and principal point, pp.

The essential matrix E is a 3x3 sized matrix, which imposes the following constraint on a point in one image and a point and a point x' corresponding image:

x'KTEKx = 0

Here, K is the calibration matrix.
This is extremely useful, as we are about to see. Another important fact we use is that the essential matrix is all we need in order to recover the two cameras' positions from our images, although only up to an arbitrary unit of scale. So, if we obtain the essential matrix, we know where each camera is positioned in space, and where it is looking. We can easily calculate the matrix if we have enough of those constraint equations, simply because each equation can be used to solve for a small part of the matrix. In fact, OpenCV internally calculates it using just five point-pairs, but through the Random Sample Consensus algorithm (RANSAC), many more pairs can be used and they make for a more robust solution.

主站蜘蛛池模板: 齐齐哈尔市| 浮梁县| 班玛县| 宣武区| 贺兰县| 凭祥市| 利津县| 紫阳县| 开封县| 合作市| 吉安县| 伽师县| 温州市| 通山县| 苏尼特右旗| 营山县| 尚义县| 微山县| 鹤峰县| 新宁县| 岑溪市| 镇雄县| 普兰店市| 霍林郭勒市| 五河县| 安义县| 通州市| 土默特左旗| 锦州市| 高台县| 洪江市| 横峰县| 青田县| 邮箱| 和田县| 周至县| 新邵县| 新民市| 沁源县| 衡山县| 富川|