JP4542821B2 - Image processing method, image processing apparatus, and image processing program - Google Patents

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

Info

Publication number
JP4542821B2
JP4542821B2 JP2004154084A JP2004154084A JP4542821B2 JP 4542821 B2 JP4542821 B2 JP 4542821B2 JP 2004154084 A JP2004154084 A JP 2004154084A JP 2004154084 A JP2004154084 A JP 2004154084A JP 4542821 B2 JP4542821 B2 JP 4542821B2
Authority
JP
Japan
Prior art keywords
grid
image
intersection
image processing
block
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.)
Expired - Fee Related
Application number
JP2004154084A
Other languages
Japanese (ja)
Other versions
JP2005340985A (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.)
AICHI GAKUIN
Original Assignee
AICHI GAKUIN
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 AICHI GAKUIN filed Critical AICHI GAKUIN
Priority to JP2004154084A priority Critical patent/JP4542821B2/en
Publication of JP2005340985A publication Critical patent/JP2005340985A/en
Application granted granted Critical
Publication of JP4542821B2 publication Critical patent/JP4542821B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、撮影光学系および撮像素子を用いて撮影した画像データの前記撮影光学系および撮像素子に起因する歪みを補正する画像処理方法、画像処理装置、および画像処理プログラムに関するものである。   The present invention relates to an image processing method, an image processing apparatus, and an image processing program for correcting distortion caused by the imaging optical system and the image sensor of image data captured using the imaging optical system and the image sensor.

従来より、それぞれ複数の光軸の異なる撮影光学系を介して撮影された画像から、被写体の位置や座標を測定する技術が知られている(たとえば下記の特許文献1)。この種の撮影方式はステレオ撮影あるいは立体撮影などと呼ばれ、また、用いられるカメラはステレオカメラや立体カメラなどと呼ばれることがある。   2. Description of the Related Art Conventionally, a technique for measuring the position and coordinates of a subject from images photographed through a plurality of photographing optical systems having different optical axes has been known (for example, Patent Document 1 below). This type of shooting method is called stereo shooting or stereoscopic shooting, and the camera used is sometimes called a stereo camera or a stereoscopic camera.

また、撮影距離の異なる画像を合成し、遠景から近景までの全ての被写体にピントの合った画像を得る技術(たとえば下記の特許文献2)が知られている。この種の技術では、たとえば、近距離(N:Near)、中距離(M:Middle)、遠距離(F:Far)にそれぞれ被写界深度を持つよう撮影光学系に対して異なる位置にそれぞれ近距離用、中距離用、遠距離用の撮像素子を配置し、各撮像素子から得られたN(近距離)、M(中距離)、F(遠距離)の各画像を解析し、各画像の鮮鋭度などの条件に基づき各画像より適切な部位を抽出して合成することによって、より鮮鋭度の高い画像を得ることができる。以下では便宜上この近距離(N:Near)、中距離(M:Middle)、遠距離(F:Far)の画像を合成して画像の鮮鋭度を高める撮影技術/画像処理技術をそれぞれNMF撮影/NMF画像処理という。   In addition, a technique (for example, Patent Document 2 below) is known in which images with different shooting distances are combined to obtain an image in which all subjects from a distant view to a close view are in focus. In this type of technology, for example, each of the photographing optical systems is located at different positions so as to have a depth of field at a short distance (N: Near), a medium distance (M: Middle), and a far distance (F: Far). Image sensors for short distance, medium distance, and long distance are arranged, and each image of N (short distance), M (medium distance), and F (far distance) obtained from each image sensor is analyzed. An image with higher sharpness can be obtained by extracting and synthesizing an appropriate part from each image based on conditions such as the sharpness of the image. In the following, for convenience, a shooting technique / image processing technique for increasing the sharpness of an image by synthesizing images at a short distance (N: Near), a medium distance (M: Middle), and a long distance (F: Far) will be referred to as NMF / This is called NMF image processing.

そして、もちろん上記のステレオ(立体)撮影の技術に、上記NMF撮影/画像処理を適用することができ、その場合、NMF画像処理により鮮鋭度を改善された画像に基づき、より正確に被写体の位置や座標を測定することができる。
特開2003−281521号公報 特開平11−37720号公報
Of course, the NMF shooting / image processing can be applied to the above-described stereo (stereoscopic) shooting technique. In this case, the position of the subject is more accurately based on the image whose sharpness is improved by the NMF image processing. And coordinates can be measured.
JP 2003-281521 A JP 11-37720 A

上記の公知技術においては、撮像素子としてはCCDのような素子が用いられるが、この種の素子には製造上の歪みが少なからず存在し、実際に撮像される画素の位置は理論的な位置からずれている。また、さらに、撮像レンズにも各種の光学収差が存在し、撮影画像にはこの収差が影響し、たとえば、上記のステレオ(立体)撮影による座標測定においては、測定精度が低下するし、また上記のNMF画像合成処理においては、そして、上記の技術においては少なくとも近距離用、中距離用、遠距離用の異なる複数の撮像素子が用いられるが、各撮像素子のそれぞれ異なる歪みと光学系の収差が撮影画像に反映される結果、良好な画像の連続性を得られなかったり、所期の鮮鋭度を得られない、などの問題が生じる。   In the above known technology, an element such as a CCD is used as an image pickup element. However, there is a considerable amount of manufacturing distortion in this type of element, and the position of a pixel actually picked up is a theoretical position. It is off. Furthermore, various optical aberrations also exist in the imaging lens, and this aberration affects the photographed image. For example, in the coordinate measurement by the above-described stereo (stereoscopic) photographing, the measurement accuracy decreases, and In the NMF image composition processing, and in the above technique, a plurality of different image sensors for at least short distance, medium distance, and long distance are used, but each image sensor has different distortion and optical system aberration. As a result, the image is reflected in the photographed image, resulting in problems such as failure to obtain good image continuity or obtain the desired sharpness.

本発明の課題は、上記の問題を解決し、撮像素子および撮影光学系の歪みに起因する誤差を補正し、特にステレオ(立体)撮影およびNMF撮影/画像処理を適用する場合に、より正確な被写体の画像を得られ、これに基づき正確に被写体の位置や座標を測定することができるようにすることにある。   The object of the present invention is to solve the above-mentioned problems, correct errors caused by distortion of the image sensor and the photographing optical system, and more accurately when applying stereo (stereoscopic) photographing and NMF photographing / image processing. An object image is obtained, and based on this, the object position and coordinates can be accurately measured.

本発明は、撮影光学系および撮像素子を用いて撮影した画像データの前記撮影光学系および撮像素子に起因する歪みを補正する画像処理方法、画像処理装置、および画像処理プログラムにおいて、直交する縦線および横線から成るグリッド画像を前記撮影光学系および撮像素子により撮影し、前記グリッド画像の縦線および横線から構成されるブロックの交点を検出し、前記ブロックの交点の座標を、該ブロックの前記グリッド線が縦横の直線となるよう、すなわち当該ブロックが矩形となるように補正し、前記グリッド交点補正により得られたブロックを画成する各交点の座標と、前記グリッド画像中のブロックを画成する各交点の座標に基づき実際の撮影画像を補正するための補正関数を演算するキャリブレーション処理を行なうとともに、前記ブロック交点の検出においては、前記グリッド画像の各座標を順次走査し、グリッド線を構成する輝度の低い画素を検出し、過去の複数走査線における同一座標の複数画素の平均の所定閾値パーセンテージを下回った画素をグリッド線の候補画素とし、各画素の座標で過去の複数走査線における同一座標における前記候補画素の数の連続性を示す評価関数P(x)=p(x−1)p(x)+p(x)p(x+1)(p(i):座標iにおけるグリッド線の候補画素の数)の値を求め、その値P(x)が閾値以上の場合、当該画素の座標をグリッド線の存在する範囲として求め、さらにこのグリッド線の存在する範囲の中心を検出して得たグリッド線の交点を前記グリッド画像の縦線および横線が画成するブロックの交点として検出する構成を採用した。 The present invention relates to an orthogonal vertical line in an image processing method, an image processing apparatus, and an image processing program for correcting distortion caused by the imaging optical system and the imaging device of image data captured using the imaging optical system and the imaging device. A grid image composed of a horizontal line and a horizontal line is photographed by the photographing optical system and the image sensor, an intersection point of the block composed of a vertical line and a horizontal line of the grid image is detected , and the coordinates of the intersection point of the block are determined as the grid of the block. The line is corrected so that it becomes a vertical and horizontal straight line, that is, the block is rectangular, and the coordinates of each intersection defining the block obtained by the grid intersection correction and the block in the grid image are defined. Tomo performing calibration process of calculating a correction function for correcting the actual photographed image based on the coordinates of the intersection point In the detection of the block intersection point, each coordinate of the grid image is sequentially scanned to detect pixels having low luminance constituting the grid line, and an average predetermined threshold percentage of a plurality of pixels having the same coordinate in a plurality of past scanning lines. The evaluation function P (x) = p (x−1) p indicating the continuity of the number of the candidate pixels at the same coordinates in the past plural scanning lines at the coordinates of each pixel, with the pixels lower than The value of (x) + p (x) p (x + 1) (p (i): the number of candidate pixels of the grid line at the coordinate i) is obtained, and when the value P (x) is equal to or greater than the threshold, the coordinates of the pixel are determined. Obtained as the range where the grid line exists, and further detects the intersection of the grid lines obtained by detecting the center of the range where the grid line exists as the intersection of the blocks defined by the vertical and horizontal lines of the grid image It was adopted configuration.

