JP4952363B2 - Image processing apparatus, image conversion method, and program - Google Patents

Image processing apparatus, image conversion method, and program Download PDF

Info

Publication number
JP4952363B2
JP4952363B2 JP2007121147A JP2007121147A JP4952363B2 JP 4952363 B2 JP4952363 B2 JP 4952363B2 JP 2007121147 A JP2007121147 A JP 2007121147A JP 2007121147 A JP2007121147 A JP 2007121147A JP 4952363 B2 JP4952363 B2 JP 4952363B2
Authority
JP
Japan
Prior art keywords
image
points
point
evaluation
feature
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.)
Active
Application number
JP2007121147A
Other languages
Japanese (ja)
Other versions
JP2008276621A (en
Inventor
玲 浜田
紳一 松井
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.)
Casio Computer Co Ltd
Original Assignee
Casio Computer Co Ltd
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 Casio Computer Co Ltd filed Critical Casio Computer Co Ltd
Priority to JP2007121147A priority Critical patent/JP4952363B2/en
Publication of JP2008276621A publication Critical patent/JP2008276621A/en
Application granted granted Critical
Publication of JP4952363B2 publication Critical patent/JP4952363B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、平面から平面への特徴点群の対応をもとに、その妥当な射影変換(ホモグラフィ)を求める画像処理装置、画像変換方法及びプログラムに関する。   The present invention relates to an image processing apparatus, an image conversion method, and a program for obtaining an appropriate projective transformation (homography) based on correspondence of a feature point group from a plane to a plane.

例えば、デジタルカメラ等の撮像装置では、パノラマ合成や手振れ補正などの目的で、複数の連続した画像を重ね合わせて処理することがある。ここで、画像間の特徴点の対応を定める手法として、RANSAC(random sampling consensus)と呼ばれるロバスト化のアルゴリズムが知られている。これは、特徴点対応に誤りが含まれている場合に、アウトライア(外れ値)を除外するための計算手法であり、具体的には以下のような手順を有する。   For example, in an imaging apparatus such as a digital camera, a plurality of continuous images may be overlapped and processed for the purpose of panorama synthesis or camera shake correction. Here, a robust algorithm called RANSAC (random sampling consensus) is known as a method for determining correspondence between feature points between images. This is a calculation method for excluding outliers (outliers) when an error is included in the feature point correspondence, and specifically includes the following procedure.

すなわち、まず、ランダムに抽出した特徴点対応の小さな部分集合を用いて、仮の変換パラメータ(ここでは、射影変換行列)を求め、その変換パラメータによって変換した特徴点の座標が実際の対応点の座標と適合するか否かを判別し、その適合点数をカウントする。   That is, first, a temporary transformation parameter (in this case, a projective transformation matrix) is obtained using a small subset of feature points corresponding to randomly extracted features, and the coordinates of the feature points transformed by the transformation parameters are the actual corresponding points. It is determined whether or not the coordinates match, and the number of matching points is counted.

ループにより、このランダム抽出を多数回繰り返して、適合点数が最も多かった時の適合点の集合を最終的なインライアとし、それ以外はアウトライアとして除外する。この場合、精度が必要でなければ、最終的なインライアを求めたときの変換パラメータをそのまま答えとしても良い。高精度を求めるならば、得られた最終的なインライア集合を用いてより大規模な非線形最小化アルゴリズム等によって変換パラメータを再算出することができる(例えば、非特許文献1参照)。   This random extraction is repeated many times by a loop, and the set of matching points when the number of matching points is the largest is taken as the final inlier, and the others are excluded as outliers. In this case, if accuracy is not required, the conversion parameter when the final inlier is obtained may be used as an answer. If high accuracy is required, the conversion parameter can be recalculated by using a larger nonlinear minimization algorithm or the like using the obtained final inlier set (see Non-Patent Document 1, for example).

今、画像Aと画像Bとの位置合わせする場合を例にして具体的に説明すると、以下のような処理手順となる。   Now, a specific description will be given by taking as an example a case where the image A and the image B are aligned. The processing procedure is as follows.

図13は従来方式による画像間の位置合わせのための処理手順を示すフローチャートである。なお、このフローチャートで示す処理は、一般的な電子計算機によって実行されるものとする。   FIG. 13 is a flowchart showing a processing procedure for alignment between images according to the conventional method. Note that the processing shown in this flowchart is executed by a general electronic computer.

まず、画像Aと画像Bから複数の特徴点を抽出し(ステップS11)、これらの特徴点の中の任意の4点を選び(ステップS12,S13)、これらの4点の組から画像Aと画像Bを位置合わせするための変換行列(射影変換の行列式)を求める(ステップS14)。この時点では、まだ適合するかどうか分からないので、仮の変換行列である。   First, a plurality of feature points are extracted from image A and image B (step S11), arbitrary four points are selected from these feature points (steps S12 and S13), and image A and image A are selected from the set of these four points. A transformation matrix (projection transformation determinant) for aligning the image B is obtained (step S14). At this point in time, it is a tentative transformation matrix because it is not known whether or not it still fits.

ここで、画像Aに変換行列を適用し(ステップS15)、画像A上の各特徴点を射影変換した座標と、それに対応する画像B上の各特徴点の座標との距離を計算する(ステップS16)。その結果、両者間の距離が所定値以上の特徴点を不適合点つまりアウトライアとして除外し(ステップS17)、残った適合点の総和を今回のスコアとして記録する(ステップS18)。   Here, a transformation matrix is applied to the image A (step S15), and the distance between the coordinates obtained by projective transformation of each feature point on the image A and the corresponding coordinates of each feature point on the image B is calculated (step S15). S16). As a result, feature points whose distance between them is equal to or greater than a predetermined value are excluded as incompatible points, that is, outliers (step S17), and the sum of the remaining compatible points is recorded as the current score (step S18).

このようにして、ランダムに4点を選びながら、前記同様の処理を所定回数繰り返し(ステップS19)、最もスコアが良かった回の適合点を用いて変換行列を計算し、これを用いて、画像Aと画像Bとの位置合わせを行う(ステップS20)。
「特徴点の位置分布に基づくランダムサンプリングによる平面領域のロバストな検出法」、電子情報通信学会論文誌 D-II Vol. J88-D-II No.2 pp.313-324
In this way, the same process is repeated a predetermined number of times while randomly selecting four points (step S19), the transformation matrix is calculated using the matching points of the best score, and the image is used to A and B are aligned (step S20).
"Robust detection of planar area by random sampling based on feature point distribution", IEICE Transactions D-II Vol. J88-D-II No.2 pp.313-324

上述したように、RANSACでは、特徴点の部分集合をランダム抽出し、仮の変換行列を求めて適合点数をカウントするといった処理を繰り返すことになる。通常、この繰り返しのループは数十回以上となる。仮の変換行列を求めるために最も簡易な線形アルゴリズムを用いたとしても、ループ数が多いために計算量が非常に多くなり、処理に時間がかかる、あるいはハードウェア構成が大かがりになるなどの問題がある。   As described above, RANSAC repeats the process of randomly extracting a subset of feature points, obtaining a temporary transformation matrix, and counting the number of matching points. Usually, this repeated loop is several tens of times or more. Even if the simplest linear algorithm is used to obtain a temporary transformation matrix, the number of loops is so large that the amount of calculation becomes very large, processing takes time, or the hardware configuration becomes large. There's a problem.

本発明は前記のような点に鑑みなされたもので、複雑な計算を必要とせずに、各画像を位置合わせするための変換式または特徴点対応のインライア集合を高速に求めることのできる画像処理装置、画像変換方法及びプログラムを提供することを目的とする。   The present invention has been made in view of the above points, and image processing capable of obtaining a conversion formula for aligning each image or an inlier set corresponding to a feature point at high speed without requiring complicated calculation. An object is to provide an apparatus, an image conversion method, and a program.

本発明の請求項1に係る画像処理装置は、少なくとも2つの画像を取得する画像取得手段と、この画像取得手段によって得られた第1の画像から格子状の特徴点を選択する特徴点選択手段と、この特徴点選択手段によって選択された特徴点を第2の画像上で追跡する追跡手段と、この追跡手段によって追跡された各特徴点の中から任意の4点を選び、この4点を元に、直線を引く操作と交点を求める操作を前記第2の画像上で繰り返すことにより、評価点を追加していく評価点生成手段と、この評価点生成手段によって生成された各評価点と前記第2の画像上で追跡された各特徴点との適合性を評価する評価手段と、この評価手段によって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する変換式算出手段とを具備したことを特徴とする。 An image processing apparatus according to claim 1 of the present invention includes an image acquisition unit that acquires at least two images, and a feature point selection unit that selects a grid-like feature point from the first image obtained by the image acquisition unit. If a tracking means for tracking the feature points selected by the feature point selecting means on the second image to select any four points from among the feature points tracked by this tracking means, the four points Originally, an evaluation point generating means for adding an evaluation point by repeating an operation for drawing a straight line and an operation for obtaining an intersection point on the second image, and each evaluation point generated by the evaluation point generating means, An evaluation unit that evaluates suitability with each feature point tracked on the second image, and a conversion formula that calculates a conversion formula between images using a set of points having the highest suitability by the evaluation unit. Provided with calculation means And features.

また、本発明の請求項2は、請求項1記載の画像処理装置において、前記評価点生成手段は、前記追跡手段によって追加された点から四角形の頂点をなす4点を新たに選び、その4点を元に前記同様の処理を繰り返して評価点として再帰的に生成することを特徴とする。 According to a second aspect of the present invention, in the image processing apparatus according to the first aspect, the evaluation point generating unit newly selects four points forming a quadrangle from the points added by the tracking unit, The same processing is repeated based on the points, and the evaluation points are recursively generated.

また、本発明の請求項3は、請求項2記載の画像処理装置において、前記評価点生成手段は、前記四角形の頂点をなす4点から前記四角形の内点を求める第1の追加処理手段と、この第1の追加処理手段によって得られた内点と前記四角形の辺との交点である境界点を求める第2の追加処理手段と、この第2の追加処理手段によって得られた境界点と前記四角形の頂点との延長線と前四角形の辺の延長線との交点である外点を求める第3の追加処理手段とを備え、前記各追加処理手段によって得られた内点、境界点、外点を評価点として追加することを特徴とする。   According to a third aspect of the present invention, in the image processing apparatus according to the second aspect, the evaluation point generating means includes first additional processing means for obtaining an inner point of the rectangle from four points forming the vertex of the rectangle. A second additional processing means for obtaining a boundary point that is an intersection of the inner point obtained by the first additional processing means and the side of the square; and a boundary point obtained by the second additional processing means; A third additional processing means for obtaining an outer point that is an intersection of an extension line with the vertex of the quadrangle and an extension line of the side of the previous square, an inner point, a boundary point obtained by each of the additional processing means, An outside point is added as an evaluation point.

また、本発明の請求項4は、請求項1記載の画像処理装置において、前記変換式算出手段によって得られた変換式に基づいて前記第1の画像と前記第2の画像を位置合わせてして所定の画像を生成する画像処理手段とをさらに具備したことを特徴とする。   According to a fourth aspect of the present invention, in the image processing apparatus according to the first aspect, the first image and the second image are aligned based on the conversion formula obtained by the conversion formula calculation means. And image processing means for generating a predetermined image.

