JP2017059048A - Arithmetic unit and operation method - Google Patents

Arithmetic unit and operation method Download PDF

Info

Publication number
JP2017059048A
JP2017059048A JP2015184315A JP2015184315A JP2017059048A JP 2017059048 A JP2017059048 A JP 2017059048A JP 2015184315 A JP2015184315 A JP 2015184315A JP 2015184315 A JP2015184315 A JP 2015184315A JP 2017059048 A JP2017059048 A JP 2017059048A
Authority
JP
Japan
Prior art keywords
matrix
simultaneous equations
transformation
coefficient
columns
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2015184315A
Other languages
Japanese (ja)
Inventor
中山 忠義
Tadayoshi Nakayama
忠義 中山
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2015184315A priority Critical patent/JP2017059048A/en
Publication of JP2017059048A publication Critical patent/JP2017059048A/en
Pending legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To make it possible to quickly and highly accurately estimate the least square solution of a projective transformation matrix.SOLUTION: Provided is an arithmetic unit which derives an M-th dimensional projective transformation matrix by solving simultaneous equations set based on coordinate point pairs before and after the projective transformation, the arithmetic unit comprising: determination means for determining 2N simultaneous equations set based on N coordinate point pairs, the simultaneous equations being represented as Ax=b, by a coefficient matrix A, a solution vector b, and a variable vector x constituted of the elements of the transformation matrix; breakdown means for breaking down the coefficient matrix A into a partial orthogonal matrix Qwith inter-vector orthogonalization partially performed in the coefficient matrix A and an upper triangular matrix R; and derivation means for determining the variable vector x by processing a deformed simultaneous equations obtained by multiplying both sides of the simultaneous equations by a transposition matrix Qof the partial orthogonal matrix Qto derive the elements of the projective transformation matrix.SELECTED DRAWING: Figure 4

Description

本発明は、2枚の画像間の射影変換行列を推定する技術に関するものである。   The present invention relates to a technique for estimating a projective transformation matrix between two images.

自由度”6”を有するアフィン変換行列は、2次元画像を、拡大・縮小・回転・並行移動することが可能である。これにさらに2つの自由度を追加して水平方向と垂直方向の奥行き(遠近感)を表現できるようしたのが、2次元射影変換行列になる。変換対象を3次元空間に拡張したアフィン変換行列は自由度”12”、射影変換行列は自由度”15”であり、これらを使った変換処理がコンピュータグラフィックス(CG)生成で利用されている。   The affine transformation matrix having the degree of freedom “6” can enlarge, reduce, rotate, and translate a two-dimensional image. A two-dimensional projective transformation matrix is obtained by adding two degrees of freedom to express the depth (perspective) in the horizontal direction and the vertical direction. The affine transformation matrix in which the transformation target is expanded to a three-dimensional space has a degree of freedom of “12” and the projective transformation matrix has a degree of freedom of “15”, and transformation processing using these is used for computer graphics (CG) generation. .

一方、コンピュータビジョンの分野では、複数の画像から変換行列を推定することも行われる。例えば、動画撮影カメラの手振れ補正を目的として、カメラ等で撮影した複数の画像から変換行列を推定し補正を行う。2つの画像中の対応点の座標データから2次元射影変換行列を求める機能は多くのアプリケーションで使われており、この変換行列はホモグラフィ行列と呼ばれる。ホモグラフィ行列は、パノラマ画像の生成、プロジェクタの投影位置の補正、平面パターンを用いるカメラ校正、対象物の形状推定・復元、道路面上の障害物検出など幅広い用途で利用することが出来る。   On the other hand, in the field of computer vision, a transformation matrix is also estimated from a plurality of images. For example, for the purpose of camera shake correction of a moving image shooting camera, a transformation matrix is estimated from a plurality of images shot by a camera or the like and correction is performed. A function for obtaining a two-dimensional projective transformation matrix from coordinate data of corresponding points in two images is used in many applications, and this transformation matrix is called a homography matrix. The homography matrix can be used in a wide range of applications such as panoramic image generation, projector projection position correction, camera calibration using a plane pattern, object shape estimation / restoration, and obstacle detection on a road surface.

ただし、射影変換に基づく連立方程式を解いてホモグラフィ行列を求める処理は処理量が多い。そこで、特許文献1では、画像間の相関が高い場合に有効な近似演算で求める局所ホモグラフィ行列と、連立方程式を解いて求める大域的ホモグラフィ行列の2種類を使い分ける技術が開示されている。具体的には、画像間の相関が高い場合には高速演算が可能な局所ホモグラフィ行列を計算し、相関が低い場合に限り連立方程式を解いて大域的ホモグラフィ行列を求めるようにしている。   However, the processing for obtaining a homography matrix by solving simultaneous equations based on projective transformation has a large amount of processing. Therefore, Patent Document 1 discloses a technique for selectively using two types, a local homography matrix obtained by an approximation operation effective when the correlation between images is high, and a global homography matrix obtained by solving simultaneous equations. Specifically, when the correlation between images is high, a local homography matrix capable of high-speed calculation is calculated, and only when the correlation is low, simultaneous equations are solved to obtain a global homography matrix.

特開2012−86285号公報JP2012-86285A

しかしながら、連立方程式を作る際の対応点が多いと、係数行列Aの行列積(AA)を演算する際の積和演算において、数値計算誤差が蓄積しやすくなる。一方誤差の蓄積を避ける手法として、行列のQR分解を用いる方法があるが、係数行列Aの列ベクトルを相互に直交化する必要があり非常に重い処理となる。 However, if there are many corresponding points when creating simultaneous equations, numerical calculation errors tend to accumulate in the product-sum operation when calculating the matrix product (A T A) of the coefficient matrix A. On the other hand, as a technique for avoiding error accumulation, there is a method using QR decomposition of a matrix, but it is necessary to orthogonalize the column vectors of the coefficient matrix A to each other, which is very heavy processing.

本発明は、このような問題に鑑みてなされたものであり、射影変換行列の最小二乗解を高速かつ精度よく推定可能とする技術を提供することを目的とする。   The present invention has been made in view of such a problem, and an object of the present invention is to provide a technique capable of estimating a least-squares solution of a projective transformation matrix with high speed and accuracy.

上述の問題点を解決するため、本発明に係る演算装置は以下の構成を備える。すなわち、M次元の射影変換の変換行列を、該射影変換による変換前後の座標点ペアに基づいて立式される連立方程式を解くことにより導出する演算装置において、N個の座標点ペアに基づいて立式される2N個(ただし、2N>(M+1)−1)の連立方程式であって、係数行列A、解ベクトルb、前記変換行列の各要素により構成される変数ベクトルxによりAx=bと表現される連立方程式を決定する決定手段と、前記係数行列Aを、該係数行列Aにおける列ベクトル間の直交化を部分的に行った部分直交行列Qと上三角行列Rとに分解する分解手段と、前記部分直交行列Qの転置行列Q を前記連立方程式の両辺に乗算して得られる変形連立方程式を処理することにより前記変数ベクトルxを決定し、前記射影変換の変換行列の各要素を導出する導出手段と、を有し、前記部分直交行列Qにおける少なくとも1組の列ベクトルは互いに直交していない。 In order to solve the above-described problems, the arithmetic device according to the present invention has the following configuration. That is, in an arithmetic device that derives a transformation matrix of M-dimensional projective transformation by solving simultaneous equations formed based on coordinate point pairs before and after transformation by the projective transformation, based on N coordinate point pairs. 2N simultaneous equations (where 2N> (M + 1) 2 −1), and Ax = b by a variable vector x composed of a coefficient matrix A, a solution vector b, and each element of the transformation matrix A determination means for determining simultaneous equations expressed as follows: the coefficient matrix A is decomposed into a partial orthogonal matrix Q p and an upper triangular matrix R p partially orthogonalized between column vectors in the coefficient matrix A And determining the variable vector x by processing the modified simultaneous equations obtained by multiplying both sides of the simultaneous equations by the transposed matrix Q p T of the partial orthogonal matrix Q p . Deriving means for deriving each element of the transformation matrix, and at least one set of column vectors in the partial orthogonal matrix Q p are not orthogonal to each other.