以上の構成によれば、グリッド画像のキャリブレーション撮影を行ない、グリッド画像の縦線および横線から構成されるブロックを単位として、そのブロックを画成する交点の座標を、該ブロックの前記グリッド線が縦横の直線となるよう、すなわちそのブロックが矩形となるように補正し、グリッド交点補正により得られたブロックを画成する各交点の座標と、グリッド画像中のブロックを画成する各交点の座標に基づき実際の撮影画像を補正するための補正関数を演算するようにしているので、実際の撮影において、撮像素子および撮影光学系の歪みに起因する誤差を補正し、特にステレオ(立体)撮影およびNMF撮影/画像処理を適用する場合に、より正確な被写体の画像を得られ、これに基づき正確に被写体の位置や座標を測定することができる、という優れた効果がある。 According to the above configuration, calibration of the grid image is performed, and the coordinates of the intersection defining the block are expressed in units of a block composed of vertical and horizontal lines of the grid image. The coordinates of each intersection defining the block obtained by the grid intersection correction, and the coordinates of each intersection defining the block in the grid image are corrected so that it becomes a vertical and horizontal straight line, that is, the block is rectangular. Since a correction function for correcting an actual captured image is calculated based on the above, in actual shooting, errors caused by distortion of the image sensor and the shooting optical system are corrected, and particularly stereo (stereoscopic) shooting and When applying NMF shooting / image processing, a more accurate image of the subject can be obtained, and the position and coordinates of the subject can be accurately measured based on this. It is possible, there is an excellent effect that.

以下では、便宜上、ステレオ(立体)撮影およびNMF撮影/画像処理を行なう撮影システムを例示する。しかしながら、本発明の画像処理技術の基本部分は必ずしもステレオ(立体)撮影およびNMF撮影/画像処理を行なう場合でなくても適用できる。たとえば、本発明の画像処理技術の基本部分は、単一レンズを用い、NMF画像合成を行なわない撮影システムにも適用できる。   Hereinafter, for convenience, an imaging system that performs stereo (stereoscopic) imaging and NMF imaging / image processing is illustrated. However, the basic part of the image processing technique of the present invention is not necessarily applied when performing stereo (stereoscopic) shooting and NMF shooting / image processing. For example, the basic portion of the image processing technique of the present invention can be applied to a photographing system that uses a single lens and does not perform NMF image synthesis.

<ハードウェア構成>
図1は本発明を採用した画像処理システムの全体構成を示している。図1のシステムはステレオカメラ20および制御システム40から構成されている。
<Hardware configuration>
FIG. 1 shows the overall configuration of an image processing system employing the present invention. The system in FIG. 1 includes a stereo camera 20 and a control system 40.

ステレオカメラ20は、立体撮影を行なうための撮影光学系として、所定距離離して平行に光軸を配置したレンズ21および22と、これらレンズ21および22の背後にそれぞれ配置されたCCDなどから構成された撮像素子201n、201m、201f、および202n、202m、202f、を有する。   The stereo camera 20 is composed of lenses 21 and 22 having optical axes arranged in parallel at a predetermined distance and CCDs disposed behind the lenses 21 and 22 as a photographing optical system for performing stereoscopic photography. Imaging devices 201n, 201m, 201f, and 202n, 202m, 202f.

撮像素子201n(202n)、201m(202m)、201f(202f)は、N(近距離)、M(中距離)、F(遠距離)の被写体の画像を各々良好に撮像できるよう、それぞれレンズ21(22)の光軸上の異なる位置に配置される。図1では、簡略化のため撮像素子201n(202n)および201m(202m)の方向に撮影光を導くためにハーフミラー204を配置した構成を示しているが、このような光路分割手段の構成は任意であり、たとえば撮像素子201n(202n)、201m(202m)、201f(202f)の方向に撮影光を導くような反射/透過面を有するプリズムなどを用いることができる。   The imaging elements 201n (202n), 201m (202m), and 201f (202f) each have a lens 21 so that images of subjects of N (short distance), M (medium distance), and F (far distance) can be captured satisfactorily. They are arranged at different positions on the optical axis (22). FIG. 1 shows a configuration in which the half mirror 204 is arranged to guide the imaging light in the direction of the image sensors 201n (202n) and 201m (202m) for simplification. The configuration of such an optical path dividing unit is as follows. For example, a prism having a reflection / transmission surface that guides imaging light in the direction of the imaging elements 201n (202n), 201m (202m), and 201f (202f) can be used.

また、ステレオカメラ20は、レンズ21および22の合焦動作や露光制御、各撮像素子の撮影タイミングや画像出力処理などを制御するCPU203を有している。レンズ21および22は通常(ステレオ画像の左右を同一条件で撮影する場合に)、同一の焦点距離および開口比を持つものが用いられる。CPU203および各撮像素子201n、201m、201f、および202n、202m、202fの撮影画像データは所定のインターフェース(USBなど)を介して制御システム40に送信される。   In addition, the stereo camera 20 includes a CPU 203 that controls the focusing operation and exposure control of the lenses 21 and 22, the shooting timing of each image sensor, image output processing, and the like. As the lenses 21 and 22, lenses having the same focal length and aperture ratio are usually used (when the left and right of a stereo image are photographed under the same conditions). The captured image data of the CPU 203 and the image sensors 201n, 201m, 201f, and 202n, 202m, 202f are transmitted to the control system 40 via a predetermined interface (USB or the like).

制御システム40は、既存のPCのほぼ一般的なハードウェアから構成することができる。すなわち、制御システム40は、装置全体の制御、および本発明の画像処理を制御するためのCPU51、プログラムやデータを格納するためのROM52およびRAM53、後述の制御プログラムや撮影データを格納するためのHDD54、ユーザーインターフェースのためのディスプレイ(CRTやLCDなど)41およびキーボード42、そしてステレオカメラ20と接続するためのUSBなどのインターフェース55から構成されている。   The control system 40 can be composed of almost common hardware of an existing PC. That is, the control system 40 includes a CPU 51 for controlling the entire apparatus and the image processing of the present invention, a ROM 52 and a RAM 53 for storing programs and data, and an HDD 54 for storing control programs and photographing data described later. , A display (CRT, LCD, etc.) 41 for a user interface, a keyboard 42, and an interface 55 such as a USB for connecting to the stereo camera 20.

上述のように以上の構成においても、各撮像素子201n、201m、201f、および202n、202m、202fには、製造条件などに応じて個体ごとにそれぞれ異なる歪みが存在し、また、どのような高精度の素子を用いたとしてもレンズ21および22には何らかの収差が残っており、ステレオ(立体)撮影およびNMF画像合成に少なからず影響を与える。本実施例では、この撮像素子およびレンズに起因する歪みを補正する。   Even in the above-described configuration as described above, each of the image pickup devices 201n, 201m, 201f, and 202n, 202m, 202f has different distortions depending on the individual depending on the manufacturing conditions and the like. Even if a precision element is used, some aberrations remain in the lenses 21 and 22, which have a considerable influence on stereo (stereoscopic) imaging and NMF image synthesis. In the present embodiment, distortion caused by the image sensor and the lens is corrected.

<画像処理全体の流れ>
本実施例の画像処理は制御システム40のCPU51により実行されるものとする。また、以下の補正処理は、実際の撮影を行なう前(たとえばステレオカメラ20の製品出荷時など)に1回行なえばよい。
<Overall image processing flow>
Assume that the image processing of this embodiment is executed by the CPU 51 of the control system 40. Further, the following correction process may be performed once before actual shooting (for example, when the stereo camera 20 is shipped).