本発明の請求項5に係る画像変換方法は、少なくとも2つの画像を取得する第1のステップと、この第1のステップによって得られた第1の画像から格子状の特徴点を選択する第2のステップと、この第2のステップによって選択された特徴点を第2の画像上で追跡する第3のステップと、この第3のステップによって追跡された各特徴点の中から任意の4点を選び、この4点を元に、直線を引く操作と交点を求める操作を前記第2の画像上で繰り返すことにより、評価点を追加していく第4のステップと、この第4のステップによって生成された各評価点と前記第2の画像上で追跡された各特徴点との適合性を評価する第5のステップと、この第5のステップによって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する第6のステップとを備えたことを特徴とする
また、本発明の請求項6に係るプログラムは、コンピュータによって読み取り可能な記録媒体に記録されたプログラムであって、前記コンピュータに、少なくとも2つの画像を取得する第1の機能と、この第1の機能によって得られた第1の画像から格子状の特徴点を選択する第2の機能と、この第2の機能によって選択された特徴点を第2の画像上で追跡する第3の機能と、この第3の機能によって追跡された各特徴点の中から任意の4点を選び、この4点を元に、直線を引く操作と交点を求める操作を前記第2の画像上で繰り返すことにより、評価点を追加していく第4の機能と、この第4の機能によって生成された各評価点と前記第2の画像上で追跡された各特徴点との適合性を評価する第5の機能と、この第5の機能によって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する第6の機能とを実現させることを特徴とする。
The image conversion method according to claim 5 of the present invention is a first step of acquiring at least two images, and a second step of selecting grid-like feature points from the first image obtained by the first step. Step, a third step of tracking the feature point selected by the second step on the second image, and arbitrary four points among the feature points tracked by the third step. Based on these four points, the fourth step of adding an evaluation point by repeating the operation of drawing a straight line and the operation of obtaining an intersection point on the second image based on these four points, and generated by this fourth step A fifth step of evaluating the relevance of each evaluated point and each feature point tracked on the second image, and using the set of points having the highest relevance by the fifth step Calculate the conversion formula between images The program according to claim 6 of the present invention is a program recorded on a computer-readable recording medium, and acquires at least two images from the computer. A second function for selecting a grid-like feature point from the first image obtained by the first function, and a second feature point selected by the second function. A third function for tracking on the image, and an arbitrary four points selected from each of the feature points tracked by the third function, and an operation for drawing a straight line and an operation for obtaining an intersection point based on these four points. A fourth function for adding evaluation points by repeating on the second image, each evaluation point generated by the fourth function, and each feature point tracked on the second image To evaluate the compatibility with the fifth Function and, characterized in that to realize a sixth function that calculates a conversion formula between the fifth image using a set of points was higher most compatible with features.

本発明によれば、複雑な計算を必要とせずに、各画像を位置合わせするための変換式または特徴点対応のインライア集合を高速に求めることができる。   According to the present invention, an inlier set corresponding to a conversion formula or feature point for aligning each image can be obtained at high speed without requiring complicated calculation.

以下、図面を参照して本発明の実施形態を説明する。   Hereinafter, embodiments of the present invention will be described with reference to the drawings.

(第1の実施形態)
図1は本発明の第1の実施形態に係る画像処理装置をデジタルカメラに適用した場合の外観構成を示す図であり、図1(a)は主に前面の構成、同図(b)は主に背面の構成を示す斜視図である。
(First embodiment)
FIG. 1 is a diagram showing an external configuration when the image processing apparatus according to the first embodiment of the present invention is applied to a digital camera. FIG. 1 (a) is mainly a front configuration, and FIG. It is a perspective view which mainly shows the structure of a back surface.

このデジタルカメラ1は、略矩形の薄板状ボディ2の前面に、撮影レンズ3、セルフタイマランプ4、光学ファインダ窓5、ストロボ発光部6、マイクロホン部7などを有し、上面の(ユーザにとって)右端側には電源キー8及びシャッタキー9などが設けられている。   The digital camera 1 has a photographing lens 3, a self-timer lamp 4, an optical finder window 5, a strobe light emitting unit 6, a microphone unit 7 and the like on the front surface of a substantially rectangular thin plate-like body 2 on the upper surface (for the user). On the right end side, a power key 8 and a shutter key 9 are provided.

電源キー8は、電源のオン/オフ毎に操作するキーであり、シャッタキー9は、撮影時に撮影タイミングを指示するキーである。   The power key 8 is a key operated every time the power is turned on / off, and the shutter key 9 is a key for instructing a photographing timing at the time of photographing.

また、デジタルカメラ1の背面には、撮影モード(R)キー10、再生モード(P)キー11、光学ファインダ12、スピーカ部13、マクロキー14、ストロボキー15、メニュー(MENU)キー16、リングキー17、セット(SET)キー18、表示部19などが設けられている。   Also, on the back of the digital camera 1, a shooting mode (R) key 10, a playback mode (P) key 11, an optical viewfinder 12, a speaker unit 13, a macro key 14, a strobe key 15, a menu (MENU) key 16, a ring A key 17, a set (SET) key 18, a display unit 19, and the like are provided.

撮影モードキー10は、電源オフの状態から操作することで自動的に電源オンとして静止画の撮影モードに移行する一方で、電源オンの状態から繰返し操作することで、静止画モード、動画モードを循環的に設定する。静止画モードは、静止画を撮影するためのモードである。また、動画モードは、動画を撮影するためのモードである。   The shooting mode key 10 is operated automatically from the power-off state to automatically turn on the power and shift to the still image shooting mode. On the other hand, by repeatedly operating from the power-on state, the still image mode and the moving image mode are switched. Set cyclically. The still image mode is a mode for photographing a still image. The moving image mode is a mode for shooting a moving image.

前記シャッタキー9は、これらの撮影モードに共通に使用される。すなわち、静止画モードでは、シャッタキー9が押下されたときのタイミングで静止画の撮影が行われる。動画モードでは、シャッタキー9が押下されたときのタイミングで動画の撮影が開始され、シャッタキー9が再度押下されたときにその動画の撮影が終了する。   The shutter key 9 is commonly used for these photographing modes. That is, in the still image mode, a still image is taken at the timing when the shutter key 9 is pressed. In the moving image mode, shooting of a moving image is started at a timing when the shutter key 9 is pressed, and shooting of the moving image is ended when the shutter key 9 is pressed again.

再生モードキー11は、電源オフの状態から操作することで自動的に電源オンとして再生モードに移行する。   When the playback mode key 11 is operated from the power-off state, the playback mode key 11 is automatically turned on to enter the playback mode.

マクロキー14は、静止画の撮影モードで通常撮影とマクロ撮影とを切換える際に操作する。ストロボキー15は、ストロボ発光部6の発光モードを切換える際に操作する。メニューキー16は、連続撮影モードを含む各種メニュー項目等を選択する際に操作する。リングキー17は、上下左右各方向への項目選択用のキーが一体に形成されたものであり、このリングキー17の中央に位置するセットキー18は、その時点で選択されている項目を設定する際に操作する。   The macro key 14 is operated when switching between normal shooting and macro shooting in the still image shooting mode. The strobe key 15 is operated when switching the light emission mode of the strobe light emitting unit 6. The menu key 16 is operated when selecting various menu items including the continuous shooting mode. The ring key 17 is integrally formed with item selection keys in the up, down, left, and right directions, and the set key 18 located in the center of the ring key 17 sets the item selected at that time. To operate.

表示部19は、バックライト付きのカラー液晶パネルで構成されるもので、撮影モード時には電子ファインダとしてスルー画像のモニタ表示を行う一方で、再生モード時には選択した画像等を再生表示する。   The display unit 19 is composed of a color liquid crystal panel with a backlight, and displays a through image on the monitor as an electronic viewfinder in the photographing mode, and reproduces and displays the selected image and the like in the reproduction mode.

なお、図示はしないがデジタルカメラ1の底面には、記録媒体として用いられるメモリカードを着脱するためのメモリカードスロットや、外部のパーソナルコンピュータ等と接続するためのシリアルインタフェースコネクタとして、例えばUSB(Universal Serial Bus)コネクタ等が設けられている。   Although not shown, the digital camera 1 has a memory card slot for attaching / detaching a memory card used as a recording medium, a serial interface connector for connecting to an external personal computer, etc., for example, USB (Universal). Serial Bus) connector and the like are provided.

図2はデジタルカメラ1の電子回路構成を示すブロック図である。   FIG. 2 is a block diagram showing an electronic circuit configuration of the digital camera 1.

このデジタルカメラ1には、光学レンズ装置21、イメージセンサ22、メモリ23、表示装置24、画像処理装置25、操作部26、コンピュータインタフェース部27、外部記憶IO装置28、プログラムコード記憶装置29、CPU30、メモリカード31が備えられている。   The digital camera 1 includes an optical lens device 21, an image sensor 22, a memory 23, a display device 24, an image processing device 25, an operation unit 26, a computer interface unit 27, an external storage IO device 28, a program code storage device 29, and a CPU 30. A memory card 31 is provided.

光学レンズ装置21は、撮影レンズ3を構成する図示せぬフォーカスレンズおよびズームレンズを含むレンズ光学系とその駆動部とを備えたものであり、イメージセンサ22上に、撮影対象からの光を集光させて像を結像させる。   The optical lens device 21 includes a lens optical system including a focus lens and a zoom lens (not shown) constituting the photographing lens 3 and a driving unit thereof, and collects light from the photographing target on the image sensor 22. Light to form an image.

イメージセンサ22は、結像した画像を、デジタル化した画像データとして取り込むためのものであり、例えば、CCD(Charge Coupled Device:電荷結合素子)等によって構成される。イメージセンサ22は、CPU30によって制御され、シャッタキー9が押下されなければ、プレビュー用の解像度の低いデジタルの画像データを生成し、この画像データを秒間30枚程度の間隔で、定期的にメモリ23に送出する。また、イメージセンサ22は、シャッタキー9が押下されると、解像度の高い画像データを生成し、生成した画像データをメモリ23に送出する。また、イメージセンサ22は、CPU30によって撮像感度(ISO感度)の設定可能である。   The image sensor 22 is for capturing a formed image as digitized image data, and is configured by, for example, a CCD (Charge Coupled Device). If the image sensor 22 is controlled by the CPU 30 and the shutter key 9 is not pressed, digital image data having a low preview resolution is generated, and this image data is periodically stored in the memory 23 at intervals of about 30 sheets per second. To send. Further, when the shutter key 9 is pressed, the image sensor 22 generates image data with high resolution and sends the generated image data to the memory 23. Further, the image sensor 22 can set imaging sensitivity (ISO sensitivity) by the CPU 30.

メモリ23は、イメージセンサ22からの低解像度のプレビュー画像、高解像度の画像データまたは画像処理装置25が画像処理する元画像のデータ、処理後の画像データを一時記憶するものである。メモリ23は、一時記憶した画像データを表示装置24または画像処理装置25に送り出す。   The memory 23 temporarily stores a low-resolution preview image from the image sensor 22, high-resolution image data, original image data processed by the image processing device 25, and processed image data. The memory 23 sends the temporarily stored image data to the display device 24 or the image processing device 25.

表示装置24は、液晶モニタである表示部19に画像を表示させるためのものである。表示装置24は、メモリ23が一時記憶した低解像度のプレビュー画像または解像度の高い画像を表示部19に表示する。   The display device 24 is for displaying an image on the display unit 19 which is a liquid crystal monitor. The display device 24 displays a low-resolution preview image or a high-resolution image temporarily stored in the memory 23 on the display unit 19.

画像処理装置25は、メモリ23に一時記憶された画像データに対して、画像データの圧縮等の画像処理を行うためのものである。   The image processing device 25 is for performing image processing such as image data compression on the image data temporarily stored in the memory 23.

操作部26は、シャッタキー9の他に、電源キー8、撮影モードキー10、再生モードキー11、マクロキー14、ストロボキー15、メニューキー16、リングキー17、セットキー18などから構成され、それらのキー操作に伴う信号は直接CPU30へ送出される。   In addition to the shutter key 9, the operation unit 26 includes a power key 8, a shooting mode key 10, a playback mode key 11, a macro key 14, a strobe key 15, a menu key 16, a ring key 17, a set key 18, and the like. Signals associated with these key operations are sent directly to the CPU 30.