又は、M次元の射影変換の変換行列を、該射影変換による変換前後の座標点ペアに基づいて立式される連立方程式を解くことにより導出する演算装置において、N個の座標点ペアに基づいて立式される2N個(ただし、2N>(M+1)−1)の連立方程式であって、N行((M+1)−1)列の係数行列A、N行M列の解行列B、前記変換行列の各要素により構成される((M+1)−1)行M列の変数行列XによりAX=Bと表現される連立方程式を決定する決定手段と、前記係数行列Aを、該係数行列Aにおける列ベクトル間の直交化を部分的に行った部分直交行列Qと上三角行列Rとに分解する分解手段と、前記部分直交行列Qの転置行列Q を前記連立方程式の両辺に乗算して得られる変形連立方程式を処理することにより前記解行列Bを決定し、前記射影変換の変換行列の各要素を導出する導出手段と、を有し、前記部分直交行列Qにおける少なくとも1組の列ベクトルは互いに直交していない。 Alternatively, in an arithmetic unit that derives a transformation matrix of M-dimensional projective transformation by solving simultaneous equations that are formulated based on coordinate point pairs before and after transformation by the projective transformation, based on N coordinate point pairs 2N (2N> (M + 1) 2 −1) simultaneous equations that are formulated, and N rows ((M + 1) 2 −1) columns of coefficient matrix A h and N rows and M columns of solution matrix B , A determining means for determining a simultaneous equation expressed as A h X = B by a variable matrix X of ((M + 1) 2 −1) rows and M columns composed of each element of the transformation matrix, and the coefficient matrix A h and a decomposing means for decomposing into a orthogonalizing partially portion orthogonal matrix was performed Q p and an upper triangular matrix R p between column vectors in the coefficient matrix a h, transpose matrix Q p of the partial orthogonal matrix Q p deformation communicating obtained by multiplying the T on both sides of the simultaneous equations The solution matrix B determined by processing an equation, orthogonal the a derivation means for deriving the respective elements of the transformation matrix of the projective transformation, has at least one set of row vectors in the partial orthogonal matrix Q p are each Not done.

本発明によれば、射影変換行列の最小二乗解を高速かつ精度よく推定可能とする技術を提供することができる。   ADVANTAGE OF THE INVENTION According to this invention, the technique which makes it possible to estimate the least squares solution of a projective transformation matrix quickly and accurately can be provided.

ホモグラフィ行列を求めるための連立方程式の係数行列と転置行列を例示的に示す図である。It is a figure which shows the coefficient matrix and transposed matrix of simultaneous equations for calculating | requiring a homography matrix exemplarily. 正規方程式の係数行列を例示的に示す図である。It is a figure which shows the coefficient matrix of a normal equation exemplarily. 第1実施形態における係数行列の変遷を説明する図である。It is a figure explaining transition of a coefficient matrix in a 1st embodiment. 第1実施形態における処理のフローチャートである。It is a flowchart of the process in 1st Embodiment. 第2実施形態における係数行列の変遷を説明する図である。It is a figure explaining transition of a coefficient matrix in a 2nd embodiment. 第2実施形態における処理のフローチャートである。It is a flowchart of the process in 2nd Embodiment. 第3実施形態における係数行列の変遷を説明する図である。It is a figure explaining transition of a coefficient matrix in a 3rd embodiment. 第3実施形態における処理のフローチャートである。It is a flowchart of the process in 3rd Embodiment. PCにより構成した演算装置の内部ブロック図である。It is an internal block diagram of the arithmetic unit comprised by PC.

以下に、図面を参照して、この発明の好適な実施の形態を詳しく説明する。なお、以下の実施の形態はあくまで例示であり、本発明の範囲を限定する趣旨のものではない。   Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the drawings. The following embodiments are merely examples, and are not intended to limit the scope of the present invention.

(第1実施形態)
本発明に係る演算装置の第1実施形態として、ホモグラフィ行列や3次元の射影変換行列等の最小二乗解を高速かつ精度よく推定する演算装置について説明する。具体的には、連立方程式の係数行列の構造に着目し、列ベクトルの直交化を部分的に行って最小二乗推定を行う。これにより高精度かつ高速な推定を可能とする。
(First embodiment)
As a first embodiment of an arithmetic device according to the present invention, an arithmetic device that estimates a least square solution such as a homography matrix or a three-dimensional projective transformation matrix at high speed and with high accuracy will be described. Specifically, focusing on the structure of the coefficient matrix of the simultaneous equations, the least square estimation is performed by partially orthogonalizing the column vectors. This enables high-precision and high-speed estimation.

<前提技術>
まず、ホモグラフィ行列を利用して実現する動画撮影カメラの手振れ補正の原理、及び、ホモグラフィ行列の求め方を説明する。
<Prerequisite technology>
First, the principle of camera shake correction of a moving image shooting camera realized using a homography matrix and how to obtain the homography matrix will be described.

動画撮影して得られる連続フレームのフレーム間のブレを幾何変換行列として検出し、この幾何変換行列を十数フレームに渡って平滑化した行列を導出する。このようにして導出された行列を用いて画像を逆補正することにより、フレーム間のブレや視点移動を平滑化でき、動画撮影時の手ぶれ補正機能を実現できる。特に、カメラから被写体までの距離が十分に離れており、被写体の各注目点が同一平面上に存在すると見なすことが出来る場合、フレーム間のブレを表現する幾何変換行列はホモグラフィ行列で表すことができる。そのとき、時間的に先行するフレームと後続のフレームとの間の画素の座標は式(1)で対応付けられる。   A blur between consecutive frames obtained by moving image shooting is detected as a geometric transformation matrix, and a matrix obtained by smoothing the geometric transformation matrix over a dozen frames is derived. By inversely correcting the image using the matrix derived in this way, blurring between frames and viewpoint movement can be smoothed, and a camera shake correction function during moving image shooting can be realized. In particular, when the distance from the camera to the subject is sufficiently far away and it can be considered that each point of interest of the subject exists on the same plane, the geometric transformation matrix that represents the blur between frames should be represented by a homography matrix. Can do. At that time, the coordinates of the pixel between the temporally preceding frame and the succeeding frame are associated by Expression (1).

Figure 2017059048
Figure 2017059048