本実施例の補正処理の全体の流れは図2に示す通りであり、まずステップS21においてキャリブレーション用のグリッドを図1のステレオカメラ20により撮影する。図3に示すようにこのグリッド60は白地に黒で直交する縦線および横線から成るグリッドが描かれたもので、紙やプラスチックシートに印刷などの方法で形成する。このグリッド60のそれぞれ隣り合う直線により構成され、該直線の交点により囲まれた最も小さい正方形の矩形のブロックは以下では便宜上「ブロック」という。   The overall flow of the correction processing of this embodiment is as shown in FIG. 2, and first, a calibration grid is photographed by the stereo camera 20 of FIG. 1 in step S21. As shown in FIG. 3, the grid 60 is a grid in which black and white vertical lines and horizontal lines are drawn on a white background, and is formed by printing or the like on paper or a plastic sheet. The smallest square rectangular block that is formed by adjacent straight lines of the grid 60 and surrounded by the intersections of the straight lines is hereinafter referred to as a “block” for convenience.

グリッド60の密度および撮影距離は任意であるが、撮像素子上に補正処理を行なうに充分な本数のグリッドが撮影されるように選ぶ。たとえば、後述の例では、撮像素子は画素数が1024×768程度のものであるが、撮像素子の50〜60画素ごとに一本程度の密度でグリッドが写るようにグリッド60の密度および撮影距離が選択されている。   The density and shooting distance of the grid 60 are arbitrary, but the grid 60 is selected so that a sufficient number of grids can be shot on the image sensor. For example, in the example described later, the image sensor has a pixel count of about 1024 × 768, but the density of the grid 60 and the shooting distance so that the grid appears at a density of about one for every 50 to 60 pixels of the image sensor. Is selected.

ステップS22では、撮像素子(たとえば201n)で撮影した撮影画像データ上の縦横のグリッド線が存在する範囲を演算する。ここでは、交点周辺のグリッド線範囲(縦・横)の中心を通る直線の式を求め、さらに縦横2つの直線の式から交点をサブピクセル単位で求める。この撮影画像データ上のグリッド交点を検出する処理については以下で詳述する。   In step S22, a range in which vertical and horizontal grid lines exist on the captured image data captured by the image sensor (for example, 201n) is calculated. Here, an equation of a straight line passing through the center of the grid line range (vertical / horizontal) around the intersection is obtained, and further, the intersection is obtained in units of subpixels from the equation of two vertical and horizontal straight lines. The processing for detecting the grid intersection on the captured image data will be described in detail below.

撮影画像データ上では上記の撮像素子およびレンズに起因する歪みの影響で、グリッドは直線として写っていないので、続くステップS23ではグリッドが縦横の直線となるよう、すなわち各ブロックが矩形(正方形)となるように補正し、その補正後のグリッド交点を求める。この縦横の直線となるように補正したグリッドは本来撮像素子およびレンズに起因する歪みが無い場合に撮影されたグリッドである。このグリッド交点の補正についても以下で詳述する。   In the captured image data, the grid is not shown as a straight line due to the influence of the distortion caused by the imaging element and the lens, so that in the subsequent step S23, the grid is a vertical and horizontal straight line, that is, each block is rectangular (square). Then, the corrected grid intersection is obtained. The grid corrected so as to be vertical and horizontal straight lines is a grid that was originally photographed when there was no distortion caused by the image sensor and the lens. This grid intersection correction will also be described in detail below.

いうまでもなく、補正前のグリッドは撮像素子およびレンズに起因する歪みを反映しているから、補正前のグリッドと補正後のグリッドの形状の差を評価しておき、その評価結果を用いれば実際の撮影画像を補正し、撮像素子およびレンズに起因する歪みの影響を除去した画像を得られる。本実施例では、ステップS24に示されるように補正前のグリッドと補正後のグリッドの形状の差の評価はグリッドが構成する各ブロックごとに補正前のブロックと補正後のブロックの形状に基づきアフィン変換関数を求めることにより行なう。   Needless to say, the grid before correction reflects the distortion caused by the image sensor and the lens. Therefore, if the difference between the shape of the grid before correction and the grid after correction is evaluated and the evaluation result is used, It is possible to obtain an image obtained by correcting an actual captured image and removing the influence of distortion caused by the image sensor and the lens. In this embodiment, as shown in step S24, the difference between the shape of the grid before correction and the shape of the grid after correction is evaluated for each block included in the grid based on the shape of the block before correction and the block after correction. This is done by obtaining a conversion function.

このように、各ブロックごとに実際の撮影画素を補正するためのアフィン変換関数を求めておけば、実際の撮影においてこのアフィン変換関数を用いて撮影画像を補正し、撮像素子およびレンズに起因する歪みの影響を排除した画像データを得ることができる。(ステップS25)。   As described above, if an affine transformation function for correcting an actual photographing pixel is obtained for each block, the photographed image is corrected by using the affine transformation function in actual photographing, resulting from the imaging element and the lens. Image data from which the influence of distortion is eliminated can be obtained. (Step S25).

上記の補正処理を行なう際、まず重要なのは図2のステップS22において撮影画像上においてグリッドの交点座標を求め、また、ステップS23においてグリッドの交点を補正することである。   When performing the above correction processing, it is first important to obtain the grid intersection coordinates on the photographed image in step S22 of FIG. 2, and to correct the grid intersection points in step S23.

以下では、これらの補正処理につき説明するが、最初にステレオ(立体)撮影およびNMF画像合成に関係しない一対のレンズおよび撮像素子(たとえばレンズ21と撮像素子201n)の組合せにおける画像処理を説明し、続いてステレオ(立体)撮影およびNMF画像合成、特にNMF画像合成において重要な画像処理を説明するものとする。   Hereinafter, these correction processes will be described. First, image processing in a combination of a pair of lenses and an image sensor (for example, the lens 21 and the image sensor 201n) not related to stereo (stereo) shooting and NMF image composition will be described. Subsequently, image processing that is important in stereo (stereoscopic) shooting and NMF image composition, particularly NMF image composition, will be described.

<グリッド交点検出処理>
まずステップS22におけるグリッド交点検出につき説明する。
<Grid intersection detection processing>
First, the grid intersection detection in step S22 will be described.

グリッド線検出に関して考察すると、次のような問題がある。一般論としては所定の閾値を設定し、撮影画像データで輝度が閾値以下となる点をグリッド線の存在する位置として検出することが考えられ、そして、この閾値によるスキャンを縦または横方向に行なえばグリッド線の位置が得られると考えられる。しかし、実際は次の2つの問題によって上記の方法ではグリッド線の位置を正確に得ることができない。   Considering grid line detection, there are the following problems. As a general theory, it is conceivable to set a predetermined threshold value, and to detect a point where the luminance is below the threshold value in the captured image data as a position where the grid line exists, and to perform scanning by this threshold value in the vertical or horizontal direction. The position of the grid line can be obtained. However, in actuality, the grid line position cannot be obtained accurately by the above method due to the following two problems.

(1)レンズ周辺は中央部に比べて暗くなるため白い部分も閾値を下回る場合がある
(2)全体が樽型にゆがんでいるため縦・横の走査線上においてグリッド線が現れたり消えたりする。
(1) Since the periphery of the lens is darker than the central part, the white part may be below the threshold. (2) Since the whole is distorted in a barrel shape, grid lines appear and disappear on the vertical and horizontal scanning lines. .

問題(1)に関して、グリッド撮影画像上を横方向に1本の走査線で走査した輝度のグラフを図4に示す。図4(および後述の図5および図6)の縦軸は輝度、横軸は画素アドレスを示している。図示のように、グリッドの縦線に相当する鋭い輝度の落ち込みが周期的に現れているが、レンズ周辺部で輝度が落ち込んでいる様子がわかる。   Regarding the problem (1), FIG. 4 shows a luminance graph obtained by scanning the grid photographed image in the horizontal direction with one scanning line. In FIG. 4 (and FIGS. 5 and 6 described later), the vertical axis represents luminance, and the horizontal axis represents pixel address. As shown in the figure, sharp brightness drops corresponding to the vertical lines of the grid appear periodically, but it can be seen that the brightness drops at the periphery of the lens.

また、問題(2)の樽型歪みは図8に示すようなもので、走査線L上にグリッド線が現れたり消えたりする現象である。単純な横方向走査ではグリッド線が画像の端から端ではなく、図8の破線内に存在すると誤検出されることがある。図5の走査線データは図の右方において輝度が落ち込んでおり、この部分において樽型に歪んだ横方向のグリッドの影響が現われている。   Further, the barrel distortion of the problem (2) is as shown in FIG. 8 and is a phenomenon in which grid lines appear or disappear on the scanning lines L. In simple horizontal scanning, it may be erroneously detected that the grid line is not within the edge of the image but within the broken line in FIG. The scanning line data in FIG. 5 has a reduced luminance on the right side of the figure, and the influence of a horizontal grid distorted in a barrel shape appears in this portion.

