JP6582618B2 - Template matching program, template matching method, and template matching apparatus - Google Patents

Template matching program, template matching method, and template matching apparatus Download PDF

Info

Publication number
JP6582618B2
JP6582618B2 JP2015130252A JP2015130252A JP6582618B2 JP 6582618 B2 JP6582618 B2 JP 6582618B2 JP 2015130252 A JP2015130252 A JP 2015130252A JP 2015130252 A JP2015130252 A JP 2015130252A JP 6582618 B2 JP6582618 B2 JP 6582618B2
Authority
JP
Japan
Prior art keywords
image
pixel
scale
captured image
template matching
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
JP2015130252A
Other languages
Japanese (ja)
Other versions
JP2017016266A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu 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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2015130252A priority Critical patent/JP6582618B2/en
Publication of JP2017016266A publication Critical patent/JP2017016266A/en
Application granted granted Critical
Publication of JP6582618B2 publication Critical patent/JP6582618B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、テンプレートマッチングプログラム等に関する。   The present invention relates to a template matching program and the like.

従来、対象物を撮影して、撮影された画像から人手を介さずに対象物の検出を行う技術が広く使われている.例えば、道路を走行する車を撮影した画像からの車番の検出が挙げられる。検出結果を利用することで、監視員への車番表示や文字認識手段と組み合わせた車番の自動認識が可能となる。また、人を検出することで、建物への侵入者検知も行うことができる。これらの用途では、検出処理はリアルタイムに行われるため、処理の高速性が重要となる。   Conventionally, a technique for photographing an object and detecting the object from the photographed image without human intervention has been widely used. For example, detection of a car number from an image obtained by photographing a car traveling on a road can be mentioned. By using the detection result, it is possible to automatically recognize the vehicle number in combination with the vehicle number display to the monitoring staff and the character recognition means. Moreover, the intruder detection to a building can also be performed by detecting a person. In these applications, since the detection process is performed in real time, the high speed of the process is important.

対象物の検出を行う基本的な手法として、テンプレートマッチングがある。テンプレートマッチングにおいては、あらかじめ対象物を表すテンプレートを用意しておき、撮影した画像上でそのテンプレートを走査してテンプレートとの類似性が高い箇所を対象物と判定する。外光等の影響を受けにくくするため、画像そのものではなく、画像から特徴を抽出してマッチングを行うことが多い。特徴抽出には例えばエッジ抽出等のフィルタが用いられる。また、対象物は画像内で様々な大きさで写るので、例えば、テンプレートや画像の縮尺を様々に変更して繰り返しマッチングが行われる。   There is a template matching as a basic method for detecting an object. In template matching, a template representing an object is prepared in advance, and the template is scanned on the photographed image to determine a portion having high similarity to the template as the object. In order to reduce the influence of external light or the like, matching is often performed by extracting features from the image, not the image itself. For feature extraction, for example, a filter such as edge extraction is used. In addition, since the object is captured in various sizes in the image, for example, the matching is repeatedly performed by changing the scale of the template or the image in various ways.

特開2009−199575号公報JP 2009-199575 A

しかしながら、上述した従来技術では、テンプレートや画像の縮尺を様々に変えてマッチングを行うため、処理量が増えるという問題がある。   However, the above-described conventional technique has a problem that the amount of processing increases because matching is performed by changing the scale of the template or image in various ways.

1つの側面では、本発明は、テンプレートや画像の縮尺を様々に変えることなくマッチングを行うことができるテンプレートマッチングプログラム、テンプレートマッチング方法およびテンプレートマッチング装置を提供することを目的とする。   In one aspect, an object of the present invention is to provide a template matching program, a template matching method, and a template matching apparatus that can perform matching without changing the scale of a template or an image in various ways.

第1の案では、テンプレートマッチングプログラムは、コンピュータに下記の処理を実行させる。コンピュータは、同一形状の複数の物体が撮影された撮影画像を取得する。コンピュータは、撮影画像に含まれる複数の物体に対する基準点の位置を受け付け、物体の基準点の間隔に基づいて、撮影画像の各画素における縮尺を算出する。コンピュータは、撮影画像の各画素における縮尺を基にして、撮影画像を、各画素における縮尺が一定となる補正画像に変換する。コンピュータは、補正画像に対してテンプレートマッチングを実行することで対象物を検出する。   In the first plan, the template matching program causes the computer to execute the following processing. The computer acquires captured images obtained by capturing a plurality of objects having the same shape. The computer receives the positions of the reference points for a plurality of objects included in the captured image, and calculates the scale of each pixel of the captured image based on the interval between the reference points of the objects. The computer converts the photographed image into a corrected image in which the scale of each pixel is constant based on the scale of each pixel of the photographed image. The computer detects an object by executing template matching on the corrected image.

テンプレートや画像の縮尺を様々に変えることなくマッチングを行うことができる。   Matching can be performed without changing the scale of the template or image.

図1は、本実施例1にかかるシステムの構成を示す図である。FIG. 1 is a diagram illustrating the configuration of the system according to the first embodiment. 図2は、本実施例1にかかる画像処理装置の構成を示す機能ブロック図である。FIG. 2 is a functional block diagram of the configuration of the image processing apparatus according to the first embodiment. 図3は、撮影画像の一例を示す図(1)である。FIG. 3 is a diagram (1) illustrating an example of a captured image. 図4は、撮影画像の一例を示す図(2)である。FIG. 4 is a diagram (2) illustrating an example of a captured image. 図5は、本実施例1にかかる基準点の位置を説明するための図である。FIG. 5 is a diagram for explaining the positions of the reference points according to the first embodiment. 図6は、本実施例1にかかる座標値テーブルのデータ構造の一例を示す図である。FIG. 6 is a diagram illustrating an example of the data structure of the coordinate value table according to the first embodiment. 図7は、本実施例1にかかる縮尺テーブルの一例を示す図である。FIG. 7 is a diagram illustrating an example of a scale table according to the first embodiment. 図8は、各画素の縮尺の算出例を示す図である。FIG. 8 is a diagram illustrating a calculation example of the scale of each pixel. 図9は、本実施例1にかかるデータ加算処理を説明するための図(1)である。FIG. 9 is a diagram (1) for explaining the data addition processing according to the first embodiment. 図10は、本実施例1にかかるデータ加算処理を説明するための図(2)である。FIG. 10 is a diagram (2) for explaining the data addition processing according to the first embodiment. 図11は、本実施例1にかかるデータ加算処理を説明するための図(3)である。FIG. 11 is a diagram (3) for explaining the data addition processing according to the first embodiment. 図12は、本実施例1にかかる補正パラメータのデータ構造の一例を示す図である。FIG. 12 is a diagram illustrating an example of the data structure of the correction parameter according to the first embodiment. 図13は、補正画像の一例を示す図である。FIG. 13 is a diagram illustrating an example of a corrected image. 図14は、検出結果の一例を示す図である。FIG. 14 is a diagram illustrating an example of the detection result. 図15は、校正時の画像処理装置の処理手順を示すフローチャートである。FIG. 15 is a flowchart showing a processing procedure of the image processing apparatus at the time of calibration. 図16は、検出時の画像処理装置の処理手順を示すフローチャートである。FIG. 16 is a flowchart illustrating a processing procedure of the image processing apparatus at the time of detection. 図17は、本実施例1にかかる画像処理装置の効果を説明するための図である。FIG. 17 is a diagram for explaining the effect of the image processing apparatus according to the first embodiment. 図18は、本実施例2にかかる画像処理装置の構成を示す機能ブロック図である。FIG. 18 is a functional block diagram of the configuration of the image processing apparatus according to the second embodiment. 図19は、本実施例2にかかる基準点位置を説明するための図である。FIG. 19 is a diagram for explaining the reference point positions according to the second embodiment. 図20は、本実施例2にかかる座標値テーブルのデータ構造の一例を示す図である。FIG. 20 is a diagram illustrating an example of the data structure of the coordinate value table according to the second embodiment. 図21は、各画素の線形変換パラメータの算出例を示す図である。FIG. 21 is a diagram illustrating a calculation example of the linear conversion parameter of each pixel. 図22は、本実施例2にかかるデータ加算処理を説明するための図である。FIG. 22 is a diagram for explaining the data addition processing according to the second embodiment. 図23は、本実施例3にかかる画像処理装置の構成を示す機能ブロック図である。FIG. 23 is a functional block diagram of the configuration of the image processing apparatus according to the third embodiment. 図24は、本実施例4にかかる画像処理装置の構成を示す機能ブロック図である。FIG. 24 is a functional block diagram of the configuration of the image processing apparatus according to the fourth embodiment. 図25は、本実施例4にかかる補正パラメータのデータ構造の一例を示す図である。FIG. 25 is a diagram illustrating an example of the data structure of the correction parameter according to the fourth embodiment. 図26は、画像処理プログラムを実行するコンピュータの一例を示す図である。FIG. 26 is a diagram illustrating an example of a computer that executes an image processing program.

以下に、本願の開示するテンプレートマッチングプログラム、テンプレートマッチング方法およびテンプレートマッチング装置の実施例を図面に基づいて詳細に説明する。なお、この実施例によりこの発明が限定されるものではない。   Hereinafter, embodiments of a template matching program, a template matching method, and a template matching apparatus disclosed in the present application will be described in detail with reference to the drawings. Note that the present invention is not limited to the embodiments.

図1は、本実施例1にかかるシステムの構成を示す図である。図1に示すように、このシステムは、カメラ50および画像処理装置100を有する。画像処理装置100は、テンプレートマッチング装置の一例である。   FIG. 1 is a diagram illustrating the configuration of the system according to the first embodiment. As shown in FIG. 1, this system includes a camera 50 and an image processing apparatus 100. The image processing apparatus 100 is an example of a template matching apparatus.

カメラ50は、例えば、建物の天井に設置され、広角レンズによって撮影範囲の画像を撮影する装置である。例えば、カメラ50は、防犯カメラに対応するが、これに限定されるものではない。カメラ50は、撮影した画像の情報を、画像処理装置100に送信する。以下の説明において、カメラ50によって撮影された画像の情報を適宜、撮影画像と表記する。   The camera 50 is, for example, a device that is installed on the ceiling of a building and shoots an image in the shooting range with a wide-angle lens. For example, the camera 50 corresponds to a security camera, but is not limited thereto. The camera 50 transmits information on the captured image to the image processing apparatus 100. In the following description, information on an image photographed by the camera 50 is appropriately referred to as a photographed image.

画像処理装置100は、テンプレートマッチングを実行して、撮影画像から対象物を検出する装置である。例えば、画像処理装置100は、対象物を検出した場合には、警報等を出力しても良い。   The image processing apparatus 100 is an apparatus that detects an object from a captured image by executing template matching. For example, the image processing apparatus 100 may output an alarm or the like when an object is detected.

ここで、カメラ50が撮影した撮影画像は、広角レンズで撮影されているため、同じ対象物であっても、例えば、撮影画像の上側よりも、撮影画像の下側で対象物が大きくなる場合がある。このため、画像処理装置100は、予め撮影画像の画素毎にそこに対象物が写るときの縮尺を調べておき、各位置での対象物の大きさの違いを打ち消すように、撮影画像を拡大補正してからテンプレートマッチングを実行する。例えば、画像処理装置100は、画像の各画素での補正すべき縮尺を読み込み、読み込んだ縮尺が一定となるように、撮影画像を補正することで補正画像を生成し、補正画像から特徴点を抽出してテンプレートマッチングを実行する。   Here, since the captured image captured by the camera 50 is captured with a wide-angle lens, even if the captured object is the same object, for example, the object on the lower side of the captured image is larger than the upper side of the captured image. There is. For this reason, the image processing apparatus 100 examines the scale when the object appears in each pixel of the photographed image in advance, and enlarges the photographed image so as to cancel the difference in the size of the object at each position. Perform template matching after correction. For example, the image processing apparatus 100 reads a scale to be corrected at each pixel of the image, generates a corrected image by correcting the captured image so that the read scale is constant, and extracts feature points from the corrected image. Extract and execute template matching.

本システムに関して、校正時の処理と検出時の処理を実行する。まず、校正時の処理について説明する。まず、作業員は多数の校正物体を建物の様々な場所に置く。建物天井に設置されたカメラ50が、校正物体の画像を撮影する。   For this system, calibration processing and detection processing are executed. First, processing during calibration will be described. First, the worker places a large number of calibration objects at various locations in the building. A camera 50 installed on the ceiling of the building takes an image of the calibration object.

画像処理装置100は、カメラ50から取得した撮影画像を、ディスプレイ(図示せず)に表示する。かかる撮影画像には、複数の校正物体が含まれる。作業員は、表示された校正物体上の定められた2つの基準点をマウス(図示せず)の操作によって指示する。画像処理装置100は、作業員によって指示された基準点を読み込む。画像処理装置100は、指示された基準点に基づき、撮影画像の各画素での補正すべき縮尺を算出する。画像処理装置100は、撮影画像全体を補正する補正パラメータを決定し、補正パラメータを保存する。   The image processing apparatus 100 displays a captured image acquired from the camera 50 on a display (not shown). Such a photographed image includes a plurality of calibration objects. The worker instructs two predetermined reference points on the displayed calibration object by operating a mouse (not shown). The image processing apparatus 100 reads the reference point designated by the worker. The image processing apparatus 100 calculates a scale to be corrected at each pixel of the captured image based on the instructed reference point. The image processing apparatus 100 determines a correction parameter for correcting the entire captured image, and stores the correction parameter.

次に、検出時の処理について説明する。建物天井に設置されたカメラ50は、例えば、人を含む建物内の画像を撮影する。画像処理装置100は、校正時の処理で保存しておいた補正パラメータに基づいて撮影画像全体を補正することで、補正画像を生成する。画像処理装置100は、補正画像から特徴を抽出し、内部に保持したテンプレートを用いてテンプレートマッチングを行い人の位置を検出する。画像処理装置100は、検出結果を出力する。   Next, processing at the time of detection will be described. The camera 50 installed on the building ceiling, for example, takes an image of a building including a person. The image processing apparatus 100 generates a corrected image by correcting the entire captured image based on the correction parameter stored in the calibration process. The image processing apparatus 100 extracts features from the corrected image, and performs template matching using a template held inside to detect a person's position. The image processing apparatus 100 outputs a detection result.

