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

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.

主站蜘蛛池模板: 屯昌县| 凤山县| 五寨县| 元江| 远安县| 阜平县| 突泉县| 桂林市| 三原县| 军事| 霍州市| 淮安市| 兴国县| 马山县| 江津市| 印江| 遂昌县| 龙南县| 孙吴县| 长海县| 天门市| 安国市| 班戈县| 重庆市| 绥宁县| 胶州市| 涿州市| 新平| 井研县| 平定县| 巴青县| 武冈市| 嵊州市| 麻栗坡县| 金乡县| 吴桥县| 兰坪| 新泰市| 安龙县| 桓仁| 津市市|