そして、問題(1)と問題(2)が複合している部分における輝度の変化は図6に示すようなものとなる。さらに、図7は複数の走査線上の輝度の変化を1つのグラフ中に示しているが、図4〜図7を考察すれば、単純な閾値による切断ではグリッド線の位置を正確に演算することは極めて困難であることがわかる。   And the change of the brightness | luminance in the part which the problem (1) and the problem (2) compound is as shown in FIG. Further, FIG. 7 shows the change in luminance on a plurality of scanning lines in one graph. However, if FIGS. 4 to 7 are considered, the position of the grid line can be accurately calculated by cutting with a simple threshold. Proves extremely difficult.

そこで、本実施例では、グリッド線を検出するために、次のような手法を用いる。   Therefore, in this embodiment, the following method is used to detect grid lines.

(a1)グリッド線を構成する輝度の低い画素を検出する。ここでは画像データの(縦のグリッド線検出の場合)キャリブレーション画像を横方向に走査、あるいは(横のグリッド線検出の場合)キャリブレーション画像を縦方向に走査する
(a2)グリッド線と思われる候補画素を検出する。ここでは、輝度が過去の複数走査線(たとえば4〜5本程度)における同一画素アドレスの複数画素(たとえば4〜5画素程度)の平均の60%(あるいは他の適当な閾値パーセンテージ)を下回った画素を候補画素とする
(a3)グリッド線が存在する範囲を検出する。ここでは、各画素アドレスでグリッド線の候補画素が何点あったかを求め、その連続性を評価する。この評価には次の評価関数を用いる。
(A1) Detect low-luminance pixels that make up the grid lines. Here, the calibration image is scanned in the horizontal direction (in the case of vertical grid line detection) or the calibration image is scanned in the vertical direction (in the case of horizontal grid line detection). Candidate pixels are detected. Here, the luminance is lower than the average 60% (or other appropriate threshold percentage) of a plurality of pixels (for example, about 4 to 5 pixels) having the same pixel address in a plurality of past scanning lines (for example, about 4 to 5 lines). A pixel is a candidate pixel. (A3) A range where a grid line exists is detected. Here, the number of grid line candidate pixels at each pixel address is determined, and the continuity is evaluated. The following evaluation function is used for this evaluation.

Figure 0004542821
Figure 0004542821

この式においてp(i)は画素アドレス(座標)iにおけるグリッド線の候補画素の数である。この評価関数P(x)の値が閾値以上の場合、グリッド線が存在する範囲として検出する。   In this equation, p (i) is the number of grid line candidate pixels at the pixel address (coordinate) i. When the value of the evaluation function P (x) is equal to or greater than the threshold value, it is detected as a range where the grid line exists.

図9に上の評価関数P(x)による範囲検出の様子を示す。図9では、横方向の4本の走査線が示されており、一番下のこれら4本の走査線を用いて行なわれる評価の様子が下部の表中に示してある。この表の上段は上の評価関数P(x)の右辺のp(x)のそれぞれの(水平)画素アドレスにおける値で上部の4本の走査線における各(水平)画素アドレスにおける黒画素の数に一致する。また、表の下段は、算出された評価関数P(x)の値で、たとえば中央の「20」は上段のp(x)の値「3」、「4」、「2」からP(x)20=(3×4)+(4×2)と算出されたものである。そして、図9では、適当な閾値(たとえば10以上)のP(x)の値の範囲をグリッド線の領域として検出している。   FIG. 9 shows how the range is detected by the above evaluation function P (x). In FIG. 9, four scanning lines in the horizontal direction are shown, and the state of evaluation performed using these four scanning lines at the bottom is shown in the lower table. The upper part of this table shows the value of p (x) on the right side of the above evaluation function P (x) at each (horizontal) pixel address, and the number of black pixels at each (horizontal) pixel address in the upper four scanning lines. Matches. The lower part of the table is the value of the calculated evaluation function P (x). For example, the central “20” is the upper p (x) value “3”, “4”, “2” to P (x ) 20 = (3 × 4) + (4 × 2). In FIG. 9, the range of the value of P (x) with an appropriate threshold (for example, 10 or more) is detected as a grid line region.

図10および図11は、上記のようにグリッド画像から求めた縦および横の実際のグリッド線範囲の例を示す。図10および図11では、図9のようにして検出されたグリッド線の領域を黒線で示しているが、図示のように画面周辺部で歪み/収差の影響によりグリッド線の範囲が広く検出されていることがわかる。   10 and 11 show examples of actual grid line ranges in the vertical and horizontal directions obtained from the grid image as described above. 10 and 11, the grid line area detected as shown in FIG. 9 is indicated by a black line. However, as shown in the figure, a wide range of grid lines is detected by the influence of distortion / aberration at the periphery of the screen. You can see that

以上のようにして、縦横のグリッド線範囲を検出できる。さらに図10および図11のように幅のあるグリッド線範囲の交点領域内でグリッド交点を検出しなければならない。   As described above, vertical and horizontal grid line ranges can be detected. Further, as shown in FIGS. 10 and 11, the grid intersection must be detected in the intersection region of the wide grid line range.

図10および図11のように幅のあるグリッド線範囲の交点領域付近を拡大すると図12のようにグリッド線範囲が交わっており、グリッド線範囲の内部は輝度の異なる画素で埋められている。ここで検出すべき交点座標は    When the vicinity of the intersection region of the wide grid line range as shown in FIGS. 10 and 11 is enlarged, the grid line range intersects as shown in FIG. 12, and the inside of the grid line range is filled with pixels having different luminances. The intersection coordinates to be detected here are

Figure 0004542821
Figure 0004542821

と考えることができるから、縦と横の線の中心を求める必要がある。このためには、線の太さ方向に見て輝度が最も低い画素の前後1画素(計3画素)の輝度値を用い、次のようにして線の中心を求める。 It is necessary to find the center of the vertical and horizontal lines. For this purpose, using the luminance value of one pixel before and after the pixel having the lowest luminance when viewed in the thickness direction of the line (a total of three pixels), the center of the line is obtained as follows.

(b1)図12の横方向のグリッド線の中心を求める場合、図12の右側に示すように、線の太さ方向に見て輝度が最も低い画素の前後1画素(計3画素)の輝度値を用い、グリッド線領域の画素データの輝度値を用いてこれら3点の輝度値を通る2次関数を適当な演算法、たとえばガウス法などを用いて求める
(b2)同関数曲線上で最も輝度が暗くなる座標を線の中心座標として検出する。
(B1) When obtaining the center of the horizontal grid line in FIG. 12, as shown on the right side of FIG. 12, the luminance of one pixel before and after the pixel having the lowest luminance when viewed in the line thickness direction (total of three pixels) (2) Find a quadratic function that passes through these three luminance values using the luminance value of the pixel data in the grid line area using an appropriate arithmetic method such as the Gaussian method. The coordinates at which the brightness is reduced are detected as the center coordinates of the line.

以上のようにして、グリッド画像上のグリッドの交点の座標をサブピクセル単位で得ることができる。   As described above, the coordinates of the grid intersection on the grid image can be obtained in units of subpixels.

以上のようにしてグリッド画像から求めた交点(の一部)をグラフ化したものを図13に、また、図13の上部のグリッド線のうち1本分を拡大したものを図14に示す。図13および図14において、上記のようにして検出された交点座標は黒点で示されている。これら交点座標(ここではy座標)はサブピクセル単位で算出される。図14では縦方向を他の図よりも拡大しているために、グリッド線の曲りはより強調して示されている。   FIG. 13 is a graph showing the intersection (part) obtained from the grid image as described above, and FIG. 14 is an enlarged view of one grid line in the upper part of FIG. 13 and 14, the intersection coordinates detected as described above are indicated by black dots. These intersection coordinates (here, y coordinates) are calculated in units of subpixels. In FIG. 14, since the vertical direction is enlarged as compared with other figures, the curve of the grid line is shown with more emphasis.

なお、以上では、x(横)方向に関する走査線に関する演算を示したが、y(縦)方向に関しても同様の演算を行なうことができるのはいうまでもない。   In addition, although the calculation regarding the scanning line regarding x (horizontal) direction was shown above, it cannot be overemphasized that the same calculation can be performed also about y (vertical) direction.

以上のようにして、図2のステップS22におけるグリッド交点検出を行なうことができる。   As described above, grid intersection detection in step S22 of FIG. 2 can be performed.

<グリッド交点補正処理>
続いて図2のステップS23におけるグリッドの交点補正につき説明する。
<Grid intersection correction processing>
Next, the grid intersection correction in step S23 of FIG. 2 will be described.