コンピュータインタフェース部27は、デジタルカメラ1がPC40に接続されたときに、USBのストレジクラスドライバとして動作するものである。これにより、PC40は、デジタルカメラ1に接続されると、メモリカード31をコンピュータの外部記憶装置として取り扱う。   The computer interface unit 27 operates as a USB storage class driver when the digital camera 1 is connected to the PC 40. Thus, when the PC 40 is connected to the digital camera 1, the PC 40 handles the memory card 31 as an external storage device of the computer.

外部記憶IO装置28は、メモリカード31との間で、画像データ等の入出力を行うものである。メモリカード31は、外部記憶IO装置28から供給された画像データ等を記憶するものである。   The external storage IO device 28 inputs and outputs image data and the like with the memory card 31. The memory card 31 stores image data and the like supplied from the external storage IO device 28.

プログラムコード記憶装置29は、CPU30が実行するプログラムを記憶するためのものであり、ROMやフラッシュメモリなどによって構成される。   The program code storage device 29 is for storing a program executed by the CPU 30, and is configured by a ROM, a flash memory, or the like.

CPU30は、プログラムコード記憶装置29に格納されているプログラムに従って、システム全体を制御するものである。なお、メモリ23は、CPU30の作業メモリとしても用いられる。   The CPU 30 controls the entire system according to a program stored in the program code storage device 29. The memory 23 is also used as a work memory for the CPU 30.

操作部26のスイッチ・キーが押下されることにより、操作部26から操作情報が送信されると、CPU30は、この操作情報に基づいて、イメージセンサ22、メモリ23、表示装置24、画像処理装置25等を制御する。   When operation information is transmitted from the operation unit 26 by pressing a switch key of the operation unit 26, the CPU 30 performs image sensor 22, memory 23, display device 24, and image processing device based on the operation information. 25 etc. are controlled.

具体的には、操作部26から撮影モードキー10が押下された旨の操作情報が送信されると、CPU30は各部を撮影モードに設定する。この状態で、シャッタキー9が押下されなければ、イメージセンサ22をプレビューモードに設定し、シャッタキー9が押下されれば、解像度の高い撮影対象画像を読み込む高解像度モードに設定する。その際、メニューキー16の操作により連続撮影モードが設定されていれば、シャッタキー9の押下に伴い、所定枚数分の画像の読み込み処理が所定時間間隔で実行される。   Specifically, when operation information indicating that the shooting mode key 10 is pressed is transmitted from the operation unit 26, the CPU 30 sets each unit to the shooting mode. In this state, if the shutter key 9 is not pressed, the image sensor 22 is set to the preview mode, and if the shutter key 9 is pressed, the high-resolution mode for reading a high-resolution image to be captured is set. At this time, if the continuous shooting mode is set by operating the menu key 16, a predetermined number of image reading processes are executed at predetermined time intervals as the shutter key 9 is pressed.

また、再生モードキー11が押下された旨の操作情報が送信されると、CPU30は、各部を再生モードに設定する。   When the operation information indicating that the playback mode key 11 is pressed is transmitted, the CPU 30 sets each unit to the playback mode.

また、CPU30は、外部記憶IO装置28を介してメモリカード31に、プレビュー画像、高解像度の画像のデータを記録したり、メモリカード31から、記録された画像データを読み出したりする。CPU30は、メモリカード31には、例えばJPEG(Joint Photographic Experts Group)フォーマットで圧縮した画像データを記録する。   Further, the CPU 30 records preview image and high-resolution image data on the memory card 31 via the external storage IO device 28, and reads the recorded image data from the memory card 31. The CPU 30 records image data compressed in, for example, a JPEG (Joint Photographic Experts Group) format in the memory card 31.

CPU30は、メモリ23に画像データを一時記憶する際、プレビュー画像、高解像度の画像データを異なる記憶領域に記録する。また、CPU30は、メモリカード31には、画像データを画像ファイルに分けて記録する。   When the image data is temporarily stored in the memory 23, the CPU 30 records the preview image and the high-resolution image data in different storage areas. Further, the CPU 30 records the image data separately in the image file in the memory card 31.

また、CPU30は、外部記憶IO装置28を介してメモリカード31に、プレビュー画像、高解像度の画像のデータを記録したり、メモリカード31から、記録された画像データを読み出したりする。CPU30は、メモリカード31に画像データを格納する画像ファイルを作成する。   Further, the CPU 30 records preview image and high-resolution image data on the memory card 31 via the external storage IO device 28, and reads the recorded image data from the memory card 31. The CPU 30 creates an image file for storing image data in the memory card 31.

図3はCPU30の機能構成を示すブロック図である。CPU30を機能的に示すと、画像取得部30a、特徴点選択部30b、追跡部30c、評価点生成部30d、評価部30e、変換式算出部30f、画像処理部30gからなる。   FIG. 3 is a block diagram showing a functional configuration of the CPU 30. Functionally, the CPU 30 includes an image acquisition unit 30a, a feature point selection unit 30b, a tracking unit 30c, an evaluation point generation unit 30d, an evaluation unit 30e, a conversion formula calculation unit 30f, and an image processing unit 30g.

画像取得部30aは、図4に示すように、連続撮影などにより得られた少なくとも2つの画像A,Bを取得する。この場合、画像Aは基準画像としてメモリ23の第1のバッファ23aに格納され、画像Bは被追跡画像としてメモリ23の第2のバッファ23bに格納される。   As shown in FIG. 4, the image acquisition unit 30 a acquires at least two images A and B obtained by continuous shooting or the like. In this case, the image A is stored as a reference image in the first buffer 23a of the memory 23, and the image B is stored as a tracked image in the second buffer 23b of the memory 23.

特徴点選択部30bは、画像取得部30aによって得られた画像Aから一定の制約の下で直線上に並んだ特徴点を選択する。   The feature point selection unit 30b selects feature points arranged on a straight line from the image A obtained by the image acquisition unit 30a under certain restrictions.

追跡部30cは、特徴点選択部30bによって選択された各特徴点を画像B上で追跡する。   The tracking unit 30c tracks each feature point selected by the feature point selection unit 30b on the image B.

評価点生成部30dは、追跡部30cによって追跡された各特徴点から所定数の点を選び、これらの点を元に画像B上で直線上に並んだ特徴点を評価点として再帰的に生成する。詳しくは、この評価点生成部30dは、追跡部30cによって得られた各特徴点の中で四角形の頂点をなす4点を抽出し、その4点を元に画像B上で直線上に並んだ特徴点を評価点として再帰的に生成する。また、この評価点生成部30dは、四角形の頂点をなす4点から前記四角形の内点を求める第1の追加処理部30d−1と、この第1の追加処理部30d−1によって得られた内点と前記四角形の辺との交点である境界点を求める第2の追加処理部30d−2と、この第2の追加処理部30−2によって得られた境界点と前記四角形の頂点との延長線と前四角形の辺の延長線との交点である外点を求める第3の追加処理部30d−3とを備え、前記各追加処理部30d−1〜30d−3によって得られた内点、境界点、外点を評価点として追加する。   The evaluation point generation unit 30d selects a predetermined number of points from each feature point tracked by the tracking unit 30c, and recursively generates feature points arranged on a straight line on the image B based on these points as evaluation points. To do. Specifically, the evaluation point generation unit 30d extracts four points that form a rectangular vertex from the feature points obtained by the tracking unit 30c, and arranges them on a straight line on the image B based on the four points. Feature points are generated recursively as evaluation points. The evaluation point generation unit 30d is obtained by the first additional processing unit 30d-1 that obtains the inner point of the rectangle from the four points that form the vertex of the quadrangle, and the first additional processing unit 30d-1. A second additional processing unit 30d-2 that obtains a boundary point that is an intersection of the inner point and the side of the quadrangle, and the boundary point obtained by the second additional processing unit 30-2 and the vertex of the quadrangle A third additional processing unit 30d-3 for obtaining an outer point that is an intersection of the extension line and the extension line of the side of the front square, and the inner points obtained by the additional processing units 30d-1 to 30d-3 , Boundary points, and outer points are added as evaluation points.

評価部30eは、評価点生成部30dによって生成された各評価点と画像B上で追跡された各特徴点との適合性を評価する。   The evaluation unit 30e evaluates the suitability between the evaluation points generated by the evaluation point generation unit 30d and the feature points tracked on the image B.

変換式算出部30fは、評価部30eによって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する。   The conversion formula calculation unit 30f calculates a conversion formula between images using a collection of points having the highest suitability by the evaluation unit 30e.

また、画像処理部30gは、変換式算出部30fによって得られた変換式に基づいて画像Aと画像Bを位置合わせてして所定の画像を生成する。前記所定の画像とは、例えばパノラマ画像や手振れ補正した画像などである。   Further, the image processing unit 30g aligns the images A and B based on the conversion formula obtained by the conversion formula calculation unit 30f to generate a predetermined image. The predetermined image is, for example, a panoramic image or an image subjected to camera shake correction.

次に、具体的な処理手順を説明する前に、理解を容易にするため、図5乃至図8を参照して、本方式について説明しておく。   Next, before explaining a specific processing procedure, the present method will be described with reference to FIGS. 5 to 8 for easy understanding.

処理の全体はRANSACアルゴリズムに基づく。仮の変換行列を繰り返し計算する従来例のRANSACとの違いは、特徴点の配置に次に述べるような制約を設けることと、適合点の判定方法で用いる「変換によって移る座標」の算出を、従来のように変換パラメータ(射影変換行列)を求めることで行うのではなく、4組の特徴点から再帰的に求められる各点の座標から直接判定することである。   The entire process is based on the RANSAC algorithm. The difference from the conventional RANSAC that repeatedly calculates the temporary transformation matrix is that the following restrictions are placed on the arrangement of the feature points, and the calculation of the “coordinates transferred by the transformation” used in the matching point determination method is as follows: Rather than performing conversion parameters (projection conversion matrix) as in the prior art, the determination is made directly from the coordinates of each point obtained recursively from four sets of feature points.

なお、後述するように再帰的に各点の座標を求めていくため、計算誤差が蓄積する懸念はあるが、RANSACによってインライア集合を求めるのに十分な精度があれば良く、最終的なパラメータを算出するにはループを出てから再計算すれば良いので、大きな問題とはならない。   As will be described later, since the coordinates of each point are recursively obtained, there is a concern that calculation errors may accumulate. However, it is sufficient if there is sufficient accuracy to obtain an inlier set by RANSAC, and the final parameters are determined. Since it is only necessary to recalculate after exiting the loop, it is not a big problem.

(1)特徴点座標の制約
(入力の制約)
まず、特徴点を選出するに際し、以下のような制約を置く。
(1) Restriction of feature point coordinates (Input restriction)
First, the following restrictions are placed when selecting feature points.

一方の平面である基準平面上の各特徴点の座標は、正方格子状に所定の座標に固定的に設定するものとしている。ここで、特徴のないパターンの上にある特徴点は特徴点対応集合から除去してかまわない。   The coordinates of each feature point on the reference plane, which is one plane, are fixedly set to predetermined coordinates in a square lattice pattern. Here, the feature points on the featureless pattern may be removed from the feature point correspondence set.

他方の平面を被追跡平面と呼び、その上の各特徴点の座標は、基準平面上の特徴点座標にある特徴パターンが、どの座標に移動したかを追跡アルゴリズム(ブロックマッチングや勾配法)によって推定した座標によって構成するものとする。   The other plane is called the tracked plane, and the coordinates of each feature point on it are determined by the tracking algorithm (block matching or gradient method) to which coordinate the feature pattern in the feature point coordinates on the reference plane has moved. It shall consist of estimated coordinates.