次に、画像処理装置100の構成の一例について説明する。図2は、本実施例1にかかる画像処理装置の構成を示す機能ブロック図である。図2に示すように、画像処理装置100は、カメラ50に接続される。画像処理装置100は、取得部110、校正物体表示部120、校正情報入力部130、局所変換算出部140、大域変換決定部150、補正パラメータ記憶部160を有する。画像処理装置100は、補正画像生成部170、テンプレートマッチング実行部180、検出結果出力部190を有する。   Next, an example of the configuration of the image processing apparatus 100 will be described. FIG. 2 is a functional block diagram of the configuration of the image processing apparatus according to the first embodiment. As shown in FIG. 2, the image processing apparatus 100 is connected to a camera 50. The image processing apparatus 100 includes an acquisition unit 110, a calibration object display unit 120, a calibration information input unit 130, a local conversion calculation unit 140, a global conversion determination unit 150, and a correction parameter storage unit 160. The image processing apparatus 100 includes a corrected image generation unit 170, a template matching execution unit 180, and a detection result output unit 190.

カメラ50は、図1に示したカメラ50に対応するものである。例えば、カメラ50は、CMOS(Complementary MOS)カメラまたはCCD(Charge-Coupled Device)カメラであることが好ましい。カメラ50の撮影結果は、撮影画像として表現される。   The camera 50 corresponds to the camera 50 shown in FIG. For example, the camera 50 is preferably a CMOS (Complementary MOS) camera or a CCD (Charge-Coupled Device) camera. The photographing result of the camera 50 is expressed as a photographed image.

撮影画像は、多数の画素から構成された2次元の配列であり、各画素は光の強度に応じた値(画素値)を持つ。カラー画像の場合には各画素は例えばR、G、Bに応じた3つの値を持つ。各画素は、その座標値で特定される。座標値は、例えば左上端の画素を(0,0)とし、画像右側ほど第1成分が大きく、画像下側ほど第2成分が大きくなると定める。画素の座標値は離散的な値を取り、例えば非負の整数値で表される。   A captured image is a two-dimensional array composed of a large number of pixels, and each pixel has a value (pixel value) corresponding to the intensity of light. In the case of a color image, each pixel has three values corresponding to R, G, and B, for example. Each pixel is specified by its coordinate value. For example, the coordinate value is defined such that the upper left pixel is (0, 0), the first component increases toward the right side of the image, and the second component increases toward the bottom of the image. The coordinate value of the pixel takes a discrete value and is represented by, for example, a non-negative integer value.

図3および図4は、撮影画像の一例を示す図である。図3に示す撮影画像10は、校正時の処理で、カメラ50によって撮影された画像である。例えば、図3に示すように、撮影画像10には、複数の校正物体10a〜10tが含まれる。校正物体10a〜10tは、同一形状であるが、広角レンズで撮影されているため、上側の校正物体よりも下側の校正物体の方が大きく写っている。   3 and 4 are diagrams illustrating an example of a captured image. A captured image 10 shown in FIG. 3 is an image captured by the camera 50 in the calibration process. For example, as illustrated in FIG. 3, the captured image 10 includes a plurality of calibration objects 10 a to 10 t. Although the calibration objects 10a to 10t have the same shape but are photographed with a wide-angle lens, the lower calibration object is larger than the upper calibration object.

図4に示す撮影画像20は、検出時処理で、カメラ50によって撮影された画像である。例えば、図4に示すように、撮影画像20には、複数の人20a〜20dが含まれる。例えば、図3および図4に示す撮影画像10,20のサイズは、640×480である。   A captured image 20 illustrated in FIG. 4 is an image captured by the camera 50 in the detection time process. For example, as illustrated in FIG. 4, the captured image 20 includes a plurality of people 20 a to 20 d. For example, the size of the captured images 10 and 20 shown in FIGS. 3 and 4 is 640 × 480.

図2の説明に戻る。取得部110は、カメラ50から撮影画像を取得する処理部である。取得部110は、校正時の処理で撮影された撮影画像を、校正物体表示部120に出力する。取得部110は、検出時の処理で撮影された撮影画像を、補正画像生成部170に出力する。   Returning to the description of FIG. The acquisition unit 110 is a processing unit that acquires a captured image from the camera 50. The acquisition unit 110 outputs the captured image captured by the calibration process to the calibration object display unit 120. The acquisition unit 110 outputs the captured image captured by the detection process to the corrected image generation unit 170.

校正物体表示部120は、校正時の処理で撮影された撮影画像をディスプレイ等に表示する処理部である。例えば、校正時の処理で撮影された撮影画像は、図3に示す撮影画像10である。校正物体表示部120は、校正物体10a〜10tを見やすくなるように、撮影画像の明るさを変える等の処理を実行しても良い。   The calibration object display unit 120 is a processing unit that displays a captured image captured by the process at the time of calibration on a display or the like. For example, the photographed image photographed in the calibration process is the photographed image 10 shown in FIG. The calibration object display unit 120 may execute processing such as changing the brightness of the captured image so that the calibration objects 10a to 10t can be easily seen.

作業員は、ディスプレイに表示された撮影画像10を参照し、画像処理装置100に接続されたマウス等の入力装置を操作して、校正物体毎に定まった2つの基準点を指定する。図5は、本実施例1にかかる基準点の位置を説明するための図である。図5では、校正物体の一例として、校正物体10aを示す。基準点は、例えば、校正物体10aの左上1aと、校正物体10aの右上1bとする。以下の説明では、適宜、校正物体の左上の基準点を、1番目の基準点と表記し、右上の基準点を2番目の基準点と表記する。   The worker refers to the captured image 10 displayed on the display and operates an input device such as a mouse connected to the image processing apparatus 100 to designate two reference points determined for each calibration object. FIG. 5 is a diagram for explaining the positions of the reference points according to the first embodiment. FIG. 5 shows a calibration object 10a as an example of a calibration object. The reference points are, for example, the upper left 1a of the calibration object 10a and the upper right 1b of the calibration object 10a. In the following description, the upper left reference point of the calibration object will be referred to as the first reference point, and the upper right reference point will be referred to as the second reference point as appropriate.

校正情報入力部130は、校正物体毎に作業員に指定された1番目の基準点と、2番目の基準点の座標値を読み込み、座標値テーブルを生成する処理部である。図6は、本実施例1にかかる座標値テーブルのデータ構造の一例を示す図である。図6に示すように、この座標値テーブル130aは、校正物体番号と、1番目の基準点の座標と、2番目の基準点の座標とを対応付ける。校正物体番号は、校正物体を一意に識別する番号である。校正情報入力部130は、座標値テーブル130aを、局所変換算出部140に出力する。   The calibration information input unit 130 is a processing unit that reads the coordinate values of the first reference point and the second reference point designated by the worker for each calibration object, and generates a coordinate value table. FIG. 6 is a diagram illustrating an example of the data structure of the coordinate value table according to the first embodiment. As shown in FIG. 6, the coordinate value table 130a associates the calibration object number, the coordinates of the first reference point, and the coordinates of the second reference point. The calibration object number is a number that uniquely identifies the calibration object. The calibration information input unit 130 outputs the coordinate value table 130 a to the local conversion calculation unit 140.

局所変換算出部140は、座標値テーブル130aを基にして、撮影画像上の局所的な縮尺を算出する処理部である。ここで、局所的な縮尺は、撮影画像上の校正物体が存在する位置の縮尺である。例えば、局所変換算出部140は、下記の処理を実行する。   The local conversion calculation unit 140 is a processing unit that calculates a local scale on the captured image based on the coordinate value table 130a. Here, the local scale is the scale of the position where the calibration object exists on the captured image. For example, the local conversion calculation unit 140 executes the following process.

局所変換算出部140は、着目する基準点を、座標値テーブル130aの先頭とすることで、初期化を行う。局所変換算出部140は、1番目の基準点と2番目の基準点との距離で所定値を割ることで、1番目の基準点の位置における縮尺を算出する。局所変換算出部140は、着目する基準点を、座標値テーブル130aの一つ下に移動し、縮尺を算出する処理を繰り返し実行する。局所変換算出部140は、座標値テーブル130aの一番下の基準点に対する縮尺を算出した場合には、処理を終了する。   The local conversion calculation unit 140 performs initialization by setting the target reference point as the head of the coordinate value table 130a. The local conversion calculation unit 140 calculates a scale at the position of the first reference point by dividing a predetermined value by the distance between the first reference point and the second reference point. The local conversion calculation unit 140 moves the reference point of interest down one position in the coordinate value table 130a, and repeatedly executes the process of calculating the scale. The local conversion calculation unit 140 ends the process when the scale with respect to the lowest reference point of the coordinate value table 130a is calculated.

局所変換算出部140は、縮尺の算出結果を縮尺テーブルに登録する。図7は、本実施例1にかかる縮尺テーブルの一例を示す図である。図7に示すように、縮尺テーブル140aは、点の座標と、縮尺とを対応付ける。点の座標は、1番目の基準点の座標に対応する。局所変換算出部140は、縮尺テーブル140aを、大域変換決定部150に出力する。   The local conversion calculation unit 140 registers the scale calculation result in the scale table. FIG. 7 is a diagram illustrating an example of a scale table according to the first embodiment. As shown in FIG. 7, the scale table 140a associates the coordinates of the point with the scale. The coordinates of the point correspond to the coordinates of the first reference point. The local conversion calculation unit 140 outputs the scale table 140a to the global conversion determination unit 150.

ここで、局所変換算出部140は、点の距離として、例えば、ユークリッド距離を用いる。ユークリッド距離は、第1成分の差の2乗と第2成分の差の2乗の和の平方根で定義される。また、上記の所定値としては、例えば校正物体を標準的な位置、向きに置いたときの基準点間の距離を用いる。   Here, the local transformation calculation unit 140 uses, for example, the Euclidean distance as the point distance. The Euclidean distance is defined as the square root of the sum of the square of the difference between the first components and the square of the difference between the second components. Further, as the predetermined value, for example, a distance between reference points when the calibration object is placed at a standard position and orientation is used.

大域変換決定部150は、縮尺テーブル140aを基にして、撮影画像を補正画像に変換するための補正パラメータを生成する処理部である。大域変換決定部150は、パラメータを、補正パラメータ記憶部160に格納する。   The global conversion determination unit 150 is a processing unit that generates correction parameters for converting a captured image into a correction image based on the scale table 140a. The global conversion determination unit 150 stores the parameters in the correction parameter storage unit 160.

大域変換決定部150は、例えば、データ補間処理、データ加算処理、逆変換算出処理を順に実行することで、補正パラメータを生成する。   For example, the global conversion determination unit 150 generates a correction parameter by sequentially executing a data interpolation process, a data addition process, and an inverse conversion calculation process.

大域変換決定部150が実行するデータ補間処理について説明する。大域変換決定部150は、縮尺テーブル140aに登録された局所的な縮尺を用いて、未知の縮尺を補間することで、撮影画像の全画素に対応する縮尺を算出する。例えば、大域変換決定部150は、式(1)に基づいて、撮影画像の画素(u,v)における縮尺s(u,v)を算出する。式(1)において、作業員に指定された1番目の基準点を(pi,0,qi,0)とする。また、1番目の基準点(pi,0,qi,0)に対応する縮尺をsとする。i=1,・・・,nは、校正物体の番号である。nは、校正物体の総数を表す。 Data interpolation processing executed by the global conversion determination unit 150 will be described. The global conversion determination unit 150 calculates a scale corresponding to all the pixels of the captured image by interpolating an unknown scale using a local scale registered in the scale table 140a. For example, the global conversion determination unit 150 calculates the scale s (u, v) at the pixel (u, v) of the captured image based on the equation (1). In the formula (1), the first reference point designated by the worker is ( pi, 0 , qi , 0 ). Also, let s i be the scale corresponding to the first reference point ( pi, 0 , qi , 0 ). i = 1,..., n is the number of the calibration object. n represents the total number of calibration objects.

Figure 0006582618
Figure 0006582618

式(1)において、distは、2点間の距離を表す。w(u,v)は、重みを正規化したものであり、式(2)によって定義される。   In equation (1), dist represents the distance between two points. w (u, v) is a normalized weight and is defined by equation (2).

Figure 0006582618
Figure 0006582618

大域変換決定部150は、式(1)、式(2)を用いて、撮影画像の各画素(u,v)の縮尺を算出する。図8は、各画素の縮尺の算出例を示す図である。例えば、図8では、画素30a〜30fを示す。原点の画素を30aとする。画素30aの縮尺を0.8とし、画素30bの縮尺を0.7とし、画素30cの縮尺を0.6とする。画素30dの縮尺を0.8とし、画素30eの縮尺を0.7とし、画素30fの縮尺を0.6とする。   The global conversion determination unit 150 calculates the scale of each pixel (u, v) of the captured image using Expressions (1) and (2). FIG. 8 is a diagram illustrating a calculation example of the scale of each pixel. For example, FIG. 8 shows the pixels 30a to 30f. Let the pixel at the origin be 30a. The scale of the pixel 30a is 0.8, the scale of the pixel 30b is 0.7, and the scale of the pixel 30c is 0.6. The scale of the pixel 30d is 0.8, the scale of the pixel 30e is 0.7, and the scale of the pixel 30f is 0.6.

続いて、大域変換決定部150が実行するデータ加算処理について説明する。図9、図10、図11は、本実施例1にかかるデータ加算処理を説明するための図である。大域変換決定部150は、撮影画像の原点と、補正画像の原点とを決めて、撮影画像の原点と、補正画像の原点とを対応させる。例えば、図9に示すように、撮影画像の原点を撮影画像上の画素30aとし、補正画像の原点を補正画像上の画素40aとすると、大域変換決定部150は、画素30aと画素40aとを対応させる。   Next, the data addition process executed by the global conversion determination unit 150 will be described. 9, FIG. 10 and FIG. 11 are diagrams for explaining the data addition processing according to the first embodiment. The global conversion determination unit 150 determines the origin of the captured image and the origin of the corrected image, and associates the origin of the captured image with the origin of the corrected image. For example, as shown in FIG. 9, when the origin of the captured image is the pixel 30a on the captured image and the origin of the corrected image is the pixel 40a on the corrected image, the global conversion determination unit 150 sets the pixel 30a and the pixel 40a to each other. Make it correspond.