以上の説明から明らかなように、キャリブレーション撮影により撮影されたグリッド画像は、撮像素子およびレンズに起因する歪みの影響を受け、図15の右側に示すように歪んでいる。本実施例ではこの歪みの状態を反映したアフィン変換関数を求めておき、実際の撮影画像を補正する。   As is clear from the above description, the grid image captured by the calibration imaging is affected by the distortion caused by the imaging element and the lens, and is distorted as shown on the right side of FIG. In this embodiment, an affine transformation function reflecting this distortion state is obtained, and an actual captured image is corrected.

このアフィン変換関数の生成には、実際に撮影したグリッド画像の他に、本来の歪んでいないグリッド画像データが必要である。この歪んでいないグリッド画像データとしては撮影距離や倍率、画角中心などの撮影条件を厳密に制御した上、あらかじめ撮像素子上に撮影されると考えられるグリッド画像データを固定的に用いることも考えられるが、キャリブレーション時に撮影条件の制御を正確に行なうことはそれほど容易ではない。   In order to generate this affine transformation function, in addition to the actually captured grid image, the original undistorted grid image data is required. As this undistorted grid image data, it is also possible to use fixed grid image data that is presumed to be photographed on the image sensor in advance, while strictly controlling the photographing conditions such as the photographing distance, magnification, and center of angle of view. However, it is not so easy to accurately control shooting conditions during calibration.

したがって、本実施例では、キャリブレーション撮影されたグリッド画像に基づき、歪んでいないグリッドを求めるグリッド補正を行なう。   Therefore, in this embodiment, grid correction for obtaining a grid that is not distorted is performed based on the grid image that has been calibrated.

本実施例のグリッド補正では、図15のようにキャリブレーション撮影されたグリッド画像中心部の4点の交点P00、P01、P10、およびP11を用いて画面全体にわたって本来の歪んでいないグリッドを生成する。これらの交点P00、P01、P10、およびP11は、画面中心の座標から外側に向かってグリッド画像データを探索すれば容易に同定することができる。なお、これら画面中心部の交点P00、P01、P10、およびP11を用いるのは、この部位がレンズの光学的特性や撮像素子の機械的歪みの影響が最も少ない条件で撮影された部位であると考えられるからである。   In the grid correction of this embodiment, an original undistorted grid is generated over the entire screen using the four intersections P00, P01, P10, and P11 of the center portion of the grid image that has been calibrated as shown in FIG. . These intersections P00, P01, P10, and P11 can be easily identified by searching the grid image data outward from the coordinates of the screen center. Note that the intersections P00, P01, P10, and P11 at the center of the screen are used when this part is a part that has been imaged under the condition that the optical characteristics of the lens and the mechanical distortion of the image sensor are least affected. It is possible.

交点P00、P01、P10、およびP11はそれぞれ(x00,y00)、(x01,y01)、(x10,y10)、および(x11,y11)の各座標値を有するものとすれば、これら交点P00、P01、P10、およびP11が画成するブロックの幅Dxおよび高さDyは、これらのうち適当な2点を決め、x座標値およびy座標値を減算すれば求めることができるが、たとえば、幅DxはDx=((x01−x00)+(x11−x10))/2、高さDyはDy=((y10−y00)+(y11−y01))/2のように平均値として求めれば演算精度を向上できる。   If the intersection points P00, P01, P10, and P11 have the coordinate values of (x00, y00), (x01, y01), (x10, y10), and (x11, y11), respectively, these intersection points P00, The width Dx and height Dy of the block defined by P01, P10, and P11 can be obtained by determining appropriate two points out of these and subtracting the x coordinate value and the y coordinate value. If Dx is calculated as an average value such that Dx = ((x01−x00) + (x11−x10)) / 2 and the height Dy is calculated as Dy = ((y10−y00) + (y11−y01)) / 2, the calculation is performed. Accuracy can be improved.

後は、このようにして求めた幅Dxないし高さDyを整数倍した値を交点P00、P01、P10、およびP11のxy座標に加算すれば歪みのない交点群を得ることができる。たとえば、交点P00、P01、P10、およびP11に対してiおよびj番目(iおよびjは整数)にxないしy座標が大きい、あるいは小さい交点の座標値は、次のように求めることができる。   After that, if a value obtained by multiplying the width Dx or the height Dy thus obtained by an integer is added to the xy coordinates of the intersections P00, P01, P10, and P11, an intersection group without distortion can be obtained. For example, the coordinate values of the intersections where the x and y coordinates are large or small at the i and j-th (i and j are integers) with respect to the intersections P00, P01, P10 and P11 can be obtained as follows.

P00よりx座標が小さく、y座標も小さい交点Pij:
Pij(x00−Dx×i,y00−Dy×j)
P01よりx座標が大きく、y座標が小さい交点Pij:
Pij(x01+Dx×i,y01−Dy×j)
P10よりx座標が小さく、y座標が大きい交点Pij:
Pij(x10−Dx×i,y10+Dy×j)
P11よりx座標が大きく、y座標も大きい交点Pij:
Pij(x11+Dx×i,y11+Dy×j)
Dx×iまたはDy×jの値が画面の大きさを超えない範囲内でiおよびjのカウンタをインクリメントしながら、上記の演算を行なえば、歪みのないグリッド交点群を得ることができる。なお、この演算中にDx×iまたはDy×jの値が画面の大きさを超えた(あるいは等しい)場合は、画面端部の補正後交点Pijは図18に示すようにその1つ前の補正後交点Pijのxまたはy座標の一方の値を画面端部に対応する座標値に置換することにより画面端部の補正後交点Pijを求めることができる。図18の例は画面上端の補正後交点Pijの例で、1つ前の補正後交点Pijのxまたはy座標の一方の値を画面端部に対応する座標値である0に置換している。他の4辺上の補正後交点についても同様の演算により求めることができる。
Intersection Pij whose x coordinate is smaller than P00 and y coordinate is also smaller:
Pij (x00−Dx × i, y00−Dy × j)
Intersection Pij having an x coordinate larger than P01 and a smaller y coordinate:
Pij (x01 + Dx × i, y01−Dy × j)
Intersection Pij having an x coordinate smaller than P10 and a larger y coordinate:
Pij (x10−Dx × i, y10 + Dy × j)
Intersection Pij whose x coordinate is larger than P11 and whose y coordinate is also larger:
Pij (x11 + Dx × i, y11 + Dy × j)
If the above calculation is performed while incrementing the i and j counters within a range where the value of Dx × i or Dy × j does not exceed the size of the screen, a grid intersection group without distortion can be obtained. If the value of Dx × i or Dy × j exceeds (or is equal to) the size of the screen during this calculation, the corrected intersection Pij at the end of the screen is the previous one as shown in FIG. By replacing one value of the x or y coordinates of the corrected intersection Pij with the coordinate value corresponding to the screen edge, the corrected intersection Pij of the screen edge can be obtained. The example of FIG. 18 is an example of the corrected intersection Pij at the upper end of the screen, and one value of the x or y coordinate of the previous corrected intersection Pij is replaced with 0 which is a coordinate value corresponding to the screen edge. . The corrected intersections on the other four sides can be obtained by the same calculation.

以上のようにして、キャリブレーション撮影により撮影されたグリッド画像に基づいて歪みのない補正後ブロックをそれぞれ画成するグリッド交点群を得ることができる。   As described above, it is possible to obtain grid intersection groups that respectively define corrected blocks without distortion based on grid images captured by calibration imaging.

なお、上記のようにキャリブレーション撮影により撮影されたグリッド画像に基づいて行なうグリッド補正は、キャリブレーション時の厳密な撮影条件制御が不要であり、低コストで容易に実施できる。   Note that the grid correction performed based on the grid image photographed by calibration photographing as described above does not require strict photographing condition control at the time of calibration, and can be easily performed at low cost.

<補正関数演算処理>
以上のようにして得られた補正前ブロックと補正後ブロックから、実際の撮影画像の補正処理(図2のステップS25)に用いるべきアフィン変換関数を求める。たとえば、図16では画像左上部の補正前交点1−1、1−2、2−1、2−2の4交点により画成されたブロックは補正後交点1−1、1−2、2−1、2−2の4交点により画成されたブロックに対応づけることができ、この補正前ブロックの形状を補正後ブロックの形状に変形させることができるアフィン変換関数を求めればよい。このグリッド補正のためのアフィン変換関数は各補正前および補正後のブロックごとに生成する。
<Correction function calculation processing>
From the pre-correction block and the post-correction block obtained as described above, an affine transformation function to be used in the actual captured image correction process (step S25 in FIG. 2) is obtained. For example, in FIG. 16, the block defined by the four intersections 1-1, 1-2, 2-1, 2-2 before correction at the upper left of the image is the corrected intersection 1-1, 1-2, 2- What is necessary is just to obtain | require the affine transformation function which can be matched with the block defined by the four intersection of 1 and 2-2, and can change the shape of this block before correction | amendment to the shape of the block after correction | amendment. The affine transformation function for this grid correction is generated for each block before and after each correction.