これらの特徴点対応がn組、すなわち、
((x0 ,y0 (x″0 ,y″0 )),((x1 ,y1 ),(x″1 ,y″1 )),…,((xn-1 ,yn-1 ),(x″n-1 ,y″n-1 ))
の要領で、対の配列として構成されているものとする。
These feature points correspond to n sets, that is,
((X 0 , y 0 ) , (x ″ 0 , y ″ 0 )), ((x 1 , y 1 ), (x ″ 1 , y ″ 1 )),..., ((X n−1 , y n-1 ), (x " n-1 , y" n-1 ))
In this manner, it is assumed to be configured as an array of pairs.

なお、(x,y)は基準平面上の特徴点の座標、(x″,y″)は被追跡平面上で追跡した特徴点の座標を表している。また、後述する(x′,y′)は被追跡平面上の特徴点の座標を表している。   Note that (x, y) represents the coordinates of the feature points on the reference plane, and (x ″, y ″) represents the coordinates of the feature points tracked on the tracked plane. Further, (x ′, y ′) described later represents the coordinates of feature points on the tracked plane.

(部分集合の抽出)
従来例のRANSACによるランダムな部分集合の抽出は、4組の特徴点を使うアルゴリズムであれば、4個の特徴点をランダムに選んで行う。特徴点が重複したり、退化条件(一直線に並ぶなど)の場合は意味がなく、再度抽出し直すが、本方式では、さらに制約を強くする。
(Subset extraction)
Extraction of a random subset by the conventional RANSAC is performed by randomly selecting four feature points if the algorithm uses four sets of feature points. If feature points overlap or degenerate conditions (aligned in a straight line, etc.), there is no meaning and they are extracted again. However, in this method, restrictions are further strengthened.

すなわち、4組の特徴点を選択するが、基準平面(画像A)における4点の配置が、矩形の各頂点をなし、その1辺の長さが、前述した格子配置の間隔の2m(但し、mは任意の正整数)となっているものを選ぶ。 That is, four sets of feature points are selected, and the arrangement of the four points on the reference plane (image A) forms each vertex of a rectangle, and the length of one side thereof is 2 m (2 m ( Where m is an arbitrary positive integer).

具体的な方法としては、例えば、左上座標とmをランダムに決めることで選んでも良いし、制約が強く組み合わせ数が少ないため、ループによって順次すべての組み合わせを選択していっても良い。当然ながら、存在しない特徴点の座標を含んでしまった場合は破棄して次の組み合わせに進む。   As a specific method, for example, the upper left coordinate and m may be selected at random, or all the combinations may be selected sequentially by a loop because there are few restrictions and the number of combinations is strong. Of course, if the coordinates of feature points that do not exist are included, the coordinates are discarded and the process proceeds to the next combination.

図5に基準平面における特徴点の部分集合の抽出例を示す。黒点は特徴点座標を示す。図中の点線枠で示した正方形の各頂点を構成する4点の組みが抽出対象となる。   FIG. 5 shows an example of extracting a subset of feature points on the reference plane. Black dots indicate feature point coordinates. A set of four points constituting each vertex of a square indicated by a dotted frame in the figure is an extraction target.

(2)変換によって移る座標の導出方法
ここが本実施形態の特徴となる。
(2) Derivation method of coordinates to be moved by conversion This is a feature of the present embodiment.

通常、正方形配置の4点の特徴点対応から射影変換は一意に決まる(射影変換が退化するような例外的な対応点が存在する場合を除く)。本実施形態では、この時点で基準平面(画像A)から被追跡平面(画像B)への射影変換のパラメータ(変換行列)を求めることはしないが、便宜的に変換Hとして名前をつけて説明する。   Usually, the projective transformation is uniquely determined from the correspondence of the four feature points in the square arrangement (except in the case where there is an exceptional corresponding point where the projective transformation is degenerated). In this embodiment, a parameter (transformation matrix) for projective transformation from the reference plane (image A) to the tracked plane (image B) is not obtained at this time, but the name is given as transformation H for convenience. To do.

4点の周囲の他の特徴点対応について、以下に述べるように、基準平面上の特徴点の座標(xi ,yi )が変換Hによって被追跡平面に移される座標(x′i ,y′i )を求める。求めた後の処理は、一般のRANSACと同様で、追跡座標(x″i ,y″i )との距離を調べて適合性を判定することができる。 Other feature points corresponding the surrounding four points, as described below, reference plane of the feature point coordinates (x i, y i) is the coordinates (x 'i, which is transferred to the track plane by converting H, y ′ I ) is obtained. The processing after the determination is similar to general RANSAC, and the compatibility with the tracking coordinates (x ″ i , y ″ i ) can be determined by examining the distance.

座標(x′i ,y′i )を変換Hの成分を求めることなく、直接に求めることができる理由は、特徴点相互の位置関係が制約されているために、射影変換の性質「直線を直線に移す」を利用できるからである。すなわち、基準平面から抽出した4つの特徴点を結ぶ6個の直線は、そのまま被追跡平面から抽出した4つの特徴点がなす6個の直線に移る。さらに、「直線の交点は直線の交点に移る」ことが言える。したがって、変換によって移る交点の座標が求められるという原理である。 The reason why the coordinates (x ′ i , y ′ i ) can be obtained directly without obtaining the component of the transformation H is that the positional relationship between the feature points is restricted, so This is because “shift to a straight line” can be used. That is, the six straight lines connecting the four feature points extracted from the reference plane are directly transferred to the six straight lines formed by the four feature points extracted from the tracked plane. Furthermore, it can be said that “the intersection of the straight lines moves to the intersection of the straight lines”. Therefore, it is a principle that the coordinates of the intersection point to be moved by conversion are obtained.

ここで示した導出方法を再帰的に適用して、全ての特徴点変換座標を求めるが、初期の抽出4点に関しては、基準平面の点a,b,c,dから、変換Hを用いて移る点a′,b′,c′,d′と、追跡された点a″,b″,c″,d″は同じ座標となる。それ以外の導出された点では同じ座標とは限らない。   By applying the derivation method shown here recursively to obtain all feature point conversion coordinates, the initial four extraction points are converted from the points a, b, c, and d on the reference plane using the conversion H. The moving points a ′, b ′, c ′, d ′ and the tracked points a ″, b ″, c ″, d ″ have the same coordinates. Other derived points are not necessarily the same coordinates.

ここで、前記4点の周囲の他の特徴点として、内点、境界点、外点を導出する方法について説明する。   Here, a method for deriving an inner point, a boundary point, and an outer point as other characteristic points around the four points will be described.

(3)内点の変換座標の導出
まず、内点を導出する方法について説明する。内点とは、ここでは基準画像の選択矩形の中心点のことを指している。
(3) Derivation of conversion coordinates of inner point First, a method for deriving an inner point will be described. Here, the inner point refers to the center point of the selected rectangle of the reference image.

図6は内点の変換座標の導出方法を説明するための図である。図6(a)が基準平面の位置関係、同図(b)が被追跡平面の位置関係の例である。なお、図には、追跡された座標e″の例も示した(e′とe″の距離を測れば適合点か否かを判別できる)。但し、以後の処理で、再帰的処理のためにe′を求める場合には、e″は必ずしも存在しない。特徴点が除外されていて追跡が行われなかったり、再帰的処理の中間結果として導出する場合には、特徴点格子幅より小さい幅単位になっていることもあって良い。図7、図8についても同様である。   FIG. 6 is a diagram for explaining a method for deriving the transformation coordinates of the inner point. FIG. 6A shows an example of the positional relationship of the reference plane, and FIG. 6B shows an example of the positional relationship of the tracked plane. The figure also shows an example of the coordinate e ″ tracked (the distance between e ′ and e ″ can be determined to determine whether it is a matching point). However, in the subsequent processing, when e ′ is obtained for recursive processing, e ″ does not necessarily exist. Feature points are excluded and tracking is not performed, or derived as an intermediate result of recursive processing. In this case, the width unit may be smaller than the feature point grid width, and the same applies to FIGS.

基準平面の正方形頂点a,b,c,dを被追跡平面の点a′,b′,c′,d′に移す変換Hを用いて、ちょうど中央の点eが、被追跡平面に変換される座標e′を、以下のように求めることができる。   Using the transformation H that moves the square vertices a, b, c, d of the reference plane to the points a ′, b ′, c ′, d ′ of the tracked plane, the center point e is converted to the tracked plane. The coordinate e ′ can be obtained as follows.

点pの平面座標(xp ,yp )の内部表現を、(xp ,yp ,1)のように拡張ベクトルで表現する。なお、後で無限遠点も扱うが、平面原点から見て、(xp ,yp )方向の無限遠点は(xp ,yp ,0)のように表現する。同次座標と捉えても良い。 The internal representation of the plane coordinates (x p , y p ) of the point p is represented by an extension vector as (x p , y p , 1). Although the point at infinity is also handled later, the point at infinity in the (x p , y p ) direction is expressed as (x p , y p , 0) when viewed from the plane origin. It may be considered as homogeneous coordinates.

ここで、基準平面上の点eは、点aと点dを通る直線と、点bと点cを通る直線の交点である。したがって、変換Hによって移される被追跡平面上の点e′は、点a′とd′を通る直線と、点b′と点c′を通る直線の交点を求めれば良い。この計算は、「2点を通る直線を求める方法」と、「2直線の交点を求める方法」を用いれば容易に構成できる。後の処理でも、この2つの方法をサブルーチンとして使う。   Here, the point e on the reference plane is an intersection of a straight line passing through the points a and d and a straight line passing through the points b and c. Therefore, the point e ′ on the tracked plane moved by the transformation H may be obtained by calculating the intersection of a straight line passing through the points a ′ and d ′ and a straight line passing through the points b ′ and c ′. This calculation can be easily configured by using “a method for obtaining a straight line passing through two points” and “a method for obtaining an intersection of two straight lines”. In later processing, these two methods are used as subroutines.

「2点を通る直線を求める方法」
平面上の2点p,qを通る直線は、次の(1)式で表される。
"How to find a straight line passing through two points"
A straight line passing through two points p and q on the plane is expressed by the following equation (1).

(x′p −x′q )(y′−y′q )=(y′p −y′q )(x′−x′q
…(1)
前記(1)式において、同類項をまとめれば、直線:α1 x′+α2 y′+α3 =0となる。
(X 'p -x' q) (y'-y 'q) = (y' p -y 'q) (x'-x' q)
... (1)
In the above equation (1), when similar terms are put together, a straight line: α 1 x ′ + α 2 y ′ + α 3 = 0.

なお、後で、p,qのうち1点が無限遠点となる場合が出てくるが、その時は、無限遠点の方向に方向ベクトルを持ち、平面上の点(無限遠点でないほうの点)を通る直線を求めればよい。   Later, one of the points p and q may become an infinite point. At that time, the direction vector is in the direction of the infinite point, and the point on the plane (the one that is not the infinite point) What is necessary is just to obtain a straight line passing through the point.

「2直線の交点を求める方法」
2直線の交点は、直線:α1 x′+α2 y′+α3 =0、直線:β1 x′+β2 y′+β3 =0とすると、次式の線形方程式の解を求めればよい。

Figure 0004952363
“How to find the intersection of two straight lines”
Assuming that the intersection of two straight lines is a straight line: α 1 x ′ + α 2 y ′ + α 3 = 0, and a straight line: β 1 x ′ + β 2 y ′ + β 3 = 0, a solution of the following linear equation may be obtained.
Figure 0004952363

但し、2直線が平行である場合(数値計算上は、ほぼ平行な場合)は、直線の延長上の無限遠点、例えば(α2,−α1,0)ないし(β2,−β1,0)を解と決める。 However, when the two straight lines are parallel (in the case of numerical calculation, they are almost parallel), an infinite point on the extension of the straight line, for example, (α 2 , −α 1 , 0) to (β 2 , −β 1 , 0) is determined as the solution.

(4)境界点の変換座標の導出
次に、境界点を導出する方法について説明する。境界点とは、ここでは基準画像の選択矩形の各辺の中点のことを指している。
(4) Derivation of transformation coordinates of boundary point Next, a method of deriving the boundary point will be described. Here, the boundary point refers to the midpoint of each side of the selected rectangle of the reference image.

図7は境界点の変換座標の導出方法を説明するための図である。図7(a)が基準平面の位置関係、同図(b)が被追跡平面の位置関係の例である。なお、正方形を構成する4辺のどの辺を選んでも全く対称的なので、ここでは右辺上の点fを例にして説明する。   FIG. 7 is a diagram for explaining a method for deriving the conversion coordinates of the boundary point. FIG. 7A shows an example of the positional relationship of the reference plane, and FIG. 7B shows an example of the positional relationship of the tracked plane. It should be noted that any of the four sides constituting the square is completely symmetrical, and here, the point f on the right side will be described as an example.

基準平面の正方形頂点a,b,c,dを被追跡平面の点a′,b′,c′,d′に移す変換Hを用いて、任意の辺の中点が、被追跡平面のどの座標に変換されるかを、以下のように求めることができる。   Using a transformation H that moves the square vertices a, b, c, d of the reference plane to the points a ′, b ′, c ′, d ′ of the tracked plane, the midpoint of any side is Whether it is converted into coordinates can be determined as follows.

今、中央の点eに対応する点e′が求められているとする。まず、点a′と点b′を通る直線と、点c′と点d′を通る直線の交点w′を前述の方法によって求める。前述の通り、直線が平行ならば、w′は無限遠点である。   Assume that a point e ′ corresponding to the center point e is obtained. First, an intersection point w ′ between a straight line passing through the points a ′ and b ′ and a straight line passing through the points c ′ and d ′ is obtained by the method described above. As described above, if the straight lines are parallel, w ′ is a point at infinity.

次に、点b′と点d′を通る直線と、e′とw′を通る直線の交点を前述の方法によって求める。この交点が境界点f′である。 Next, an intersection of a straight line passing through the points b ′ and d ′ and a straight line passing through the e ′ and w ′ is obtained by the above-described method. This intersection is the boundary point f ′ .

同様にして、すべての辺の中点を求めると、各辺の長さが半分の4個の小正方形の頂点の変換座標が求められる。なお、これらの小正方形の変換に対して、再帰的に、内点座標の導出と境界点座標の導出を適用していけば、もとの正方形の内部及び境界のすべての格子状特徴点の変換座標が求めることができる。   Similarly, when the midpoints of all the sides are obtained, the transformation coordinates of the vertices of four small squares each having a half length are obtained. In addition, if the derivation of the internal point coordinates and the derivation of the boundary point coordinates are applied recursively to these small square transformations, all of the lattice-like feature points inside the original square and the boundary are obtained. Conversion coordinates can be obtained.

(5)外点の変換座標の導出
次に、外点を導出する方法について説明する。外点とは、ここでは基準画像の選択矩形の頂点から矩形辺長だけ離れた格子点のことを指している。
(5) Derivation of transformation point of outer point Next, a method for deriving the outer point will be described. Here, the outer point refers to a grid point that is separated from the vertex of the selected rectangle of the reference image by a rectangular side length.

図8は外点の変換座標の導出方法を説明するための図である。図7(a)が基準平面の位置関係、同図(b)が被追跡平面の位置関係の例である。なお、正方形を構成する4辺のどの辺・方向を選んでも全く対称的なので、ここでは下辺を右側に延長した点gを例にして説明する。   FIG. 8 is a diagram for explaining a method for deriving the transformation coordinates of the outer points. FIG. 7A shows an example of the positional relationship of the reference plane, and FIG. 7B shows an example of the positional relationship of the tracked plane. It should be noted that any side or direction of the four sides constituting the square is completely symmetrical, and here, the point g with the lower side extended to the right will be described as an example.

基準平面の正方形頂点a,b,c,dを被追跡平面の点a′,b′,c′,d′に移す変換Hを用いて、任意の辺上を辺の長さだけ外に延長した点が、被追跡平面のどの座標に変換されるかを、以下のように求めることができる。   Extending any side outward by the length of the side using transformation H that moves the square vertices a, b, c, d of the reference plane to the points a ′, b ′, c ′, d ′ of the tracked plane It can be determined as follows to which coordinate on the tracked plane the converted point is converted.

今、右辺の中点fに対応する点f′が求められているとする。変換Hによって移される点g′は、変換Hによって移される点a′,b′,c′,d′の座標から、点a′と点f′を通る直線と、点c′と点d′を通る直線の交点を求めれば良い。この交点が外点である。 Now, it is assumed that a point f ′ corresponding to the midpoint f on the right side is obtained. The point g ′ moved by the transformation H is a straight line passing through the points a ′ and f ′ from the coordinates of the points a ′, b ′, c ′ and d ′ moved by the transformation H, and the points c ′ and d ′. Find the intersection of the straight lines passing through. This intersection is the outer point.

この方法で、外側の隣接点のすべてを求めることができ、もとと同じ大きさの4個の正方形の頂点の座標が求められる。以上の方法を再帰的に適用して、順次、隣接点とその内部・境界をたどっていけば、画面上の全ての特徴点の変換座標を求めることができる。   In this way, all of the outer neighboring points can be determined, and the coordinates of the vertices of four squares of the same size as the original are determined. By applying the above method recursively and sequentially tracing the adjacent points and their interiors / boundaries, the transformation coordinates of all feature points on the screen can be obtained.

以下に、具体的な処理手順について説明する。
今、連続した2つの画像Aと画像Bを位置合わせする場合を想定する。画像Aで直線上に並んだ特徴点は、カメラの回転などによって歪んだ画像B上でも直線上に並んでいるはずである。したがって、画像Aで直線上に並んでいた特徴点を画像B上で追跡してみて、これが画像B上で直線上になければ、異常な動きをしている特徴点として除外できる。
A specific processing procedure will be described below.
Assume that two continuous images A and B are aligned. The feature points arranged on the straight line in the image A should be arranged on the straight line even on the image B distorted by the rotation of the camera or the like. Therefore, when the feature points arranged on the straight line in the image A are tracked on the image B and are not on the straight line on the image B, they can be excluded as feature points that are moving abnormally.

ここで、直線が直線に移ることは保証されているが、直線自体の角度は変化しうるし、直線各部の長さも変化する。そこで、画像B上で評価用の適切な直線をいかに引くかという問題を「4点を基準にして内点を作り、境界点を作り、外点を作る」という手法を繰り返すことで解決するものである。   Here, although it is guaranteed that the straight line moves to the straight line, the angle of the straight line itself can change, and the length of each part of the straight line also changes. Therefore, the problem of how to draw an appropriate straight line for evaluation on image B can be solved by repeating the method of “creating an inner point based on four points, creating a boundary point, and creating an outer point”. It is.

図9は第1の実施形態における画像間の位置合わせの処理手順を示すフローチャートである。また、図10は図9に含まれる評価対象追加処理を示すフローチャートである。なお、これらのフローチャートで示す各処理は、プログラムコードの形態でプログラムコード記憶装置29に記憶されている。コンピュータであるCPU30は、このプログラムを読み込むことにより、以下のような処理を実行する。   FIG. 9 is a flowchart showing a processing procedure for alignment between images in the first embodiment. FIG. 10 is a flowchart showing the evaluation target addition process included in FIG. Each process shown in these flowcharts is stored in the program code storage device 29 in the form of a program code. CPU30 which is a computer performs the following processes by reading this program.

図9のフローチャートに示すように、CPU30は、連続した2つの画像Aと画像Bを取得する(ステップS100)。なお、この画像A,Bは、連続撮影などによってイメージセンサ22から直接取得することでも良いし、メモリカード31などを通じて外部から提供されるものであっても良い。画像Aは基準画像として、図3に示したメモリ23の第1のバッファ23aに格納され、画像Bは被追跡画像として、第2のバッファ23bに格納される。   As shown in the flowchart of FIG. 9, the CPU 30 acquires two consecutive images A and B (step S100). The images A and B may be acquired directly from the image sensor 22 by continuous shooting or the like, or may be provided from the outside through the memory card 31 or the like. The image A is stored as a reference image in the first buffer 23a of the memory 23 shown in FIG. 3, and the image B is stored as a tracked image in the second buffer 23b.

画像Aと画像Bが得られると、まず、CPU30は、図5に示したように基準画像である画像A上から格子状の特徴点を選択、つまり、直線上に並んだ特徴点の集まりを選択する(ステップS101)。続いて、CPU30は、画像A上の格子点(特徴点)に対応する画像B上の特徴点をブロックマッチングまたは勾配法などを用いて追跡する(ステップS102)。そして、この追跡処理によって得られた画像B上の特徴点の中から任意の4点を選び、これを仮想格子点とする(ステップS103)。この4点は、図6(b)に示した点a′,b′,c′,d′に相当し、四角形の頂点をなす。   When the image A and the image B are obtained, first, the CPU 30 selects a grid-like feature point from the image A that is the reference image as shown in FIG. 5, that is, a collection of feature points arranged on a straight line. Select (step S101). Subsequently, the CPU 30 tracks feature points on the image B corresponding to lattice points (feature points) on the image A using block matching or a gradient method (step S102). Then, arbitrary four points are selected from the feature points on the image B obtained by this tracking process, and these are set as virtual lattice points (step S103). These four points correspond to the points a ′, b ′, c ′, and d ′ shown in FIG. 6B, and form quadrangular vertices.

なお、ここで言う「仮想格子点」とは、画像Aの特徴点から変換Hによって画像Bに移される点のことであり、評価点として用いられる。この時点では、まだ4点しかないので、この4点を元に下記のような方法によって増やしていく。   The “virtual grid points” referred to here are points that are transferred from the feature points of the image A to the image B by the transformation H, and are used as evaluation points. At this point, there are still only 4 points, so the number is increased by the following method based on these 4 points.

すなわち、CPU30は、この4点を元に、直線を引く操作と交点を求める操作を画像B上で繰り返すことにより、仮想格子点を追加していく(ステップS104)。   That is, the CPU 30 adds virtual lattice points by repeating the operation for drawing a straight line and the operation for obtaining an intersection point on the image B based on these four points (step S104).

詳しくは、図10のフローチャートに示すように、CPU30は、ステップS103で選んだ画像B上の4点を元に内点を求め(ステップS201)、続いて、その内点を手かがりにして境界点を求め(ステップS202)、さらに、その境界点を手かがりにして外点を求める(ステップS203)。なお、これらの点の求め方については、図6乃至図8で説明した通りであるため、ここでは省略する。   Specifically, as shown in the flowchart of FIG. 10, the CPU 30 obtains an inner point based on the four points on the image B selected in step S103 (step S201), and then uses the inner point as a cue to make a boundary. A point is obtained (step S202), and an outer point is obtained using the boundary point as a cue (step S203). Note that how to obtain these points is as described with reference to FIGS.

このように、ステップS103で得られた4点を元に内点、境界点、外点の順で求めていく。これにより、内点1つ、境界点4つ、外点8つの計13個の点が仮想格子点(評価点)が生成されることになる。これらの点は、ステップS103で得られた4点から変換Hによって、画像Aから画像Bに移された特徴点座標を意味している。   Thus, the inner point, the boundary point, and the outer point are obtained in this order based on the four points obtained in step S103. As a result, a total of 13 points, one inner point, four boundary points, and eight outer points, generate virtual lattice points (evaluation points). These points mean the feature point coordinates transferred from the image A to the image B by the transformation H from the four points obtained in step S103.

続いて、CPU30は、前記追加された点から四角形の頂点をなす4点を新たに選び(ステップS106)、その4点を元に前記同様の処理を繰り返して仮想格子点を順次追加していく(ステップS104)。   Subsequently, the CPU 30 newly selects four points forming a quadrangle from the added points (step S106), and repeats the same processing based on the four points to sequentially add virtual lattice points. (Step S104).

仮想格子点の数が画像A上の格子点の数に達すると、つまり、仮想格子点が画像Bの全体に生成されると(ステップS105のYes)、ここでのループが終了する。この場合、最終的に画像A上の格子点の数まで追加処理を繰り返しても良いし、予め決められた数に達した時点で終了しても良い。精度を求めるのであれば、格子点の数になるまで追加処理を繰り返すことが好ましい。   When the number of virtual lattice points reaches the number of lattice points on the image A, that is, when virtual lattice points are generated in the entire image B (Yes in step S105), the loop here ends. In this case, the addition process may be repeated until the number of grid points on the image A finally, or may be terminated when a predetermined number is reached. If accuracy is desired, it is preferable to repeat additional processing until the number of grid points is reached.

次に、CPU30は、画像B上で、それぞれに対応する仮想格子点と追跡点との間の距離を計算する(ステップS107)。つまり、画像Aの各特徴点から変換Hによって画像Bに移される各点と、画像Aの各特徴点からステップS102の追跡処理で求められた各点とを比較して、両者間の位置ずれを求める。   Next, the CPU 30 calculates the distance between the corresponding virtual lattice point and the tracking point on the image B (step S107). That is, each point transferred from the feature point of the image A to the image B by the transformation H is compared with each point obtained from the feature point of the image A by the tracking process in step S102, and the positional deviation between the two points is compared. Ask for.

そして、CPU30は、両者の距離が所定値以下であった場合、つまり、仮想格子点と追跡点との位置ずれが許容範囲内であれば、そのときの追跡点を適合点と判断し、その座標をメモリ23の所定の領域に記録しておくと共に(ステップS108)、適合点の総和を今回のスコアとして求め、図11に示すスコア管理テーブル32に記録する(ステップS109)。   Then, if the distance between the two is equal to or less than the predetermined value, that is, if the positional deviation between the virtual lattice point and the tracking point is within an allowable range, the CPU 30 determines the tracking point at that time as a matching point, and The coordinates are recorded in a predetermined area of the memory 23 (step S108), and the sum of the matching points is obtained as the current score and recorded in the score management table 32 shown in FIG. 11 (step S109).

例えば、仮想格子点の数が100個あったとして、その中の20個の点が不適合であった場合には、その回のスコアとして80点がスコア管理テーブル32に記録される。なお、このスコア管理テーブル32は、メモリ23に設けられている。   For example, if the number of virtual lattice points is 100 and 20 of them are incompatible, 80 points are recorded in the score management table 32 as the score for that time. The score management table 32 is provided in the memory 23.

続いて、CPU30は、再び画像B上の特徴点からスタート点となる別の4点を仮想格子点として選ぶ(ステップS110のNo→S103)。そして、前記同様に、その4点を元に直線を引く操作と交点を求める操作を繰り返して仮想格子点を増やしていき、仮想格子点の数が格子点の数に達した時点で、仮想格子点と追跡点との距離に基づいて適合性を判断し、適合点として得られた数の総和を今回のスコアとしてスコア管理テーブル32に記録する(ステップS104〜S109)
以上の処理を所定回数繰り返す。
所定回数分のスコアが得られると(ステップS110のYes)、CPU30は、その中で最もスコアが高かった回の適合点を前記メモリ23の所定の領域から読み出し、その適合点の集合を用いて画像Aと画像Bの変換行列(射影変換の行列式)を計算する(ステップS111)。
Subsequently, the CPU 30 again selects another four points as start points from the feature points on the image B (No in step S110 → S103). Then, as described above, the number of virtual grid points is increased by repeating the operation of drawing a straight line based on the four points and the operation of obtaining intersection points, and when the number of virtual grid points reaches the number of grid points, The suitability is determined based on the distance between the points and the tracking points, and the sum of the numbers obtained as the fit points is recorded in the score management table 32 as the current score (steps S104 to S109).
The above process is repeated a predetermined number of times.
When the score for the predetermined number of times is obtained (Yes in step S110), the CPU 30 reads out the matching point of the times with the highest score from the predetermined area of the memory 23, and uses the set of matching points. A transformation matrix (determinant of projective transformation) between image A and image B is calculated (step S111).

図11の例では、5回までのスコアが記録されており、その中で最もスコアの高い2回目で抽出された適合点が変換に最適な点として選択されることになる。なお、変換行列の求め方については従来と同様であるため、ここではその説明を省略するものとする。   In the example of FIG. 11, scores up to five times are recorded, and the matching point extracted the second time with the highest score among them is selected as the optimum point for conversion. Note that the method for obtaining the transformation matrix is the same as in the prior art, and therefore the description thereof is omitted here.

このようにして変換行列が得られると、以後、CPU30は、その変換行列を用いて画像Aと画像Bを位置合わせてして、予め設定された撮影モードに従って、例えばパノラマ画像を生成したり、手振れを補正した画像を生成するなどの所定の画像処理を行う(ステップS112)。なお、この変換行列を用いた画像処理については公知であるため、ここでは、その詳しい説明は省略する。この画像処理によって得られた画像は、JPEG等の所定の方式で圧縮された後、例えばメモリカード31などに記録保存される。   After the conversion matrix is obtained in this way, the CPU 30 thereafter aligns the image A and the image B using the conversion matrix and generates, for example, a panoramic image according to a preset shooting mode, Predetermined image processing such as generating an image with corrected camera shake is performed (step S112). Since image processing using this transformation matrix is known, detailed description thereof will be omitted here. An image obtained by this image processing is compressed and stored in, for example, the memory card 31 after being compressed by a predetermined method such as JPEG.

このように、一定の制約の下で直線上に並んだ特徴点を選択し、その特徴点を元に「2点を通る直線を求める計算」と「2直線の交点座標を求める計算」を繰り返して、評価対象とする点を再帰的に求めていくことで、その中で適合性の高い点の集まりを用いて画像間の変換式を簡易に算出することが可能となる。したがって、従来のように仮の変換式を何度も繰り返し求める方法に比べて、計算量を大幅に削減でき、ハードウェア構成も簡素化して画像間の変換式を高速に求めることができる。   In this way, feature points arranged on a straight line under certain restrictions are selected, and “calculation for obtaining a straight line passing through two points” and “calculation for obtaining the intersection coordinates of two straight lines” are repeated based on the feature points. Thus, by recursively obtaining the points to be evaluated, it is possible to easily calculate a conversion formula between images using a collection of highly compatible points among them. Therefore, as compared with the conventional method of repeatedly obtaining a temporary conversion formula many times, the calculation amount can be greatly reduced, the hardware configuration can be simplified, and the conversion formula between images can be calculated at high speed.

また、このようにして得られた変換式をカメラの画像合成に適用することで、例えばパノラマ画像や手振れ補正した画像などを簡単に作成することができる。   In addition, by applying the conversion formula obtained in this way to the image composition of the camera, for example, a panoramic image, an image subjected to camera shake correction, and the like can be easily created.

(第2の実施形態)
次に、本発明の第2の実施形態について説明する。
(Second Embodiment)
Next, a second embodiment of the present invention will be described.

前記第1の実施形態では、画像A上の全特徴点に対して一括して追跡処理を行い、以後の処理は画像Bだけで行うようにしたが、第2の実施形態では、画像A上で特徴点を追加しながら、画像B上でその特徴点に対応させて評価点を追加するようにしものである。   In the first embodiment, all the feature points on the image A are collectively tracked, and the subsequent processing is performed only on the image B. In the second embodiment, on the image A, While adding feature points, the evaluation points are added in correspondence with the feature points on the image B.

なお、装置構成については、前記第1の実施形態と同様であるため、ここでは処理手順についてのみ説明する。   Since the apparatus configuration is the same as that of the first embodiment, only the processing procedure will be described here.

図12は第2の実施形態における画像間の位置合わせの処理手順を示すフローチャートである。なお、このフローチャートで示す各処理は、プログラムコードの形態でプログラムコード記憶装置29に記憶されている。コンピュータであるCPU30は、このプログラムを読み込むことにより、以下のような処理を実行する。   FIG. 12 is a flowchart showing a processing procedure for alignment between images in the second embodiment. Each process shown in this flowchart is stored in the program code storage device 29 in the form of a program code. CPU30 which is a computer performs the following processes by reading this program.

図12のフローチャートに示すように、CPU30は、連続した2つの画像Aと画像Bを取得する(ステップS300)。なお、この画像A,Bは、連続撮影などによってイメージセンサ22から直接取得することでも良いし、メモリカード31などを通じて外部から提供されるものであっても良い。画像Aは基準画像として、図3に示したメモリ23の第1のバッファ23aに格納され、画像Bは被追跡画像として、第2のバッファ23bに格納される。   As shown in the flowchart of FIG. 12, the CPU 30 acquires two consecutive images A and B (step S300). The images A and B may be acquired directly from the image sensor 22 by continuous shooting or the like, or may be provided from the outside through the memory card 31 or the like. The image A is stored as a reference image in the first buffer 23a of the memory 23 shown in FIG. 3, and the image B is stored as a tracked image in the second buffer 23b.

画像Aと画像Bが得られると、まず、図5で説明したように、CPU30は、基準画像である画像A上の特徴点から一定の制約の下に直線上に並んだ2点を2組、合わせて4点を選ぶ(ステップS301)。この4点は、図6(a)に示した点a,b,c,dに相当し、四角形(画像A上では矩形)の頂点をなす。   When the images A and B are obtained, first, as described with reference to FIG. 5, the CPU 30 sets two sets of two points arranged on a straight line from the feature points on the image A, which is the reference image, under a certain restriction. In total, four points are selected (step S301). These four points correspond to the points a, b, c, and d shown in FIG. 6A, and form vertices of a quadrangle (rectangle on the image A).

続いて、CPU30は、画像A上の4点に対応する画像B上の4点をブロックマッチングまたは勾配法などを用いて追跡する(ステップS302)。この場合、画像Bはカメラの回転などによって歪んでいる可能性があるため、追跡処理によって得られた画像B上の4点は矩形になるとは限らない。   Subsequently, the CPU 30 tracks four points on the image B corresponding to the four points on the image A using block matching or a gradient method (step S302). In this case, since the image B may be distorted due to the rotation of the camera or the like, the four points on the image B obtained by the tracking process are not necessarily rectangular.

ここで、画像Aに対し、CPU30は、前記ステップS301で選んだ4点の組み元に、直線を引く操作と交点を求める操作を繰り返すことにより、特徴点を追加していく(ステップS303)。なお、この追加処理については図10と同様である。すなわち、画像A上で、ステップS301で得られた4点を元に内点、境界点、外点を求めていく。   Here, with respect to the image A, the CPU 30 adds feature points by repeating the operation of drawing a straight line and the operation of obtaining an intersection point in the group of four points selected in step S301 (step S303). This addition process is the same as in FIG. That is, on the image A, the inner point, the boundary point, and the outer point are obtained based on the four points obtained in step S301.

画像Bについても同様であり、CPU30は、ステップS302の追跡処理で得られた4点を元に直線を引く操作と交点を求める操作を繰り返すことにより、評価点を追加していく(ステップS306)。なお、「評価点」とは、前記第1の実施形態で説明した「仮想格子点」と同様の意味であり、画像Aの特徴点から変換Hによって画像Bに移される点のことである。   The same applies to the image B, and the CPU 30 adds evaluation points by repeating an operation of drawing a straight line based on the four points obtained in the tracking process of step S302 and an operation of obtaining an intersection (step S306). . The “evaluation point” has the same meaning as the “virtual grid point” described in the first embodiment, and is a point that is transferred from the feature point of the image A to the image B by the transformation H.

さらに、CPU30は、画像Aから前の処理で追加された点から四角形(画像Aでは矩形)の頂点をなす4点を新たに選び(ステップS305)、その4点を元に前記同様の処理を繰り返して特徴点を順次追加していく(ステップS303)。画像Bについても同様であり、画像Bから前の処理で追加された点から四角形の頂点をなす4点を新たに選び(ステップS308)、前記同様の処理を繰り返して評価値を順次追加していく(ステップS306)。   Further, the CPU 30 newly selects four points forming the vertices of a rectangle (rectangle in the image A) from the points added in the previous process from the image A (step S305), and performs the same process as described above based on the four points. The feature points are sequentially added repeatedly (step S303). The same applies to the image B. Four points that form a rectangular vertex are newly selected from the points added in the previous process from the image B (step S308), and the evaluation values are sequentially added by repeating the same process. (Step S306).

なお、ステップS305の処理とステップS308の処理はリンクしており、画像A上で新たな4点を選んだ場合に、当然のことながら、画像B上では、その画像A上の4点と対応関係にある4点を選ぶことになる。   Note that the processing in step S305 and the processing in step S308 are linked so that when four new points are selected on the image A, it naturally corresponds to the four points on the image A on the image B. You will choose 4 points that are related.

画像A、B上で追加された点がそれぞれに所定数に達すると(ステップS304のYes,ステップS307のYes)、ここでのループが終了する。この場合、最終的に画像A上の特徴点のすべてを選び出すまで、追加処理を繰り返しても良いし、予め決められた数に達した時点で終了しても良い。精度を求めるのであれば、特徴点のすべてを選び出すまで、追加処理を繰り返すことが好ましい。   When the number of points added on the images A and B reaches a predetermined number (Yes in step S304, Yes in step S307), the loop here ends. In this case, the addition process may be repeated until all the feature points on the image A are finally selected, or may be terminated when a predetermined number is reached. If accuracy is desired, it is preferable to repeat the additional process until all the feature points are selected.

次に、CPU30は、画像A上の特徴点に対応する画像B上の特徴点を追跡する(ステップS309)。そして、CPU30は、画像B上で、それぞれに対応する評価点と追跡点との距離を計算する(ステップS310)。つまり、画像Aの各特徴点から変換Hによって画像Bに移される各点(第2のループで得られる各点)と、画像Aの各特徴点(第1のループで得られる各点)からステップS309の追跡処理で求められた各点とを比較して、両者間の位置ずれを求める。なお、第1のループとはステップS303〜S305の繰り返し処理、第2のループとはステップS306〜S308の繰り返し処理のことを示す。   Next, the CPU 30 tracks the feature points on the image B corresponding to the feature points on the image A (step S309). Then, the CPU 30 calculates the distance between the corresponding evaluation point and the tracking point on the image B (step S310). That is, from each point transferred to the image B by transformation H from each feature point of the image A (each point obtained in the second loop) and each feature point of the image A (each point obtained in the first loop). Each point obtained by the tracking process in step S309 is compared, and a positional deviation between them is obtained. Note that the first loop indicates the repetition process of steps S303 to S305, and the second loop indicates the repetition process of steps S306 to S308.

そして、CPU30は、両者の距離が所定値以下であった場合、つまり、評価点と追跡点との位置ずれが許容範囲内であれば、そのときの追跡点を適合点と判断し、その座標をメモリ23の所定の領域に記録しておくと共に(ステップS311)、そのときに得られた適合点の総和を今回のスコアとして求め、図11に示すスコア管理テーブル32に記録する(ステップS312)。   Then, when the distance between the two is equal to or less than the predetermined value, that is, when the positional deviation between the evaluation point and the tracking point is within an allowable range, the CPU 30 determines that the tracking point at that time is a matching point, and coordinates thereof Is recorded in a predetermined area of the memory 23 (step S311), and the sum of the matching points obtained at that time is obtained as the current score and recorded in the score management table 32 shown in FIG. 11 (step S312). .

続いて、CPU30は、再び画像Aからスタート点となる別の4点を選び(ステップS313のNo→301)、その4点に対応する画像B上の4点を追跡する(ステップS302)。そして、前記同様に、画像A上で、その4点を元に直線を引く操作と交点を求める操作を繰り返して特徴点を増やしていく(ステップS303〜S305)。画像Bについても同様であり、画像Aで選んだ4点に対応した4点を元に直線を引く操作と交点を求める操作を繰り返しながら、評価点を増やしていく(ステップS306〜S307)。   Subsequently, the CPU 30 again selects another four points as the start points from the image A (No in step S313) and tracks the four points on the image B corresponding to the four points (step S302). Then, in the same manner as described above, feature points are increased by repeating an operation of drawing a straight line based on the four points and an operation of obtaining an intersection point on the image A (steps S303 to S305). The same applies to the image B, and the evaluation points are increased while repeating the operation of drawing a straight line based on the four points corresponding to the four points selected in the image A and the operation of obtaining the intersection (steps S306 to S307).

そして、CPU30は、画像A上の特徴点に対応する画像B上の特徴点を追跡し、前記同様に、画像B上で評価値と追跡点との距離に基づいて適合性を判断し、適合点として得られた数の総和を今回のスコアとしてスコア管理テーブル32に記録する(ステップS309〜S312)
以上の処理を所定回数繰り返す。
Then, the CPU 30 tracks the feature point on the image B corresponding to the feature point on the image A, and determines the suitability based on the distance between the evaluation value and the tracking point on the image B, as described above. The sum of the numbers obtained as points is recorded in the score management table 32 as the current score (steps S309 to S312).
The above process is repeated a predetermined number of times.

所定回数分のスコアが得られると(ステップS313のYes)、CPU30は、その中で最もスコアが高かった回の適合点を前記メモリ23の所定の領域から読み出し、その適合点の集合を用いて画像Aと画像Bの変換行列(射影変換の行列式)を計算する(ステップS314)。   When the score for the predetermined number of times is obtained (Yes in step S313), the CPU 30 reads out the matching point of the times with the highest score from the predetermined area of the memory 23, and uses the set of the matching points. A transformation matrix (projection transformation determinant) between the images A and B is calculated (step S314).

このようにして変換行列が得られると、以後、CPU30は、前記変換行列を用いて画像Aと画像Bを位置合わせてして、予め設定された撮影モードに従って、例えばパノラマ画像を生成したり、手振れを補正した画像を生成するなどの所定の画像処理を行う(ステップS315)。   When the conversion matrix is obtained in this way, thereafter, the CPU 30 aligns the image A and the image B using the conversion matrix and generates, for example, a panoramic image according to a preset shooting mode, Predetermined image processing such as generation of an image with corrected camera shake is performed (step S315).

このように、画像A上で特徴点を追加しながら、画像B上でその特徴点に対応させて評価点を追加するような方法であっても、前記第1の実施形態と同様の効果を得ることができる。   As described above, even when a method for adding an evaluation point corresponding to a feature point on the image B while adding a feature point on the image A, the same effect as that of the first embodiment is obtained. Obtainable.

なお、本発明の用途はRANSACに限定されない。例えば、特殊なマーカを用いるなどして絶対に信頼できる4点があった時に、その他の誤りを含む対応点の中からアウトライアを高速に除去する場合にも使える。   The application of the present invention is not limited to RANSAC. For example, when there are four absolutely reliable points by using a special marker or the like, it can also be used when the outlier is removed from corresponding points including other errors at high speed.

また、前記各実施形態では、デジタルカメラに例にして説明したが、デジタルカメラの他に、例えばパーソナルコンピュータなど、画像を扱える装置であれば、そのすべてに適用可能である。この場合、図2に示すように、デジタルカメラ1とPC40とを接続し、デジタルカメラ1で連続撮影された各画像をPC40に転送し、PC40側で図9および図10に示したような処理を実行するといった構成にしても良い。   In each of the above-described embodiments, the digital camera has been described as an example. However, in addition to the digital camera, the present invention can be applied to any apparatus that can handle images, such as a personal computer. In this case, as shown in FIG. 2, the digital camera 1 and the PC 40 are connected, and each image continuously taken by the digital camera 1 is transferred to the PC 40, and processing as shown in FIGS. 9 and 10 is performed on the PC 40 side. May be configured to execute.

要するに、本発明は前記各実施形態そのままに限定されるものではなく、実施段階ではその要旨を逸脱しない範囲で構成要素を変形して具体化できる。また、前記各実施形態に開示されている複数の構成要素の適宜な組み合わせにより、種々の発明を形成できる。例えば、実施形態に示される全構成要素から幾つかの構成要素を削除してもよい。さらに、異なる実施形態にわたる構成要素を適宜組み合わせてもよい。   In short, the present invention is not limited to the above-described embodiments as they are, and can be embodied by modifying constituent elements without departing from the scope of the invention in the implementation stage. Various inventions can be formed by appropriately combining a plurality of constituent elements disclosed in the respective embodiments. For example, some components may be deleted from all the components shown in the embodiment. Furthermore, constituent elements over different embodiments may be appropriately combined.

また、上述した各実施形態において記載した手法は、コンピュータに実行させることのできるプログラムとして、例えば磁気ディスク(フレキシブルディスク、ハードディスク等)、光ディスク(CD−ROM、DVD等)、半導体メモリなどの記録媒体に書き込んで各種装置に適用したり、通信媒体により伝送して各種装置に適用することも可能である。本装置を実現するコンピュータは、記録媒体に記録されたプログラムを読み込み、このプログラムによって動作が制御されることにより、上述した処理を実行する。   In addition, the methods described in each of the above-described embodiments are, as programs that can be executed by a computer, recording media such as magnetic disks (flexible disks, hard disks, etc.), optical disks (CD-ROM, DVD, etc.), semiconductor memories, etc. Can be applied to various devices, or transmitted by a communication medium and applied to various devices. A computer that implements this apparatus reads the program recorded on the recording medium, and executes the above-described processing by controlling the operation by this program.

図1は本発明の第1の実施形態に係る画像処理装置をデジタルカメラに適用した場合の外観構成を示す図であり、図1(a)は主に前面の構成、同図(b)は主に背面の構成を示す斜視図である。FIG. 1 is a diagram showing an external configuration when the image processing apparatus according to the first embodiment of the present invention is applied to a digital camera. FIG. 1 (a) is mainly a front configuration, and FIG. It is a perspective view which mainly shows the structure of a back surface. 図2は同実施形態におけるデジタルカメラの電子回路構成を示すブロック図である。FIG. 2 is a block diagram showing an electronic circuit configuration of the digital camera in the embodiment. 図3は同実施形態におけるデジタルカメラのCPUの機能構成を示すブロック図である。FIG. 3 is a block diagram showing a functional configuration of the CPU of the digital camera in the embodiment. 図4は同実施形態におけるデジタルカメラの処理対象とする2つの連続した画像の一例を示す図である。FIG. 4 is a diagram showing an example of two consecutive images to be processed by the digital camera in the embodiment. 図5は同実施形態における基準平面における特徴点の部分集合の抽出例を示す図である。FIG. 5 is a diagram showing an example of extracting a subset of feature points on the reference plane in the embodiment. 図6は同実施形態における内点の変換座標の導出方法を説明するための図である。FIG. 6 is a diagram for explaining a method for deriving the transformation coordinates of the inner point in the embodiment. 図7は同実施形態における境界点の変換座標の導出方法を説明するための図である。FIG. 7 is a diagram for explaining a method for deriving the conversion coordinates of the boundary points in the embodiment. 図8は同実施形態における外点の変換座標の導出方法を説明するための図である。FIG. 8 is a diagram for explaining a method for deriving the transformation coordinates of the outer points in the same embodiment. 図9は同実施形態における画像間の位置合わせの処理手順を示すフローチャートである。FIG. 9 is a flowchart showing a processing procedure for alignment between images in the embodiment. 図10は同実施形態における評価対象追加処理を示すフローチャートである。FIG. 10 is a flowchart showing an evaluation object addition process in the embodiment. 図11は同実施形態におけるすスコア管理テーブルの一例を示す図である。FIG. 11 is a diagram showing an example of a soot score management table in the embodiment. 図12は本発明の第2の実施形態における画像間の位置合わせの処理手順を示すフローチャートである。FIG. 12 is a flowchart showing a processing procedure for alignment between images in the second embodiment of the present invention. 図13は従来方式による画像間の位置合わせの処理手順を示すフローチャートである。FIG. 13 is a flowchart showing a processing procedure for registration between images according to the conventional method.

符号の説明Explanation of symbols

1…デジタルカメラ、2…ボディ、3…撮影レンズ、4…セルフタイマランプ、5…光学ファインダ窓、6…ストロボ発光部、7…マイクロホン部、8…電源キー、9…シャッタキー、10…撮影モード(R)キー、11…再生モード(P)キー、12…光学ファインダ、13…スピーカ部、14…マクロキー、15…ストロボキー、16…メニュー(MENU)キー、17…リングキー、18…セット(SET)キー、19…表示部、21…光学レンズ装置、22…イメージセンサ、23…メモリ、24…表示装置、25…画像処理装置、26…操作部、27…コンピュータインタフェース部、28…外部記憶IO装置、29…プログラムコード記憶装置、30…CPU、30a…画像取得部、30b…特徴点選択部、30c…追跡部、30d…評価点生成部、30d−1…第1の追加処理部、30d−2…第2の追加処理部、30d−3…第3の追加処理部、30e…評価部、30f…変換式算出部、30g…画像処理部、31…メモリカード、32…スコア管理テーブル、40…PC。   DESCRIPTION OF SYMBOLS 1 ... Digital camera, 2 ... Body, 3 ... Shooting lens, 4 ... Self-timer lamp, 5 ... Optical finder window, 6 ... Strobe light emission part, 7 ... Microphone part, 8 ... Power key, 9 ... Shutter key, 10 ... Photographing Mode (R) key, 11 ... Playback mode (P) key, 12 ... Optical viewfinder, 13 ... Speaker section, 14 ... Macro key, 15 ... Strobe key, 16 ... Menu (MENU) key, 17 ... Ring key, 18 ... SET (SET) key, 19 ... display unit, 21 ... optical lens device, 22 ... image sensor, 23 ... memory, 24 ... display device, 25 ... image processing device, 26 ... operation unit, 27 ... computer interface unit, 28 ... External storage IO device 29 ... Program code storage device 30 ... CPU 30a ... Image acquisition unit 30b ... Feature point selection unit 30c ... Tracking unit 3 d ... Evaluation point generation unit, 30d-1 ... First addition processing unit, 30d-2 ... Second addition processing unit, 30d-3 ... Third addition processing unit, 30e ... Evaluation unit, 30f ... Conversion formula calculation Part, 30g ... image processing part, 31 ... memory card, 32 ... score management table, 40 ... PC.

Claims (6)

少なくとも2つの画像を取得する画像取得手段と、
この画像取得手段によって得られた第1の画像から格子状の特徴点を選択する特徴点選択手段と、
この特徴点選択手段によって選択された特徴点を第2の画像上で追跡する追跡手段と、
この追跡手段によって追跡された各特徴点の中から任意の4点を選び、この4点を元に、直線を引く操作と交点を求める操作を前記第2の画像上で繰り返すことにより、評価点を追加していく評価点生成手段と、
この評価点生成手段によって生成された各評価点と前記第2の画像上で追跡された各特徴点との適合性を評価する評価手段と、
この評価手段によって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する変換式算出手段と
を具備したことを特徴とする画像処理装置。
Image acquisition means for acquiring at least two images;
Feature point selection means for selecting grid-like feature points from the first image obtained by the image acquisition means;
Tracking means for tracking the feature point selected by the feature point selection means on the second image;
By selecting arbitrary four points from each feature point tracked by the tracking means and repeating the operation for drawing a straight line and the operation for obtaining the intersection point on the second image based on the four points, the evaluation point is obtained. An evaluation point generating means for adding
Evaluation means for evaluating the suitability between each evaluation point generated by the evaluation point generation means and each feature point tracked on the second image;
An image processing apparatus comprising: a conversion formula calculation unit that calculates a conversion formula between images using a set of points having the highest compatibility by the evaluation unit.
前記評価点生成手段は、前記追跡手段によって追加された点から四角形の頂点をなす4点を新たに選び、その4点を元に前記同様の処理を繰り返して評価点として再帰的に生成することを特徴とする請求項1記載の画像処理装置。 The evaluation point generating means newly selects four points forming a quadrangle from the points added by the tracking means, and repeats the same processing based on the four points to generate recursively as evaluation points. The image processing apparatus according to claim 1. 前記評価点生成手段は、
前記四角形の頂点をなす4点から前記四角形の内点を求める第1の追加処理手段と、
この第1の追加処理手段によって得られた内点と前記四角形の辺との交点である境界点を求める第2の追加処理手段と、
この第2の追加処理手段によって得られた境界点と前記四角形の頂点との延長線と前四角形の辺の延長線との交点である外点を求める第3の追加処理手段とを備え、
前記各追加処理手段によって得られた内点、境界点、外点を評価点として追加することを特徴とする請求項2記載の画像処理装置。
The evaluation point generating means includes
First additional processing means for obtaining an inner point of the rectangle from four points forming the vertex of the rectangle;
Second additional processing means for obtaining a boundary point that is an intersection of the inner point obtained by the first additional processing means and the sides of the rectangle;
A third additional processing means for obtaining an outer point that is an intersection of an extension line between the boundary point obtained by the second additional processing means and the vertex of the rectangle and an extension line of the side of the previous square;
The image processing apparatus according to claim 2, wherein an inner point, a boundary point, and an outer point obtained by each of the additional processing means are added as evaluation points.
前記変換式算出手段によって得られた変換式に基づいて前記第1の画像と前記第2の画像を位置合わせてして所定の画像を生成する画像処理手段と
をさらに具備したことを特徴とする請求項1記載の画像処理装置。
Image processing means for generating a predetermined image by aligning the first image and the second image based on the conversion formula obtained by the conversion formula calculation means. The image processing apparatus according to claim 1.
少なくとも2つの画像を取得する第1のステップと、
この第1のステップによって得られた第1の画像から格子状の特徴点を選択する第2のステップと、
この第2のステップによって選択された特徴点を第2の画像上で追跡する第3のステップと、
この第3のステップによって追跡された各特徴点の中から任意の4点を選び、この4点を元に、直線を引く操作と交点を求める操作を前記第2の画像上で繰り返すことにより、評価点を追加していく第4のステップと、
この第4のステップによって生成された各評価点と前記第2の画像上で追跡された各特徴点との適合性を評価する第5のステップと、
この第5のステップによって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する第6のステップと
を備えたことを特徴とする画像変換方法。
A first step of acquiring at least two images;
A second step of selecting grid-like feature points from the first image obtained by the first step;
A third step of tracking on the second image the feature points selected by this second step;
By selecting arbitrary four points from each feature point tracked in the third step, and repeating the operation of drawing a straight line and the operation of obtaining an intersection point on the second image based on the four points, A fourth step of adding evaluation points ;
A fifth step of evaluating the suitability between each evaluation point generated by the fourth step and each feature point tracked on the second image;
An image conversion method comprising: a sixth step of calculating a conversion formula between images using a set of points having the highest compatibility in the fifth step.
コンピュータによって読み取り可能な記録媒体に記録されたプログラムであって、
前記コンピュータに、
少なくとも2つの画像を取得する第1の機能と、
この第1の機能によって得られた第1の画像から格子状の特徴点を選択する第2の機能と、
この第2の機能によって選択された特徴点を第2の画像上で追跡する第3の機能と、
この第3の機能によって追跡された各特徴点の中から任意の4点を選び、この4点を元に、直線を引く操作と交点を求める操作を前記第2の画像上で繰り返すことにより、評価点を追加していく第4の機能と、
この第4の機能によって生成された各評価点と前記第2の画像上で追跡された各特徴点との適合性を評価する第5の機能と、
この第5の機能によって最も適合性の高かった点の集まりを用いて画像間の変換式を算出する第6の機能と
を実現させることを特徴とするプログラム。
A program recorded on a computer-readable recording medium,
In the computer,
A first function for acquiring at least two images;
A second function of selecting grid-like feature points from the first image obtained by the first function;
A third function for tracking the feature point selected by the second function on the second image;
By selecting arbitrary four points from each feature point tracked by the third function, and repeating the operation for drawing a straight line and the operation for obtaining the intersection point on the second image based on the four points, A fourth function for adding evaluation points ,
A fifth function for evaluating suitability between each evaluation point generated by the fourth function and each feature point tracked on the second image;
A program for realizing a sixth function for calculating a conversion formula between images using a set of points having the highest compatibility by the fifth function.
JP2007121147A 2007-05-01 2007-05-01 Image processing apparatus, image conversion method, and program Active JP4952363B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007121147A JP4952363B2 (en) 2007-05-01 2007-05-01 Image processing apparatus, image conversion method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007121147A JP4952363B2 (en) 2007-05-01 2007-05-01 Image processing apparatus, image conversion method, and program

Publications (2)

Publication Number Publication Date
JP2008276621A JP2008276621A (en) 2008-11-13
JP4952363B2 true JP4952363B2 (en) 2012-06-13

Family

ID=40054479

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007121147A Active JP4952363B2 (en) 2007-05-01 2007-05-01 Image processing apparatus, image conversion method, and program

Country Status (1)

Country Link
JP (1) JP4952363B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5499261B2 (en) * 2009-07-16 2014-05-21 日本信号株式会社 Image processing device
JP6536169B2 (en) * 2015-05-21 2019-07-03 カシオ計算機株式会社 Image processing apparatus, image processing method and program
JP6528540B2 (en) * 2015-05-28 2019-06-12 カシオ計算機株式会社 Image processing apparatus, image processing method and program
JP6677980B2 (en) * 2015-07-07 2020-04-08 Kddi株式会社 Panorama video data processing device, processing method and processing program
JP6558803B2 (en) * 2016-03-23 2019-08-14 Kddi株式会社 Geometric verification apparatus and program

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3889650B2 (en) * 2002-03-28 2007-03-07 三洋電機株式会社 Image processing method, image processing apparatus, computer program, and recording medium
JP5011504B2 (en) * 2005-07-22 2012-08-29 カシオ計算機株式会社 Image composition apparatus, image composition method, and program

Also Published As

Publication number Publication date
JP2008276621A (en) 2008-11-13

Similar Documents

Publication Publication Date Title
JP5035372B2 (en) 3D modeling apparatus, 3D modeling method, and program
JP4341629B2 (en) Imaging apparatus, image processing method, and program
CN105144687B (en) Image processing apparatus, image processing method and computer-readable medium
JP4952363B2 (en) Image processing apparatus, image conversion method, and program
CN102202180A (en) Imaging apparatus
CN102739962A (en) Image processing device capable of generating wide-range image
KR101204888B1 (en) Digital photographing apparatus, method for controlling the same, and recording medium storing program to implement the method
CN101729788A (en) Image-taking apparatus, image-taking region displaying method, and image-taking region displaying program
CN102739961A (en) Image processing device capable of generating wide-range image
JP4640032B2 (en) Image composition apparatus, image composition method, and program
JP2010211255A (en) Imaging apparatus, image processing method, and program
JP4110560B2 (en) Image processing method and apparatus
JP5011504B2 (en) Image composition apparatus, image composition method, and program
CN102263894A (en) Imaging apparatus
JP2003179798A (en) Digital camera
JP4609315B2 (en) Imaging device, method of displaying angle frame at zoom, and program
JP2008065530A (en) Image processor and program
JP5146575B2 (en) Image processing apparatus and program
JP5703771B2 (en) Imaging assistance device, imaging assistance method, and program
JP2016134686A (en) Imaging apparatus and imaging method
JP2005275765A (en) Image processor, image processing method, image processing program and recording medium recording the program
JP4458720B2 (en) Image input apparatus and program
JP2006245921A (en) Imaging device and system, mobile telephone, control method, and program
JP2008306284A (en) Photographing apparatus, display method and program
JP4924149B2 (en) Image processing apparatus and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100419

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20110905

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110927

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20111111

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20120214

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120227

R150 Certificate of patent or registration of utility model

Ref document number: 4952363

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150323

Year of fee payment: 3