続いて、大域変換決定部150は、原点における縮尺だけはなして、隣接する点を対応させる。例えば、図10に示すように、撮影画像の画素30aから1離れて隣接する画素を画素30bとし、画素30aの縮尺を「0.8」とする。また、図9で説明したように、画素30aは、画素40aに対応付けられているものとする。この場合には、大域変換決定部150は、画素30bに対応する点を、画素40aから「0.8」離れた点40bと対応付ける。すなわち、撮影画像上の座標(1,0)の画素30bは、補正画像上の座標(0.8,0)の点40bに対応する。   Subsequently, the global transformation determination unit 150 associates adjacent points with only the scale at the origin. For example, as illustrated in FIG. 10, a pixel adjacent to one pixel away from the pixel 30 a of the captured image is a pixel 30 b, and the scale of the pixel 30 a is “0.8”. Further, as described in FIG. 9, the pixel 30a is assumed to be associated with the pixel 40a. In this case, the global conversion determination unit 150 associates the point corresponding to the pixel 30b with the point 40b that is “0.8” away from the pixel 40a. That is, the pixel 30b at the coordinate (1,0) on the captured image corresponds to the point 40b at the coordinate (0.8, 0) on the corrected image.

また、大域変換決定部150は、画素に対応する縮尺を加算する上記の処理を繰り返し実行することで、順番に点(画素)の対応を求める。これにより、撮影画像の各画素に対して、その画素が対応する補正画像の点の座標値が定まる。ただし、補正画像の点の座標値は、必ずしも整数になるとは限らない。   In addition, the global conversion determination unit 150 repeatedly performs the above-described process of adding the scales corresponding to the pixels to obtain the correspondence of the points (pixels) in order. Thereby, for each pixel of the captured image, the coordinate value of the point of the corrected image corresponding to the pixel is determined. However, the coordinate value of the point of the corrected image is not necessarily an integer.

図11に、撮影画像上の画素と、この画素に対応付けた補正画像の座標値との関係を示す。例えば、撮影画像の画素30aに対応する補正画像の点の座標値は(0,0)となる。撮影画像の画素30bに対応する補正画像の点の座標値は(0.8,0)となる。撮影画像の画素30cに対応する補正画像の点の座標値は(1.5,0)となる。撮影画像の画素30dに対応する補正画像の点の座標値は(0,0.8)となる。撮影画像の画素30eに対応する補正画像の点の座標値は(0.8,0.7)となる。撮影画像の画素30fに対応する補正画像の点の座標値は(1.5,0.6)となる。   FIG. 11 shows the relationship between the pixel on the captured image and the coordinate value of the corrected image associated with this pixel. For example, the coordinate value of the point of the corrected image corresponding to the pixel 30a of the captured image is (0, 0). The coordinate value of the point of the corrected image corresponding to the pixel 30b of the photographed image is (0.8, 0). The coordinate value of the point of the corrected image corresponding to the pixel 30c of the photographed image is (1.5, 0). The coordinate value of the point of the corrected image corresponding to the pixel 30d of the captured image is (0, 0.8). The coordinate value of the point of the corrected image corresponding to the pixel 30e of the captured image is (0.8, 0.7). The coordinate value of the point of the corrected image corresponding to the pixel 30f of the captured image is (1.5, 0.6).

例えば、画素30cに対応する補正画像の座標値は、x座標について、画素30aの縮尺「0.8」と、画素30bの縮尺「0.7」を加算した値「1.5」となる。また、画素30dに対応する補正画像の座標値は、y座標について、画素30aの縮尺「0.8」を加算した値「0.8」となる。   For example, the coordinate value of the corrected image corresponding to the pixel 30c is a value “1.5” obtained by adding the scale “0.8” of the pixel 30a and the scale “0.7” of the pixel 30b with respect to the x coordinate. Further, the coordinate value of the corrected image corresponding to the pixel 30d is a value “0.8” obtained by adding the scale “0.8” of the pixel 30a to the y coordinate.

続いて、大域変換決定部150が実行する逆変換算出処理について説明する。上記のデータ加算処理では、撮影画像の画素に対して、その画素が対応する補正画像の点の座標値を求めた。これに対して、逆変換算出処理では、大域変換決定部150は、補正画像の各画素(x,y)に対して、その画素が対応する撮影画像の点の座標値(u,v)を算出する。これは、補正画像を生成する場合に、この対応関係を用いるためである。   Next, the inverse conversion calculation process executed by the global conversion determination unit 150 will be described. In the above data addition process, the coordinate value of the point of the corrected image corresponding to the pixel of the captured image is obtained. On the other hand, in the inverse transformation calculation process, the global transformation determination unit 150 uses, for each pixel (x, y) of the corrected image, the coordinate value (u, v) of the point of the captured image corresponding to that pixel. calculate. This is because this correspondence is used when generating a corrected image.

大域変換決定部150は、補正画像の画素(x,y)に対応する、撮影画像の点の座標値(u(x,y),v(x,y))を、式(3)、式(4)に基づいて算出する。式(3)、(4)について、(ui,j,vi,j)は、撮影画像の各画素を示す。x(ui,j,vi,j),y(ui,j,vi,j)は、撮影画像の画素(ui,j,vi,j)に対応する補正画像の点の座標値を表す。w(x,y)は重みの正規化を表し、式(5)によって定義される。 The global conversion determination unit 150 obtains the coordinate values (u (x, y), v (x, y)) of the captured image corresponding to the pixel (x, y) of the corrected image using the equations (3) and (3). Calculate based on (4). In the expressions (3) and (4), (u i, j , v i, j ) represents each pixel of the captured image. x (u i, j , v i, j ), y (u i, j , v i, j ) is the point of the corrected image corresponding to the pixel (u i, j , v i, j ) of the captured image. Represents a coordinate value. w (x, y) represents weight normalization and is defined by equation (5).

Figure 0006582618
Figure 0006582618

Figure 0006582618
Figure 0006582618

Figure 0006582618
Figure 0006582618

大域変換決定部150は、式(3)〜式(4)の計算を、補正画像の全ての画素(x,y)について実行し、実行した結果を補正パラメータとして生成する。   The global conversion determination unit 150 executes the calculations of Expressions (3) to (4) for all the pixels (x, y) of the corrected image, and generates the execution results as correction parameters.

図12は、補正パラメータのデータ構造の一例を示す図である。図12に示すように、補正パラメータ160aは、補正画像の画素の座標値と、撮影画像の点の座標値とを有する。例えば、補正画像の画素の座標値(0,0)に対応する、撮影画像の点の座標値は、(u0,0,v0,0)となることが示される。 FIG. 12 is a diagram illustrating an example of the data structure of the correction parameter. As shown in FIG. 12, the correction parameter 160a has the coordinate value of the pixel of the corrected image and the coordinate value of the point of the captured image. For example, it is indicated that the coordinate value of the point of the photographed image corresponding to the coordinate value (0, 0) of the pixel of the corrected image is (u 0,0 , v 0,0 ).

図2の説明に戻る。補正パラメータ記憶部160は、補正パラメータを記憶する記憶部である。   Returning to the description of FIG. The correction parameter storage unit 160 is a storage unit that stores correction parameters.

補正画像生成部170は、撮影画像と補正パラメータ160aとを基にして、補正画像を生成する処理部である。補正画像生成部170は、補正パラメータ160aに示される補正画像の画素の座標値に、撮影画像の座標値の点(画素)を移動させていくことで、補正画像を生成する。例えば、補正画像生成部170は、以下の処理を実行する。   The corrected image generation unit 170 is a processing unit that generates a corrected image based on the captured image and the correction parameter 160a. The corrected image generation unit 170 generates a corrected image by moving the point (pixel) of the coordinate value of the captured image to the coordinate value of the pixel of the corrected image indicated by the correction parameter 160a. For example, the corrected image generation unit 170 executes the following process.

補正画像生成部170は、注目画素を補正画像の左上に設定し、補正画像を生成する2次元配列を用意することで、初期化を行う。補正画像生成部170は、補正パラメータを読み込み、補正パラメータから、注目画素に対応する撮影画像の点の座標値を求める。補正画像生成部170は、求めた座標値に最も近い画素の画素値を補正画像の画素値として2次元配列に書き込む。補正画像生成部170は、注目画素の移動を行う。補正画像生成部170は、注目画像を1つ右に移動させ、右端の場合には、1段下の左端に移動し、右下の場合には終了する。補正画像生成部170は、再び、補正パラメータの読み込みを行い、上記処理を繰り返し実行する。   The corrected image generation unit 170 performs initialization by setting the target pixel at the upper left of the corrected image and preparing a two-dimensional array for generating the corrected image. The corrected image generation unit 170 reads the correction parameter and obtains the coordinate value of the point of the captured image corresponding to the target pixel from the correction parameter. The corrected image generation unit 170 writes the pixel value of the pixel closest to the obtained coordinate value into the two-dimensional array as the pixel value of the corrected image. The corrected image generation unit 170 moves the target pixel. The corrected image generation unit 170 moves the image of interest to the right by one, moves it to the left end one step lower in the case of the right end, and ends it in the case of the lower right. The corrected image generation unit 170 reads the correction parameter again and repeats the above processing.

補正画像生成部170は、画素値を計算する場合に、上記の例では、最も近い画素の画素値をそのまま用いたが、複数個の画素の画素値を距離で重み付けして平均した値を用いても良い。例えば、図4に示した撮影画像20を基にして、補正画像生成部170が、補正画像を生成すると、図13に示す補正画像25が生成される。図13は、補正画像の一例を示す図である。補正画像生成部170は、補正画像を、テンプレートマッチング実行部180に出力する。   When calculating the pixel value, the corrected image generation unit 170 uses the pixel value of the nearest pixel as it is in the above example, but uses the average value obtained by weighting the pixel values of a plurality of pixels by the distance. May be. For example, when the corrected image generation unit 170 generates a corrected image based on the captured image 20 illustrated in FIG. 4, a corrected image 25 illustrated in FIG. 13 is generated. FIG. 13 is a diagram illustrating an example of a corrected image. The corrected image generation unit 170 outputs the corrected image to the template matching execution unit 180.

なお、本願では主に対象物の写り方が定まっている固定カメラでの撮影を想定しているが、ズーム等の機能を持つカメラであっても、ズーム倍率に応じて補正パラメータを切り替えることで本願が適用可能となる。   Note that this application mainly assumes shooting with a fixed camera in which the way an object is captured, but even with a camera having a zoom function, the correction parameters can be switched according to the zoom magnification. The present application can be applied.

テンプレートマッチング実行部180は、補正画像から特徴を抽出し、テンプレートを走査して対象物を検出する処理部である。テンプレートマッチング実行部180は、マッチング結果を、検出結果出力部190に出力する。例えば、テンプレートマッチング実行部180は、補正画像から特徴を抽出する場合に、フィルタを用いる。   The template matching execution unit 180 is a processing unit that extracts features from the corrected image and scans the template to detect an object. The template matching execution unit 180 outputs the matching result to the detection result output unit 190. For example, the template matching execution unit 180 uses a filter when extracting features from the corrected image.

本願で特徴抽出としてフィルタを用いる理由は以下の通りである。フィルタは、どの画素でも同じ演算方法で特徴を抽出する。したがって,補正画像全体に適用しても一部分の画像に適用しても同じ特徴が抽出される。一方、フィルタでない一般の特徴抽出では、画素の位置によって異なる演算が行われる。このため、対象物の候補となる部分画像を切り出して特徴抽出するように特徴が設計されている場合には,補正画像全体で一括して特徴抽出を行うことができない。   The reason why a filter is used for feature extraction in the present application is as follows. The filter extracts features by the same calculation method for every pixel. Therefore, the same feature is extracted regardless of whether it is applied to the entire corrected image or a partial image. On the other hand, in general feature extraction that is not a filter, different calculations are performed depending on the pixel position. For this reason, when a feature is designed so as to extract a feature by cutting out a partial image that is a candidate for an object, feature extraction cannot be performed collectively for the entire corrected image.

検出結果出力部190は、マッチング結果を基にして、人の人数と位置とを出力する処理部である。検出結果出力部190は、人の位置として、例えば、補正画像上での人のテンプレートの中心座標を用いても良い。図14は、検出結果の一例を示す図である。例えば、検出結果には、通し番号と、検出された座標値とが含まれる。通し番号は、検出された人を識別する番号である。検出された座標値は、補正画像上での人のテンプレートの中心座標に対応する。   The detection result output unit 190 is a processing unit that outputs the number and positions of people based on the matching result. The detection result output unit 190 may use, for example, the center coordinates of the person's template on the corrected image as the person's position. FIG. 14 is a diagram illustrating an example of the detection result. For example, the detection result includes a serial number and a detected coordinate value. The serial number is a number for identifying the detected person. The detected coordinate value corresponds to the center coordinate of the human template on the corrected image.

次に、本実施例1にかかる画像処理装置100の処理手順の一例について説明する。図15は、校正時の画像処理装置の処理手順を示すフローチャートである。図15に示すように、画像処理装置100の取得部110は、校正物体を撮影した撮影画像を取得し(ステップS101)、画像処理装置100の校正物体表示部120は、撮影画像を表示する(ステップS102)。   Next, an example of a processing procedure of the image processing apparatus 100 according to the first embodiment will be described. FIG. 15 is a flowchart showing a processing procedure of the image processing apparatus at the time of calibration. As illustrated in FIG. 15, the acquisition unit 110 of the image processing apparatus 100 acquires a captured image obtained by capturing a calibration object (step S101), and the calibration object display unit 120 of the image processing apparatus 100 displays the captured image ( Step S102).

画像処理装置100の校正情報入力部130は、基準点を読み込む(ステップS103)。画像処理装置100の局所変換算出部140および大域変換決定部150は、補正する縮尺を算出し(ステップS104)、大域変換決定部150は、補正パラメータ160aを決定する(ステップS105)。大域変換決定部150は、補正パラメータ160aを、補正パラメータ記憶部160に保存する(ステップS106)。   The calibration information input unit 130 of the image processing apparatus 100 reads the reference point (step S103). The local conversion calculation unit 140 and the global conversion determination unit 150 of the image processing apparatus 100 calculate a scale to be corrected (step S104), and the global conversion determination unit 150 determines a correction parameter 160a (step S105). The global conversion determination unit 150 stores the correction parameter 160a in the correction parameter storage unit 160 (step S106).

図16は、検出時の画像処理装置の処理手順を示すフローチャートである。図16に示すように、画像処理装置100の取得部110は、撮影画像を取得する(ステップS201)。画像処理装置100の補正画像生成部170は、補正パラメータ160aに基づいて、撮影画像を補正することで、補正画像を生成する(ステップS202)。   FIG. 16 is a flowchart illustrating a processing procedure of the image processing apparatus at the time of detection. As illustrated in FIG. 16, the acquisition unit 110 of the image processing apparatus 100 acquires a captured image (step S201). The corrected image generation unit 170 of the image processing apparatus 100 generates a corrected image by correcting the captured image based on the correction parameter 160a (step S202).