実際の撮影画像を取り扱うプログラム処理(図2のステップS25)では、画面中の特定のアドレス(xy座標)にある画素の輝度値を補正する処理を行なうことになる。したがって、処理効率を考えると、画面中の特定のアドレスを補正後ブロック中の特定点と考え、この画面中の特定のアドレスに存在すべき輝度値が補正前のどのアドレスから得られるかを求められるよう、アフィン変換関数を当該ブロックについて求めておくと都合がよい。   In the program process (step S25 in FIG. 2) for handling an actual captured image, a process for correcting the luminance value of a pixel at a specific address (xy coordinate) on the screen is performed. Therefore, considering the processing efficiency, a specific address on the screen is considered as a specific point in the corrected block, and the address from which the luminance value that should exist at the specific address in this screen can be obtained is calculated. For this reason, it is convenient to obtain an affine transformation function for the block.

一般に座標(x,y)から座標(u,v)へのアフィン変換は   In general, the affine transformation from coordinates (x, y) to coordinates (u, v) is

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

で表される。この2つの式において、p1,p2,p3,q1,q2,q3がアフィン変換関数を決定づけるアフィン変換係数である。 It is represented by In these two equations, p1, p2, p3, q1, q2, and q3 are affine transformation coefficients that determine the affine transformation function.

ここで、あるブロックについてアフィン変換係数p1〜q3を求めるには、たとえば次の条件を満足するp1〜q3を算出すればよい:
(c1)補正後の交点1-1(x11,y11) を補正前の交点1-1(u11,v11) へ変換
(c2)補正後の交点1-2(x12,y12) を補正前の交点1-2(u12,v12) へ変換
(c3)補正後の交点2-1(x21,y21) を補正前の交点2-1(u21,v21) へ変換
すなわち、上記の条件を満足するアフィン変換係数は、交点1-1(x11,y11)、交点1-2(x12,y12)、交点2-1(x21,y21)、交点2-2(x22,y22)、により規定される補正後のブロックを、交点1-1(u11,v11) 、交点1-2(u12,v12) 、交点2-1(u21,v21) 、交点2-2(u22,v22) 、補正前のブロックに変形させることができるものである。
Here, in order to obtain the affine transformation coefficients p1 to q3 for a certain block, for example, p1 to q3 satisfying the following condition may be calculated:
(C1) Convert corrected intersection 1-1 (x11, y11) to uncorrected intersection 1-1 (u11, v11) (c2) Convert corrected intersection 1-2 (x12, y12) before correction Convert to 1-2 (u12, v12) (c3) Convert corrected intersection 2-1 (x21, y21) to intersection 2-1 (u21, v21) before correction, that is, affine transformation that satisfies the above conditions Coefficients are corrected by intersection point 1-1 (x11, y11), intersection point 1-2 (x12, y12), intersection point 2-1 (x21, y21), intersection point 2-2 (x22, y22). Transform the block into the intersection 1-1 (u11, v11), the intersection 1-2 (u12, v12), the intersection 2-1 (u21, v21), the intersection 2-2 (u22, v22), and the block before correction It is something that can be done.

ここで、   here,

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

と置くと、 And put

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

が成り立つ。この式(10)(11)は上記のアフィン変換関数について上の条件(c1)〜(c3)を適用したものである。そして、この式(10)、(11)を解けばアフィン変換係数を求めることができる。この式を解くにはいくつかの方法があるが、本実施例では行列が3×3と小さいことから、クラーメルの公式を用いる。 Holds. Expressions (10) and (11) are obtained by applying the above conditions (c1) to (c3) to the affine transformation function. Then, the affine transformation coefficients can be obtained by solving these equations (10) and (11). There are several ways to solve this equation. In this embodiment, since the matrix is as small as 3 × 3, the Kramel formula is used.

たとえば式(10)の場合、   For example, in the case of equation (10),

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

Figure 0004542821
Figure 0004542821

と計算できる。ここで、││は行列式で、その値は Can be calculated. Where ││ is a determinant whose value is

Figure 0004542821
Figure 0004542821

と計算でき、アフィン変換係数p1〜p3を求めることができる。式(11)についても同様の演算を行なうことにより、アフィン変換係数q1〜q3を求めることができる。 The affine transformation coefficients p1 to p3 can be obtained. The affine transformation coefficients q1 to q3 can be obtained by performing the same calculation for Expression (11).

<撮影画像補正処理>
以上のように係数を求めたアフィン変換は、画素アドレスから画素アドレスへの変換であり、補正後のブロック中の所定画素アドレスから補正前のブロック中の対応する画素アドレスを求めることができるように係数が求められている。したがって、実際の撮影画像を取り扱うプログラム処理(図2のステップS25)においては、ある注目画素アドレスを決めれば、補正前のブロック中の注目画素アドレスに対応する画素アドレスを求め、その画素アドレスにおいて得られる輝度値を当該注目画素アドレスの輝度値として出力することができる。
<Photograph image correction processing>
The affine transformation in which the coefficient is obtained as described above is a transformation from a pixel address to a pixel address, so that a corresponding pixel address in the block before correction can be obtained from a predetermined pixel address in the corrected block. A coefficient is required. Therefore, in the program processing (step S25 in FIG. 2) for handling an actual captured image, if a certain target pixel address is determined, a pixel address corresponding to the target pixel address in the block before correction is obtained and obtained at that pixel address. Can be output as the luminance value of the target pixel address.

たとえば、あるブロックに関して求められたアフィン変換係数を用いて、処理すべき注目画素のアドレス(xy座標)が(150,150)であった場合、アフィン変換係数を用いると(152.5,151.3)のような画素アドレスが得られる。すなわち、画素アドレス(150,150)の注目画素の輝度値は、実際の撮影データでは、アドレス(152.5,151.3)に歪んで出力されているから、この画素アドレス(152.5,151.3)における輝度を画素アドレス(150,150)の輝度として出力すれば撮像素子およびレンズに起因する歪みを補正できることになる。   For example, when the address (xy coordinates) of the target pixel to be processed is (150, 150) using the affine transformation coefficient obtained for a certain block, the affine transformation coefficient is used (152.5, 151. A pixel address such as 3) is obtained. That is, the luminance value of the target pixel at the pixel address (150, 150) is distorted and output to the address (152.5, 151.3) in the actual shooting data. If the luminance in 151.3) is output as the luminance of the pixel address (150, 150), distortion caused by the image sensor and the lens can be corrected.