式(1)における右辺の3行3列の行列がホモグラフィ行列であり、先行するフレームの(u,v)座標の画素(変換前の座標点)は、(x,y)座標の画素(変換後の座標点)に変換される。以下では、これらの変換前後の2つの座標点を座標点ペアと呼ぶ。また、式(1)は、非線形な射影変換を線形演算らしく表現するために、同次座標を用いた変換式で表現される。   The matrix of 3 rows and 3 columns on the right side in Equation (1) is a homography matrix, and the pixel (coordinate point before conversion) of the preceding frame is the pixel (x, y) coordinate ( Converted to a coordinate point after conversion. Hereinafter, these two coordinate points before and after conversion are referred to as a coordinate point pair. Further, the expression (1) is expressed by a conversion expression using homogeneous coordinates in order to express the nonlinear projective transformation like a linear operation.

右下の9番目の要素が”1”となるように規格化(正規化)すると、他の8つの要素が自由な値をとることが可能であり、自由度が8の行列となる。一方、式(1)の関係で表される2画像間の座標を展開すると、式(2)に示す2つの方程式が得られる。   When the 9th element in the lower right is normalized (normalized) to be “1”, the other 8 elements can take free values, and a matrix with 8 degrees of freedom is obtained. On the other hand, when the coordinates between the two images represented by the relationship of Expression (1) are developed, two equations shown in Expression (2) are obtained.

Figure 2017059048
Figure 2017059048

4組の座標点ペアから8つの方程式、すなわち、8元連立方程式を決定し立式することができ、この連立方程式を解くことによりホモグラフィ行列を1つ求めることができる。但し、4組の座標点ペアは被写体空間において同一平面上に存在する必要があり、同一平面上に無い座標点ペアを含む場合、意味の無いホモグラフィ行列になってしまう。そのため、どれだけ適切な解であるかを、他の座標点ペアの座標データを変換して評価する必要がある。   Eight equations, that is, eight simultaneous equations can be determined and formulated from four coordinate point pairs, and one homography matrix can be obtained by solving these simultaneous equations. However, the four coordinate point pairs need to exist on the same plane in the subject space, and if a coordinate point pair that is not on the same plane is included, it becomes a meaningless homography matrix. Therefore, it is necessary to evaluate how much the solution is appropriate by converting the coordinate data of other coordinate point pairs.

一方、5組以上の座標点からホモグラフィ行列を求める場合、方程式の数が8つを超える過条件の連立方程式となり、全ての方程式を満たす解が存在しなくなり、方程式を解く事ができなくなってしまうことがある。M次元の射影変換においては、N個以上(ただし、2N>(M+1)−1)の座標点ペアを用いる場合に2N個の連立方程式が立式され過条件の連立方程式となる。 On the other hand, when obtaining a homography matrix from more than 5 sets of coordinate points, it becomes an over-conditioning simultaneous equation with more than 8 equations, and there are no solutions that satisfy all equations, and the equations cannot be solved. May end up. In M-dimensional projective transformation, when N or more (2N> (M + 1) 2 −1) coordinate point pairs are used, 2N simultaneous equations are formed to form over-conditional simultaneous equations.

この場合は、方程式の係数行列Aを転置した行列Aを、両辺に、すなわち係数行列Aと解ベクトルbに乗じる。これにより、係数行列と解ベクトルを8次元空間に投影し、「正規方程式」と呼ばれる8元連立方程式に変換して解を算出する。変数ベクトルをxで表した時、正規方程式は(AA)x=Abと表現される。ここで(AA)はの正規方程式の係数行列であり、行列のサイズは8×8である。右辺のAbは8次元ベクトルである。 In this case, the matrix AT obtained by transposing the coefficient matrix A of the equation is multiplied on both sides, that is, the coefficient matrix A and the solution vector b. As a result, the coefficient matrix and the solution vector are projected onto an eight-dimensional space and converted into an 8-ary simultaneous equation called a “normal equation” to calculate a solution. When the variable vector is represented by x, the normal equation is expressed as (A T A) x = A T b. Here, (A T A) is a coefficient matrix of the normal equation, and the size of the matrix is 8 × 8. A T b on the right side is an 8-dimensional vector.

正規方程式を解いて得られる解は、5組以上の座標点ペアに対する最小二乗法解(最小二乗法に基づく解)であり、全座標点ペアを反映した解となる。この正規方程式を用いて最小二乗解を得る手法は、統計処理でよく用いられる一般的な手法である。   A solution obtained by solving a normal equation is a least square method solution (solution based on the least square method) for five or more pairs of coordinate points, and is a solution reflecting all the coordinate point pairs. The method of obtaining a least square solution using this normal equation is a general method often used in statistical processing.

<装置構成>
図9は、演算装置のハードウェア構成を示すブロック図である。ここでは、演算装置101が一般的なパーソナルコンピュータ(PC)により構成する例を示しているためディスプレイ123、通信I/F124、キーボード125などを含んでいるが、これらは必須の構成というわけではない。
<Device configuration>
FIG. 9 is a block diagram illustrating a hardware configuration of the arithmetic device. Here, since an example in which the arithmetic unit 101 is configured by a general personal computer (PC) is shown, the display 123, the communication I / F 124, the keyboard 125, and the like are included, but these are not essential configurations. .

CPU120は、各種演算を実行するほか、演算装置101を統括的に制御する。CPU120は、例えばROM122やハードディスクドライブ(HDD)126に格納された演算プログラムを実行することにより図4に示される各処理を実現する。   In addition to executing various calculations, the CPU 120 comprehensively controls the calculation device 101. The CPU 120 implements each process shown in FIG. 4 by executing a calculation program stored in, for example, the ROM 122 or the hard disk drive (HDD) 126.

HDD126、例えば、演算装置101で利用される演算プログラムあるいは各種の制御プログラムを記憶する。また、演算プログラムあるいは各種の制御プログラムに関連する各種情報を保存する。ここでは、各種情報としては、連立方程式に関連する情報を含む。また、一時的に各種情報を記憶するためにRAM121も利用される。   The HDD 126 stores, for example, a calculation program or various control programs used in the calculation device 101. Also, various information related to the arithmetic program or various control programs is stored. Here, various information includes information related to simultaneous equations. A RAM 121 is also used to temporarily store various information.

キーボード125は、ユーザから、計算に用いる各種情報などの入力を受け付ける機能部である。また、ディスプレイ123は、ユーザに対して、計算処理の進行状況や計算結果など各種情報を提供する機能部である。通信インタフェース(I/F)124は、不図示の外部装置に接続するためのインタフェースであり、例えば、有線通信又は無線通信のインタフェースである。I/F124を介して、例えば、外部の撮像装置などから処理の対象となる複数フレームの画像を入力したり、特徴点のペアを入力したりすることができる。また、I/F124を介して、得られた射影変換行列を外部の画像補正装置などに出力することができる。   The keyboard 125 is a functional unit that accepts input of various information used for calculation from the user. The display 123 is a functional unit that provides the user with various types of information such as the progress of calculation processing and calculation results. The communication interface (I / F) 124 is an interface for connecting to an external device (not shown), and is, for example, an interface for wired communication or wireless communication. Via the I / F 124, for example, an image of a plurality of frames to be processed can be input from an external imaging device or the like, or a pair of feature points can be input. Further, the obtained projective transformation matrix can be output to an external image correction device or the like via the I / F 124.

<ホモグラフィ行列導出の動作概要>
まず、N組(Nは5以上)の座標点ペアに対する過条件連立方程式と、その正規方程式の具体例を示す。既に説明したように、N組の座標点ペアから2N個の8元連立方程式を決定することが出来る。この連立方程式は、係数行列A、変数ベクトルx、解ベクトルbを用いてAx=bと表現される。
<Overview of homing matrix derivation>
First, a specific example of an overconditional simultaneous equation for N pairs (N is 5 or more) of coordinate point pairs and its normal equation will be shown. As described above, 2N 8-ary simultaneous equations can be determined from N coordinate point pairs. This simultaneous equation is expressed as Ax = b using a coefficient matrix A, a variable vector x, and a solution vector b.

図1は、ホモグラフィ行列を求めるための連立方程式の係数行列・解ベクトルと、係数行列の転置行列を例示的に示す図である。図1(A)は、2N個の8元連立方程式を、行列形式で表現したものである。図1(B)は、図1(A)の行列を解ベクトルに基づき並び替えたものである。以下では、図1(B)に示す行列および列ベクトルをそれぞれ係数行列A、解ベクトルbと呼ぶ。また、図1(C)は、係数行列Aの転置行列であるAを示している。 FIG. 1 is a diagram exemplarily showing a coefficient matrix / solution vector of simultaneous equations for obtaining a homography matrix and a transposed matrix of the coefficient matrix. FIG. 1 (A) represents 2N simultaneous equations in matrix form. FIG. 1B shows the matrix of FIG. 1A rearranged based on the solution vector. Hereinafter, the matrix and the column vector shown in FIG. 1B are referred to as a coefficient matrix A and a solution vector b, respectively. FIG. 1C shows AT , which is a transposed matrix of the coefficient matrix A.

図2は、正規方程式の係数行列を例示的に示す図である。図2(A)に示す行列と図2(B)に示す列ベクトルは、係数行列Aと解ベクトルbの各々に、図1(C)の転置行列を掛けて8次元空間へ投影したものである。   FIG. 2 is a diagram exemplarily showing a coefficient matrix of a normal equation. The matrix shown in FIG. 2 (A) and the column vector shown in FIG. 2 (B) are obtained by multiplying each of the coefficient matrix A and the solution vector b by the transposed matrix of FIG. is there.

すなわち、各々は正規方程式の両辺に存在する係数行列(AA)と解ベクトル(Ab)に対応する。Σ記号は不図示の添え字i=1,2,・・・,Nの合算を表す。なお、この係数行列は対称行列になる。つまり、図2(A)においては、左下の2行6列をΣ記号のみを用いて記述しているが、右上の2列6行を転置した要素と同じである。 That is, each corresponds to a coefficient matrix (A T A) and a solution vector (A T b) existing on both sides of the normal equation. The symbol Σ represents the sum of subscripts i = 1, 2,. This coefficient matrix is a symmetric matrix. That is, in FIG. 2A, the lower left 2 rows and 6 columns are described using only the Σ symbol, but are the same as the elements obtained by transposing the upper right 2 columns and 6 rows.

図2(A)を見ると、ホモグラフィ行列を求める正規方程式にはゼロ要素が規則的に配置されており、その係数行列には冗長な部分が存在していることが分かる。   As can be seen from FIG. 2A, zero elements are regularly arranged in a normal equation for obtaining a homography matrix, and a redundant portion exists in the coefficient matrix.

QR分解法では係数行列Aを、直交行列Qと上三角行列Rとに分解する。一方、第1実施形態では、係数行列Aを、部分的に直交させた部分直交行列QとQに対応する上三角行列Rとに分解する。そして、Qの転置行列をQに乗算して、得られる8×8行列のゼロ要素を、図2(A)の行列に比較してさらに増やす。これにより、図2に示す正規方程式より解き易い形の方程式にする。 In the QR decomposition method, the coefficient matrix A is decomposed into an orthogonal matrix Q and an upper triangular matrix R. On the other hand, in the first embodiment, the coefficient matrix A is decomposed into partially orthogonal matrices Q p partially orthogonalized and an upper triangular matrix R p corresponding to Q p . Then, by multiplying Q p by the transposed matrix of Q p , the zero element of the obtained 8 × 8 matrix is further increased compared to the matrix of FIG. Thus, the equation is more easily solved than the normal equation shown in FIG.

特に、第1実施形態では、図1(B)に示す係数行列中の1列目と4列目を除く4個の列ベクトルにおいて、上側N個と下側N個に対し、各々の平均を算出して、各要素からこれら平均を減算する。“0”がN個並んでいるところは何もしなくてもよい。なお、M次元の射影変換においては、N個の座標点ペアそれぞれに含まれる変換前の座標点の値を含む2M個の列ベクトルに対して同様の処理を行うことになる。   In particular, in the first embodiment, in the four column vectors excluding the first and fourth columns in the coefficient matrix shown in FIG. 1 (B), the average of each of the upper N and lower N is calculated. Calculate and subtract these averages from each element. There is no need to do anything where N "0" s are lined up. In the M-dimensional projective transformation, the same processing is performed on 2M column vectors including the values of the coordinate points before conversion included in each of the N coordinate point pairs.

平均値を減算した各列ベクトルは、1列目及び4列目と直交するようになる。このように処理した行列をQとする。すなわち、一般的なQR分解におけるQ行列は、列ベクトルが相互に直交している。それに対し、第1実施形態におけるQの列ベクトルは特定の列に対して直交しているだけであり、互いに直交していない列ベクトルの組が存在する。 Each column vector obtained by subtracting the average value is orthogonal to the first column and the fourth column. Let Q p be the matrix processed in this way. That is, column vectors in a general QR decomposition are orthogonal to each other. In contrast, the column vectors of Q p in the first embodiment is only orthogonal to the particular column, there is a set of column vectors which are not orthogonal to each other.

図3は、第1実施形態における係数行列の変遷を説明する図である。具体的には、連立方程式である正規方程式の両辺に対して同様の処理を行い、変形連立方程式を生成する処理に相当する。図3(A)は、係数行列Aを、上述のQと上三角行列Rの積で表したものである。すなわち、図3(A)の右側に示す上三角行列がRである。なお、図3においては、u座標、v座標から上述の平均を減算した結果をdu、dvと表記している。 FIG. 3 is a diagram for explaining the transition of the coefficient matrix in the first embodiment. Specifically, this is equivalent to a process of performing a similar process on both sides of a normal equation that is a simultaneous equation and generating a modified simultaneous equation. 3 (A) is a coefficient matrix A, a representation by the product of the above Q p and an upper triangular matrix R p. That is, the upper triangular matrix shown on the right side shown in FIG. 3 (A) is R p. In FIG. 3, the result of subtracting the above average from the u coordinate and the v coordinate is expressed as du and dv.

次に、Qの転置行列Q を左辺のQと右辺の列ベクトルbに乗算する。このとき、Q の計算結果は8×8の対称行列で、図3(B)に示すような行列となる。対称行列であるため、左下三角行列部分の記述を省略した。そして、この8×8の係数行列に対して、以下の処理を行う。なお以下の処理は、結果的には、Q の逆行列を乗算する処理に相当する。 Then, multiplying the transposed matrix Q p T of Q p into a column vector b of the left side of Q p and the right side. At this time, the calculation result of Q p T Q p is an 8 × 8 symmetric matrix as shown in FIG. 3B. Since it is a symmetric matrix, the description of the lower left triangular matrix part is omitted. Then, the following processing is performed on the 8 × 8 coefficient matrix. Note that the following process corresponds to a process of multiplying an inverse matrix of Q p T Q p as a result.

まず、Nの逆数、すなわち1/Nを算出して、1行目と4行目に乗算する。次に、2,3行目と5,6行目の対角要素近辺の2×2領域を対角化するため、2×2行列の逆行列を求め、この逆行列を用いて、2,3行目と5,6行目の各列を2次の列ベクトルとして変換する。なお、対角要素近辺の2×2領域は、変換すると単位行列になることが分かっているため、変換は不要である。   First, the reciprocal of N, that is, 1 / N is calculated and multiplied by the first and fourth rows. Next, in order to diagonalize the 2 × 2 region in the vicinity of the diagonal elements in the 2nd, 3rd and 5th and 6th rows, an inverse matrix of the 2 × 2 matrix is obtained, and using this inverse matrix, Each column in the third row and the fifth and sixth rows is converted as a secondary column vector. Note that the 2 × 2 region in the vicinity of the diagonal element is known to become a unit matrix when converted, and thus conversion is not necessary.

すなわち、上述の逆行列により実際に変換しなければならない列ベクトルは、7列目、8列目と解ベクトルにのみ存在する。この2×2逆行列による変換によって、8×8係数行列は、左上6×6領域を単位行列化した行列となる。   That is, column vectors that must be actually converted by the inverse matrix described above exist only in the seventh column, the eighth column, and the solution vector. By the conversion by the 2 × 2 inverse matrix, the 8 × 8 coefficient matrix becomes a matrix obtained by unitizing the upper left 6 × 6 region.

次に、7,8行目の1〜6列の要素をゼロに消去する。7行目の4つの有意要素と、7列目の4つの有意要素との間で積和を演算し、行と列が交差する7行7列目の要素から減算する。この積和・減算処理を、7行目と8列目、8行目と7列目、8行目と8列目の間で同様に行う。   Next, the elements in the first to sixth columns of the seventh and eighth rows are erased to zero. The sum of products is calculated between the four significant elements in the seventh row and the four significant elements in the seventh column, and is subtracted from the element in the seventh row and the seventh column where the row and the column intersect. This sum-of-product / subtraction process is similarly performed between the seventh row and the eighth column, the eighth row and the seventh column, and the eighth row and the eighth column.

以上の処理により、7,8行における1〜6列の要素がゼロ消去される。次は、残りの7,8列目の2×2要素を対角化する。ここでは、上述の2×2の逆行列で、対応する解ベクトルの要素を変換するだけでよい。これにより変数ベクトルxの各要素を決定することが可能となる。   With the above processing, the elements in the first to sixth columns in the seventh and eighth rows are zero-erased. Next, the remaining 2 × 2 elements in the seventh and eighth columns are diagonalized. Here, it is only necessary to transform the elements of the corresponding solution vector with the 2 × 2 inverse matrix described above. Thereby, each element of the variable vector x can be determined.

<演算装置の動作>
図4は、第1実施形態における処理のフローチャートである。以下の処理は、例えば、時間的に先行するフレームと後続のフレームとの間の座標点ペア群が入力されることにより開始される。
<Operation of arithmetic unit>
FIG. 4 is a flowchart of processing in the first embodiment. The following process is started, for example, by inputting a coordinate point pair group between a temporally preceding frame and a subsequent frame.

ステップS401では、CPU120は、座標点ペア群の中からN組(Nは5以上)の座標データを選択し、図1(B)に示す形式で係数行列Aと解ベクトルbを生成する。   In step S401, the CPU 120 selects N sets (N is 5 or more) of coordinate data from the coordinate point pair group, and generates a coefficient matrix A and a solution vector b in the format shown in FIG.

ステップS402では、CPU120は、2N行×8列の係数行列Aを、図3(A)に示す形式で行列Qと、行列Rとに分解する。上述のように、Qは、係数行列Aの1列目と4列目を除く列ベクトルにおいて、上側N個と下側N個に対し各々の平均を算出して減算することにより得られる。 In step S402, the CPU 120 decomposes the 2N rows × 8 columns coefficient matrix A into a matrix Q p and a matrix R p in the format shown in FIG. As described above, Q p is obtained by calculating and subtracting the average of the upper N pieces and the lower N pieces in the column vector excluding the first and fourth columns of the coefficient matrix A.

ステップS403では、CPU120は、Qの転置行列Q を、Qとbに乗算する。 In step S403, CPU 120 is a transposed matrix Q p T of Q p, multiplies the Q p and b.

ステップS404では、CPU120は、Nの逆数と、2×2行列の逆行列を計算する。ステップS405では、CPU120は、図3(B)に示す行列に対し、1,4行目にNの逆数を、2,3行目と5,6行目に2×2逆行列を乗算する。ステップS406では、CPU120は、図3(B)に示す行列に対し、7,8行目の1〜6列をゼロ消去する。   In step S404, the CPU 120 calculates an inverse of N and an inverse matrix of 2 × 2 matrix. In step S405, the CPU 120 multiplies the matrix shown in FIG. 3B by the reciprocal number of N in the 1st and 4th rows and the 2 × 2 inverse matrix in the 2nd, 3rd and 5th and 6th rows. In step S406, the CPU 120 zero-erases the first and sixth columns of the seventh and eighth rows with respect to the matrix shown in FIG.

ステップS407では、CPU120は、7,8行目に存在する残りの係数から2元連立方程式を解き、パラメータを2つ算出する。ステップS408では、CPU120は、Qの7,8列に残る要素を消去する後退代入処理を行う。ステップS409では、CPU120は、上三角行列Rの非対角要素を消去する後退代入処理を行う。 In step S407, the CPU 120 solves the binary simultaneous equations from the remaining coefficients existing in the seventh and eighth rows, and calculates two parameters. In step S408, CPU 120 performs a backward substitution processing for deleting an element that remains in 7,8 rows of Q p. In step S409, CPU 120 performs a backward substitution process of erasing the non-diagonal elements of the upper triangular matrix R p.

これらの一連の処理により、最小二乗推定したホモグラフィ行列を1個得ることが出来る。なお、上述の処理では、ゼロでない有意な係数のみを効率よく処理するため、細々とした処理ステップに分割した。ただし、図3(B)に示すQ をガウス消去法やガウス・ジョルダン法などのよく知られた方法で処理することも可能である。その場合は、上述のS404〜S408をこれらの方法に置き換えて処理することになる。また、上述の説明では、ゼロ要素も区別なく処理しているが、ゼロ要素を検出して処理をスキップするよう構成してもよい。 Through this series of processes, one homography matrix estimated by least squares can be obtained. In the above-described processing, only significant coefficients that are not zero are processed efficiently, so that the processing steps are divided into fine steps. However, it is also possible to process Q p T Q p shown in FIG. 3B by a well-known method such as Gaussian elimination or Gauss-Jordan method. In that case, the above-described steps S404 to S408 are replaced with these methods. In the above description, the zero element is also processed without distinction. However, the zero element may be detected and the process may be skipped.

なお、S401で選択した座標点ペアの中には、前提から外れたアウトライアが含まれている可能性がある。なお、アウトライアとは、先行するフレームにおける座標をホモグラフィ行列により変換した結果の座標と、対応する後続のフレームにおける座標とが所定閾値よりも大きい差分(ズレ)を有する座標点ペアを意味する。   Note that the coordinate point pair selected in S401 may include outliers that deviate from the premise. The outlier means a coordinate point pair having a difference (deviation) larger than a predetermined threshold between coordinates obtained as a result of transforming coordinates in a preceding frame by a homography matrix and coordinates in a corresponding subsequent frame. .

そのため、一部または全部の座標データを入れ替えて、いくつもの最小二乗推定行列を得るように構成してもよい。すなわち、種々の組合せのN組の座標点ペアについて図4に示す処理を行い、変換によるズレ具合の評価を行い、評価の一番良いパラメータを選んで、最終的なホモグラフィ行列として導出してもよい。   Therefore, some or all of the coordinate data may be exchanged to obtain a number of least square estimation matrices. That is, the processing shown in FIG. 4 is performed for N coordinate point pairs of various combinations, the degree of deviation by the conversion is evaluated, the best parameter for evaluation is selected, and the final homography matrix is derived. Also good.

以上説明したとおり第1実施形態によれば、直交化処理が容易な一部の列ベクトル間のみを直交化することにより、ホモグラフィ行列や3次元の射影変換行列等の最小二乗解を高速かつ精度よく推定可能となる。すなわち、少なくとも1組の列ベクトル間は直交処理を行わない。これにより、単位時間内に算出した多くのパラメータを評価して、信頼性の高い変換行列を選別することが可能となる。その結果、例えば、動画像データを処理する場合には、1フレーム時間内に多くのパラメータを評価することができるため、より精度の高いホモグラフィ行列を導出することが可能となる。その他、画像合成や位置合せ、カメラ防振、対象物の3次元形状推定・復元などの性能を向上することが可能となる。   As described above, according to the first embodiment, the least square solution such as a homography matrix or a three-dimensional projective transformation matrix can be obtained at high speed by orthogonalizing only a part of column vectors that can be orthogonalized easily. It becomes possible to estimate with high accuracy. That is, orthogonal processing is not performed between at least one set of column vectors. This makes it possible to evaluate a large number of parameters calculated within a unit time and to select a highly reliable conversion matrix. As a result, for example, when processing moving image data, many parameters can be evaluated within one frame time, so that a homography matrix with higher accuracy can be derived. In addition, it is possible to improve performances such as image composition, alignment, camera image stabilization, and three-dimensional shape estimation / restoration of an object.

(第2実施形態)
第2実施形態では、第1実施形態と同等に、係数行列Aを、部分的に直交させた部分直交行列Qと該Qに対応する上三角行列Rとに分解する。ただし、Qの算出方法が第1実施形態と異なる。
(Second Embodiment)
In the second embodiment, as in the first embodiment, the coefficient matrix A is decomposed into a partially orthogonal matrix Q p partially orthogonalized and an upper triangular matrix R p corresponding to the Q p . However, the calculation method of Q p is different from that of the first embodiment.

具体的には、係数行列Aにおいて、2列目,3列目に対し部分平均を算出・減算して1列目に直交化させた後、さらに2列目と3列目を直交化させて、部分直交行列Qとする。この場合、4,5,6列目はQ を計算する時、1,2,3列目の結果を利用すれば足りるため処理を省略できる。 Specifically, in the coefficient matrix A, after calculating and subtracting partial averages for the second and third columns to make the first column orthogonal, the second and third columns are further orthogonalized. , A partial orthogonal matrix Q p . In this case, when calculating Q p T Q p for the 4th, 5th and 6th columns, it is sufficient to use the results of the 1st, 2nd and 3rd columns, so the processing can be omitted.

図5は、第2実施形態における係数行列の変遷を説明する図である。図5(A)は、係数行列Aを、上述のQと上三角行列Rの積で表したものである。なお、図3と同様に、u座標、v座標から上述の部分平均を減算した結果をdu、dvと表記している。 FIG. 5 is a diagram for explaining the transition of the coefficient matrix in the second embodiment. FIG. 5 (A), the coefficient matrix A, a representation by the product of the above Q p and an upper triangular matrix R p. As in FIG. 3, the result of subtracting the above-mentioned partial average from the u coordinate and the v coordinate is denoted as du and dv.

図5(B)は、Q により得られる行列を示している。7,8列目の非零の要素が増えているが、左上6×6の部分行列が、Q 計算直後の段階で既に対角行列になっている。よって、図5(B)に示す行列においては、1〜6行目の各行を対角要素の値で除算することによって、この6×6部分行列を単位行列化することができる。 FIG. 5B shows a matrix obtained by Q p T Q p . Although the non-zero elements in the seventh and eighth columns are increasing, the upper left 6 × 6 submatrix is already a diagonal matrix immediately after the calculation of Q p T Q p . Therefore, in the matrix shown in FIG. 5B, this 6 × 6 submatrix can be unitized by dividing each of the first to sixth rows by the value of the diagonal element.

次に、図5(B)に示す行列の7,8行目の1〜6列の要素をゼロに消去する。まず、7行目1〜6列の6つの要素と、7列目1〜6行の6つの要素間で積和を演算し、行と列が交差する7行7列目の要素から減算する。この積和・減算処理を、7行目と8列目、8行目と7列目、8行目と8列目の間で同様に行う。以上の処理により、7,8行における1〜6列の要素がゼロ消去される。以降は、第1実施形態と同様の処理であるため、説明を省略する。   Next, the elements in the first to sixth columns of the seventh and eighth rows of the matrix shown in FIG. First, the sum of products is calculated between the six elements in the seventh row and the first to sixth columns and the six elements in the seventh column and the first to sixth rows, and is subtracted from the element in the seventh row and the seventh column where the row and the column intersect. . This sum-of-product / subtraction process is similarly performed between the seventh row and the eighth column, the eighth row and the seventh column, and the eighth row and the eighth column. With the above processing, the elements in the first to sixth columns in the seventh and eighth rows are zero-erased. Since the subsequent processing is the same as that of the first embodiment, description thereof is omitted.

<演算装置の動作>
図6は、第2実施形態における処理のフローチャートである。第1実施形態と同様に、例えば、時間的に先行するフレームと後続のフレームとの間の座標点ペア群が入力されることにより開始される。なお、ステップS602、S604、S605の3つのステップ以外は第1実施形態と同様であるため説明は省略する。
<Operation of arithmetic unit>
FIG. 6 is a flowchart of processing in the second embodiment. Similar to the first embodiment, for example, it is started by inputting a pair of coordinate points between a temporally preceding frame and a subsequent frame. In addition, since it is the same as that of 1st Embodiment except three steps of step S602, S604, and S605, description is abbreviate | omitted.

ステップS602では、CPU120は、2N行×8列の係数行列Aを、図5(A)に示す形式で行列Qと、行列Rとに分解する。上述のように、Qは、2列目,3列目に対し部分平均を算出・減算して1列目に直交化させた後、さらに2列目と3列目を直交化させることにより得られる。上述したように4,5,6列目は、1,2,3列目の結果を利用すれば足りる。 In step S602, the CPU 120 decomposes the coefficient matrix A of 2N rows × 8 columns into a matrix Q p and a matrix R p in the format shown in FIG. As described above, Q p is obtained by calculating and subtracting partial averages for the second and third columns to make the first column orthogonal, and then making the second and third columns orthogonal. can get. As described above, it is sufficient for the fourth, fifth, and sixth columns to use the results of the first, second, and third columns.

ステップS604では、CPU120は、図5(B)に示す行列(Q の結果)における、対角行列になっている左上6×6行列の対角要素の逆数を計算する。なお、対角要素は計6つあるが、4〜6行の対角要素は1〜3行と同じ値になるため、実際には3つの逆数のみ計算すればよい。 In step S604, the CPU 120 calculates the reciprocal of the diagonal elements of the upper left 6 × 6 matrix which is a diagonal matrix in the matrix (result of Q p T Q p ) shown in FIG. Although there are a total of six diagonal elements, the diagonal elements of 4-6 rows have the same values as those of 1-3 rows, so in practice only three reciprocals need be calculated.

ステップS605では、CPU120は、S604により計算された3つの逆数を1〜6行の対応する行に乗算する。実際には、行の要素すべてに乗算する必要は無く、7,8列目と解ベクトルの3つの要素に乗算するだけでよい。   In step S605, the CPU 120 multiplies the corresponding lines of 1 to 6 by the three reciprocals calculated in step S604. Actually, it is not necessary to multiply all the elements of the row, and it is only necessary to multiply the three elements of the seventh and eighth columns and the solution vector.

なお、第2実施形態においては、7列目と8列目の列ベクトルの直交化を行わなかったが、第1実施形態と同様に、この2列を1列目と4列目に対して直交化しておくことも可能である。その場合の直交化以降の処理は、第1実施形態とほぼ同じであり、積和を計算するときの要素数(=積の回数)が6つから4つに減少する点のみが異なる。   In the second embodiment, the column vectors of the seventh and eighth columns are not orthogonalized. However, as in the first embodiment, these two columns are assigned to the first and fourth columns. It is also possible to make it orthogonal. In this case, the processing after orthogonalization is almost the same as in the first embodiment, except that the number of elements (= the number of products) when calculating the product sum is reduced from six to four.

以上説明したとおり第2実施形態によれば、直交化処理が容易な一部の列ベクトル間のみを直交化することにより、ホモグラフィ行列や3次元の射影変換行列等の最小二乗解を高速かつ精度よく推定可能となる。   As described above, according to the second embodiment, the least square solution such as a homography matrix or a three-dimensional projective transformation matrix can be obtained at high speed by orthogonalizing only a part of column vectors that can be orthogonalized easily. It becomes possible to estimate with high accuracy.

(第3実施形態)
第3実施形態では、より小さな行列サイズでホモグラフィ行列や3次元の射影変換行列等の最小二乗解を高速かつ精度よく推定する形態について説明する。特に、行列サイズを半分に減らした場合の係数データの保持方法と処理方法について説明する。
(Third embodiment)
In the third embodiment, a mode will be described in which a least square solution such as a homography matrix or a three-dimensional projective transformation matrix is estimated at high speed and with a smaller matrix size. In particular, a method for holding and processing coefficient data when the matrix size is reduced to half will be described.

図1(B)に示すように、列ベクトルを直交化する対象である係数行列Aは2N行×8列のサイズである。つまり、Nの数が例えば500である場合には係数行列を格納するための記憶領域は8Kワードになり、かなり大きくなる。そのため、メモリサイズをあまり大きく取れない場合には適切に処理できない可能性がある。特に、組込み用途のプロセッサなどでは、メモリ領域を他の処理と分割して使用することが想定されるため、行列サイズは小さい程よい。   As shown in FIG. 1B, the coefficient matrix A that is an object for orthogonalizing column vectors has a size of 2N rows × 8 columns. That is, when the number of N is 500, for example, the storage area for storing the coefficient matrix is 8K words, which is considerably large. For this reason, there is a possibility that appropriate processing cannot be performed when the memory size cannot be made very large. In particular, in a processor for embedded use and the like, it is assumed that the memory area is divided and used for other processing, so that the smaller the matrix size, the better.

図7は、第3実施形態における係数行列の変遷を説明する図である。図7(A)は、係数行列Aと解行列Bを示す図である。係数行列Aは、行数を図1(B)の半分のN行×8列とした行列であり、行列へ座標データを格納して生成する。M次元の場合は、係数行列Aは、N行((M+1)−1)列となる。また、図1(B)に示す解ベクトルbのN+1行目以降を2列目に移動して、N行×2列の解行列Bとする。M次元の場合は、解行列Bは、N行M列となる。また、変数行列Xは、((M+1)−1)行M列となる。このとき、連立方程式は、AX=Bと表現されることになる。 FIG. 7 is a diagram for explaining the transition of the coefficient matrix in the third embodiment. FIG. 7A shows a coefficient matrix A h and a solution matrix B. The coefficient matrix A h is a matrix in which the number of rows is N rows × 8 columns, which is a half of FIG. 1B, and is generated by storing coordinate data in the matrix. In the case of M dimensions, the coefficient matrix A h has N rows ((M + 1) 2 −1) columns. Further, the N + 1 and subsequent rows of the solution vector b shown in FIG. 1B are moved to the second column to obtain a solution matrix B of N rows × 2 columns. In the case of M dimensions, the solution matrix B has N rows and M columns. Further, the variable matrix X has ((M + 1) 2 −1) rows and M columns. At this time, the simultaneous equations are expressed as A h X = B.

ここで、係数行列Aの1列目と4列目を除く各列を1列目と直交化する。すなわち、各列のN個のデータの平均を算出し各データから減算・除去して部分直交行列Qとする。そして、対応する8行×8列の上三角行列Rを生成する。 Here, each column excluding the first column and the fourth column of the coefficient matrix A h is orthogonalized with the first column. That is, the partial orthogonal matrix Q p by subtracting and removing from the data to calculate the average of the N data in each column. Then, a corresponding upper triangular matrix R p of 8 rows × 8 columns is generated.

図7(B)は、係数行列Aを、上述のQと上三角行列Rの積で表したものである。なお、図3と同様に、u座標、v座標から上述の平均を減算した結果をdu、dvと表記している。 FIG. 7B shows the coefficient matrix A h as a product of the above-described Q p and the upper triangular matrix R p . As in FIG. 3, the result of subtracting the above average from the u coordinate and v coordinate is denoted as du and dv.

図7(C)は、Q により得られる8行×8列の行列を示している。ここでは、図7(C)においてΣ記号を付した17個の要素を計算することになる。左上隅の要素の値“N”は確定値であるため計算対象には含まれない。 FIG. 7C shows an 8 × 8 matrix obtained by Q p T Q p . Here, 17 elements with a Σ symbol in FIG. 7C are calculated. The element value “N” in the upper left corner is a definite value and is not included in the calculation target.

この17個の要素の中で5,6列目のyを含む7つの要素を、7,8列目に移動する。もしくは、移動した先の要素に加算して図3(B)に示す行列の7,8列目と同じ構成の列ベクトルを形成する。但し、7列目の一番下の要素は無視する。その後、行列を対称化するため、該行列の上三角領域を対角成分で折り返して下三角領域へコピーする。   Among the 17 elements, 7 elements including y in the 5th and 6th columns are moved to the 7th and 8th columns. Alternatively, a column vector having the same configuration as the seventh and eighth columns of the matrix shown in FIG. 3B is formed by adding to the moved previous element. However, the bottom element in the seventh column is ignored. Thereafter, in order to symmetrize the matrix, the upper triangular area of the matrix is folded back with a diagonal component and copied to the lower triangular area.

図7(D)は、Q を解行列Bに乗算して得られる8行×2列の行列である。図7(D)においてΣ記号を付した10個の要素を計算し、上述と同様に移動と加算を行って、図2(B)に示すベクトルと同じ結果を得る。 FIG. 7D is an 8-row × 2-column matrix obtained by multiplying the solution matrix B by Q p T. In FIG. 7D, 10 elements with a Σ symbol are calculated, and movement and addition are performed in the same manner as described above to obtain the same result as the vector shown in FIG.

これ以降は、第1実施形態における処理フローのS404以降と同じ処理になる。これは、同じ図3(B)の行列を処理するためである。   The subsequent processing is the same as the processing after S404 of the processing flow in the first embodiment. This is for processing the same matrix in FIG.

<演算装置の動作>
図8は、第3実施形態における処理のフローチャートである。上述のように、S404以降は第1実施形態と同じであるため、それ以前のステップS801〜S805について説明する。
<Operation of arithmetic unit>
FIG. 8 is a flowchart of processing in the third embodiment. As described above, S404 and subsequent steps are the same as those in the first embodiment, and steps S801 to S805 before that will be described.

ステップS801では、CPU120は、座標点ペア群の中からN組(Nは5以上)の座標データを選択し、図7(A)に示す形式でN行×8列の係数行列Aを生成する。 In step S801, the CPU 120 selects N sets (N is 5 or more) of coordinate data from the coordinate point pair group, and generates a coefficient matrix A h of N rows × 8 columns in the format shown in FIG. To do.

ステップS802では、CPU120は、係数行列Aを、図7(B)に示す形式で行列Qと、行列Rとに分解する。上述のように、Qは、係数行列Aの1列目と4列目を除く各列から列毎の平均値を減算することに得られる。 In step S802, the CPU 120 decomposes the coefficient matrix A h into a matrix Q p and a matrix R p in the format shown in FIG. 7B. As described above, Q p is obtained by subtracting the average value for each column from each column except the first column and the fourth column of the coefficient matrix A h .

ステップS803では、CPU120は、Qの転置行列Q を、Qに乗算する。上述したように、形成される行列は8行×8列の行列であるが、この段階では17個の要素のみを計算する。 In step S803, CPU 120 is a transposed matrix Q p T of Q p, multiplies the Q p. As described above, the formed matrix is an 8 × 8 matrix, but at this stage, only 17 elements are calculated.

ステップS804では、CPU120は、形成中の8×8行列を、図3(B)に示す行列に類似するように変形する。例えば、上述したように、5,6列目のyを含む7つの要素を、7,8列目に移動するか、もしくは、移動した先の要素に加算する。ステップS805では、CPU120は、行列の上三角領域を対角成分で折り返して下三角領域へコピーし、行列を対称化する。   In step S804, the CPU 120 transforms the 8 × 8 matrix being formed so as to be similar to the matrix shown in FIG. For example, as described above, the seven elements including y in the fifth and sixth columns are moved to the seventh and eighth columns, or added to the moved previous elements. In step S805, the CPU 120 folds the upper triangular area of the matrix with a diagonal component and copies it to the lower triangular area to make the matrix symmetric.

以上の処理の結果、図3(B)に示す8行×8列の対称行列が得られることになる。そのため、この処理結果に対してS404〜S409の処理を行えば、第1実施形態と同様の結果を得ることが出来る。   As a result of the above processing, a symmetric matrix of 8 rows × 8 columns shown in FIG. 3B is obtained. Therefore, if the processing of S404 to S409 is performed on this processing result, the same result as in the first embodiment can be obtained.

以上説明したとおり第3実施形態によれば、係数行列を格納する行列のサイズを小さくして記憶領域を減らすことが可能となる。なお、次のようにすれば、行列のサイズをさらに小さくすることができる。   As described above, according to the third embodiment, it is possible to reduce the storage area by reducing the size of the matrix storing the coefficient matrix. Note that the matrix size can be further reduced by doing the following.

係数行列Aにおいては、4列目に格納されるデータは全部“0”であるため、該4列目を除いて7列にすることも考えられる。また、1列目に格納するデータは全部“1”であるため、該1列目を除いて6列にすることも考えられる。 In the coefficient matrix Ah , all the data stored in the fourth column is “0”, so it can be considered that there are seven columns except for the fourth column. Further, since all the data stored in the first column is “1”, it can be considered that there are six columns excluding the first column.

その場合、転置行列との乗算によって得られる行列サイズは6行×6列となる。図3(B)に示す8行×8列の行列を得るには、要素を大幅に並び替える必要があるものの、係数行列を格納するための記憶領域をさらに25%減らすことが可能となる。   In that case, the matrix size obtained by multiplication with the transposed matrix is 6 rows × 6 columns. In order to obtain the 8-row × 8-column matrix shown in FIG. 3B, the elements need to be rearranged significantly, but the storage area for storing the coefficient matrix can be further reduced by 25%.

(変形例)
上述の第1〜第3実施形態では、2次元の射影変換行列であるホモグラフィ行列を対象として説明を行った。ただし、本発明は、M次元、例えば3次元の射影変換行列の最小二乗推定にも適用することが可能である。
(Modification)
In the first to third embodiments described above, the description has been made on the homography matrix that is a two-dimensional projective transformation matrix. However, the present invention can also be applied to least square estimation of an M-dimensional, for example, three-dimensional projective transformation matrix.

ホモグラフィ行列の自由度は8(=3×3−1)であるため、N個の座標点ペアに対する係数行列Aのサイズは2N行×8列である。そして、Q の演算結果は8行×8列の行列である。 Since the degree of freedom of the homography matrix is 8 (= 3 × 3-1), the size of the coefficient matrix A for N coordinate point pairs is 2N rows × 8 columns. The calculation result of Q p T Q p is a matrix of 8 rows × 8 columns.

一方、3次元射影変換行列の自由度は15(=4×4−1)であるため、係数行列のサイズは2N行×15列となる。つまり、対応するQ の演算結果は15行×15列の行列になる。そのため、15列の係数行列の全ての列ベクトルをQR分解を用いて完全に直交化する場合、8列の場合の4倍近い計算量となる。 On the other hand, since the degree of freedom of the three-dimensional projective transformation matrix is 15 (= 4 × 4-1), the size of the coefficient matrix is 2N rows × 15 columns. That is, the calculation result of the corresponding Q p T Q p is a matrix of 15 rows × 15 columns. Therefore, when all the column vectors of the 15-column coefficient matrix are completely orthogonalized using QR decomposition, the calculation amount is nearly four times that in the case of 8 columns.

一方、上述の実施形態と同様に、平均値除去を中心とする部分直交化を行った場合は、短時間で処理することが可能である。すなわち、Q の結果は15×15行列であるが、非ゼロの非対角成分を効率的にゼロ消去することが可能である。 On the other hand, similarly to the above-described embodiment, when partial orthogonalization centering on removal of the average value is performed, processing can be performed in a short time. That is, the result of Q p T Q p is a 15 × 15 matrix, but non-zero off-diagonal components can be effectively zeroed out.

(その他の実施例)
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
(Other examples)
The present invention supplies a program that realizes one or more functions of the above-described embodiments to a system or apparatus via a network or a storage medium, and one or more processors in a computer of the system or apparatus read and execute the program This process can be realized. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

101 演算装置; 120 CPU; 121 RAM; 122 ROM   101 arithmetic unit; 120 CPU; 121 RAM; 122 ROM

Claims (10)

M次元の射影変換の変換行列を、該射影変換による変換前後の座標点ペアに基づいて立式される連立方程式を解くことにより導出する演算装置であって、
N個の座標点ペアに基づいて立式される2N個(ただし、2N>(M+1)−1)の連立方程式であって、係数行列A、解ベクトルb、前記変換行列の各要素により構成される変数ベクトルxによりAx=bと表現される連立方程式を決定する決定手段と、
前記係数行列Aを、該係数行列Aにおける列ベクトル間の直交化を部分的に行った部分直交行列Qと上三角行列Rとに分解する分解手段と、
前記部分直交行列Qの転置行列Q を前記連立方程式の両辺に乗算して得られる変形連立方程式を処理することにより前記変数ベクトルxを決定し、前記射影変換の変換行列の各要素を導出する導出手段と、
を有し、
前記部分直交行列Qにおける少なくとも1組の列ベクトルは互いに直交していない
ことを特徴とする演算装置。
An arithmetic device for deriving a transformation matrix of M-dimensional projective transformation by solving simultaneous equations formed based on a pair of coordinate points before and after transformation by the projective transformation,
2N (2N> (M + 1) 2 −1) simultaneous equations formulated based on N coordinate point pairs, each of which includes a coefficient matrix A, a solution vector b, and elements of the transformation matrix Determining means for determining simultaneous equations expressed as Ax = b by the variable vector x
Decomposition means for decomposing the coefficient matrix A into a partial orthogonal matrix Q p and an upper triangular matrix R p partially orthogonalized between column vectors in the coefficient matrix A;
The variable vector x is determined by processing a modified simultaneous equation obtained by multiplying both sides of the simultaneous equations by the transposed matrix Q p T of the partial orthogonal matrix Q p , and each element of the transformation matrix of the projective transformation is defined as Deriving means for deriving;
Have
The arithmetic unit, wherein at least one set of column vectors in the partial orthogonal matrix Q p is not orthogonal to each other.
前記分解手段は、前記係数行列Aにおける所定の列ベクトルにおいて、それぞれの列ベクトルの有意要素の平均値を該有意要素から減算して行うことにより直交化を行う
ことを特徴とする請求項1に記載の演算装置。
2. The decomposition means performs orthogonalization by subtracting an average value of significant elements of each column vector from the significant elements in a predetermined column vector in the coefficient matrix A. The computing device described.
前記所定の列ベクトルは、前記N個の座標点ペアそれぞれに含まれる変換前の座標点の値を含む2M個の列ベクトルを含む
ことを特徴とする請求項2に記載の演算装置。
The computing device according to claim 2, wherein the predetermined column vector includes 2M column vectors including values of coordinate points before conversion included in the N coordinate point pairs.
前記導出手段は、前記変形連立方程式の左辺に存在するQ の非対角成分がゼロとなるように、前記連立方程式の両辺に所定の演算を行う
ことを特徴とする請求項1乃至3の何れか1項に記載の演算装置。
The derivation means performs a predetermined calculation on both sides of the simultaneous equations so that a non-diagonal component of Q p T Q p existing on the left side of the modified simultaneous equations becomes zero. 4. The arithmetic unit according to any one of items 1 to 3.
前記導出手段は、Q の逆行列を前記変形連立方程式の両辺に乗算し、更に、Rの逆行列を両辺に乗算することにより前記変数ベクトルxを決定する
ことを特徴とする請求項4に記載の演算装置。
The derivation means determines the variable vector x by multiplying both sides of the modified simultaneous equations by an inverse matrix of Q p T Q p and further multiplying both sides by an inverse matrix of R p. The arithmetic device according to claim 4.
前記乗算は、後退代入処理を行うことにより実現される
ことを特徴とする請求項5に記載の演算装置。
The arithmetic unit according to claim 5, wherein the multiplication is realized by performing a backward substitution process.
M次元の射影変換の変換行列を、該射影変換による変換前後の座標点ペアに基づいて立式される連立方程式を解くことにより導出する演算装置であって、
N個の座標点ペアに基づいて立式される2N個(ただし、2N>(M+1)−1)の連立方程式であって、N行((M+1)−1)列の係数行列A、N行M列の解行列B、前記変換行列の各要素により構成される((M+1)−1)行M列の変数行列XによりAX=Bと表現される連立方程式を決定する決定手段と、
前記係数行列Aを、該係数行列Aにおける列ベクトル間の直交化を部分的に行った部分直交行列Qと上三角行列Rとに分解する分解手段と、
前記部分直交行列Qの転置行列Q を前記連立方程式の両辺に乗算して得られる変形連立方程式を処理することにより前記解行列Bを決定し、前記射影変換の変換行列の各要素を導出する導出手段と、
を有し、
前記部分直交行列Qにおける少なくとも1組の列ベクトルは互いに直交していない
ことを特徴とする演算装置。
An arithmetic device for deriving a transformation matrix of M-dimensional projective transformation by solving simultaneous equations formed based on a pair of coordinate points before and after transformation by the projective transformation,
2N (2N> (M + 1) 2 −1) simultaneous equations formulated based on N coordinate point pairs, and N rows ((M + 1) 2 −1) columns of coefficient matrix A h , N rows and M columns of solution matrix B, and ((M + 1) 2 −1) rows and M columns of variable matrix X configured by each element of the transformation matrix determine simultaneous equations expressed as A h X = B. A determination means;
The coefficient matrix A h, and the coefficient matrix A partial orthogonal matrix was orthogonalization between column vectors partially in h Q p and an upper triangular matrix R p and the decomposing decomposition means,
The solution matrix B is determined by processing a modified simultaneous equation obtained by multiplying both sides of the simultaneous equations by the transposed matrix Q p T of the partial orthogonal matrix Q p , and each element of the transformation matrix of the projective transformation is defined as Deriving means for deriving;
Have
The arithmetic unit, wherein at least one set of column vectors in the partial orthogonal matrix Q p is not orthogonal to each other.
M次元の射影変換の変換行列を、該射影変換による変換前後の座標点ペアに基づいて立式される連立方程式を解くことにより導出する演算装置における演算方法であって、
N個の座標点ペアに基づいて立式される2N個(ただし、2N>(M+1)−1)の連立方程式であって、係数行列A、解ベクトルb、前記変換行列の各要素により構成される変数ベクトルxによりAx=bと表現される連立方程式を決定する決定工程と、
前記係数行列Aを、該係数行列Aにおける列ベクトル間の直交化を部分的に行った部分直交行列Qと上三角行列Rとに分解する分解工程と、
前記部分直交行列Qの転置行列Q を前記連立方程式の両辺に乗算して得られる変形連立方程式を処理することにより前記変数ベクトルxを決定し、前記射影変換の変換行列の各要素を導出する導出工程と、
を含み、
前記部分直交行列Qにおける少なくとも1組の列ベクトルは互いに直交していない
ことを特徴とする演算方法。
An arithmetic method in an arithmetic device for deriving a transformation matrix of M-dimensional projective transformation by solving simultaneous equations formed based on coordinate point pairs before and after transformation by the projective transformation,
2N (2N> (M + 1) 2 −1) simultaneous equations formulated based on N coordinate point pairs, each of which includes a coefficient matrix A, a solution vector b, and elements of the transformation matrix A determination step of determining simultaneous equations expressed as Ax = b by a variable vector x
A decomposition step of decomposing the coefficient matrix A into a partial orthogonal matrix Q p and an upper triangular matrix R p partially orthogonalized between column vectors in the coefficient matrix A;
The variable vector x is determined by processing a modified simultaneous equation obtained by multiplying both sides of the simultaneous equations by the transposed matrix Q p T of the partial orthogonal matrix Q p , and each element of the transformation matrix of the projective transformation is defined as A derivation process to derive,
Including
The calculation method according to claim 1, wherein at least one set of column vectors in the partial orthogonal matrix Q p is not orthogonal to each other.
M次元の射影変換の変換行列を、該射影変換による変換前後の座標点ペアに基づいて立式される連立方程式を解くことにより導出する演算装置における演算方法であって、
N個の座標点ペアに基づいて立式される2N個(ただし、2N>(M+1)−1)の連立方程式であって、N行((M+1)−1)列の係数行列A、N行M列の解行列B、前記変換行列の各要素により構成される((M+1)−1)行M列の変数行列XによりAX=Bと表現される連立方程式を決定する決定工程と、
前記係数行列Aを、該係数行列Aにおける列ベクトル間の直交化を部分的に行った部分直交行列Qと上三角行列Rとに分解する分解工程と、
前記部分直交行列Qの転置行列Q を前記連立方程式の両辺に乗算して得られる変形連立方程式を処理することにより前記解行列Bを決定し、前記射影変換の変換行列の各要素を導出する導出工程と、
を有し、
前記部分直交行列Qにおける少なくとも1組の列ベクトルは互いに直交していない
ことを特徴とする演算装置。
An arithmetic method in an arithmetic device for deriving a transformation matrix of M-dimensional projective transformation by solving simultaneous equations formed based on coordinate point pairs before and after transformation by the projective transformation,
2N (2N> (M + 1) 2 −1) simultaneous equations formulated based on N coordinate point pairs, and N rows ((M + 1) 2 −1) columns of coefficient matrix A h , N rows and M columns of solution matrix B, and ((M + 1) 2 −1) rows and M columns of variable matrix X configured by each element of the transformation matrix determine simultaneous equations expressed as A h X = B. A decision process;
The coefficient matrix A h, and the coefficient matrix A partial orthogonal matrix was orthogonalization between column vectors partially in h Q p and an upper triangular matrix R p and the decomposing decomposition step,
The solution matrix B is determined by processing a modified simultaneous equation obtained by multiplying both sides of the simultaneous equations by the transposed matrix Q p T of the partial orthogonal matrix Q p , and each element of the transformation matrix of the projective transformation is defined as A derivation process to derive,
Have
The arithmetic unit, wherein at least one set of column vectors in the partial orthogonal matrix Q p is not orthogonal to each other.
コンピュータを、請求項1乃至7の何れか1項に記載の演算装置の各手段として機能させるためのプログラム。   The program for functioning a computer as each means of the arithmetic unit of any one of Claims 1 thru | or 7.
JP2015184315A 2015-09-17 2015-09-17 Arithmetic unit and operation method Pending JP2017059048A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015184315A JP2017059048A (en) 2015-09-17 2015-09-17 Arithmetic unit and operation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015184315A JP2017059048A (en) 2015-09-17 2015-09-17 Arithmetic unit and operation method

Publications (1)

Publication Number Publication Date
JP2017059048A true JP2017059048A (en) 2017-03-23

Family

ID=58390701

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015184315A Pending JP2017059048A (en) 2015-09-17 2015-09-17 Arithmetic unit and operation method

Country Status (1)

Country Link
JP (1) JP2017059048A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536651A (en) * 2018-04-19 2018-09-14 武汉轻工大学 The method and apparatus for generating reversible modal m matrix

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536651A (en) * 2018-04-19 2018-09-14 武汉轻工大学 The method and apparatus for generating reversible modal m matrix
CN108536651B (en) * 2018-04-19 2022-04-05 武汉轻工大学 Method and apparatus for generating reversible modulo m matrix

Similar Documents

Publication Publication Date Title
EP3025491B1 (en) Adaptive path smoothing for video stabilization
JP5294343B2 (en) Image alignment processing device, area expansion processing device, and image quality improvement processing device
JP6547754B2 (en) Triangulation apparatus, triangulation method and program thereof
Chhatkuli et al. Inextensible non-rigid structure-from-motion by second-order cone programming
US9940691B2 (en) Information processing apparatus, control method of the same, and video camera
JP2016015037A (en) Information processing apparatus and control method, and video camera
KR101586007B1 (en) Data processing apparatus and method
JP4053021B2 (en) Image enlargement apparatus and program
JP2017059048A (en) Arithmetic unit and operation method
JP6839116B2 (en) Learning device, estimation device, learning method, estimation method and computer program
Khosravi et al. A new statistical technique for interpolation of landsat images
Tristán et al. A fast B-spline pseudo-inversion algorithm for consistent image registration
CN103217147A (en) Measurement device and measurement method
You et al. Robust and Fast Motion Estimation for Video Completion.
JP5387289B2 (en) Image processing apparatus, image processing method and program thereof
JP2017162313A (en) Image processing device, image processing method and program
Blachut et al. Hardware implementation of multi-scale Lucas-Kanade optical flow computation algorithm—A demo
JP6604537B2 (en) Keypoint detector, keypoint detection method, and keypoint detection program
Hamzah et al. Depth Estimation Based on Stereo Image Using Passive Sensor
JP5215615B2 (en) Three-dimensional position information restoration apparatus and method
JP2009104228A (en) Image alignment method and image alignment program
JP2010039968A (en) Object detecting apparatus and detecting method
JP5387288B2 (en) Image processing apparatus, image processing method and program thereof
WO2023166617A1 (en) Camera parameter estimation device, camera parameter estimation method, and computer-readable recording medium
KR102044626B1 (en) Joint Filtering Device and Method Using Learning