画像処理装置100のテンプレートマッチング実行部180は、補正画像に対してテンプレートマッチングを実行する(ステップS203)。画像処理装置100の検出結果出力部190は、テンプレートマッチングの結果を出力する(ステップS204)。   The template matching execution unit 180 of the image processing apparatus 100 executes template matching on the corrected image (step S203). The detection result output unit 190 of the image processing apparatus 100 outputs the result of template matching (step S204).

次に、本実施例にかかる画像処理装置100の効果について説明する。画像処理装置100は、撮影画像に含まれる複数の構成物体に対する基準点の位置を受け付け、校正物体の基準点の間隔を基づいて、撮影画像の各画素における縮尺を算出する。画像処理装置100は、各画素の縮尺が一定となるように、撮影画像を補正することで補正画像を生成し、補正画像から特徴点を抽出してテンプレートマッチングを実行する。かかる処理を実行することで、同一の対象物の大きさが位置によらず均一となるため、テンプレートや画像の縮尺を様々に変えてマッチングを行わなくても良くなり、処理量を削減することができる。   Next, effects of the image processing apparatus 100 according to the present embodiment will be described. The image processing apparatus 100 receives the positions of reference points for a plurality of constituent objects included in the photographed image, and calculates the scale at each pixel of the photographed image based on the intervals between the reference points of the calibration objects. The image processing apparatus 100 generates a corrected image by correcting the captured image so that the scale of each pixel becomes constant, extracts feature points from the corrected image, and executes template matching. By executing such processing, the size of the same object becomes uniform regardless of position, so that it is not necessary to perform matching by changing the scale of the template or image in various ways, and the processing amount can be reduced. Can do.

ここで、汎用性のある従来技術として、撮影画像の縮尺を変えて特徴抽出を何度も行う場合と比較して、本実施例1にかかる画像処理装置100の処理が高速であることについて説明する。図17は、本実施例1にかかる画像処理装置の効果を説明するための図である。   Here, as a conventional technique having versatility, it is described that the processing of the image processing apparatus 100 according to the first embodiment is faster than the case where the feature extraction is performed many times by changing the scale of the captured image. To do. FIG. 17 is a diagram for explaining the effect of the image processing apparatus according to the first embodiment.

従来技術では、一つの画素に対して、縮尺を変えて特徴を何度も抽出するため、処理量が多くなる。図17に示す例では、テンプレートと同じ縮尺に揃えて処理を行うべく、下記の処理を行う。従来技術は、撮影画像5の部分画像5aを1.1倍に拡大して、補正部分画像6aを生成し、補正部分画像6aから特徴を抽出した特徴抽出画像7aを生成する。また、従来技術は、撮影画像5の部分画像5bを1.3倍に拡大して、補正部分画像6bを生成し、補正部分画像6bから特徴を抽出した特徴抽出画像7bを生成する。そうすると、ある画素8に対して特徴抽出が2回行われることになる。   In the prior art, since a feature is extracted many times at different scales for one pixel, the processing amount increases. In the example shown in FIG. 17, the following processing is performed in order to perform processing at the same scale as the template. In the conventional technique, the partial image 5a of the photographed image 5 is enlarged 1.1 times to generate a corrected partial image 6a, and a feature extraction image 7a in which features are extracted from the corrected partial image 6a is generated. Further, in the related art, the partial image 5b of the photographed image 5 is enlarged 1.3 times to generate a corrected partial image 6b, and a feature extraction image 7b in which features are extracted from the corrected partial image 6b is generated. Then, feature extraction is performed twice for a certain pixel 8.

従来技術における必要な処理量は、1画素あたりの特徴抽出の処理量*補正部分画像の画素数*繰り返し数と見積もられる。例えば、1画素あたりの特徴抽出の処理量が100,補正部分画像の画素数が100*100、繰り返し数が1000の場合、処理量は、100*100*1000=1012となり、膨大な値になる。これは、単位処理を1ピコ秒できる高速計算機であっても全処理で1秒かかるため,リアルタイム処理としては不十分である。 The required processing amount in the prior art is estimated as processing amount of feature extraction per pixel * number of pixels of the corrected partial image * number of repetitions. For example, the process of feature extraction per pixel is 100, the correction partial images the number of pixels is 100 * 100, if the repetition number is 1000 2, throughput is 100 * 100 2 * 1000 2 = 10 12, and the large Value. This is insufficient for real-time processing because even a high-speed computer capable of 1 picosecond unit processing takes 1 second for all processing.

一方、本実施例にかかる画像処理装置100では、必要な処理量は、1画素あたりの特徴抽出の処理量*補正画像の画素数と見積もられる。上記と同じ数値例に対して、テンプレートマッチングの処理量は,同じ数値例に対して2*1010と見積もられる。このため、単位処理を1ピコ秒で実行できる高速計算機であれば全体で20msで済み、リアルタイム処理が可能となる。 On the other hand, in the image processing apparatus 100 according to the present embodiment, the necessary processing amount is estimated as the feature extraction processing amount per pixel * the number of pixels of the corrected image. For the same numerical example as above, the amount of template matching processing is estimated to be 2 * 10 10 for the same numerical example. For this reason, a high-speed computer capable of executing unit processing in 1 picosecond requires 20 ms as a whole, and enables real-time processing.

次に、本実施例2にかかる画像処理装置について説明する。システムの構成は、実施例1に示したシステムと同様である。   Next, an image processing apparatus according to the second embodiment will be described. The system configuration is the same as that of the system shown in the first embodiment.

図18は、本実施例2にかかる画像処理装置の構成を示す機能ブロック図である。図18に示すように、画像処理装置200は、カメラ50に接続される。画像処理装置200は、取得部210、校正物体表示部220、校正情報入力部230、局所変換算出部240、大域変換決定部250、補正パラメータ記憶部260を有する。画像処理装置200は、補正画像生成部270、テンプレートマッチング実行部280、検出結果出力部290を有する。   FIG. 18 is a functional block diagram of the configuration of the image processing apparatus according to the second embodiment. As shown in FIG. 18, the image processing apparatus 200 is connected to the camera 50. The image processing apparatus 200 includes an acquisition unit 210, a calibration object display unit 220, a calibration information input unit 230, a local conversion calculation unit 240, a global conversion determination unit 250, and a correction parameter storage unit 260. The image processing apparatus 200 includes a corrected image generation unit 270, a template matching execution unit 280, and a detection result output unit 290.

カメラ50、取得部210、校正物体表示部220に関する説明は、図2のカメラ50、取得部110、校正物体表示部120に関する説明と同様である。補正画像生成部270、テンプレートマッチング実行部280、検出結果出力部290に関する説明は、図2の補正画像生成部170、テンプレートマッチング実行部180、検出結果出力部190に関する説明と同様である。   The description regarding the camera 50, the acquisition unit 210, and the calibration object display unit 220 is the same as the description regarding the camera 50, the acquisition unit 110, and the calibration object display unit 120 of FIG. The description regarding the corrected image generation unit 270, the template matching execution unit 280, and the detection result output unit 290 is the same as the description regarding the correction image generation unit 170, the template matching execution unit 180, and the detection result output unit 190 of FIG.

校正情報入力部230は、校正物体毎に作業員に指定された1番目の基準点と、2番目の基準点と、3番目の基準点との座標値を読み込み、座標値テーブルを生成する処理部である。図19は、本実施例2にかかる基準点位置を説明するための図である。図19では、校正物体の一例として、基準点は、例えば、校正物体10aの左上1aと、校正物体10aの右上1bと、校正物体10aの左下1cとする。以下の説明では、適宜、校正物体の左上の基準点を、1番目の基準点と表記し、右上の基準点を2番目の基準点と表記し、左下の基準点を3番目の基準点と表記する。作業員は、ディスプレイに表示された撮影画像10を参照し、画像処理装置200に接続されたマウス等の入力装置を操作して、校正物体毎に定まった3つの基準点を指定する。   The calibration information input unit 230 reads the coordinate values of the first reference point, the second reference point, and the third reference point designated by the worker for each calibration object, and generates a coordinate value table. Part. FIG. 19 is a diagram for explaining the reference point positions according to the second embodiment. In FIG. 19, as an example of the calibration object, the reference points are, for example, the upper left 1a of the calibration object 10a, the upper right 1b of the calibration object 10a, and the lower left 1c of the calibration object 10a. In the following description, the reference point at the upper left of the calibration object is referred to as the first reference point, the reference point at the upper right is referred to as the second reference point, and the reference point at the lower left is referred to as the third reference point. write. The worker refers to the captured image 10 displayed on the display and operates an input device such as a mouse connected to the image processing apparatus 200 to designate three reference points determined for each calibration object.

図20は、本実施例2にかかる座標値テーブルのデータ構造の一例を示す図である。図20に示すように、この座標値テーブル230aは、校正物体番号と、1番目の基準点の座標と、2番目の基準点の座標と、3番目の基準点の座標とを対応付ける。校正物体番号は、校正物体を一意に識別する番号である。校正情報入力部230は、座標値テーブル230aを、局所変換算出部240に出力する。   FIG. 20 is a diagram illustrating an example of the data structure of the coordinate value table according to the second embodiment. As shown in FIG. 20, the coordinate value table 230a associates the calibration object number, the coordinates of the first reference point, the coordinates of the second reference point, and the coordinates of the third reference point. The calibration object number is a number that uniquely identifies the calibration object. The calibration information input unit 230 outputs the coordinate value table 230a to the local conversion calculation unit 240.

局所変換算出部240は、局所的な座標変換として、式(6)を用いる。実施例1の局所変換算出部140は、対象物の縮尺の変化に対応する構成を開示したが、式(6)を用いることで、対象物の向きの変化にも対応することができる。   The local conversion calculation unit 240 uses Expression (6) as local coordinate conversion. Although the local conversion calculation part 140 of Example 1 disclosed the structure corresponding to the change of the scale of a target object, it can respond also to the change of the direction of a target object using Formula (6).

Figure 0006582618
Figure 0006582618

式(6)において、(δx,δy)は、補正画像の点の微小変化を表し、(δu,δv)は、撮影画像の点の微小変化を表す。なお、上付きの添え字のTは、行列やベクトルの転置を表す。a,b,c,dは、線形変換のパラメータであり、撮影画像の点(u,v)によって異なる。b=c=0、a=dの場合が、縮尺だけの変換(実施例1の構成等)に対応する。 In Expression (6), (δx, δy) T represents a minute change in the point of the corrected image, and (δu, δv) T represents a minute change in the point of the captured image. Note that the superscript T indicates transposition of a matrix or a vector. “a”, “b”, “c”, and “d” are linear transformation parameters, which differ depending on the point (u, v) of the photographed image. The case of b = c = 0 and a = d corresponds to the conversion with only the reduced scale (configuration of the first embodiment, etc.).

作業員に指定された基準点の3つの組を(pi,0,qi,0)、(pi,x,qi,x)、(pi,y,qi,y)(i=1,・・・,n)とする。校正物体の標準幅をw、標準高をhとする。このとき、逆向きの変換パラメータa’,b’,c’,d’を式(7)〜式(10)で定める。 Three sets of reference points designated by the worker are expressed as ( pi, 0 , qi , 0 ), ( pi, x , qi , x ), ( pi, y , qi , y ) (i = 1,..., N). The standard width of the calibration object is w 0 and the standard height is h 0 . At this time, reverse conversion parameters a ′, b ′, c ′, and d ′ are determined by Expressions (7) to (10).

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

式(6)の線形変換パラメータa,b,c,dは、a’,b’,c’,d’からなる行列の逆行列として定められ、式(11)〜式(14)で表される。ここでは、引数の(pi,0,qi,0)を省略した。 The linear conversion parameters a, b, c, and d in Equation (6) are defined as inverse matrices of a matrix composed of a ′, b ′, c ′, and d ′, and are expressed by Equations (11) to (14). The Here, the argument (p i, 0 , q i, 0 ) is omitted.

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

局所変換算出部240は、各基準点に対応する局所的な線形変換パラメータa,b,c,dを算出する。局所変換算出部240は、局所的な線形変換パラメータa,b,c,dを、大域変換決定部250に出力する。   The local conversion calculation unit 240 calculates local linear conversion parameters a, b, c, and d corresponding to each reference point. The local conversion calculation unit 240 outputs the local linear conversion parameters a, b, c, and d to the global conversion determination unit 250.

大域変換決定部250は、局所的な線形変換パラメータを基にして、撮影画像を補正画像に変換するための補正パラメータを生成する処理部である。大域変換決定部250は、例えば、データ補間処理、データ加算処理、逆変換算出処理を順に実行することで、補正パラメータを生成する。大域変換決定部250は、補正パラメータを補正パラメータ記憶部260に格納する。   The global conversion determination unit 250 is a processing unit that generates a correction parameter for converting a captured image into a corrected image based on a local linear conversion parameter. The global conversion determination unit 250 generates a correction parameter by sequentially executing, for example, a data interpolation process, a data addition process, and an inverse conversion calculation process. The global conversion determination unit 250 stores the correction parameter in the correction parameter storage unit 260.

大域変換決定部250が実行するデータ補間処理について説明する。大域変換決定部250は、局所的な線形変換パラメータを基にして、撮影画像の全画素に対して、各画素での線形変換パラメータを算出する。これは、作業員に指定された基準点から得られる線形変換パラメータ(局所的な線形変換パラメータ)を補間することで求める。   Data interpolation processing executed by the global conversion determination unit 250 will be described. The global conversion determination unit 250 calculates a linear conversion parameter at each pixel for all pixels of the captured image based on the local linear conversion parameter. This is obtained by interpolating a linear transformation parameter (local linear transformation parameter) obtained from a reference point designated by the worker.

作業員に指定された1番目の基準点の座標を(pi,0,qi,0)とし、かかる座標の線形変換パラメータをa,b,c,dとする。i=1,・・・,nは、校正物体の番号を表し、nは校正物体の総数を表す。このとき、撮影画像の画素(u,v)における線形変換パラメータを、式(15)〜式(18)で定める。 The coordinates of the first reference point specified in the operator and (p i, 0, q i , 0), the linear conversion parameters of such coordinates a i, b i, c i , and d i. i = 1,..., n represents the number of calibration objects, and n represents the total number of calibration objects. At this time, the linear conversion parameters for the pixel (u, v) of the captured image are defined by Expressions (15) to (18).

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

式(15)〜式(18)において、distは2点間の距離を表す。w(u,v)は重みの正規化を表し、式(19)により定められる。   In Expressions (15) to (18), dist represents the distance between two points. w (u, v) represents weight normalization and is defined by equation (19).

Figure 0006582618
Figure 0006582618

大域変換決定部250は、撮影画像の各画素(u,v)に対して、式(15)〜式(19)に基づき、線形変換のパラメータを計算する。図21は、各画素の線形変換パラメータの算出例を示す図である。図21では、画素30a〜30fを示す。原点の画素を30aとする。画素30aの線形パラメータをa1,b1,c1,d1とする。画素30bの線形パラメータをa2,b2,c2,d2とする。画素30cの線形パラメータをa3,b3,c3,d3とする。画素30dの線形パラメータをa4,b4,c4,d4とする。画素30eの線形パラメータをa5,b5,c5,d5とする。画素30fの線形パラメータをa6,b6,c6,d6とする。   The global conversion determination unit 250 calculates linear conversion parameters for each pixel (u, v) of the captured image based on Expressions (15) to (19). FIG. 21 is a diagram illustrating a calculation example of the linear conversion parameter of each pixel. In FIG. 21, pixels 30a to 30f are shown. Let the pixel at the origin be 30a. The linear parameters of the pixel 30a are a1, b1, c1, and d1. The linear parameters of the pixel 30b are a2, b2, c2, and d2. The linear parameters of the pixel 30c are a3, b3, c3, and d3. The linear parameters of the pixel 30d are a4, b4, c4, and d4. The linear parameters of the pixel 30e are a5, b5, c5, and d5. The linear parameters of the pixel 30f are a6, b6, c6, and d6.

続いて、大域変換決定部250が実行するデータ加算処理について説明する。図22は、本実施例2にかかるデータ加算処理を説明するための図である。大域変換決定部250は、実施例1の大域変換決定部150と同様にして、撮影画像の原点と、補正画像の原点とを決めて、撮影画像の原点と、補正画像の原点とを対応させる。そして、大域変換決定部250は、原点の画素から順番に線形変換パラメータを加算することで、順方向の大域的な座標変換を定める。   Next, the data addition process executed by the global conversion determination unit 250 will be described. FIG. 22 is a diagram for explaining the data addition processing according to the second embodiment. Similar to the global conversion determination unit 150 of the first embodiment, the global conversion determination unit 250 determines the origin of the captured image and the origin of the correction image, and associates the origin of the captured image with the origin of the correction image. . Then, the global transformation determination unit 250 determines the global coordinate transformation in the forward direction by adding linear transformation parameters in order from the pixel at the origin.

図22において、撮影画像上の画素と、この画素に対応する線形変換パラメータとの関係を示す。例えば、撮影画像の画素30aに対応する補正画像の点の座標値は(0,0)となる。撮影画像の画素30bに対応する補正画像の画点の座標は(a1,c1)となる。撮影画像の画素30cに対応する補正画像の点の座標は(a1+a2,c1+c2)となる。撮影画像の画素30dに対応する補正画像の点の座標は(b1,d1)となる。撮影画像の画素30eに対応する補正画像の点の座標は(a1+b2,c1+d2)となる。撮影画像の画素30fに対応する補正画像の点の座標は(a1+a2+b3,c1+c2+d3)となる。   FIG. 22 shows the relationship between the pixels on the captured image and the linear conversion parameters corresponding to the pixels. For example, the coordinate value of the point of the corrected image corresponding to the pixel 30a of the captured image is (0, 0). The coordinates of the image point of the corrected image corresponding to the pixel 30b of the captured image are (a1, c1). The coordinates of the point of the corrected image corresponding to the pixel 30c of the captured image are (a1 + a2, c1 + c2). The coordinates of the point of the corrected image corresponding to the pixel 30d of the photographed image are (b1, d1). The coordinates of the point of the corrected image corresponding to the pixel 30e of the photographed image are (a1 + b2, c1 + d2). The coordinates of the point of the corrected image corresponding to the pixel 30f of the photographed image are (a1 + a2 + b3, c1 + c2 + d3).

続いて、大域変換決定部250が実行する逆変換算出処理について説明する。大域変換決定部250が実行する逆変換算出処理は、実施例1の大域変換決定部150が実行する逆変換算出処理と同様である。   Next, the inverse conversion calculation process executed by the global conversion determination unit 250 will be described. The inverse conversion calculation process executed by the global conversion determination unit 250 is the same as the inverse conversion calculation process executed by the global conversion determination unit 150 of the first embodiment.

次に、本実施例2にかかる画像処理装置200の効果について説明する。画像処理装置200は、撮影画像に含まれる複数の校正物体に対する基準点の位置を受け付けて線形変換パラメータを算出し、各縮尺が一定となるように、撮影画像を補正することで補正画像を生成し、補正画像から特徴点を抽出してテンプレートマッチングを実行する。かかる処理を実行することで、同一の対象物の大きさが位置、向きによらず均一となるため、テンプレートや画像の縮尺を様々に変えてマッチングを行わなくても良くなり、処理量を削減することができる。   Next, effects of the image processing apparatus 200 according to the second embodiment will be described. The image processing apparatus 200 receives the positions of reference points for a plurality of calibration objects included in the captured image, calculates linear transformation parameters, and generates a corrected image by correcting the captured image so that each scale is constant. Then, feature points are extracted from the corrected image and template matching is executed. By executing such processing, the size of the same object becomes uniform regardless of position and orientation, so there is no need to perform matching by changing the scale of the template or image in various ways, reducing the amount of processing. can do.

次に、本実施例3にかかる画像処理装置について説明する。システムの構成は、実施例1に示したシステムと同様である。   Next, an image processing apparatus according to the third embodiment will be described. The system configuration is the same as that of the system shown in the first embodiment.

図23は、本実施例3にかかる画像処理装置の構成を示す機能ブロック図である。図23に示すように、画像処理装置300は、カメラ50に接続される。画像処理装置300は、取得部310、校正物体表示部320、校正情報入力部330、局所変換算出部340、大域変換決定部350、補正パラメータ記憶部360を有する。画像処理装置300は、補正画像生成部370、テンプレートマッチング実行部380、検出結果出力部390を有する。   FIG. 23 is a functional block diagram of the configuration of the image processing apparatus according to the third embodiment. As shown in FIG. 23, the image processing apparatus 300 is connected to the camera 50. The image processing apparatus 300 includes an acquisition unit 310, a calibration object display unit 320, a calibration information input unit 330, a local conversion calculation unit 340, a global conversion determination unit 350, and a correction parameter storage unit 360. The image processing apparatus 300 includes a corrected image generation unit 370, a template matching execution unit 380, and a detection result output unit 390.

カメラ50、取得部310、校正物体表示部320、校正情報入力部330、局所変換算出部340に関する説明は、図18のカメラ50、取得部210、校正物体表示部220、校正情報入力部230、局所変換算出部240に関する説明と同様である。補正画像生成部370、テンプレートマッチング実行部380、検出結果出力部390に関する説明は、図18の補正画像生成部270、テンプレートマッチング実行部280、検出結果出力部290に関する説明と同様である。   The description of the camera 50, the acquisition unit 310, the calibration object display unit 320, the calibration information input unit 330, and the local transformation calculation unit 340 is as follows: the camera 50, the acquisition unit 210, the calibration object display unit 220, the calibration information input unit 230, FIG. This is the same as the description regarding the local conversion calculation unit 240. The description regarding the correction image generation unit 370, the template matching execution unit 380, and the detection result output unit 390 is the same as the description regarding the correction image generation unit 270, the template matching execution unit 280, and the detection result output unit 290 of FIG.

実施例2においては、大域的な座標変換を定める際に、画素の順番を決める必要がある。画素の順番を変えると一般に得られる変換は変化する。画素には本来、順番は付与されておらず、順番に依存せずに変換を定める方法が望ましい。そこで,本実施例3では画素の順番に依存しない変換決定方法を開示する。   In the second embodiment, it is necessary to determine the order of pixels when determining global coordinate transformation. Changing the order of the pixels generally changes the resulting conversion. Originally, the order is not given to the pixels, and a method of determining conversion without depending on the order is desirable. Therefore, this third embodiment discloses a conversion determination method that does not depend on the order of pixels.

大域変換決定部350は、局所的な線形変換パラメータを基にして、撮影画像を補正画像に変換するための補正パラメータを生成する処理部である。大域変換決定部350は、パラメータを、補正パラメータ記憶部360に格納する。   The global conversion determination unit 350 is a processing unit that generates a correction parameter for converting a captured image into a corrected image based on a local linear conversion parameter. The global conversion determination unit 350 stores the parameters in the correction parameter storage unit 360.

大域変換決定部350は、例えば、順変換決定処理、逆変換算出処理を順に実行することで、補正パラメータを生成する。   For example, the global conversion determination unit 350 generates a correction parameter by sequentially executing a forward conversion determination process and an inverse conversion calculation process.

大域変換決定部350が実行する順変換決定処理について説明する。一般に、大域的な座標変換は狭い範囲ではその微分を変換パラメータとする線形変換で近似される。この性質に基づき、順変換決定処理において、大域変換決定部350は、未知の係数を持つ関数(の族)を予め定めておき、その微分が与えられた局所的な座標変換とできるだけ一致するように最小二乗法で係数を定める。これにより、画像の各点で局所的な座標変換をよく近似する順向きの大域的な座標変換を定めることができる。   The forward conversion determination process executed by the global conversion determination unit 350 will be described. In general, global coordinate transformation is approximated by linear transformation using a derivative as a transformation parameter in a narrow range. Based on this property, in the forward conversion determination process, the global conversion determination unit 350 predetermines a function (family) having an unknown coefficient, and the derivative thereof matches as much as possible with the given local coordinate conversion. The coefficient is determined by the least square method. Thereby, the forward global coordinate transformation that closely approximates the local coordinate transformation at each point of the image can be determined.

大域変換決定部350は、関数の族として、例えば、式(20)、式(21)を用いる。   The global transformation determination unit 350 uses, for example, Expression (20) and Expression (21) as the function family.

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

最小二乗法の評価関数Fは、式(22)で表される。式(22)において、下付の添え字は、その変数による偏微分を表す。評価関数Fは、未知の係数a,・・・,a,b,・・・,bについて2次式であるので、最小化は線形連立方程式を解くことで帰着される。線形連立方程式は、例えば、公知のガウスの消去法で解くことができる。 The evaluation function F of the least square method is expressed by Expression (22). In the equation (22), the subscript suffix represents the partial differentiation by the variable. Since the evaluation function F is a quadratic expression with respect to the unknown coefficients a 0 ,..., A 5 , b 0 ,..., B 5 , the minimization is reduced by solving the linear simultaneous equations. The linear simultaneous equations can be solved, for example, by a known Gaussian elimination method.

Figure 0006582618
Figure 0006582618

係数a,・・・,a,b,・・・,bが求められると、撮影画像の各画素(u,v)に対して、対応する補正画像の点(f,f)を計算することができる。 When the coefficients a 0 ,..., A 5 , b 0 ,..., B 5 are obtained, for each pixel (u, v) of the photographed image, the corresponding corrected image point (f x , f y ) can be calculated.

続いて、大域変換決定部350が実行する逆変換算出処理について説明する。大域変換決定部350が実行する逆変換算出処理は、実施例1の大域変換決定部150が実行する逆変換算出処理と同様である。   Next, the inverse conversion calculation process executed by the global conversion determination unit 350 will be described. The inverse transformation calculation process executed by the global transformation determination unit 350 is the same as the inverse transformation calculation process executed by the global transformation determination unit 150 of the first embodiment.

次に、本実施例3にかかる画像処理装置300の効果について説明する。画像処理装置300は、大域的な座標変換は狭い範囲ではその微分を変換パラメータとする線形変換で近似されるという特性に基づいて、未知の係数を持つ関数の族を予め定めておき、その微分が与えられた局所的な座標変換とできるだけ一致するように最小二乗法で係数を定める。これによって、画素の順番に依存しないで、撮影画像の画素に対応する補正画像の点を特定することができる。   Next, effects of the image processing apparatus 300 according to the third embodiment will be described. The image processing apparatus 300 predetermines a family of functions having unknown coefficients based on the characteristic that global coordinate transformation is approximated by linear transformation using the derivative as a transformation parameter in a narrow range. The coefficient is determined by the least square method so that is as close as possible to the given local coordinate transformation. Thereby, the point of the corrected image corresponding to the pixel of the captured image can be specified without depending on the order of the pixels.

次に、本実施例4にかかる画像処理装置について説明する。システムの構成は、実施例1に示したシステムと同様である。   Next, an image processing apparatus according to the fourth embodiment will be described. The system configuration is the same as that of the system shown in the first embodiment.

実施例1〜3においては、局所的な座標変換、大域的な座標変換はともに撮影画像の各画素が補正画像のどの点に対応するかを表していた。そのため,補正画像を生成する際には逆変換を算出する。これに対して、本実施例4では、実施例1〜3とは逆向きに変換を定める。これにより、逆変換を算出する処理が不要になる。変換の回数が少なくなるため、補間画像の品質向上が期待できる。また、後述するように、大域的な座標変換が望ましい性質を満たすことが数学的に保証される。   In the first to third embodiments, both local coordinate conversion and global coordinate conversion indicate to which point of the corrected image each pixel of the captured image corresponds. Therefore, inverse transformation is calculated when generating a corrected image. On the other hand, in the fourth embodiment, conversion is determined in the opposite direction to the first to third embodiments. Thereby, the process which calculates reverse transformation becomes unnecessary. Since the number of conversions is reduced, the quality of the interpolated image can be improved. In addition, as will be described later, it is mathematically guaranteed that global coordinate transformation satisfies desirable properties.

図24は、本実施例4にかかる画像処理装置の構成を示す機能ブロック図である。図24に示すように、画像処理装置400は、カメラ50に接続される。画像処理装置400は、取得部410、校正物体表示部420、校正情報入力部430、局所変換算出部440、大域変換決定部450、補正パラメータ記憶部460を有する。画像処理装置400は、補正画像生成部470、テンプレートマッチング実行部480、検出結果出力部490を有する。   FIG. 24 is a functional block diagram of the configuration of the image processing apparatus according to the fourth embodiment. As shown in FIG. 24, the image processing apparatus 400 is connected to the camera 50. The image processing apparatus 400 includes an acquisition unit 410, a calibration object display unit 420, a calibration information input unit 430, a local conversion calculation unit 440, a global conversion determination unit 450, and a correction parameter storage unit 460. The image processing apparatus 400 includes a corrected image generation unit 470, a template matching execution unit 480, and a detection result output unit 490.

カメラ50、取得部410、校正物体表示部420、校正情報入力部430に関する説明は、図2のカメラ50、取得部110、校正物体表示部120、校正情報入力部130(または、構成情報入力部230)に関する説明と同様である。補正画像生成部470、テンプレートマッチング実行部480、検出結果出力部490に関する説明は、図2の補正画像生成部170、テンプレートマッチング実行部180、検出結果出力部190に関する説明と同様である。   The camera 50, the acquisition unit 410, the calibration object display unit 420, and the calibration information input unit 430 are described with reference to the camera 50, the acquisition unit 110, the calibration object display unit 120, and the calibration information input unit 130 (or the configuration information input unit in FIG. 2). 230). The description regarding the correction image generation unit 470, the template matching execution unit 480, and the detection result output unit 490 is the same as the description regarding the correction image generation unit 170, the template matching execution unit 180, and the detection result output unit 190 of FIG.

局所変換算出部440は、局所的な座標変換として、式(23)を用いる。式(23)において、(δu,δv)は、撮影画像の点の微小変化を表し、(δx,δy)は、補正画像の点の微小変化を表す。a,b,c,dは、線形変換パラメータであり、撮影画像の点(u,v)によって異なる。 The local conversion calculation unit 440 uses Expression (23) as local coordinate conversion. In Expression (23), (δu, δv) T represents a minute change in the point of the captured image, and (δx, δy) T represents a minute change in the point of the corrected image. “a”, “b”, “c”, and “d” are linear conversion parameters, which differ depending on the point (u, v) of the photographed image.

Figure 0006582618
Figure 0006582618

作業員に指定された基準点の3つの組を(pi,0,qi,0)、(pi,x,qi,x)、(pi,y,qi,y)(i=1,・・・,n)とする。校正物体の標準幅をw、標準高をhとする。このとき、局所的な座標変換のパラメータa,b,c,dを式(24)〜式(27)で定める。 Three sets of reference points designated by the worker are expressed as ( pi, 0 , qi , 0 ), ( pi, x , qi , x ), ( pi, y , qi , y ) (i = 1,..., N). The standard width of the calibration object is w 0 and the standard height is h 0 . At this time, parameters a, b, c, and d for local coordinate conversion are determined by equations (24) to (27).

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

局所変換算出部440は、局所的な線形変換パラメータa,b,c,dを、大域変換決定部450に出力する。   The local conversion calculation unit 440 outputs the local linear conversion parameters a, b, c, and d to the global conversion determination unit 450.

大域変換決定部450は、局所的な線形変換パラメータを基にして、撮影画像を補正画像に変換するための補正パラメータを生成する処理部である。大域変換決定部450は、例えば、データ回帰処理、積分処理を順に実行することで、補正パラメータを生成する。大域変換決定部460は、補正パラメータを補正パラメータ記憶部460に格納する。   The global conversion determination unit 450 is a processing unit that generates a correction parameter for converting a captured image into a corrected image based on a local linear conversion parameter. The global conversion determination unit 450 generates a correction parameter by sequentially executing, for example, data regression processing and integration processing. The global conversion determination unit 460 stores the correction parameter in the correction parameter storage unit 460.

大域変換決定部450が実行するデータ回帰処理について説明する。大域変換決定部450は、未知の係数を持つ関数の族を予め定めておき、与えられた局所的な座標変換とできるだけ一致するように最小二乗法で係数を求める。これにより、撮影画像の全ての点に対して、局所的な座標変換を求めることができる。   Data regression processing executed by the global conversion determination unit 450 will be described. The global transformation determination unit 450 predetermines a family of functions having unknown coefficients, and obtains the coefficients by the least square method so as to match the given local coordinate transformation as much as possible. Thereby, local coordinate transformation can be obtained for all points of the captured image.

大域変換決定部450は、関数の族として、例えば、式(28)〜式(31)を用いる。   The global transformation determination unit 450 uses, for example, Expression (28) to Expression (31) as the function family.

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

最小二乗法の評価関数Fは、式(32)で表される。   The evaluation function F of the least square method is expressed by Expression (32).

Figure 0006582618
Figure 0006582618

大域変換決定部450は、式(32)の評価関数Fの値を最小にするように係数a,・・・,a,b,・・・,b,c,・・・,c,d,・・・,dを定める。ただし、後述する積分処理を実行するため、数学的要請として、fu,x,fu,y,fv,x,fv,yは、式(33)、式(34)の条件を満たす必要がある。 The global transformation determination unit 450 makes the coefficients a 0 ,..., A 5 , b 0 ,..., B 5 , c 0 ,. , C 5 , d 0 ,..., D 5 are determined. However, in order to execute the integration processing described later, as mathematical requests, f u, x , f u, y , f v, x , f v, y satisfy the conditions of the expressions (33) and (34). There is a need.

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

上例の2次式の場合に、式(33)、式(34)の積分可能条件を計算すると、係数に関する下記の制約式(35)〜式(54)が得られる。   In the case of the quadratic expression in the above example, the following constraint expressions (35) to (54) relating to the coefficients are obtained by calculating the integrable conditions of Expression (33) and Expression (34).

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

大域変換決定部450は、上記の制約式(35)〜式(54)を満たす係数の組み合わせの中で上記の評価関数Fを最小化するものを探索する。例えば、大域変換決定部450は、公知技術であるラグランジュ未定乗数法に基づき、上記の制約式(35)〜式(54)を満し、評価関数Fを最小化する係数を探索する。   The global transformation determination unit 450 searches for a combination that minimizes the evaluation function F from among the combinations of coefficients that satisfy the constraints (35) to (54). For example, the global transformation determination unit 450 searches for a coefficient that satisfies the constraint equations (35) to (54) and minimizes the evaluation function F based on the Lagrange undetermined multiplier method that is a known technique.

続いて、大域変換決定部450の積分処理について説明する。大域変換決定部450は、式(55)に示す偏微分方程式を解く。   Next, the integration process of the global conversion determination unit 450 will be described. The global conversion determination unit 450 solves the partial differential equation shown in Expression (55).

Figure 0006582618
Figure 0006582618

大域変換決定部450は、偏微分方程式の初期条件として、補正画像の1点(x,y)が撮影画像の1点(u,v)に対応するように選択する。例えば、大域変換決定部450は、偏微分方程式の初期条件として、補正画像の中心と、撮影画像の中心とを選択しても良い。 The global conversion determination unit 450 selects, as an initial condition of the partial differential equation, one point (x 0 , y 0 ) of the corrected image corresponds to one point (u 0 , v 0 ) of the captured image. For example, the global conversion determination unit 450 may select the center of the corrected image and the center of the captured image as the initial condition of the partial differential equation.

上記の積分可能条件となる式(35)〜式(54)は、上記の偏微分方程式(55)に解が存在するための必要十分条件である。具体的には、積分可能条件は、uをyで微分した値と、uをxで微分した値とが一致することを表している。vについても同様である。逆に積分可能条件が成り立てば、グリーンの補助公式から線積分が経路によらないことが示されるので、式(56)、式(57)で定義されるu,vが微分方程式の解となる。 Expressions (35) to (54), which are the above-mentioned integration enable conditions, are necessary and sufficient conditions for the solution to exist in the partial differential equation (55). Specifically, the integrable condition represents that the value obtained by differentiating u x by y matches the value obtained by differentiating u y by x. The same applies to v. On the other hand, if the integrable condition is satisfied, Green's auxiliary formula indicates that the line integral does not depend on the path, so u and v defined by Equation (56) and Equation (57) are the solutions of the differential equation. .

Figure 0006582618
Figure 0006582618
Figure 0006582618
Figure 0006582618

大域変換決定部450が、偏微分方程式を数値的に解く方法としては、例えば、公知技術であるオイラー法を用いる。線積分が経路によらないので、大域変換決定部450は、初期条件で選んだ1点(x,y)と各点(x,y)を結んだ適当な経路に沿って、積分を和で近似することで、解を求める。解いた結果は、補正画像の各画素(x,y)が対応する撮影画像の点の座標(u,v)で表され、補正パラメータとなる。 As a method for the global transformation determination unit 450 to numerically solve the partial differential equation, for example, the Euler method which is a known technique is used. Since the line integration does not depend on the path, the global transformation determination unit 450 performs the integration along an appropriate path connecting one point (x 0 , y 0 ) selected in the initial condition and each point (x, y). Find the solution by approximating with the sum. The solved result is expressed by the coordinates (u, v) of the point of the captured image corresponding to each pixel (x, y) of the corrected image, and becomes a correction parameter.

図25は、本実施例4にかかる補正パラメータのデータ構造の一例を示す図である。図25に示すように、補正パラメータ460aは、補正画像の画素の座標値と、撮影画像の点の座標値とを有する。例えば、補正画像の画素の座標値(0,0)に対応する、撮影画像の点の座標値は、(u0,0,v0,0)となることが示される。 FIG. 25 is a diagram illustrating an example of the data structure of the correction parameter according to the fourth embodiment. As shown in FIG. 25, the correction parameter 460a has the coordinate value of the pixel of the corrected image and the coordinate value of the point of the captured image. For example, it is indicated that the coordinate value of the point of the photographed image corresponding to the coordinate value (0, 0) of the pixel of the corrected image is (u 0,0 , v 0,0 ).

ここで、大域的な座標変換の性質について説明する。   Here, the property of global coordinate transformation will be described.

本願では補正画像から対象物の検出を行うので、補正処理の結果得られる補正画像が撮影画像全体を表し、かつ対象物が2重写しになるような補正にならないことが必要である。このことは、補正画像を生成する大域的な座標変換が大域的に全単射であることを意味する。変換φが大域的に全単射であるとは、撮影画像の任意の点(u,v)に対して、(u,v)=φ(x,y)となるような補正画像の点(x,y)が存在し、かつそのような(x,y)はただ1つであることを表す。   In the present application, since the target object is detected from the corrected image, it is necessary that the corrected image obtained as a result of the correction process represents the entire captured image, and the correction is not performed so that the target object becomes a double copy. This means that the global coordinate transformation that generates the corrected image is bijective globally. That the transformation φ is bijective globally is that a point of the corrected image (u, v) = φ (x, y) with respect to an arbitrary point (u, v) of the captured image ( x, y) is present and such (x, y) represents only one.

撮影画像において校正物体の基準点が見えるように設置されており、かつ作業員が適切な指定を行うことを仮定すると、3つの基準点が1つの直線に乗ることはない。この場合,a(u,v)d(u,v)−b(u,v)c(u,v)はu=pi,0,v=qi,0(i=1,・・・,n)において全て0でない値を取る。fu,x,fu,y,fv,x,fv,yは、撮影画像の全点で値を持つようにa,b,c,dを補間した関数である。そこで、fu,x(u,v)fv,y(u,v)−fu,y(u,v)fv,x(u,v)も全点で0にならないことが期待できる。上式は、大域的な変換におけるヤコビアン、すなわち1階微分のヤコビ行列の行列式に等しい。 Assuming that the reference point of the calibration object is visible in the photographed image and that the operator makes an appropriate designation, the three reference points do not ride on one straight line. In this case, a (u, v) d (u, v) -b (u, v) c (u, v) is u = pi, 0 , v = qi , 0 (i = 1,... , N) all take non-zero values. Fu, x , fu, y , fv, x , fv, and y are functions obtained by interpolating a, b, c, and d so as to have values at all points of the captured image. Therefore, it can be expected that f u, x (u, v) f v, y (u, v) −fu , y (u, v) f v, x (u, v) do not become zero at all points. . The above equation is equal to the Jacobian in the global transformation, that is, the determinant of the first derivative Jacobian matrix.

一般に、変換のヤコビアンが0でなければ、その変換は局所的には全単射になることが知られている。しかし、大域的な全単射性は必ずしも保証されない。例えば、x(u,v)=u cosv あるいはu*cos(v)等,y(u,v)=u sin vあるいはu*sin(v)等は、u>0でヤコビアン0にならないが、v=0,2πで値が一致するため、大域的には全単射にはならない。   In general, it is known that if the Jacobian of the conversion is not 0, the conversion is locally bijective. However, global bijectivity is not always guaranteed. For example, x (u, v) = u cosv or u * cos (v) etc., y (u, v) = u sin v or u * sin (v) etc. does not become Jacobian 0 when u> 0. Since the values match at v = 0, 2π, it is not bijective globally.

しかし、本実施例で定められる大域的な変換は、大域的に全単射になることが数学的に保証される。これは、望ましい性質である。以下に数学の定理の形でまとめる。   However, the global transformation defined in this embodiment is mathematically guaranteed to be bijective globally. This is a desirable property. The following is a summary of mathematical theorems.

[定理] fu,x,fu,y,fv,x,fv,yは、1階微分可能で微分は連続とし、積分可能条件を満たすと仮定する。このとき、偏微分方程式の解u,vは、ヤコビアンが0でなければ大域的に全単射になる。ただし、単射性では定義域は凸と仮定する。 [Theorem] It is assumed that fu, x , fu, y , fv, x , fv, and y are first-order differentiable, the differentiation is continuous, and satisfy an integrable condition. At this time, the solutions u and v of the partial differential equations are bijective globally unless the Jacobian is 0. However, in the case of injectivity, the domain is assumed to be convex.

[略証] 単射性:結論を否定して矛盾を導く。異なる2点(x,y),(x,y)に対して、同一の値(u,v)を取るような解u,vが存在すると仮定する。この2点を結んだ線分Lを考える。線分の向きを(a,b)と置く。線分Lは定義域に含まれるので、L上の点に対してu,vは閉曲線Cとなる。u,vの微分はu,vの値のみで決まるため、Cは自己交差のない単純閉曲線になる。ジョルダンの曲線定理より、閉曲線Cは平面を内側と外側に分ける。内側Dは,有界な単連結成分になる。CとDの各点において、ベクトル(afu,x+bfu,y,afv,x+bfv,y)を対応させるベクトル場を考える。このベクトル場は連続になる。また、ヤコビアンが0でないことからC,Dの各点でベクトルの大きさは0にならない。一方,Cにおいて上記のベクトルはCの接線方向を向く。これは、ポアンカレ・ホップの定理に反するので矛盾する。よって、大域的に単射である。 [Proof] Injectivity: Denies the conclusion and leads to contradiction. It is assumed that there are solutions u and v that take the same value (u 1 , v 1 ) for two different points (x 1 , y 1 ) and (x 2 , y 2 ). Consider a line segment L connecting these two points. The direction of the line segment is set as (a, b). Since the line segment L is included in the domain, u and v are closed curves C for points on L. Since the differentiation of u and v is determined only by the values of u and v, C becomes a simple closed curve without self-intersection. From the Jordan curve theorem, the closed curve C divides the plane into an inside and an outside. The inner side D becomes a bounded single connected component. Consider a vector field that correlates vectors (af u, x + bf u, y , af v, x + bf v, y ) at points C and D. This vector field is continuous. Further, since the Jacobian is not 0, the vector size does not become 0 at each point of C and D. On the other hand, in C, the above vector faces the tangential direction of C. This contradicts the Poincare hop theorem. Therefore, it is injectable globally.

全射性:初期条件で指定された(u,v)を含む任意の有界領域(連結した開集合)Ωに対して全射になることを示す。解析学でよく知られた逆写像定理の証明を若干修正することで以下の補題が得られる。写像の像になる(Ωに属する)任意の(u,v)に対して、|(u’,v’)−(u,v)|<rを満たす(Ωに属する)任意の(u’,v’)も写像の像になる。ここで,rは正数で(u,v)の境界までの距離dだけに依存する。r=r(d)は単調増加関数である。以下ではこの補題を用いて全射性を示す。Ωは連結なので、位相空間論の一般論から、Ωを共通部分のない2つの開集合A,Bの合併で表すと一方の開集合は空集合になる。ここで、Ωの部分集合Aを写像の像になる元を集めたものと定める。また、部分集合Bを写像の像にならない元を集めたものと定める。明らかに両者の共通部分はなく、AとBの合併はΩに一致する.また,(u,v)はAの元なので、Aは空集合ではない。局所的な全射性からAが開集合になることは明らかである。Bが開集合になることは以下のように示される。結論を否定すると、Bに属するある(u,v)と任意の正数εに対して、|(u’,v’)−(u,v)|<εを満たすAの元(u’,v’)が存在することになる。まず、(u,v)の境界までの距離をdとする。上記補題のrをr=r(d/2)で定める。ε=min(d/2,r)とおく。このとき、上記のAの元(u’,v’)の境界までの距離d’はd/2以上であり、かつ|(u’,v’)−(u,v)|<r(d/2)≦r(d’)となる。上記補題より、(u,v)がAの元になり矛盾する.従って,Bが空集合になることが導かれる。これは、大域的な全射性を表す。 Radiality: indicates that it is surjective for any bounded region (connected open set) Ω including (u 0 , v 0 ) specified in the initial condition. The following lemma can be obtained by slightly modifying the proof of the inverse mapping theorem, which is well known in analytics. Arbitrary (u ′) satisfying | (u ′, v ′) − (u, v) | <r with respect to arbitrary (u, v) that becomes a mapping image (belonging to Ω) , V ′) is also a mapping image. Here, r is a positive number and depends only on the distance d to the boundary of (u, v). r = r (d) is a monotonically increasing function. In the following, this lemma is used to show the bijectivity. Since Ω is connected, from the general theory of phase space theory, when Ω is represented by merging two open sets A and B having no common part, one open set is an empty set. Here, a subset A of Ω is defined as a collection of elements that become mapping images. Further, the subset B is defined as a collection of elements that do not become mapping images. Obviously, there is no common part between the two, and the merger of A and B matches Ω. Since (u 0 , v 0 ) is an element of A, A is not an empty set. It is clear that A is an open set from the local radiation. The fact that B becomes an open set is shown as follows. If the conclusion is negated, for some (u, v) and any positive number ε belonging to B, an element of A that satisfies | (u ′, v ′) − (u, v) | <ε (u ′, v ′) exists. First, let d be the distance to the boundary of (u, v). The r of the lemma is defined as r = r (d / 2). Let ε = min (d / 2, r). At this time, the distance d ′ to the boundary of the element (u ′, v ′) of A is not less than d / 2, and | (u ′, v ′) − (u, v) | <r (d / 2) ≦ r (d ′). From the above lemma, (u, v) becomes an element of A and contradicts. Therefore, it is derived that B becomes an empty set. This represents a global shot.

次に、本実施例4にかかる画像処理装置400の効果について説明する。画像処理装置400は、未知の係数を持つ関数の族を予め定めておき、与えられた局所的な座標変換とできるだけ一致するように最小二乗法で係数を求める。また、画像処理装置400は、求めた係数を用いて偏微分方程式を解くことで、補正画像の各画素(x,y)が対応する撮影画像の点の座標(u,v)を特定する。すなわち、画像処理装置400は、実施例1〜3とは逆向きに変換を定めることで、逆変換を算出する処理が不要になる。このため、変換の回数が少なくなるため、補間画像の品質向上が期待できる。   Next, effects of the image processing apparatus 400 according to the fourth embodiment will be described. The image processing apparatus 400 predetermines a family of functions having unknown coefficients, and obtains the coefficients by the least square method so as to match the given local coordinate transformation as much as possible. Further, the image processing apparatus 400 specifies the coordinates (u, v) of the point of the captured image corresponding to each pixel (x, y) of the corrected image by solving the partial differential equation using the obtained coefficient. That is, the image processing apparatus 400 determines the conversion in the opposite direction to that of the first to third embodiments, so that the process for calculating the reverse conversion becomes unnecessary. For this reason, since the number of times of conversion is reduced, the quality of the interpolated image can be improved.

次に、上記実施例に示した画像処理装置100〜400と同様の機能を実現する画像処理プログラムを実行するコンピュータの一例について説明する。図26は、画像処理プログラムを実行するコンピュータの一例を示す図である。   Next, an example of a computer that executes an image processing program that implements the same functions as those of the image processing apparatuses 100 to 400 described in the above embodiment will be described. FIG. 26 is a diagram illustrating an example of a computer that executes an image processing program.

図26に示すように、コンピュータ500は、各種演算処理を実行するCPU501と、ユーザからのデータの入力を受け付ける入力装置502と、ディスプレイ503とを有する。また、コンピュータ500は、記憶媒体からプログラム等を読み取る読み取り装置504と、ネットワークを介して他のコンピュータとの間でデータの授受を行うインターフェース装置505とを有する。また、コンピュータ500は、各種情報を一時記憶するRAM506と、ハードディスク装置507とを有する。そして、各装置501〜507は、バス508に接続される。   As illustrated in FIG. 26, the computer 500 includes a CPU 501 that executes various arithmetic processes, an input device 502 that receives input of data from a user, and a display 503. The computer 500 includes a reading device 504 that reads a program and the like from a storage medium, and an interface device 505 that exchanges data with other computers via a network. The computer 500 also includes a RAM 506 that temporarily stores various types of information and a hard disk device 507. The devices 501 to 507 are connected to the bus 508.

ハードディスク装置507は、取得プログラム507a、算出プログラム507b、検出プログラム507cを有する。CPU501は、取得プログラム507a、算出プログラム507b、検出プログラム507cを読み出してRAM506に展開する。取得プログラム507aは、取得プロセス506aとして機能する。算出プログラム507bは、算出プロセス506bとして機能する。検出プログラム507cは、検出プロセス506cとして機能する。取得プロセス506aの処理は、取得部110、210,310,410の処理に対応する。算出プロセス506bの処理は、局所変換算出部140、240,340,440、大域変換決定部150,250,350,450の処理に対応する。検出プロセス506cの処理は、補正画像生成部170、270,370,470、テンプレートマッチング実行部180,280,380,480、検出結果出力部190,290,390,490の処理に対応する。   The hard disk device 507 has an acquisition program 507a, a calculation program 507b, and a detection program 507c. The CPU 501 reads out the acquisition program 507a, the calculation program 507b, and the detection program 507c and develops them in the RAM 506. The acquisition program 507a functions as an acquisition process 506a. The calculation program 507b functions as a calculation process 506b. The detection program 507c functions as a detection process 506c. The processing of the acquisition process 506a corresponds to the processing of the acquisition units 110, 210, 310, and 410. The processing of the calculation process 506b corresponds to the processing of the local conversion calculation units 140, 240, 340, 440 and the global conversion determination units 150, 250, 350, 450. The processing of the detection process 506c corresponds to the processing of the corrected image generation units 170, 270, 370, 470, the template matching execution units 180, 280, 380, 480, and the detection result output units 190, 290, 390, 490.

なお、取得プログラム507a、算出プログラム507b、検出プログラム507cについては、必ずしも最初からハードディスク装置507に記憶させておかなくても良い。例えば、コンピュータ500に挿入されるフレキシブルディスク(FD)、CD−ROM、DVDディスク、光磁気ディスク、ICカードなどの「可搬用の物理媒体」に各プログラムを記憶させておく。そして、コンピュータ500が取得プログラム507a、算出プログラム507b、検出プログラム507cを読み出して実行するようにしてもよい。   Note that the acquisition program 507a, the calculation program 507b, and the detection program 507c are not necessarily stored in the hard disk device 507 from the beginning. For example, each program is stored in a “portable physical medium” such as a flexible disk (FD), a CD-ROM, a DVD disk, a magneto-optical disk, and an IC card inserted into the computer 500. Then, the computer 500 may read and execute the acquisition program 507a, the calculation program 507b, and the detection program 507c.

以上の各実施例を含む実施形態に関し、さらに以下の付記を開示する。   The following supplementary notes are further disclosed with respect to the embodiments including the above examples.

(付記1)コンピュータに、
同一形状の複数の物体が撮影された撮影画像を取得し、
前記撮影画像に含まれる前記複数の物体に対する基準点の位置を受け付け、前記物体の基準点の間隔に基づいて、前記撮影画像の各画素における縮尺を算出し、
前記撮影画像の各画素における縮尺を基にして、前記撮影画像を、各画素における縮尺が一定となる補正画像に変換し、
前記補正画像に対してテンプレートマッチングを実行することで対象物を検出する
処理を実行させることを特徴とするテンプレートマッチングプログラム。
(Supplementary note 1)
Acquire a captured image of multiple objects of the same shape,
Receiving positions of reference points for the plurality of objects included in the photographed image, and calculating a scale at each pixel of the photographed image based on an interval between the reference points of the objects;
Based on the scale of each pixel of the photographed image, the photographed image is converted into a corrected image in which the scale of each pixel is constant,
A template matching program that executes processing for detecting an object by executing template matching on the corrected image.

(付記2)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺を用いて補間を行うことで、前記撮影画像の各画素における縮尺を算出することを特徴とする付記1に記載のテンプレートマッチングプログラム。 (Supplementary Note 2) The process of calculating the scale at each pixel of the captured image calculates a local scale corresponding to the position of the object in the captured image based on the interval between the reference points of the object, The template matching program according to appendix 1, wherein a scale at each pixel of the captured image is calculated by performing interpolation using a local scale.

(付記3)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の間隔を基にして、前記撮影画像の点を前記補正画像の点に変換する線形変換パラメータを算出し、前記補正画像に変換する処理は、前記線形変換パラメータを基にして、前記撮影画像を、各画素における縮尺が一定となる補正画像に変換することを特徴とする付記1に記載のテンプレートマッチングプログラム。 (Additional remark 3) The process which calculates the reduced scale in each pixel of the said picked-up image calculates the linear conversion parameter which converts the point of the said picked-up image into the point of the said correction | amendment image based on the space | interval of the reference point of the said object. The template matching program according to appendix 1, wherein the process of converting to the corrected image converts the captured image into a corrected image having a constant scale in each pixel based on the linear conversion parameter. .

(付記4)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺とある点の縮尺との関係を示し、かつ、未知の係数を持つ関数を微分した関数を基にして、前記未知の係数を特定することで、前記撮影画像の各画素における縮尺を算出することを特徴とする付記1に記載のテンプレートマッチングプログラム。 (Additional remark 4) The process which calculates the reduced scale in each pixel of the said picked-up image calculates the local scale corresponding to the position of the said object of the said picked-up image based on the space | interval of the reference point of the said object, The relationship between the local scale and the scale of a certain point is shown, and the scale of each pixel of the captured image is determined by specifying the unknown coefficient based on a function obtained by differentiating a function having an unknown coefficient. The template matching program according to supplementary note 1, wherein the template matching program is calculated.

(付記5)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の位置を基にして、前記補正画像の局所的な点を前記撮影画像の局所的な点に変換する第1関数を特定し、未知の係数を持つ第2関数を微分した関数が前記第1関数に一致するように、前記未知の係数を特定し、特定した未知の係数を設定した第2関数に基づき、前記撮影画像の各画素における縮尺を算出することを特徴とする付記1に記載のテンプレートマッチングプログラム。 (Additional remark 5) The process which calculates the reduced scale in each pixel of the said picked-up image converts the local point of the said correction image into the local point of the said picked-up image based on the position of the reference point of the said object. The first function is specified, the unknown coefficient is specified so that a function obtained by differentiating the second function having the unknown coefficient matches the first function, and the specified unknown coefficient is set to the second function. The template matching program according to appendix 1, wherein a scale at each pixel of the captured image is calculated based on the template.

(付記6)コンピュータが実行するテンプレートマッチング方法であって、
同一形状の複数の物体が撮影された撮影画像を取得し、
前記撮影画像に含まれる前記複数の物体に対する基準点の位置を受け付け、前記物体の基準点の間隔に基づいて、前記撮影画像の各画素における縮尺を算出し、
前記撮影画像の各画素における縮尺を基にして、各画素における縮尺が一定となる補正画像を生成し、
前記補正画像に対してテンプレートマッチングを実行することで対象物を検出する
処理を実行することを特徴とするテンプレートマッチング方法。
(Appendix 6) A template matching method executed by a computer,
Acquire a captured image of multiple objects of the same shape,
Receiving positions of reference points for the plurality of objects included in the photographed image, and calculating a scale at each pixel of the photographed image based on an interval between the reference points of the objects;
Based on the scale of each pixel of the captured image, generate a corrected image in which the scale of each pixel is constant,
The template matching method characterized by performing the process which detects a target object by performing template matching with respect to the said correction | amendment image.

(付記7)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺を用いて補間を行うことで、前記撮影画像の各画素における縮尺を算出することを特徴とする付記6に記載のテンプレートマッチング方法。 (Supplementary Note 7) The process of calculating the scale at each pixel of the captured image calculates a local scale corresponding to the position of the object in the captured image based on the interval between the reference points of the object, The template matching method according to appendix 6, wherein a scale at each pixel of the captured image is calculated by performing interpolation using a local scale.

(付記8)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の間隔を基にして、前記撮影画像の点を前記補正画像の点に変換する線形変換パラメータを算出し、前記補正画像に変換する処理は、前記線形変換パラメータを基にして、前記撮影画像を、各画素における縮尺が一定となる補正画像に変換することを特徴とする付記6に記載のテンプレートマッチング方法。 (Supplementary Note 8) The process of calculating the scale at each pixel of the captured image calculates linear conversion parameters for converting the points of the captured image into the points of the corrected image based on the interval between the reference points of the object. The template matching method according to appendix 6, wherein the process of converting to the corrected image converts the captured image into a corrected image in which the scale of each pixel is constant based on the linear conversion parameter. .

(付記9)前記撮影画像の各画素における縮尺を算出する処理は、前記物体の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺とある点の縮尺との関係を示し、かつ、未知の係数を持つ関数を微分した関数を基にして、前記未知の係数を特定することで、前記撮影画像の各画素における縮尺を算出することを特徴とする付記7に記載のテンプレートマッチング方法。 (Supplementary note 9) The process of calculating the scale at each pixel of the photographed image calculates a local scale corresponding to the position of the object in the photographed image based on the interval between the reference points of the object, The relationship between the local scale and the scale of a certain point is shown, and the scale of each pixel of the captured image is determined by specifying the unknown coefficient based on a function obtained by differentiating a function having an unknown coefficient. 8. The template matching method according to appendix 7, wherein the template matching method is calculated.

(付記10)同一形状の複数の物体が撮影された撮影画像を取得する取得部と、
前記撮影画像に含まれる前記複数の物体に対する基準点の位置を受け付け、前記物体の基準点の間隔に基づいて、前記撮影画像の各画素における縮尺を算出し、前記撮影画像の各画素における縮尺を基にして、各画素における縮尺が一定となる補正画像を生成する補正画像生成部と、
前記補正画像に対してテンプレートマッチングを実行することで対象物を検出する検出部と
を有することを特徴とするテンプレートマッチング装置。
(Additional remark 10) The acquisition part which acquires the picked-up image by which the several object of the same shape was imaged,
Accepting positions of reference points for the plurality of objects included in the captured image, calculating a scale at each pixel of the captured image based on an interval between the reference points of the objects, and calculating a scale at each pixel of the captured image. Based on the correction image generation unit that generates a correction image in which the scale of each pixel is constant,
And a detection unit that detects an object by executing template matching on the corrected image.

(付記11)前記補正画像生成部は、前記物体の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺を用いて補間を行うことで、前記撮影画像の各画素における縮尺を算出することを特徴とする付記10に記載のテンプレートマッチング装置。 (Additional remark 11) The said correction | amendment image generation part calculates the local scale corresponding to the position of the said object of the said picked-up image based on the space | interval of the reference point of the said object, and uses the said local scale. The template matching apparatus according to appendix 10, wherein a scale at each pixel of the captured image is calculated by performing interpolation.

(付記12)前記補正画像生成部は、前記物体の基準点の間隔を基にして、前記撮影画像の局所的な点を前記補正画像の局所的な点に変換する線形変換パラメータを算出し、前記線形変換パラメータを基にして、前記撮影画像の各画素における縮尺を算出することを特徴とする付記10に記載のテンプレートマッチング装置。 (Supplementary Note 12) The correction image generation unit calculates a linear conversion parameter for converting a local point of the captured image into a local point of the correction image based on an interval between reference points of the object, The template matching apparatus according to appendix 10, wherein a scale at each pixel of the photographed image is calculated based on the linear conversion parameter.

(付記13)前記補正画像生成部は、前記物体の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺とある点の縮尺との関係を示し、かつ、未知の係数を持つ関数を微分した関数を基にして、前記未知の係数を特定することで、前記撮影画像の各画素における縮尺を算出することを特徴とする付記10に記載のテンプレートマッチング装置。 (Additional remark 13) The said correction | amendment image generation part calculates the local scale corresponding to the position of the said object of the said picked-up image based on the space | interval of the reference point of the said object, and there exists the said local scale A scale at each pixel of the captured image is calculated by specifying the unknown coefficient based on a function obtained by differentiating a function having an unknown coefficient. The template matching apparatus according to appendix 10.

(付記14)前記補正画像生成部は、前記物体の基準点の位置を基にして、前記補正画像の局所的な点を前記撮影画像の局所的な点に変換する第1関数を特定し、未知の係数を持つ第2関数を微分した関数が前記第1関数に一致するように、前記未知の係数を特定し、特定した未知の係数を設定した第2関数に基づき、前記撮影画像の各画素における縮尺を算出することを特徴とする付記10に記載のテンプレートマッチング装置。 (Supplementary Note 14) The correction image generation unit specifies a first function for converting a local point of the correction image into a local point of the captured image based on the position of the reference point of the object, The unknown coefficient is specified such that a function obtained by differentiating the second function having an unknown coefficient matches the first function, and each of the captured images is determined based on the second function in which the specified unknown coefficient is set. The template matching apparatus according to appendix 10, wherein a scale of the pixel is calculated.

50 カメラ
100,200,300,400 画像処理装置
110,210,310,410 取得部
120,220,320,420 校正物体表示部
130,230,330,430 校正情報入力部
140,240,340,440 局所変換算出部
150,250,350,450 大域変換決定部
160,260,360,460 補正パラメータ記憶部
170,270,370,470 補正画像生成部
180,280,380,480 テンプレートマッチング実行部
190,290,390,490 検出結果出力部
50 Camera 100, 200, 300, 400 Image processing device 110, 210, 310, 410 Acquisition unit 120, 220, 320, 420 Calibration object display unit 130, 230, 330, 430 Calibration information input unit 140, 240, 340, 440 Local transformation calculation unit 150, 250, 350, 450 Global transformation determination unit 160, 260, 360, 460 Correction parameter storage unit 170, 270, 370, 470 Correction image generation unit 180, 280, 380, 480 Template matching execution unit 190, 290, 390, 490 Detection result output unit

Claims (7)

コンピュータに、
同一形状の複数の物体が撮影された撮影画像を取得し、
前記撮影画像に含まれる前記複数の物体それぞれに対する複数の基準点の位置を受け付け、前記複数の基準点の間隔に基づいて、前記撮影画像の各画素における縮尺を算出し、
前記撮影画像の各画素における縮尺を基にして、各画素における縮尺が一定となる補正画像を生成し、
前記補正画像に対してテンプレートマッチングを実行することで対象物を検出する
処理を実行させることを特徴とするテンプレートマッチングプログラム。
On the computer,
Acquire a captured image of multiple objects of the same shape,
Receiving positions of a plurality of reference points for each of the plurality of objects included in the photographed image, and calculating a scale at each pixel of the photographed image based on an interval between the plurality of reference points;
Based on the scale of each pixel of the captured image, generate a corrected image in which the scale of each pixel is constant,
A template matching program that executes processing for detecting an object by executing template matching on the corrected image.
前記撮影画像の各画素における縮尺を算出する処理は、前記複数の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺を用いて補間を行うことで、前記撮影画像の各画素における縮尺を算出することを特徴とする請求項1に記載のテンプレートマッチングプログラム。 The process of calculating the scale at each pixel of the captured image calculates a local scale corresponding to the position of the object of the captured image based on the interval between the plurality of reference points, and the local scale. The template matching program according to claim 1, wherein a scale at each pixel of the captured image is calculated by performing interpolation using. 前記撮影画像の各画素における縮尺を算出する処理は、前記複数の基準点の間隔を基にして、前記撮影画像の局所的な点を前記補正画像の局所的な点に変換する線形変換パラメータを算出し、前記線形変換パラメータを基にして、前記撮影画像の各画素における縮尺を算出することを特徴とする請求項1に記載のテンプレートマッチングプログラム。 The process of calculating the scale at each pixel of the captured image includes linear conversion parameters for converting a local point of the captured image into a local point of the corrected image based on an interval between the plurality of reference points. The template matching program according to claim 1, wherein the template matching program is calculated and a scale of each pixel of the captured image is calculated based on the linear conversion parameter. 前記撮影画像の各画素における縮尺を算出する処理は、前記複数の基準点の間隔を基にして、前記撮影画像の前記物体の位置に対応する局所的な縮尺を算出し、前記局所的な縮尺とある点の縮尺との関係を示し、かつ、未知の係数を持つ関数を微分した関数を基にして、前記未知の係数を特定することで、前記撮影画像の各画素における縮尺を算出することを特徴とする請求項1に記載のテンプレートマッチングプログラム。 The process of calculating the scale at each pixel of the captured image calculates a local scale corresponding to the position of the object of the captured image based on the interval between the plurality of reference points, and the local scale. Calculating the scale at each pixel of the captured image by identifying the unknown coefficient based on a function obtained by differentiating a function having an unknown coefficient The template matching program according to claim 1. 前記撮影画像の各画素における縮尺を算出する処理は、前記複数の基準点の位置を基にして、前記補正画像の局所的な点を前記撮影画像の局所的な点に変換する第1関数を特定し、未知の係数を持つ第2関数を微分した関数が前記第1関数に一致するように、前記未知の係数を特定し、特定した未知の係数を設定した第2関数に基づき、前記撮影画像の各画素における縮尺を算出することを特徴とする請求項1に記載のテンプレートマッチングプログラム。 The process of calculating the scale at each pixel of the captured image includes a first function for converting a local point of the corrected image into a local point of the captured image based on the positions of the plurality of reference points. Based on the second function that specifies the unknown coefficient and sets the specified unknown coefficient so that a function obtained by identifying and differentiating the second function having the unknown coefficient matches the first function. The template matching program according to claim 1, wherein a scale at each pixel of the image is calculated. コンピュータが実行するテンプレートマッチング方法であって、
同一形状の複数の物体が撮影された撮影画像を取得し、
前記撮影画像に含まれる前記複数の物体それぞれに対する複数の基準点の位置を受け付け、前記複数の基準点の間隔に基づいて、前記撮影画像の各画素における縮尺を算出し、
前記撮影画像の各画素における縮尺を基にして、各画素における縮尺が一定となる補正画像を生成し、
前記補正画像に対してテンプレートマッチングを実行することで対象物を検出する
処理を実行することを特徴とするテンプレートマッチング方法。
A template matching method executed by a computer,
Acquire a captured image of multiple objects of the same shape,
Receiving positions of a plurality of reference points for each of the plurality of objects included in the photographed image, and calculating a scale at each pixel of the photographed image based on an interval between the plurality of reference points;
Based on the scale of each pixel of the captured image, generate a corrected image in which the scale of each pixel is constant,
The template matching method characterized by performing the process which detects a target object by performing template matching with respect to the said correction | amendment image.
同一形状の複数の物体が撮影された撮影画像を取得する取得部と、
前記撮影画像に含まれる前記複数の物体それぞれに対する複数の基準点の位置を受け付け、前記複数の基準点の間隔に基づいて、前記撮影画像の各画素における縮尺を算出し、前記撮影画像の各画素における縮尺を基にして、各画素における縮尺が一定となる補正画像を生成する補正画像生成部と、
前記補正画像に対してテンプレートマッチングを実行することで対象物を検出する検出部と
を有することを特徴とするテンプレートマッチング装置。
An acquisition unit for acquiring a captured image in which a plurality of objects having the same shape are captured;
Receiving positions of a plurality of reference points for each of the plurality of objects included in the photographed image, calculating a scale at each pixel of the photographed image based on an interval between the plurality of reference points, and each pixel of the photographed image A corrected image generation unit that generates a corrected image in which the scale of each pixel is constant based on the scale of
And a detection unit that detects an object by executing template matching on the corrected image.
JP2015130252A 2015-06-29 2015-06-29 Template matching program, template matching method, and template matching apparatus Active JP6582618B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015130252A JP6582618B2 (en) 2015-06-29 2015-06-29 Template matching program, template matching method, and template matching apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015130252A JP6582618B2 (en) 2015-06-29 2015-06-29 Template matching program, template matching method, and template matching apparatus

Publications (2)

Publication Number Publication Date
JP2017016266A JP2017016266A (en) 2017-01-19
JP6582618B2 true JP6582618B2 (en) 2019-10-02

Family

ID=57829185

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015130252A Active JP6582618B2 (en) 2015-06-29 2015-06-29 Template matching program, template matching method, and template matching apparatus

Country Status (1)

Country Link
JP (1) JP6582618B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008146155A (en) * 2006-12-06 2008-06-26 Sony Corp Image processing method and device
JP2008287338A (en) * 2007-05-15 2008-11-27 Konica Minolta Holdings Inc Image processor
JP2010218226A (en) * 2009-03-17 2010-09-30 Suzuki Motor Corp Measurement map generation device and traveling environment confirmation device

Also Published As

Publication number Publication date
JP2017016266A (en) 2017-01-19

Similar Documents

Publication Publication Date Title
Vishwakarma et al. Image fusion using adjustable non-subsampled shearlet transform
CN105590312B (en) Foreground image dividing method and device
US8422827B2 (en) Image correction apparatus and image correction method
WO2015165222A1 (en) Method and device for acquiring panoramic image
JP2017518556A (en) Image display method and apparatus
JP6579950B2 (en) Image analysis apparatus, program, and method for detecting person appearing in captured image of camera
JP2011134012A (en) Image processor, image processing method for the same and program
US11145032B2 (en) Image processing apparatus, method and storage medium for reducing color noise and false color
JP2015148979A (en) Image processing method, image processing program, and image processing device
JP7032913B2 (en) Image processing device, image processing method, computer program
JP6582618B2 (en) Template matching program, template matching method, and template matching apparatus
JP6669390B2 (en) Information processing apparatus, information processing method, and program
JP2017162391A (en) Image processing method and image processing program
WO2014199824A1 (en) Image processing method, image processing device, and image processing program
JP6378496B2 (en) Image processing apparatus, control method, and recording medium
JP2018160024A (en) Image processing device, image processing method and program
JP6056354B2 (en) Image processing apparatus, image processing method, and image processing program
JP5643147B2 (en) Motion vector detection apparatus, motion vector detection method, and motion vector detection program
JP2017041113A (en) Image processing device, image processing system, image processing method, and program
JP6066282B2 (en) Image processing apparatus, image processing program, and image processing method
Agarwal et al. Specular reflection removal in cervigrams
RU2630744C2 (en) Method of detecting periodical textures
EP3496390B1 (en) Information processing device, information processing method, and storage medium
JP6751663B2 (en) Image processing device, image processing method
JP2016110341A (en) Image processing device, image processing method and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20180306

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20190611

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190718

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: 20190806

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20190819

R150 Certificate of patent or registration of utility model

Ref document number: 6582618

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150