ここで、アフィン変換により補正された座標は(152.5,151.3)のようにサブピクセル単位で算出されるため、実際の演算ではこの実数座標を取り囲む位置にある4つの画素の輝度(色データ)から線形補間等で輝度値を求めればよい。   Here, since the coordinates corrected by the affine transformation are calculated in units of sub-pixels as (152.5, 151.3), in the actual calculation, the luminances of the four pixels at the positions surrounding the real number coordinates ( The luminance value may be obtained from the color data by linear interpolation or the like.

たとえば、上の画素アドレス(152.5,151.3)における輝度値cを線形補間するには、この画素を取り囲むc00(152,151)c10(153,151)c01(152,152)c11(153,152)の4画素の輝度値を用いて次のような線形補間を行なう:   For example, to linearly interpolate the luminance value c at the upper pixel address (152.5, 151.3), c00 (152, 151) c10 (153, 151) c01 (152, 152) c11 ( 153, 152) are used to perform the following linear interpolation:

Figure 0004542821
Figure 0004542821

ここで、aおよびbは入力座標値(152.5,151.3)の小数部でこの例の場合a=152.5−152=0.5、また、b=151.3−151=0.3である。   Here, a and b are decimal parts of the input coordinate values (152.5, 151.3). In this example, a = 152.5-152 = 0.5, and b = 151.3-151 = 0. .3.

実際の撮影画像を取り扱うプログラム処理(図2のステップS25)においては、撮影画像領域を1画素づつ順にスキャンし、上記のようにしてその注目画素アドレスにおいて出力すべき輝度値(たとえばRGBデータ)を演算していけばよい。   In the program process for handling an actual captured image (step S25 in FIG. 2), the captured image area is scanned one pixel at a time, and the luminance value (eg, RGB data) to be output at the target pixel address as described above. Just calculate.

以上のようにして、撮像素子および撮影光学系の歪みに起因する誤差を補正し、より正確な被写体の画像を得ることができる。   As described above, it is possible to correct errors caused by distortion of the image sensor and the photographing optical system, and obtain a more accurate image of the subject.

なお、画面周辺部ではアフィン変換により補正された座標値が実際の撮影画像データのアドレス範囲を超えてしまう場合があるので、このような部分については画像データを無効として捨てるか、あるいは適当な演算方式により近似した値を出力するようにしてもよい。   Note that the coordinate values corrected by affine transformation may exceed the address range of the actual captured image data at the periphery of the screen, so for such a part, the image data is discarded as invalid or an appropriate calculation is performed. You may make it output the value approximated with the system.

<NMF撮影における補正関数演算処理>
以上では、ステレオ撮影およびNMF撮影に依存しない補正処理につき説明した。図1に示したようなステレオ撮影およびNMF撮影を行なう撮影システムでは以下のような補正を行なうことができる。
<Correction function calculation processing in NMF shooting>
The correction processing that does not depend on stereo shooting and NMF shooting has been described above. The following correction can be performed in an imaging system that performs stereo imaging and NMF imaging as shown in FIG.

図1から明らかなように、NMF撮影においてはN(近)、M(中)、F(遠)の3枚の画像データが得られる。たとえば図1の撮像素子201n(202n)、201m(202m)、201f(202f)はそれぞれ異なる製造上の歪みを有する可能性がある。そしてこれら各撮像素子で得られる画像データごとに独立して上記の補正処理を行なってもよいが、演算コストが極めて大きくなる問題がある。   As is apparent from FIG. 1, in NMF imaging, three pieces of image data of N (near), M (middle), and F (far) are obtained. For example, the image sensors 201n (202n), 201m (202m), and 201f (202f) in FIG. 1 may have different manufacturing distortions. The above correction processing may be performed independently for each image data obtained by each of these image pickup devices, but there is a problem that the calculation cost becomes extremely high.

そこで、図2のステップS21の撮影の後、上述のステップS22の交点座標の検出までをN(近)、M(中)、F(遠)の画像データについてそれぞれ行ない、続いて、ステップS23のグリッド交点座標の補正処理をN(近)、M(中)、F(遠)の画像データのうちの1つ、たとえばM(中)の画像について行なう。ここでは、前述のようにして撮影された画面中心部の4点のグリッド交点から、歪んでいない補正後交点群を画面全体にわたって求める。   Therefore, after photographing in step S21 in FIG. 2, the image data of N (near), M (medium), and F (far) are respectively detected until the intersection coordinates are detected in step S22, and then in step S23. The grid intersection coordinate correction process is performed on one of N (near), M (middle), and F (far) image data, for example, an M (middle) image. Here, an uncorrected corrected intersection group is obtained over the entire screen from the four grid intersections in the center of the screen imaged as described above.

そしてN(近)およびF(遠)の画像データについては3画素の補正後の交点座標を一致させるため、M(中)の画像について求めた補正後のグリッド交点座標を用いてN(近)、M(中)、F(遠)の全ての画像データに関してアフィン変換関数を求める処理(ステップS24)を行なう。   For the N (near) and F (far) image data, the corrected intersection coordinates of the M (medium) image are used to match the corrected intersection coordinates of the three pixels. , M (medium), and F (far) image data for all affine transformation functions are obtained (step S24).

たとえば、F(遠)の画像データの場合、図17に示すようにM(中)の画像データから求めた補正後のグリッド交点座標と、F(遠)の画像データの補正前のグリッド交点座標を用いてアフィン変換関数を求める処理(ステップS24)を行なう。   For example, in the case of F (far) image data, the corrected grid intersection coordinates obtained from the M (middle) image data and the grid intersection coordinates before correction of the F (far) image data as shown in FIG. Is used to obtain the affine transformation function (step S24).

このようにして、NMF画像処理を行なう場合、演算量を大きく低減することができ、画像処理時間を短縮することができる。なお、ステレオ撮影系の場合、以上の画像処理はレンズ系ごとに(図1の場合、撮像素子201n、201m、201fの系と撮像素子202n、202m、202fの系はそれぞれ別に)行なうのはいうまでもない。   In this way, when performing NMF image processing, the amount of calculation can be greatly reduced, and the image processing time can be shortened. In the case of a stereo photographing system, the above image processing is performed for each lens system (in the case of FIG. 1, the system of the image sensors 201n, 201m, 201f and the system of the image sensors 202n, 202m, 202f are respectively different). Not too long.

本発明は、立体画像撮影および画像処理を行なう任意の立体画像処理システムにおいて実施することができる。以上では、画像処理をPCハードウェアで行なう構成を例示したが、画像処理を行なう装置はPCに限定されるものではなく、専用機として構成された画像処理装置、画像データを入力する機能を有する画像形成装置(プリンタなど)、あるいはステレオカメラそれ自体などであってよい。また、本発明の画像処理を制御するためのプログラムは適当な記憶媒体経由、あるいはネットワーク経由で対象の画像処理装置(上記のPCやステレオカメラなど)に導入することができる。   The present invention can be implemented in any stereoscopic image processing system that performs stereoscopic image capturing and image processing. In the above, the configuration in which the image processing is performed by the PC hardware is exemplified, but the device for performing the image processing is not limited to the PC, and has an image processing device configured as a dedicated machine and a function of inputting image data. It may be an image forming apparatus (such as a printer) or a stereo camera itself. The program for controlling the image processing of the present invention can be introduced into the target image processing apparatus (the above-mentioned PC, stereo camera, etc.) via an appropriate storage medium or via a network.

本発明を採用した画像処理システムの構成を示した説明図である。It is explanatory drawing which showed the structure of the image processing system which employ | adopted this invention. 本発明による画像処理全体の流れを示したフローチャート図である。It is the flowchart figure which showed the flow of the whole image processing by this invention. 本発明において用いられるグリッドの構成を示した説明図である。It is explanatory drawing which showed the structure of the grid used in this invention. 本発明による画像処理において撮影された走査線の輝度変化を示した線図である。It is the diagram which showed the luminance change of the scanning line image | photographed in the image processing by this invention. 本発明による画像処理において撮影された走査線の輝度変化を示した線図である。It is the diagram which showed the luminance change of the scanning line image | photographed in the image processing by this invention. 本発明による画像処理において撮影された走査線の輝度変化を示した線図である。It is the diagram which showed the luminance change of the scanning line image | photographed in the image processing by this invention. 本発明による画像処理において撮影された走査線の輝度変化を示した線図である。It is the diagram which showed the luminance change of the scanning line image | photographed in the image processing by this invention. 本発明による画像処理において問題となる樽型歪みの状態を示した説明図である。It is explanatory drawing which showed the state of barrel distortion used as a problem in the image processing by this invention. 本発明による画像処理における評価関数の適用を示した説明図である。It is explanatory drawing which showed application of the evaluation function in the image processing by this invention. 本発明による画像処理において検出されたグリッド線範囲(縦)を示した説明図である。It is explanatory drawing which showed the grid line range (vertical) detected in the image processing by this invention. 本発明による画像処理において検出されたグリッド線範囲(横)を示した説明図である。It is explanatory drawing which showed the grid line range (horizontal) detected in the image processing by this invention. 本発明による画像処理におけるグリッド交点座標の検出方法を示した説明図である。It is explanatory drawing which showed the detection method of the grid intersection coordinate in the image processing by this invention. 本発明による画像処理において検出されたグリッド交点座標を示した線図である。It is the diagram which showed the grid intersection coordinate detected in the image processing by this invention. 本発明による画像処理において検出されたグリッド交点座標を拡大して示した線図である。It is the diagram which expanded and showed the grid intersection coordinate detected in the image processing by this invention. 本発明による画像処理において撮影されるグリッドおよび撮影されたグリッド画像を示した説明図である。It is explanatory drawing which showed the grid image | photographed in the image processing by this invention, and the image | photographed grid image. 本発明による画像処理におけるグリッド交点の補正方法を示した説明図である。It is explanatory drawing which showed the correction method of the grid intersection in the image processing by this invention. 本発明による画像処理におけるグリッド交点の補正方法をNMF画像に適用する場合を示した説明図である。It is explanatory drawing which showed the case where the correction method of the grid intersection in the image processing by this invention is applied to an NMF image. 本発明による画像処理における画面端部のグリッド交点の補正方法を示した説明図である。It is explanatory drawing which showed the correction method of the grid intersection of the screen edge part in the image processing by this invention.

符号の説明Explanation of symbols

20 ステレオカメラ
21、22 レンズ
40 制御システム
41 ディスプレイ
42 キーボード
51 CPU
54 HDD
55 インターフェース
201n、201m、201f 撮像素子
202n、202m、202f 撮像素子
203 CPU
20 Stereo camera 21, 22 Lens 40 Control system 41 Display 42 Keyboard 51 CPU
54 HDD
55 Interface 201n, 201m, 201f Image sensor 202n, 202m, 202f Image sensor 203 CPU

Claims (5)

撮影光学系および撮像素子を用いて撮影した画像データの前記撮影光学系および撮像素子に起因する歪みを補正する画像処理方法において、
直交する縦線および横線から成るグリッド画像を前記撮影光学系および撮像素子により撮影する撮影過程と、
前記グリッド画像の各座標を順次走査し、グリッド線を構成する輝度の低い画素を検出し、過去の複数走査線における同一座標の複数画素の平均の所定閾値パーセンテージを下回った画素をグリッド線の候補画素とし、各画素の座標で過去の複数走査線における同一座標における前記候補画素の数の連続性を示す評価関数P(x)=p(x−1)p(x)+p(x)p(x+1)(p(i):座標iにおけるグリッド線の候補画素の数)の値を求め、その値P(x)が閾値以上の場合、当該画素の座標をグリッド線の存在する範囲として求め、さらにこのグリッド線の存在する範囲の中心を検出して得たグリッド線の交点を前記グリッド画像の縦線および横線が画成するブロックの交点として検出する交点検出過程と、
前記交点検出過程で検出された前記ブロックの交点座標を、該ブロックの前記グリッド線が縦横の直線となるよう、すなわち前記ブロックが矩形となるように補正するグリッド交点補正過程と、
前記グリッド交点補正過程により得られたブロックを画成する各交点の座標と、前記グリッド画像中のブロックを画成する各交点の座標に基づき実際の撮影画像を補正するための補正関数を演算する補正関数演算過程と、を含むキャリブレーション処理を行なうことを特徴とする画像処理方法。
In an image processing method for correcting distortion caused by the photographing optical system and the image sensor of image data photographed using the photographing optical system and the image sensor,
An imaging process in which a grid image composed of vertical lines and horizontal lines orthogonal to each other is captured by the imaging optical system and the imaging element
Each coordinate of the grid image is sequentially scanned to detect pixels with low luminance constituting the grid line, and pixels that are below the predetermined threshold percentage of the average of a plurality of pixels at the same coordinate in a plurality of past scan lines are selected as grid line candidates. An evaluation function P (x) = p (x−1) p (x) + p (x) p () indicating the continuity of the number of candidate pixels at the same coordinates in the past plural scanning lines at the coordinates of each pixel. x + 1) (p (i): the number of candidate pixels of the grid line at the coordinate i) If the value P (x) is equal to or greater than the threshold value, the coordinates of the pixel are determined as the range where the grid line exists, Further, an intersection detection process for detecting the intersection of the grid lines obtained by detecting the center of the range in which the grid lines exist as the intersection of the blocks defined by the vertical and horizontal lines of the grid image ,
Grid intersection correction process for correcting the intersection coordinates of the block detected in the intersection detection process so that the grid lines of the block are vertical and horizontal straight lines, i.e., the block is rectangular.
A correction function for correcting an actual captured image is calculated based on the coordinates of each intersection defining the block obtained by the grid intersection correction process and the coordinates of each intersection defining the block in the grid image. An image processing method comprising: performing a calibration process including a correction function calculation process.
請求項1に記載の画像処理方法において、補正関数演算過程において、グリッド画像中のブロックと、前記グリッド交点補正過程により得られたブロックを画成する各交点の座標値に基づき、当該ブロックにおける実際の撮影画像を補正するためのアフィン変換関数を演算することを特徴とする画像処理方法。   2. The image processing method according to claim 1, wherein in the correction function calculation process, the actual value in the block is determined based on the coordinate value of each block defining the block in the grid image and the block obtained by the grid intersection correction process. An image processing method comprising calculating an affine transformation function for correcting the captured image. 請求項1に記載の画像処理方法において、前記撮影光学系の背後に、撮影距離の異なる被写体画像を各々良好に撮像できるよう光軸上の異なる位置に配置された複数の撮像素子を配置し、前記撮影過程において各撮像素子によりそれぞれグリッド画像を撮影し、得られた複数のグリッド画像に関してそれぞれ行なう前記補正関数演算過程においては、複数のグリッド画像のうち所定の一のグリッド画像に関して行なった前記グリッド交点補正過程により得られたブロックを画成する各交点の座標と、当該のグリッド画像中のブロックを画成する各交点の座標に基づき実際の撮影画像を補正するための補正関数を演算することを特徴とする画像処理方法。   The image processing method according to claim 1, wherein a plurality of imaging elements arranged at different positions on the optical axis are arranged behind the imaging optical system so that subject images with different imaging distances can each be satisfactorily imaged. In the imaging process, each grid image is captured by each imaging device, and in the correction function calculation process performed for each of the obtained grid images, the grid performed for a predetermined grid image among the plurality of grid images. Calculate a correction function for correcting the actual captured image based on the coordinates of each intersection defining the block obtained by the intersection correction process and the coordinates of each intersection defining the block in the grid image. An image processing method characterized by the above. 請求項1〜のいずれか1項に記載の画像処理方法を実施するための画像処理装置。 The image processing apparatus for implementing the image processing method according to any one of claims 1-3. 請求項1〜のいずれか1項に記載の画像処理方法を所定の画像処理装置において実施するための画像処理プログラム。 An image processing program for performing a predetermined image processing apparatus an image processing method according to any one of claims 1-4.
JP2004154084A 2004-05-25 2004-05-25 Image processing method, image processing apparatus, and image processing program Expired - Fee Related JP4542821B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004154084A JP4542821B2 (en) 2004-05-25 2004-05-25 Image processing method, image processing apparatus, and image processing program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004154084A JP4542821B2 (en) 2004-05-25 2004-05-25 Image processing method, image processing apparatus, and image processing program

Publications (2)

Publication Number Publication Date
JP2005340985A JP2005340985A (en) 2005-12-08
JP4542821B2 true JP4542821B2 (en) 2010-09-15

Family

ID=35494076

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004154084A Expired - Fee Related JP4542821B2 (en) 2004-05-25 2004-05-25 Image processing method, image processing apparatus, and image processing program

Country Status (1)

Country Link
JP (1) JP4542821B2 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101550868B1 (en) 2009-03-19 2015-09-08 한화테크윈 주식회사 Image distortion compensation method by lens and mirror
US10397550B2 (en) * 2012-12-14 2019-08-27 Bp Corporation North America Inc. Apparatus and method for three dimensional surface measurement
CN112104851B (en) * 2020-09-15 2022-04-08 成都极米科技股份有限公司 Detection method, device and detection system for picture correction

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0720125B1 (en) * 1994-12-29 2002-05-08 Koninklijke Philips Electronics N.V. Image forming apparatus and method for correcting optical geometrical distortions in an image

Also Published As

Publication number Publication date
JP2005340985A (en) 2005-12-08

Similar Documents

Publication Publication Date Title
US11570423B2 (en) System and methods for calibration of an array camera
JP5075757B2 (en) Image processing apparatus, image processing program, image processing method, and electronic apparatus
KR101053506B1 (en) Method for adjusting parameters in distortion calibration of image acquired by camera having fish eye lens
CN107818542B (en) Image deformation repairing method and device
JP2020088689A (en) Image processing apparatus, imaging apparatus, and image processing method
JP2015142364A (en) Image processing device, imaging apparatus and image processing method
JP5821563B2 (en) Image reading apparatus, image reading method, and MTF correction parameter determination method
JP2008298589A (en) Device and method for detecting positions
JP4542821B2 (en) Image processing method, image processing apparatus, and image processing program
JP5446285B2 (en) Image processing apparatus and image processing method
JP5224976B2 (en) Image correction apparatus, image correction method, program, and recording medium
CN112866655A (en) Image processing method and device, electronic equipment and computer readable storage medium
JP2013120435A (en) Image processing apparatus and image processing method, and program
JP2014241580A (en) Imaging apparatus
Lluis-Gomez et al. Chromatic aberration correction in RAW domain for image quality enhancement in image sensor processors
CN112381896A (en) Method and system for correcting brightness of microscopic image and computer equipment
CN112866550B (en) Phase difference acquisition method and apparatus, electronic device, and computer-readable storage medium
JP2014154977A (en) Image processing apparatus, image processing method, and imaging device
JP7341843B2 (en) Image processing device, image processing method, imaging device, program
US20220398778A1 (en) Lens calibration method for digital imaging apparatus
JP2010041418A (en) Image processor, image processing program, image processing method, and electronic apparatus
US10079985B2 (en) Microscope system
JP6566765B2 (en) Imaging device
CN113538529A (en) Image registration apparatus
JP2003010122A (en) Pupil measuring instrument and its image distortion correcting method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070413

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090716

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090825

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20091026

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

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20100628

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

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

Free format text: PAYMENT UNTIL: 20130702

Year of fee payment: 3

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees