JP2018009927A - Image processing device, image processing method and program - Google Patents

Image processing device, image processing method and program Download PDF

Info

Publication number
JP2018009927A
JP2018009927A JP2016140288A JP2016140288A JP2018009927A JP 2018009927 A JP2018009927 A JP 2018009927A JP 2016140288 A JP2016140288 A JP 2016140288A JP 2016140288 A JP2016140288 A JP 2016140288A JP 2018009927 A JP2018009927 A JP 2018009927A
Authority
JP
Japan
Prior art keywords
light source
position information
calculated
unit
image processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2016140288A
Other languages
Japanese (ja)
Inventor
哲 鳥居
Satoru Torii
哲 鳥居
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2016140288A priority Critical patent/JP2018009927A/en
Publication of JP2018009927A publication Critical patent/JP2018009927A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Length Measuring Devices By Optical Means (AREA)
  • Image Analysis (AREA)

Abstract

PROBLEM TO BE SOLVED: To make it possible to measure a normal line of a measurement object with high accuracy even when a position relation between a light source and the measurement object cannot be measured with high accuracy.SOLUTION: An image processing device has: calculation means that calculates a normal line map holding a normal line of a surface of the measurement object for each pixel by a photometric stereo method on the basis of three or shot images in a state where a measurement object is sequentially applied from each of three or more light sources different in an irradiation direction, and position information on the light source; and determination means that calculates a rough shape of the measurement object on the basis of the normal line map calculated by the calculation means, and compares the calculated rough shape with a preliminarily acquired reference rough shape to thereby determine whether it is necessary to update the position information on the light source; and update means that, when it is determined by the determination means that it is necessary to update the position information on the light source, updates the position information on the light source. The calculation means is configured to recalculate a normal line map, using the position information on the light source updated by the update means.SELECTED DRAWING: Figure 7

Description

本発明は、照度差ステレオ法により測定対象物の法線マップを測定する技術に関する。   The present invention relates to a technique for measuring a normal map of an object to be measured by an illuminance difference stereo method.

カメラを用いて測定対象物の表面の微細な形状を測定する手法として照度差ステレオ法がある。照度差ステレオ法とは、測定対象物に対し照射方向が異なる3つ以上の光源のそれぞれから順次に照射した状態で撮像した3枚以上の画像、及び光源と測定対象物の位置関係に基づいて、測定対象物の表面の各点(微細な領域)における法線を算出する手法である。この照度差ステレオ法によって法線を算出する際に、各光源と測定対象物の位置関係を精度よく取得できないと法線の測定精度が低下してしまうという問題がある。   There is an illuminance difference stereo method as a method for measuring the fine shape of the surface of a measurement object using a camera. The illuminance difference stereo method is based on three or more images captured in a state where the measurement object is sequentially irradiated from each of three or more light sources having different irradiation directions, and the positional relationship between the light source and the measurement object. This is a method for calculating the normal line at each point (fine area) on the surface of the measurement object. When calculating the normal line by this illuminance difference stereo method, there is a problem that the measurement accuracy of the normal line decreases if the positional relationship between each light source and the measurement object cannot be obtained with high accuracy.

そこで、特許文献1には、4つ以上の光源によってそれぞれ順次に照射された測定対象物を撮像し、得られた4枚以上の画像から測定対象物の法線を相対的に高い精度で算出できる3枚以上の画像の組み合わせを推測して法線の算出に用いる方法が開示されている。また、特許文献2には、光源位置測定用に計測ピンを用いることで光源と測定対象物の位置関係を推定する方法が開示されている。   Therefore, in Patent Document 1, the measurement object irradiated sequentially by four or more light sources is imaged, and the normal line of the measurement object is calculated with relatively high accuracy from the obtained four or more images. A method of estimating a combination of three or more images that can be used and calculating a normal is disclosed. Patent Document 2 discloses a method for estimating the positional relationship between a light source and a measurement object by using a measurement pin for measuring the light source position.

特開2014−38049号公報JP 2014-38049 A 特開2014−112043号公報JP 2014-112043 A

特許文献1に開示の技術では、4つ以上の光源から相対的に測定精度が高くなる3以上の光源の組み合わせを選択することはできるが、光源の位置を正しく与えないと測定精度が低下する問題は残ったままである。   In the technique disclosed in Patent Document 1, it is possible to select a combination of three or more light sources that provide a relatively high measurement accuracy from four or more light sources, but the measurement accuracy decreases unless the positions of the light sources are given correctly. The problem remains.

また、特許文献2に開示の技術では、計測ピンの影の先端位置に基づいて光源の位置を推定する。しかし、一般に光源は一定の大きさを持つため影の先端にはボケが生じることが多い。その場合、影の先端位置を精度よく検出することは困難となり、得られる光源の位置には誤差が生じてしまうという課題があった。   In the technique disclosed in Patent Document 2, the position of the light source is estimated based on the position of the tip of the shadow of the measurement pin. However, since the light source generally has a certain size, blurring often occurs at the tip of the shadow. In that case, it is difficult to accurately detect the position of the tip of the shadow, and there is a problem that an error occurs in the position of the obtained light source.

そこで本発明は、光源と測定対象物の位置関係を高精度に測定することができない場合であっても、測定対象物の法線を高精度に測定することを可能にする画像処理を提供することを目的とする。   Therefore, the present invention provides an image processing that makes it possible to measure the normal of a measurement object with high accuracy even when the positional relationship between the light source and the measurement object cannot be measured with high accuracy. For the purpose.

本発明に係る画像処理装置は、測定対象物に対し照射方向が異なる3つ以上の光源のそれぞれから順次に照射した状態で撮像した3枚以上の画像と、前記光源の位置情報とに基づいて、照度差ステレオ法により前記測定対象物の表面の法線を画素毎に保持した法線マップを算出する算出手段と、前記算出手段にて算出された前記法線マップに基づいて前記測定対象物の概略形状を算出し、算出された概略形状を予め取得された前記測定対象物の基準概略形状と比較することで、前記光源の位置情報を更新する必要があるか否かを判定する判定手段と、前記判定手段にて前記光源の位置情報を更新する必要があると判定された場合に、前記光源の位置情報を更新する更新手段とを有し、前記算出手段は、前記更新手段にて更新された前記光源の位置情報を用いて前記法線マップを算出し直すことを特徴とする。   The image processing apparatus according to the present invention is based on three or more images captured in a state where the measurement object is sequentially irradiated from each of three or more light sources having different irradiation directions, and position information of the light sources. A calculation means for calculating a normal map in which a normal of the surface of the measurement object is held for each pixel by an illuminance difference stereo method, and the measurement object based on the normal map calculated by the calculation means A determination unit that determines whether or not the position information of the light source needs to be updated by calculating a rough shape of the light source and comparing the calculated rough shape with a reference rough shape of the measurement object acquired in advance. And updating means for updating the position information of the light source when it is determined by the determining means that the position information of the light source needs to be updated, and the calculating means is Updated light source Wherein the re-calculating the normal map using location information.

本発明によれば、照度差ステレオ法により測定対象物の法線を測定する画像処理装置において、光源と測定対象物の位置関係が精度よく測定することができない場合でも測定対象物の法線を高精度に測定することが可能となる。   According to the present invention, in the image processing apparatus that measures the normal line of the measurement object by the illuminance difference stereo method, the normal line of the measurement object is determined even when the positional relationship between the light source and the measurement object cannot be measured with high accuracy. It becomes possible to measure with high accuracy.

詳細形状と概略形状とを模式的に示す図である。It is a figure which shows a detailed shape and a schematic shape typically. 実施例1における撮像装置が測定対象物の撮像を行う場合の様子を示す図である。It is a figure which shows a mode in case the imaging device in Example 1 images a measuring object. 実施例1における撮像装置の外観を示す図である。1 is a diagram illustrating an appearance of an imaging apparatus according to a first embodiment. 実施例1における撮像装置の内部構成を示すブロック図である。1 is a block diagram illustrating an internal configuration of an imaging apparatus according to Embodiment 1. FIG. 実施例1における撮像装置の全体処理のフローチャート図である。1 is a flowchart of overall processing of an imaging apparatus in Embodiment 1. FIG. 実施例1における画像処理部の内部構成を示す図である。2 is a diagram illustrating an internal configuration of an image processing unit in Embodiment 1. FIG. 実施例1における画像処理部における処理フローを示すフローチャート図である。FIG. 3 is a flowchart illustrating a processing flow in an image processing unit according to the first exemplary embodiment. 実施例1における発光部位置の更新を模式的に示す図である。It is a figure which shows typically the update of the light emission part position in Example 1. FIG. 実施例1における評価部の内部構成を示す図である。FIG. 3 is a diagram illustrating an internal configuration of an evaluation unit in Example 1. 実施例1における評価部の処理フローを示すフローチャート図である。It is a flowchart figure which shows the processing flow of the evaluation part in Example 1. FIG. 実施例2における画像処理部の内部構成を示す図である。FIG. 10 is a diagram illustrating an internal configuration of an image processing unit according to a second embodiment. 実施例2における画像処理部の処理フローを示すフローチャート図である。FIG. 10 is a flowchart illustrating a processing flow of an image processing unit in Embodiment 2. 実施例2における評価部の内部構成を示す図である。It is a figure which shows the internal structure of the evaluation part in Example 2. FIG.

以下、本発明の実施形態について図面を参照して説明する。ただし、以下の実施形態は本発明を限定するものではなく、また、以下で説明されている特徴の組み合わせの全てが本発明の課題解決に必須のものとは限らない。尚、以下の説明において参照する各図では、原則として、他の図と同等の要素に同一の符号を付与している。   Embodiments of the present invention will be described below with reference to the drawings. However, the following embodiments do not limit the present invention, and all combinations of features described below are not necessarily essential for solving the problems of the present invention. In addition, in each figure referred in the following description, the same code | symbol is provided to the element equivalent to another figure in principle.

[実施例1]
本実施例では、照度差ステレオ法によって、測定対象物の表面の微細な凹凸を含めた法線マップ(高精度な法線マップ)を測定する。ここで、法線とは測定対象物の表面上の点における接平面に対する垂線のことで、表面の向きを表す。また、法線マップとは、測定対象物の表面を複数の微細な領域に分割し、領域毎に法線を格納したものである。
[Example 1]
In this embodiment, a normal map (high-precision normal map) including fine irregularities on the surface of the measurement object is measured by the illuminance difference stereo method. Here, the normal line is a perpendicular to the tangent plane at a point on the surface of the measurement object, and represents the direction of the surface. The normal map is obtained by dividing the surface of the measurement object into a plurality of fine regions and storing normals for each region.

尚、以下の説明では、測定対象物の形状を詳細形状と概略形状の2つの言葉で表現する。詳細形状とは測定対象物の表面の微細な凹凸を含む微細な形状を表す。本実施例では、照度差ステレオ法によって測定対象物の詳細形状を高精度に測定することが目的となる。一方、概略形状とは測定対象物の表面の微細な凹凸を含まない粗い形状を表す。図1は、詳細形状と概略形状を模式的に示す図である。詳細形状が図1(a)に示された物体の概略形状は図1(b)に示されており、詳細形状が図1(c)に示された物体の概略形状は図1(d)に示されている。尚、詳細形状がどの程度の大きさの微細な形状までを含むかは、測定に用いる撮像装置の各画素が測定対象物上で見込む大きさ程度であり、撮像装置の解像度や撮像距離、焦点距離によって異なる。以下では、照度差ステレオ法によって測定された法線マップや詳細形状は、撮像画像と同じ解像度を有するものとし、概略形状は、撮像画像の解像度よりも低い解像度を有するものとして説明を行う。   In the following description, the shape of the measurement object is expressed by two words, a detailed shape and a schematic shape. The detailed shape represents a fine shape including fine irregularities on the surface of the measurement object. In this embodiment, an object is to measure the detailed shape of the measurement object with high accuracy by the illuminance difference stereo method. On the other hand, the approximate shape represents a rough shape that does not include fine irregularities on the surface of the measurement object. FIG. 1 is a diagram schematically showing a detailed shape and a schematic shape. The schematic shape of the object whose detailed shape is shown in FIG. 1 (a) is shown in FIG. 1 (b), and the schematic shape of the object whose detailed shape is shown in FIG. Is shown in It should be noted that the size of the detailed shape up to the minute shape is about the size that each pixel of the imaging device used for measurement can expect on the measurement object, and the resolution, imaging distance, and focus of the imaging device. It depends on the distance. In the following description, it is assumed that the normal map and the detailed shape measured by the illuminance difference stereo method have the same resolution as the captured image, and the approximate shape has a resolution lower than the resolution of the captured image.

本実施例では、測定対象物の正解概略形状を予め取得し、照度差ステレオ法によって測定された法線マップに基づいて算出された概略形状と正解概略形状との類似度が高くなるまで、照度差ステレオ法に用いる光源の位置情報の更新を繰り返し行う。これによって、光源の位置が精度よく測定できていない場合でも、法線マップを高精度に測定することが可能となる。尚、予め取得された正解概略形状は、光源の位置情報を更新するために参照される基準概略形状として用いられており、基準概略形状とも称される。   In this example, the correct approximate shape of the measurement object is acquired in advance, and the illuminance is increased until the similarity between the approximate shape calculated based on the normal map measured by the illuminance difference stereo method and the correct approximate shape increases. The position information of the light source used for the difference stereo method is repeatedly updated. Thereby, even when the position of the light source cannot be measured with high accuracy, the normal map can be measured with high accuracy. The correct approximate shape acquired in advance is used as a reference approximate shape that is referred to in order to update the position information of the light source, and is also referred to as a reference approximate shape.

図2は、本実施例における撮像装置201が測定対象物204の撮像を行う場合の様子を示す図である。図2に示すように、本実施例における撮像装置201は、チャート203が付属した設置台202に設置された測定対象物204の撮像を行う。ここで、設置台202及び測定対象物204それぞれには、設置時に位置を合わせるために用いる基準位置(図示せず)がついている。この基準位置を合わせて測定対象物204を設置台202に設置することで、チャート203に対する測定対象物204の相対位置が概ね分かるものとする。   FIG. 2 is a diagram illustrating a state where the imaging apparatus 201 according to the present exemplary embodiment captures an image of the measurement object 204. As shown in FIG. 2, the imaging apparatus 201 in the present embodiment performs imaging of the measurement object 204 installed on the installation table 202 to which the chart 203 is attached. Here, each of the installation table 202 and the measurement object 204 is provided with a reference position (not shown) used for aligning the position during installation. It is assumed that the relative position of the measurement object 204 with respect to the chart 203 can be generally understood by installing the measurement object 204 on the installation table 202 with the reference position being matched.

尚、撮像装置201は手持ちで使用することも可能であるが、不図示の三脚等に固定して使用することが望ましい。また、チャート203は、チャートの特徴点が検出し易いパターンであればよく、図2に示すようなチェッカーパターンの他、ドットが配置されたドットパターンやAR(Augmented Reality)で用いられるマーカーを用いてもよい。   Note that the image pickup apparatus 201 can be used by hand, but it is desirable to use it fixed on a tripod (not shown). The chart 203 only needs to be a pattern in which feature points of the chart can be easily detected. In addition to the checker pattern as shown in FIG. 2, a dot pattern in which dots are arranged or a marker used in AR (Augmented Reality) is used. May be.

図3は、本実施例における撮像装置201の外観の一例を示す図である。図3(a)は撮像装置201の前面、図3(b)は撮像装置201の背面を示している。図3(a)に示すように、撮像装置201の前面には、カラー画像を取得することが可能な撮像部301と、撮像に合わせ測定対象物に向け光を照射する3個の発光部302〜304と、撮像ボタン305が設けられている。尚、本実施例では発光部の数を3個とするが、これに限定されるものではなく、照度差ステレオ法によって測定対象物の法線マップを取得するために必要な3以上の複数の発光部を有していればよい。また、発光部302〜304の配置についても図示の配置に限定されるものではなく、任意の配置であってもよい。実施例では、発光部302〜304は撮像装置201の中に組み込まれている例を示したが、各発光部は撮像装置201とは独立した構成であってもよい。   FIG. 3 is a diagram illustrating an example of the appearance of the imaging apparatus 201 in the present embodiment. 3A shows the front surface of the imaging device 201, and FIG. 3B shows the back surface of the imaging device 201. As shown in FIG. 3A, on the front surface of the imaging apparatus 201, an imaging unit 301 capable of acquiring a color image, and three light emitting units 302 that irradiate light toward the measurement object in accordance with the imaging. To 304 and an imaging button 305 are provided. In the present embodiment, the number of light emitting units is three, but the number of light emitting units is not limited to this, and a plurality of three or more necessary for obtaining a normal map of the measurement object by the illuminance difference stereo method is used. What is necessary is just to have a light emission part. Further, the arrangement of the light emitting units 302 to 304 is not limited to the illustrated arrangement, and may be an arbitrary arrangement. In the embodiment, an example in which the light emitting units 302 to 304 are incorporated in the imaging device 201 is shown, but each light emitting unit may have a configuration independent of the imaging device 201.

撮像ボタン305は、半押し、及び、全押しの2段階のスイッチになっている。ユーザが撮像ボタン305を半押しした場合は、露出調整やホワイトバランスなどの撮像前の準備処理やフォーカス調整が行われる。そして、ユーザがさらに撮像ボタン305を全押しした場合は、発光部302〜304が1個ずつ順次に発光し、発光部が発光する度に、撮像部301が測定対象物からの光量をセンサ(撮像素子)で検知する。そして、検知された光量がA/D変換されて、デジタルデータに変換される。このように、各発光部の発光に対応するカラー画像(デジタルデータ)を取得する。ここで、発光部の数を3個とするので、合計で3枚のカラー画像を取得する。   The imaging button 305 is a two-stage switch that is half-pressed and fully pressed. When the user presses the imaging button 305 halfway, pre-imaging preparation processing such as exposure adjustment and white balance and focus adjustment are performed. When the user further presses the imaging button 305, the light emitting units 302 to 304 sequentially emit light one by one, and each time the light emitting unit emits light, the imaging unit 301 detects the amount of light from the measurement object. Detect with image sensor. The detected light quantity is A / D converted and converted into digital data. In this way, a color image (digital data) corresponding to the light emission of each light emitting unit is acquired. Here, since the number of light emitting units is three, a total of three color images are acquired.

また、図3(b)に示すように、撮像装置201の背面には、液晶ディスプレイから成る表示部306と、ユーザによる各種の操作を受け付けるための操作部307とが設けられている。表示部306は、撮像条件設定の操作状況、又は設定の確認を行うためのGUIや、撮像中の測定対象物のプレビュー画像又は映像や、撮像後の画像を表示することができる。操作部307は、ユーザが項目を変更、選択するために方向操作等を行うものであり、例えば十字ボタンの形態で配置される。尚、ボタンの形態は十字ボタンに限られるものではない。また、本実施例ではボタンで操作を行う例を示すが、これに限定されず、表示部306がタッチパネル方式により操作を受け付けるような構成であってもよい。例えば、表示部306は、感圧式、電磁誘導式など各種方式のタッチパネルを用いており、ユーザがタッチした座標を検出し、検出した座標によってユーザの指示を読み取るような構成とすることができる。   As shown in FIG. 3B, a display unit 306 including a liquid crystal display and an operation unit 307 for receiving various operations by the user are provided on the back surface of the imaging apparatus 201. The display unit 306 can display an operation state for setting imaging conditions, a GUI for confirming the settings, a preview image or video of a measurement target being imaged, and an image after imaging. The operation unit 307 is used by a user to perform a direction operation or the like for changing or selecting an item, and is arranged in the form of a cross button, for example. The button form is not limited to the cross button. In addition, although an example in which an operation is performed using a button is described in this embodiment, the present invention is not limited to this, and a configuration in which the display unit 306 receives an operation by a touch panel method may be used. For example, the display unit 306 uses various types of touch panels such as a pressure-sensitive type and an electromagnetic induction type, and can be configured to detect the coordinates touched by the user and read the user's instructions based on the detected coordinates.

<撮像装置の内部構成>
図4は、撮像装置201の内部構成を示すブロック図である。CPU401は、中央処理装置であり、バス404を介して接続された撮像装置201内の各構成を統括的に制御する。RAM(Random Access Memory)402は、CPU401の主メモリ、ワークエリア等として機能するメモリである。ROM(Read Only Memory)403は、CPU401で実行される制御プログラム等を格納するメモリである。バス404は、撮像装置201内の各構成の間で各種データの転送経路として機能する。例えば、撮像部301によって取得されたデジタルデータはこのバス404を介してデジタル信号処理部406に送られる。
<Internal configuration of imaging device>
FIG. 4 is a block diagram illustrating an internal configuration of the imaging apparatus 201. The CPU 401 is a central processing unit, and comprehensively controls each component in the imaging device 201 connected via the bus 404. A RAM (Random Access Memory) 402 is a memory that functions as a main memory, a work area, and the like of the CPU 401. A ROM (Read Only Memory) 403 is a memory for storing a control program executed by the CPU 401. The bus 404 functions as a transfer path for various data between the components in the imaging apparatus 201. For example, digital data acquired by the imaging unit 301 is sent to the digital signal processing unit 406 via the bus 404.

撮像制御部405は、CPU401からの指示に基づいて、フォーカスを合わせる(合焦処理)、シャッターを開く・閉じる、絞りを調節するなどの、撮像部301に対する光学系制御を行う。また、撮像制御部405は、CPU401からの指示に基づいて発光部302〜304の発光を制御する。デジタル信号処理部406は、撮像部301から送られたデジタルデータに対し、ホワイトバランス処理、ガンマ処理、ノイズ低減処理等の各種処理を行う。処理結果の画像は、表示部306に表示されたり、照度差ステレオ法に用いる画像として画像処理部411に送られたりする。尚、画像処理部411に送られる、照度差ステレオ法に用いる画像に対しては、ガンマ処理を行わず、撮像部301にて検知された光量と比例した値を画素値として出力することが望ましい。   Based on an instruction from the CPU 401, the imaging control unit 405 performs optical system control on the imaging unit 301, such as focusing (focusing process), opening / closing a shutter, and adjusting a diaphragm. Further, the imaging control unit 405 controls the light emission of the light emitting units 302 to 304 based on an instruction from the CPU 401. The digital signal processing unit 406 performs various processes such as white balance processing, gamma processing, and noise reduction processing on the digital data sent from the imaging unit 301. The processing result image is displayed on the display unit 306 or sent to the image processing unit 411 as an image used for the illuminance difference stereo method. It should be noted that for the image used for the illuminance difference stereo method sent to the image processing unit 411, it is desirable not to perform gamma processing and to output a value proportional to the amount of light detected by the imaging unit 301 as a pixel value. .

表示制御部407は、表示部306に表示する撮像前プレビュー映像や撮像済み画像の表示制御を行う。また、表示部306に表示する撮像パラメータの設定のためのUIや、設定済み撮像パラメータの確認のためのUIなど、文字やアイコンを表示するための表示制御も行う。エンコーダ部408は、デジタル信号処理部406による処理結果の画像をJPEGやMPEGなどのファイルフォーマットに変換する。外部メモリ制御部409は、PCやその他の外部メモリ410(例えば、ハードディスク、メモリーカード、CFカード、SDカード、USBメモリ)に撮像装置201を接続させるためのインターフェースである。   The display control unit 407 performs display control of a pre-capture preview image and a captured image displayed on the display unit 306. In addition, display control for displaying characters and icons such as a UI for setting imaging parameters displayed on the display unit 306 and a UI for checking imaging parameters already set is also performed. The encoder unit 408 converts the image resulting from the processing by the digital signal processing unit 406 into a file format such as JPEG or MPEG. The external memory control unit 409 is an interface for connecting the imaging device 201 to a PC or other external memory 410 (for example, a hard disk, a memory card, a CF card, an SD card, a USB memory).

画像処理部411は、法線マップの算出などの画像処理を行う。本実施例において、画像処理部411は、デジタル信号処理部406から送られた画像に基づき、照度差ステレオ法によって測定対象物の高精度な法線マップを算出する。尚、撮像装置201の構成要素は図4で示されるもの以外にも存在するが、本発明の主眼ではないので、説明を省略する。   The image processing unit 411 performs image processing such as calculation of a normal map. In the present embodiment, the image processing unit 411 calculates a high-precision normal map of the measurement object based on the illuminance difference stereo method based on the image sent from the digital signal processing unit 406. The constituent elements of the image pickup apparatus 201 exist in addition to those shown in FIG. 4, but are not the main points of the present invention, and thus description thereof is omitted.

<撮像装置の処理フロー>
図5は、本実施例における撮像装置201の全体処理のフローチャートである。ステップS501において撮像制御部405は、撮像部301が撮像する際の撮像パラメータを取得する。撮像パラメータは、例えばシャッタースピードや絞り、ISO感度などを含み、操作部307を介してユーザが設定することができる。また、撮像制御部405は、発光部302〜304を発光させる順番を示す順番情報も取得する。
<Processing flow of imaging device>
FIG. 5 is a flowchart of overall processing of the imaging apparatus 201 in the present embodiment. In step S501, the imaging control unit 405 acquires imaging parameters when the imaging unit 301 performs imaging. The imaging parameters include, for example, shutter speed, aperture, ISO sensitivity, and the like, and can be set by the user via the operation unit 307. The imaging control unit 405 also acquires order information indicating the order in which the light emitting units 302 to 304 emit light.

ステップS502において撮像制御部405は、ユーザが撮像ボタン305を押下することに応じて、発光部302〜304を発光させ、撮像部301が測定対象物を撮像するよう制御する。本ステップでは、ステップS501で取得された順番情報に従い、発光部を1個ずつ発光させ、1個の発光部を発光させる度に撮像部301で撮像を行う。本実施例では発光部302〜304のそれぞれの発光に対応する3枚の画像を撮像する。ここで、画像の撮像中に、撮像装置201を手持ちで撮像する場合などに、撮像装置201の位置が動いてしまう場合は、撮像された3枚の画像に対し位置合わせを行うものとする。すなわち、3枚の画像は、同じ座標を有する画素は、測定対象物204上の同じ位置を映しているものとする。尚、撮像された画像は外部メモリ410に記憶される。   In step S502, the imaging control unit 405 controls the imaging unit 301 to image the measurement object by causing the light emitting units 302 to 304 to emit light in response to the user pressing the imaging button 305. In this step, according to the order information acquired in step S501, the light emitting units emit light one by one, and the imaging unit 301 captures an image each time one light emitting unit emits light. In this embodiment, three images corresponding to each light emission of the light emitting units 302 to 304 are captured. Here, if the position of the imaging device 201 moves, for example, when the imaging device 201 is hand-held during image capture, alignment is performed on the three captured images. That is, in the three images, pixels having the same coordinates reflect the same position on the measurement object 204. The captured image is stored in the external memory 410.

ステップS503において画像処理部411は、ステップS502で撮像された3枚の画像に基づいて、照度差ステレオ法によって測定対象物の高精度な法線マップを算出する。尚、本ステップで画像処理部411が行う処理の詳細は後述する。   In step S503, the image processing unit 411 calculates a high-precision normal map of the measurement object by the illuminance difference stereo method based on the three images captured in step S502. Details of processing performed by the image processing unit 411 in this step will be described later.

ステップS504において画像処理部411は、ステップS503で算出された法線マップを表示制御部407に出力する。表示制御部407の制御によって、法線マップは表示部306に表示される。また、画像処理部411は、ステップS503で算出された法線マップを外部メモリ制御部409に出力する。外部メモリ制御部409の制御によって、法線マップは外部メモリ410に記録される。   In step S504, the image processing unit 411 outputs the normal map calculated in step S503 to the display control unit 407. The normal map is displayed on the display unit 306 under the control of the display control unit 407. In addition, the image processing unit 411 outputs the normal map calculated in step S503 to the external memory control unit 409. The normal map is recorded in the external memory 410 under the control of the external memory control unit 409.

<画像処理部の内部構成>
図6は、画像処理部411の内部構成を示すブロック図である。画像取得部601は、ステップS502で撮像した発光部302〜304のそれぞれに対応した3枚の画像を取得する。
<Internal configuration of image processing unit>
FIG. 6 is a block diagram illustrating an internal configuration of the image processing unit 411. The image acquisition unit 601 acquires three images corresponding to each of the light emitting units 302 to 304 captured in step S502.

正解概略形状取得部602は、測定対象物の正解概略形状を取得する。本実施例において、測定対象物の正解概略形状は、予め3Dスキャナなどにより測定され、外部メモリ410またはROM403に記録されている。正解概略形状取得部602は、ユーザからの指示によって、外部メモリ410またはROM403に記録されているデータを読み出すことにより、正解概略形状を取得する。尚、3Dスキャナとしては、例えば、照射した光が測定対象物で反射して戻ってくるまでの時間を測定するTOF(Time−of−Flight)方式がある。また、測定対象物に対しパターン光を照射した様子をカメラで撮像するアクティブ方式や、測定対象物を複数視点から撮像した画像から形状を復元するパッシブ方式などもある。   The correct approximate shape acquisition unit 602 acquires the correct approximate shape of the measurement object. In this embodiment, the correct approximate shape of the measurement object is measured in advance by a 3D scanner or the like and recorded in the external memory 410 or the ROM 403. The correct approximate shape acquisition unit 602 acquires the correct approximate shape by reading data recorded in the external memory 410 or the ROM 403 according to an instruction from the user. As the 3D scanner, for example, there is a TOF (Time-of-Flight) method for measuring the time until the irradiated light is reflected by the measurement object and returned. In addition, there are an active method in which a camera is used to capture an image of a measurement object being irradiated with pattern light, and a passive method in which the shape is restored from images obtained by imaging the measurement object from a plurality of viewpoints.

尚、取得される正解概略形状のデータは、XYZの3次元座標を持つ頂点データと、3つ以上の頂点を結んで構成する面の情報とから成る、ポリゴンデータとすることができる。また、平面や直方体、球など幾何学的な基本形状を組み合わせてモデリングしたものとすることもできる。また、正解概略形状のデータには、設置台202に設置する際の位置合わせに用いる測定対象物204における基準位置を示す情報も含まれる。   The acquired correct answer approximate shape data can be polygon data composed of vertex data having three-dimensional coordinates of XYZ and information of a surface formed by connecting three or more vertices. It can also be modeled by combining geometric basic shapes such as planes, rectangular parallelepipeds, and spheres. The correct answer outline shape data also includes information indicating the reference position of the measurement object 204 used for alignment when the object is installed on the installation table 202.

初期発光部位置取得部603は、照度差ステレオ法によって法線を計算する際に使用する発光部位置の初期情報を取得する。ここで、発光部位置とは、設置台202に対する3つの発光部302〜304の相対的な3次元位置を表す。本実施例では、撮像した画像中に写った設置台202に付属のチャート203から発光部位置を算出する。発光部位置の算出方法については後述する。尚、撮像装置201が設置台202に対し固定されており、設置台202との位置関係が既知である場合は、発光部位置の初期情報は、外部メモリ410やROM403に記録されているデータを利用してもよい。   The initial light emitting unit position acquisition unit 603 acquires initial information of the light emitting unit position used when calculating the normal by the illuminance difference stereo method. Here, the light emitting unit position represents a relative three-dimensional position of the three light emitting units 302 to 304 with respect to the installation table 202. In the present embodiment, the position of the light emitting unit is calculated from the chart 203 attached to the installation base 202 shown in the captured image. A method for calculating the light emitting unit position will be described later. When the imaging device 201 is fixed to the installation table 202 and the positional relationship with the installation table 202 is known, the initial information of the light emitting unit position is the data recorded in the external memory 410 or the ROM 403. May be used.

光源方向算出部604は、測定対象物204の正解概略形状と、発光部位置とに基づいて、測定対象物204上の領域毎に光源方向を算出する。ここで、測定対象物204上の領域とは、法線の取得を行う領域であり、撮像装置201によって撮像された画像の各画素に対応する測定対象物204上の微細な領域を表すものとする。また、光源方向とは、測定対象物204上の領域ごとに、その領域から各発光部への相対位置を表す。   The light source direction calculation unit 604 calculates the light source direction for each region on the measurement object 204 based on the correct approximate shape of the measurement object 204 and the light emitting unit position. Here, the area on the measurement object 204 is an area where the normal is acquired, and represents a fine area on the measurement object 204 corresponding to each pixel of the image captured by the imaging device 201. To do. The light source direction represents a relative position from each region to each light emitting unit for each region on the measurement object 204.

法線算出部605は、光源方向算出部604によって算出された測定対象物204上の領域毎の光源方向と、発光部302〜304に対応した3枚の画像とに基づいて照度差ステレオ法によって、測定対象物204の法線マップを算出する。   The normal line calculation unit 605 uses an illuminance difference stereo method based on the light source direction for each region on the measurement object 204 calculated by the light source direction calculation unit 604 and the three images corresponding to the light emitting units 302 to 304. Then, a normal map of the measurement object 204 is calculated.

評価部606は、法線算出部605によって算出された法線マップに基づいて測定対象物204の概略形状を算出し、算出された概略形状を正解概略形状と比較し、発光部位置(位置情報)を更新するべきか評価(判定)する。   The evaluation unit 606 calculates the approximate shape of the measurement object 204 based on the normal map calculated by the normal calculation unit 605, compares the calculated approximate shape with the correct approximate shape, and determines the light emitting unit position (position information). ) Is evaluated (determined).

発光部位置更新部607は、評価部606によって発光部位置の更新が必要だと判定された場合に、照度差ステレオ法に用いる発光部位置の更新を行う。出力部608は、評価部606によって発光部位置の更新が必要でないと判定された場合に、法線算出部605によって算出された法線マップを表示制御部407や外部メモリ制御部409へ出力する。法線マップは、表示制御部407の制御によって表示部306で表示されたり、外部メモリ制御部409の制御によって外部メモリ410に記録されたりする。   When the evaluation unit 606 determines that the light emitting unit position needs to be updated, the light emitting unit position updating unit 607 updates the light emitting unit position used for the illuminance difference stereo method. The output unit 608 outputs the normal map calculated by the normal calculation unit 605 to the display control unit 407 and the external memory control unit 409 when the evaluation unit 606 determines that the light emitting unit position does not need to be updated. . The normal map is displayed on the display unit 306 under the control of the display control unit 407 or recorded in the external memory 410 under the control of the external memory control unit 409.

<画像処理部の処理フロー>
図7は、本実施例における画像処理部411の処理フローを示すフローチャートである。ステップS701において画像取得部601は、外部メモリ410から発光部302〜304のそれぞれの発光に対応した3枚の撮像画像を取得する。前述のように、各画像は撮像部301に入射した光量と比例した値を画素値として持つものとする。
<Processing flow of image processing unit>
FIG. 7 is a flowchart illustrating a processing flow of the image processing unit 411 in the present embodiment. In step S <b> 701, the image acquisition unit 601 acquires three captured images corresponding to each light emission of the light emitting units 302 to 304 from the external memory 410. As described above, each image has a pixel value that is proportional to the amount of light incident on the imaging unit 301.

ステップS702において正解概略形状取得部602は、ユーザが操作部307を介して入力した指示によって、ROM403または外部メモリ410に保持されている測定対象物204の正解概略形状を読み出す。   In step S <b> 702, the correct approximate shape acquisition unit 602 reads the correct approximate shape of the measurement object 204 held in the ROM 403 or the external memory 410 in accordance with an instruction input by the user via the operation unit 307.

ステップS703において初期発光部位置取得部603は、照度差ステレオ法に用いる発光部位置の初期情報を取得する。本実施例では、撮像した画像中に写った設置台202に付属のチャート203から発光部位置を算出することにより、発光部位置の初期情報を取得する。以下では、本ステップにおける初期発光部位置取得部603の動作の詳細を説明する。   In step S703, the initial light emitting unit position acquisition unit 603 acquires initial information of the light emitting unit position used for the illuminance difference stereo method. In the present embodiment, the initial information of the light emitting unit position is acquired by calculating the light emitting unit position from the chart 203 attached to the installation table 202 that is reflected in the captured image. Below, the detail of operation | movement of the initial light emission part position acquisition part 603 in this step is demonstrated.

<<初期発光部位置取得部の動作>>
発光部302〜304と撮像部301が撮像装置201において固定されているため、撮像部301と各発光部との位置関係が既知ならば、チャート203に対する撮像部301の相対位置から、チャート203に対する各発光部の相対位置を算出できる。チャート203に対する撮像部301の相対位置は、既存の方法、例えば以下の方法により算出することができる。
<< Operation of initial light emitting unit position acquisition unit >>
Since the light emitting units 302 to 304 and the imaging unit 301 are fixed in the imaging device 201, if the positional relationship between the imaging unit 301 and each light emitting unit is known, the relative position of the imaging unit 301 with respect to the chart 203 can be The relative position of each light emitting unit can be calculated. The relative position of the imaging unit 301 with respect to the chart 203 can be calculated by an existing method, for example, the following method.

撮像部301の撮像により得られた撮像画像における2次元座標u,vと、撮像対象の3次元座標X,Y,Zとの関係は下記の式(1)で表すことができる。   The relationship between the two-dimensional coordinates u, v in the captured image obtained by the imaging of the imaging unit 301 and the three-dimensional coordinates X, Y, Z of the imaging target can be expressed by the following equation (1).

Figure 2018009927
Figure 2018009927

ここで、Aは撮像部301の焦点距離や主点位置を表す内部パラメータである。R及びtは、撮像部301の姿勢(回転)と位置(並進)を表す外部パラメータであり、Rは3×3の行列とし、tは1×3の行列とする。sはスケールファクタであって、既知である。また、3次元座標X,Y,Zは、チャート203の複数の特徴点のうち、いずれか1つの特徴点(所定の特徴点)を原点としXY平面がチャート203と平行な3次元空間を考えた際の3次元座標とする。このような3次元空間(以下、3次元空間)におけるチャート203の各特徴点の3次元座標が既知である。 Here, A is an internal parameter that represents the focal length and principal point position of the imaging unit 301. R and t are external parameters representing the posture (rotation) and position (translation) of the imaging unit 301, R is a 3 × 3 matrix, and t is a 1 × 3 matrix. s is a scale factor and is known. The three-dimensional coordinates X, Y, and Z consider a three-dimensional space in which any one of the plurality of feature points of the chart 203 (predetermined feature point) is the origin and the XY plane is parallel to the chart 203. 3D coordinates are used. The three-dimensional coordinates of each feature point of the chart 203 in such a three-dimensional space (hereinafter, three-dimensional space) are known.

本実施例では、ステップS701で取得された撮影画像からチャート203の各特徴点の2次元座標を検出し、検出された2次元座標と各特徴点の3次元座標との関係から上記の式(1)におけるA,R,tを推定する。   In the present embodiment, the two-dimensional coordinates of each feature point of the chart 203 are detected from the photographed image acquired in step S701, and the above equation (from the relationship between the detected two-dimensional coordinates and the three-dimensional coordinates of each feature point is obtained. Estimate A, R, and t in 1).

そして、推定されたR及びtを用いて、チャート203に対する撮像部301の相対位置(すなわち、3次元空間における撮像部301の位置)Pchart,camは、下記の式(2)により算出される。ここで、trans()は行列の転置を表す。 Then, using the estimated R and t, the relative position of the imaging unit 301 with respect to the chart 203 (that is, the position of the imaging unit 301 in the three-dimensional space) P chart, cam is calculated by the following equation (2). . Here, trans () represents transposition of a matrix.

Figure 2018009927
Figure 2018009927

さらに、チャート203に対する撮像部301の相対位置Pchart,camに対し、撮像部301に対するi番目の発光部の相対位置Pcam,light[i]を加算することで、チャート203に対するi番目の発光部の相対位置Pchart,light[i]を算出する。すなわち、3次元空間における発光部の位置は、下記の式(3)により算出される。 Further, by adding the relative position P cam, light [i] of the i-th light emitting unit with respect to the imaging unit 301 to the relative position P chart, cam of the imaging unit 301 with respect to the chart 203, the i-th light emission with respect to the chart 203 The relative position P chart, light [i] of the part is calculated. That is, the position of the light emitting unit in the three-dimensional space is calculated by the following equation (3).

Figure 2018009927
Figure 2018009927

図7のフローチャートの説明に戻る。次に、ステップS704において光源方向算出部604は、測定対象物204の正解概略形状と各発光部の位置とに基づいて、測定対象物204上の領域ごとに、その領域から各発光部への方向を算出する。ここで、測定対象物204上の領域は、撮像画像の各画素に対応する測定対象物204上の領域を表すものとする。そのため、本ステップでは、撮像画像中の測定対象物204が写っている全ての画素について、その画素に対応する測定対象物204上の領域から各発光部への方向を算出する。以下では、本ステップにおける光源方向算出部604の動作の詳細を説明する。   Returning to the flowchart of FIG. Next, in step S704, the light source direction calculation unit 604, for each region on the measurement target 204 based on the correct approximate shape of the measurement target 204 and the position of each light emission unit, from that region to each light emission unit. Calculate the direction. Here, the area on the measurement object 204 represents an area on the measurement object 204 corresponding to each pixel of the captured image. Therefore, in this step, for all pixels in which the measurement object 204 is captured in the captured image, the direction from the region on the measurement object 204 corresponding to the pixel to each light emitting unit is calculated. Below, the detail of operation | movement of the light source direction calculation part 604 in this step is demonstrated.

<<光源方向算出部の動作>>
撮像画像中の座標(u,v)の画素に対応する測定対象物204からi番目の発光部への方向Dirobj,light[i](u,v)は、下記の式(4)に示すように発光部の位置Pchart,light[i]と、測定対象物上の領域の位置Pchart,obj(u,v)とから算出する。
<< Operation of Light Source Direction Calculation Unit >>
The direction Dir obj, light [i] (u, v) from the measuring object 204 corresponding to the pixel at coordinates (u, v) in the captured image to the i-th light emitting unit is expressed by the following equation (4). As described above, the calculation is performed from the position P chart, light [i] of the light emitting unit and the position P chart, obj (u, v) of the region on the measurement object.

Figure 2018009927
Figure 2018009927

ここで、Pchart,obj(u,v)は、撮像部301の位置と撮像画像中の座標(u,v)の画素を3次元座標系に投影した点とを結んだ直線が、設置台202に基準位置を合わせて仮想的に配置した測定対象物204の正解概略形状と交わる点の位置を表す。具体的に以下の方法によりPchart,obj(u,v)を算出することができる。 Here, P chart, obj (u, v) indicates that the straight line connecting the position of the imaging unit 301 and the point where the pixel of the coordinate (u, v) in the captured image is projected on the three-dimensional coordinate system is The position of a point that intersects with the correct approximate shape of the measurement object 204 virtually arranged with the reference position aligned with 202 is shown. Specifically, P chart, obj (u, v) can be calculated by the following method.

まず、外部パラメータがR、tの撮像部301で撮像された画像の2次元座標(u,v)の画素を3次元座標系に投影した点の位置P(u,v)は下記の式(5)により算出される。ここで、fは撮像部301の焦点距離、cx、cyは撮像部301の主点位置を表す。   First, the position P (u, v) of a point obtained by projecting the pixel of the two-dimensional coordinate (u, v) of the image captured by the imaging unit 301 with the external parameters R and t onto the three-dimensional coordinate system is expressed by the following formula ( 5). Here, f represents the focal length of the imaging unit 301, and cx and cy represent the principal point position of the imaging unit 301.

Figure 2018009927
Figure 2018009927

そして、画素を3次元座標系に投影した点P(u,v)と撮像部301の位置とを結ぶ直線と、測定対象物204の正解概略形状とが交わる点を見つけることで、Pchart,obj(u,v)を算出する。直線と概略形状の交点の見つけ方は、幾何学計算などによる既知の方法を用いてもよく、コンピュータグラフィックスのレイトレーシングによるレンダリング時に用いられる衝突判定を用いてもよい。以上の処理を撮像画像の全画素、全発光部について行うことで、光源方向の算出が行われる。 Then, by finding a point where a straight line connecting the point P (u, v) obtained by projecting the pixel onto the three-dimensional coordinate system and the position of the imaging unit 301 intersects the correct approximate shape of the measurement object 204, P chart, obj (u, v) is calculated. As a method of finding the intersection of the straight line and the approximate shape, a known method such as geometric calculation may be used, or collision determination used at the time of rendering by ray tracing of computer graphics may be used. The light source direction is calculated by performing the above processing for all pixels and all light emitting portions of the captured image.

図7のフローチャートの説明に戻る。続いて、ステップS705において法線算出部605は、撮像画像の全画素について照度差ステレオ法によって法線を算出する。以下では、本ステップにおける法線算出部605の動作の詳細を説明する。   Returning to the flowchart of FIG. Subsequently, in step S705, the normal calculation unit 605 calculates a normal for all pixels of the captured image by the illuminance difference stereo method. Below, the detail of operation | movement of the normal calculation part 605 in this step is demonstrated.

<<法線算出部の動作>>
照度差ステレオ法は既存の方法を用いることができる。例えば、下記の式(6)によって座標(u,v)の画素の法線N(u,v)を算出することができる。
<< Operation of Normal Calculation Unit >>
An existing method can be used for the photometric stereo method. For example, the normal N (u, v) of the pixel at the coordinates (u, v) can be calculated by the following equation (6).

Figure 2018009927

Figure 2018009927
Figure 2018009927

Figure 2018009927

ここで、Ilight[i](u,v)は各発光部の発光に対応する撮像画像の座標(u,v)の画素値(例えば、輝度値)であり、I(u,v)はIlight[i](u,v)をまとめた1×3の行列である。S(u,v)は座標(u,v)の画素に対応する測定対象物204上の領域から各発光部への方向Dirobj,light[i](u,v)をまとめた3×3の行列であり、下記の式(7)で表すことができる。 Here, I light [i] (u, v) is a pixel value (for example, luminance value) of coordinates (u, v) of a captured image corresponding to light emission of each light emitting unit, and I (u, v) is It is a 1 × 3 matrix that summarizes I light [i] (u, v). S (u, v) is a 3 × 3 obtained by collecting the directions Dir obj, light [i] (u, v) from the region on the measurement object 204 corresponding to the pixel of coordinates (u, v) to each light emitting unit. And can be expressed by the following equation (7).

Figure 2018009927
Figure 2018009927

また、式(6)におけるinv(S)は、行列Sの逆行列を表す。尚、発光部の数が4以上の場合は、各発光部への方向Dirobj,light[i](u,v)をまとめた行列S(u,v)の逆行列を算出することができないため、inv(S)の代わりに下記の式(8)のような擬似逆行列を用いる。 Inv (S) in Equation (6) represents an inverse matrix of the matrix S. When the number of light emitting units is 4 or more, it is impossible to calculate an inverse matrix of the matrix S (u, v) in which the directions Dir obj, light [i] (u, v) to the respective light emitting units are collected. Therefore, a pseudo inverse matrix like the following formula (8) is used instead of inv (S).

Figure 2018009927
Figure 2018009927

さらに、上記の算出を撮像画像の全画素について行うことで法線マップを算出することができる。尚、法線算出部605は、算出された法線マップに基づいて測定対象物204の詳細形状をさらに算出してもよい。 Furthermore, the normal map can be calculated by performing the above calculation for all the pixels of the captured image. Note that the normal line calculation unit 605 may further calculate the detailed shape of the measurement object 204 based on the calculated normal map.

図7のフローチャートの説明に戻る。次に、ステップS706において評価部606は、ステップS705で照度差ステレオ法によって算出された法線マップと、ステップS702で取得された正解概略形状とに基づいて発光部位置の更新の必要性を評価する。すなわち、評価部606は、照度差ステレオ法によって算出された法線マップに基づいて測定対象物の概略形状を算出する。そして、算出された概略形状と、正解概略形状との類似度を表す評価値を算出し、この評価値が予め設定した評価基準を満たすか否かに基づいて発光部位置の更新の必要性を評価する。例えば、評価値が所定の基準値以下である場合に、発光部位置の更新が必要であると判定され、処理はステップS707へ遷移する。一方、評価値が所定の基準値より大きい場合に、発光部位置の更新が必要でないと判定され、処理はステップS708へ遷移する。本ステップにおける評価部606の動作の詳細については後述する。   Returning to the flowchart of FIG. Next, in step S706, the evaluation unit 606 evaluates the necessity of updating the light emitting unit position based on the normal map calculated by the illuminance difference stereo method in step S705 and the correct approximate shape acquired in step S702. To do. That is, the evaluation unit 606 calculates the approximate shape of the measurement object based on the normal map calculated by the illuminance difference stereo method. Then, an evaluation value representing the degree of similarity between the calculated approximate shape and the correct approximate shape is calculated, and the necessity of updating the light emitting portion position is determined based on whether the evaluation value satisfies a preset evaluation criterion. evaluate. For example, when the evaluation value is equal to or less than a predetermined reference value, it is determined that the light emitting unit position needs to be updated, and the process proceeds to step S707. On the other hand, when the evaluation value is larger than the predetermined reference value, it is determined that the light emitting unit position does not need to be updated, and the process proceeds to step S708. Details of the operation of the evaluation unit 606 in this step will be described later.

ステップS707において発光部位置更新部607は、法線マップの算出に用いる発光部位置を更新する。ここで、発光部位置の更新は、発光部302、303、304の物理的な位置を変更するのではなく、ステップS704の光源方向の算出に用いる発光部の位置情報を更新する処理である。   In step S707, the light emitting unit position updating unit 607 updates the light emitting unit position used for calculation of the normal map. Here, the update of the light emitting unit position is a process of updating the position information of the light emitting unit used for calculation of the light source direction in step S704, instead of changing the physical position of the light emitting units 302, 303, and 304.

図8は、本実施例における発光部位置の更新を模式的に示す図である。図8において、設置台202に設置された測定対象物204、及び発光部302、303、304を上から見た断面図が示されている。発光部302、303、304の位置は図中点線の位置から実線の位置に更新される。   FIG. 8 is a diagram schematically showing the update of the light emitting unit position in the present embodiment. FIG. 8 shows a cross-sectional view of the measuring object 204 and the light emitting units 302, 303, and 304 installed on the installation table 202 as viewed from above. The positions of the light emitting units 302, 303, and 304 are updated from the dotted line position to the solid line position in the figure.

図8では、発光部302、303、304の位置をX方向に同一の量だけ変更する例を示しているが、発光部位置の更新は全ての発光部の位置を一律の量、方向に変更することに限定されず、異なる方向、異なる量で発光部位置の変更を行うこともできる。発光部位置の変更量、方向の決定方法としては、ランダムに決定してもよく、または規則的に決定してもよい。例えば、発光部の位置が取り得る範囲を予め定めておいた上で、ステップS707の実行毎に変更量と方向に対応する乱数を発生させ上記範囲内で位置を変更してもよい。または、上記範囲内を一定の間隔で規則的に位置を更新していく方法であってもよい。あるいは、過去に行われた複数の発光部の位置の変更量、方向と、その発光部位置を用いて算出した法線マップに対する評価値から評価値が良くなる変更量、方向を予測することで変更量、方向を決定してもよい。ステップS707の後、処理はステップS704へ遷移し、更新後の発光部位置を用いて光源方向の算出を行う。そして、発光部位置の更新が必要でないと判定されるまでステップS704〜S707の処理が繰り返される。   FIG. 8 shows an example in which the positions of the light emitting units 302, 303, and 304 are changed by the same amount in the X direction. However, updating the positions of the light emitting units changes the positions of all the light emitting units to a uniform amount and direction. However, the light emitting unit position can be changed in different directions and in different amounts. As a method for determining the change amount and direction of the light emitting unit position, the light emitting unit position may be determined randomly or regularly. For example, after the range that the position of the light emitting unit can take is determined in advance, a random number corresponding to the change amount and direction may be generated every time step S707 is executed, and the position may be changed within the above range. Alternatively, a method of regularly updating the position within the above range at regular intervals may be used. Alternatively, by predicting the change amount and direction in which the evaluation value is improved from the evaluation value for the normal map calculated using the light emission unit position and the change amount and direction of the position of the plurality of light emission units performed in the past. The change amount and direction may be determined. After step S707, the process proceeds to step S704, and the light source direction is calculated using the updated light emitting unit position. And the process of step S704-S707 is repeated until it determines with the update of a light emission part position not being required.

次に、ステップS708において出力部608は、ステップS705で照度差ステレオ法によって算出された法線マップ(または詳細形状)を表示制御部407や外部メモリ制御部409へ出力する。法線マップ(または詳細形状)は、表示制御部407の制御によって表示部306で表示されたり、外部メモリ制御部409の制御によって外部メモリ410に記録されたりする。以上で、画像処理部411の動作手順の説明を終了する。   Next, in step S708, the output unit 608 outputs the normal map (or detailed shape) calculated by the illuminance difference stereo method in step S705 to the display control unit 407 and the external memory control unit 409. The normal map (or detailed shape) is displayed on the display unit 306 under the control of the display control unit 407 or recorded in the external memory 410 under the control of the external memory control unit 409. Above, description of the operation | movement procedure of the image process part 411 is complete | finished.

<<評価部の動作>>
以下では、ステップS706における評価部606の動作の詳細を説明する。評価部606は、ステップS705で照度差ステレオ法によって算出された法線マップに基づいて測定対象物の概略形状を算出する。そして、算出された測定対象物の概略形状と、ステップS702で予め取得された測定対象物の正解概略形状との類似度を表す評価値を算出する。さらに、この評価値が予め設定した評価基準を満たすか否かに基づいて、発光部位置の更新の必要性を判定する。
<< Operation of Evaluation Unit >>
Below, the detail of operation | movement of the evaluation part 606 in step S706 is demonstrated. The evaluation unit 606 calculates the approximate shape of the measurement object based on the normal map calculated by the illuminance difference stereo method in step S705. Then, an evaluation value representing a similarity between the calculated approximate shape of the measurement object and the correct approximate shape of the measurement object acquired in advance in step S702 is calculated. Further, the necessity of updating the light emitting unit position is determined based on whether or not the evaluation value satisfies a preset evaluation criterion.

以下では、法線マップに基づいて算出された測定対象物の概略形状と正解概略形状との類似度を表す評価値を算出する際には、形状情報としてデプスマップを用いる例を説明する。ここで、デプスマップとは、各画素の画素値として、撮像部301から測定対象物上の領域までの距離に比例した値を保持する画像である。尚、評価値はデプスマップから算出する方法に限らず、頂点と面から成るポリゴンデータの形式から評価値を算出し、発光部位置の更新の必要性を判定してもよい。   Hereinafter, an example will be described in which a depth map is used as shape information when calculating an evaluation value representing the degree of similarity between the approximate shape of a measurement object calculated based on a normal map and the correct approximate shape. Here, the depth map is an image that holds a value proportional to the distance from the imaging unit 301 to the region on the measurement object as the pixel value of each pixel. Note that the evaluation value is not limited to the method of calculating from the depth map, and the evaluation value may be calculated from the form of polygon data including vertices and surfaces to determine the necessity of updating the light emitting unit position.

図9は、評価部606の詳細な内部構成を示すブロック図である。デプスマップ算出部901は、法線算出部605で照度差ステレオ法によって算出された法線マップに基づいて、撮像部301から見た測定対象物のデプスマップを算出する。   FIG. 9 is a block diagram illustrating a detailed internal configuration of the evaluation unit 606. The depth map calculation unit 901 calculates a depth map of the measurement object viewed from the imaging unit 301 based on the normal map calculated by the normal calculation unit 605 by the illuminance difference stereo method.

正解デプスマップ算出部902は、正解概略形状取得部602で取得された正解概略形状に基づいて、撮像部301から見た測定対象物の正解デプスマップを算出する。   The correct answer map calculation unit 902 calculates the correct depth map of the measurement object viewed from the imaging unit 301 based on the correct approximate shape acquired by the correct approximate shape acquisition unit 602.

評価値算出部903は、照度差ステレオ法によって算出されたデプスマップと正解デプスマップとの類似度を表す評価値を算出する。   The evaluation value calculation unit 903 calculates an evaluation value indicating the degree of similarity between the depth map calculated by the illuminance difference stereo method and the correct answer depth map.

判定部904は、評価値算出部903で算出された評価値を予め設定された評価基準を満たすか否かに基づいて発光部位置の更新の必要性を判定する。評価値が評価基準を満たさない場合に、発光部位置の更新が必要であると判定し、評価値が評価基準を満たす場合に、発光部位置の更新が必要でないと判定する。そして、発光部位置の更新が必要であると判定された場合は発光部位置更新部607による発光部の位置の更新処理を行う。一方、発光部位置の更新が必要でないと判定された場合は法線マップの算出処理を終了し、法線マップの、出力部608による表示や外部メモリへの出力を行う。   The determination unit 904 determines the necessity of updating the light emitting unit position based on whether or not the evaluation value calculated by the evaluation value calculation unit 903 satisfies a preset evaluation criterion. When the evaluation value does not satisfy the evaluation standard, it is determined that the light emitting unit position needs to be updated, and when the evaluation value satisfies the evaluation standard, it is determined that the light emitting unit position needs not be updated. When it is determined that the light emitting unit position needs to be updated, the light emitting unit position updating unit 607 performs the light emitting unit position updating process. On the other hand, if it is determined that it is not necessary to update the position of the light emitting unit, the normal map calculation process is terminated, and the normal map is displayed by the output unit 608 or output to an external memory.

図10は、上記構成から成る評価部606の処理フローを示すフローチャートである。ステップS1001においてデプスマップ算出部901は、法線算出部605で照度差ステレオ法によって算出された測定対象物の法線マップを積分することで、撮像部301から見た測定対象物のデプスマップを得る。このとき、測定対象物の法線マップは撮像画像の画素毎に法線を有するため、そのまま積分すると高解像度なデプスマップが得られる。そのため、本ステップでは、法線マップを積分して得たデプスマップに対し、例えばガウシアンフィルタなどのフィルタによって平滑化処理をさらに行うことで、概略形状の解像度に合わせたデプスマップを算出する。尚、概略形状の解像度に合わせたデプスマップを算出する方法は上記の方法に限定されず、例えば、本ステップでは測定対象物の法線マップを平滑化した後に積分を行うものとしてもよい。   FIG. 10 is a flowchart showing a processing flow of the evaluation unit 606 configured as described above. In step S <b> 1001, the depth map calculation unit 901 integrates the normal map of the measurement target calculated by the illuminance difference stereo method in the normal calculation unit 605, thereby obtaining the depth map of the measurement target viewed from the imaging unit 301. obtain. At this time, since the normal map of the measurement object has a normal for each pixel of the captured image, a high-resolution depth map can be obtained by integrating as it is. Therefore, in this step, the depth map obtained by integrating the normal map is further subjected to a smoothing process using a filter such as a Gaussian filter to calculate a depth map that matches the resolution of the approximate shape. The method for calculating the depth map according to the resolution of the approximate shape is not limited to the above method. For example, in this step, the normal map of the measurement object may be smoothed and then integration may be performed.

ステップS1002において正解デプスマップ算出部902は、撮像時の撮像部301と測定対象物204の相対位置関係を再現するよう仮想カメラと正解概略形状を仮想空間上に配置した場合のデプスマップを、正解デプスマップとして算出する。具体的に、撮像部301と測定対象物204の相対位置関係は、ステップS703で求めたチャート203に対する撮像部301の相対位置Pchart,camと、チャート203に対する測定対象物204の相対位置Pchart,obj(u,v)とから算出する。尚、本ステップで算出された正解デプスマップと、ステップS1001で算出されたデプスマップとは、解像度、サイズが等しく、座標が同じ画素のデプスは測定対象物上の同一の領域に対するデプスを表すものとする。 In step S1002, the correct depth map calculation unit 902 corrects the depth map when the virtual camera and the correct approximate shape are arranged in the virtual space so as to reproduce the relative positional relationship between the imaging unit 301 and the measurement object 204 at the time of imaging. Calculated as a depth map. Specifically, the relative positional relationship between the imaging unit 301 and the measuring object 204, the relative position P chart of the imaging unit 301 for chart 203 obtained in step S703, cam and the relative position of the measurement object 204 with respect to the chart 203 P chart , obj (u, v). The correct depth map calculated in this step and the depth map calculated in step S1001 have the same resolution and size, and the depth of pixels having the same coordinates represents the depth of the same region on the measurement object. And

ステップS1003において評価値算出部903は、照度差ステレオ法によって得られた法線マップに基づいて算出されたデプスマップと正解デプスマップとの間の類似度を表す評価値を算出する。本実施例では、評価値として下記の式(9)によりPSNR(Peak Signal to Noise Ratio)値が算出される。   In step S1003, the evaluation value calculation unit 903 calculates an evaluation value representing the similarity between the depth map calculated based on the normal map obtained by the illuminance difference stereo method and the correct depth map. In this embodiment, a PSNR (Peak Signal to Noise Ratio) value is calculated by the following formula (9) as an evaluation value.

Figure 2018009927
Figure 2018009927

このPSNR値が高いほど照度差ステレオ法によって得られたデプスマップと正解デプスマップの類似度が高いことを表す。尚、評価値はPSNR値に限定されず、照度差ステレオ法によって得られたデプスマップと正解デプスマップとの類似度を表す値であればよい。例えば、類似度が高いほど評価値が低くなるものとしてもよい。 The higher the PSNR value, the higher the similarity between the depth map obtained by the illuminance difference stereo method and the correct depth map. The evaluation value is not limited to the PSNR value, and may be any value that represents the similarity between the depth map obtained by the illuminance difference stereo method and the correct answer depth map. For example, the evaluation value may be lower as the similarity is higher.

続いて、ステップS1004において判定部904は、ステップS1003で算出された評価値を予め設定された基準値TRと比較することで、発光部位置の更新が必要か否か判定を行う。具体的には、基準値TRを予め設定しておき、式(9)で算出されたPSNR値が基準値TR以下である場合は、類似度が低いため発光部位置の更新が必要であると判定し、処理はステップS707へ遷移する。一方、PSNR値が基準値TRより大きい場合は、類似度が高いため発光部位置の更新が必要でないと判定し、処理はステップS708へ遷移する。   Subsequently, in step S1004, the determination unit 904 determines whether or not the light emitting unit position needs to be updated by comparing the evaluation value calculated in step S1003 with a preset reference value TR. Specifically, when the reference value TR is set in advance and the PSNR value calculated by the equation (9) is equal to or less than the reference value TR, the similarity is low and the light emitting unit position needs to be updated. Determination is made, and the process proceeds to step S707. On the other hand, if the PSNR value is greater than the reference value TR, it is determined that the light emitting unit position does not need to be updated because the degree of similarity is high, and the process moves to step S708.

上述のように本実施例では、測定対象物の正解概略形状を予め取得し、照度差ステレオ法によって測定された法線から算出された概略形状と正解概略形状の類似度が高くなるまで照度差ステレオ法に用いる発光部位置の更新を繰り返し行う。これによって、発光部と測定対象物の位置関係を精度よく測定することができない場合でも法線を高精度に測定することが可能となる。   As described above, in this embodiment, the correct approximate shape of the measurement object is acquired in advance, and the difference in illuminance is increased until the similarity between the approximate shape calculated from the normal measured by the illuminance difference stereo method and the correct approximate shape increases. The light emitting unit position used for the stereo method is repeatedly updated. Thereby, even when the positional relationship between the light emitting unit and the measurement object cannot be measured with high accuracy, the normal can be measured with high accuracy.

尚、本実施例では、画像処理部411が撮像装置201に含まれるものとして説明したが、これに限定されず、画像処理部411は撮像装置201と通信可能な他の装置に含まれてもよい。または、画像処理部411は、撮像装置201と通信可能な画像処理装置として構成されてもよい。   In this embodiment, the image processing unit 411 is described as being included in the imaging device 201. However, the present invention is not limited to this, and the image processing unit 411 may be included in another device that can communicate with the imaging device 201. Good. Alternatively, the image processing unit 411 may be configured as an image processing device that can communicate with the imaging device 201.

[実施例2]
実施例1では、発光部位置の更新処理として発光部の位置をランダム、または規則的に更新する方法を説明した。本実施例では、照度差ステレオ法によって測定された法線から算出されたデプスマップと正解概略形状から得られたデプスマップとの差の分布に応じて発光部位置を更新する方法を説明する。
[Example 2]
In the first embodiment, the method of updating the position of the light emitting unit randomly or regularly as the update process of the light emitting unit position has been described. In this embodiment, a method of updating the light emitting unit position according to the distribution of the difference between the depth map calculated from the normal measured by the illuminance difference stereo method and the depth map obtained from the correct approximate shape will be described.

本実施例における評価値算出部と発光部位置更新部の動作は、実施例1で説明した評価部606内の評価値算出部903及び発光部位置更新部607の動作と異なる。以下では実施例2における評価値算出部と発光部位置更新部の動作について詳細に説明する。尚、本実施例の説明において、実施例1と同様の部分については、その説明を省略あるいは簡略化する。   The operations of the evaluation value calculation unit and the light emitting unit position update unit in the present embodiment are different from the operations of the evaluation value calculation unit 903 and the light emitting unit position update unit 607 in the evaluation unit 606 described in the first embodiment. Hereinafter, operations of the evaluation value calculation unit and the light emitting unit position update unit in the second embodiment will be described in detail. In the description of the present embodiment, the description of the same parts as those of the first embodiment will be omitted or simplified.

図11に本実施例における画像処理部の内部構成を表すブロック図を示す。本実施例における評価部1101は法線算出部605が算出した測定対象物の法線マップから概略形状を求め、正解概略形状取得部602が取得した正解概略形状との類似度を表す評価値を算出する。算出された評価値に基づいて、法線の算出に用いる発光部位置の更新の必要性を判定する。さらに、評価部1101は測定対象物の法線マップから求めた概略形状と正解概略形状との間の差分を算出して、発光部位置更新部1102に渡す。発光部位置更新部1102は、法線の算出に用いる発光部位置の更新が必要であると判定された場合に、評価部1101で算出された形状の差分に基づいて、発光部302〜304の位置を更新する。   FIG. 11 is a block diagram showing the internal configuration of the image processing unit in this embodiment. In this embodiment, the evaluation unit 1101 obtains an approximate shape from the normal map of the measurement object calculated by the normal calculation unit 605, and obtains an evaluation value representing the similarity to the correct approximate shape acquired by the correct approximate shape acquisition unit 602. calculate. Based on the calculated evaluation value, the necessity of updating the light emitting portion position used for calculating the normal is determined. Further, the evaluation unit 1101 calculates the difference between the approximate shape obtained from the normal map of the measurement object and the correct approximate shape, and passes the difference to the light emitting unit position update unit 1102. When it is determined that the light emitting unit position used for calculating the normal line needs to be updated, the light emitting unit position updating unit 1102 determines the light emitting units 302 to 304 based on the difference in shape calculated by the evaluation unit 1101. Update position.

図12は、本実施例における画像処理部の処理フローを示すフローチャートである。図12においては、実施例1の画像処理部の処理フローを示す図7から、ステップS706とステップS707が、ステップS1201とステップS1202に変更している。以下では、ステップS1201及びステップS1202を説明する。   FIG. 12 is a flowchart illustrating a processing flow of the image processing unit in the present embodiment. In FIG. 12, step S706 and step S707 are changed to step S1201 and step S1202 from FIG. 7 showing the processing flow of the image processing unit of the first embodiment. Hereinafter, step S1201 and step S1202 will be described.

ステップS1201において評価部1101は、ステップS705で算出された法線から求められた概略形状と正解概略形状とから、評価値と形状の差分とを算出する()。そして、評価値が予め設定された評価基準を満たすか否かを判定し、評価値が基準を満たさない場合は、発光部位置の更新が必要であると判定し、処理はステップS1202に移行する。評価値が基準を満たす場合は、発光部位置の更新が必要でないと判定し、処理はステップS708に移行する。   In step S1201, the evaluation unit 1101 calculates an evaluation value and a difference between the shapes from the approximate shape obtained from the normal calculated in step S705 and the correct approximate shape (). Then, it is determined whether or not the evaluation value satisfies a preset evaluation criterion. If the evaluation value does not satisfy the criterion, it is determined that the light emitting unit position needs to be updated, and the process proceeds to step S1202. . If the evaluation value satisfies the criterion, it is determined that the light emitting unit position does not need to be updated, and the process proceeds to step S708.

図13は、本実施例における評価部1101の詳細な内部構成を示す図である。評価部1101の内部構成のうち、実施例1と動作が異なる評価値算出部1301について説明する。評価値算出部1301は、法線マップから算出されたデプスマップと正解概略形状から算出された正解デプスマップとから、2つのデプスマップの類似度を表す評価値を算出すると共に、2つのデプスマップの差分を算出する。そして、算出された評価値を判定部904へ、デプスマップの差分を発光部位置更新部1102へそれぞれ渡す。ここで、デプスマップの類似度を表す評価値の算出方法は実施例1と同様のため説明を省略する。デプスマップの差分は、2つのデプスマップにおける同じ座標の画素のデプスについて差分を算出する処理を、全画素について行うことで算出される。尚、単に差分を算出してもよいし、差分の絶対値を算出してもよい。   FIG. 13 is a diagram illustrating a detailed internal configuration of the evaluation unit 1101 in the present embodiment. Of the internal configuration of the evaluation unit 1101, the evaluation value calculation unit 1301 whose operation is different from that of the first embodiment will be described. The evaluation value calculation unit 1301 calculates an evaluation value representing the similarity between the two depth maps from the depth map calculated from the normal map and the correct depth map calculated from the correct approximate shape, and the two depth maps. The difference is calculated. Then, the calculated evaluation value is passed to the determination unit 904, and the depth map difference is passed to the light emitting unit position update unit 1102. Here, since the calculation method of the evaluation value representing the similarity of the depth map is the same as that of the first embodiment, the description thereof is omitted. The difference between the depth maps is calculated by performing a process for calculating the difference between the depths of the pixels having the same coordinates in the two depth maps for all the pixels. Note that the difference may be simply calculated or the absolute value of the difference may be calculated.

ステップS1202において発光部位置更新部1102は、発光部位置の更新が必要であると判定された場合に、デプスマップの差分に基づいて、法線の算出に用いる発光部302〜304の位置を更新する。   If it is determined in step S1202 that the light emitting unit position needs to be updated, the light emitting unit position updating unit 1102 updates the positions of the light emitting units 302 to 304 used for calculating the normal based on the difference in the depth map. To do.

ここで、発光部位置とデプスマップの差分の分布との関係について説明する。仮に照度差ステレオ法によって誤差のない正確な法線マップを測定することができていたら、全ての座標においてデプスの差分は0となるはずである。しかし、撮像画像のノイズによる輝度値の変動や、発光部位置が正しく取得できていないことによる光源方向の誤差から、測定された法線には誤差が生じる。その結果、法線から算出された概略形状と正解概略形状との差分が生じる。ここで、撮像画像のノイズは一般的に輝度値がランダムに変動するため、その影響による法線の誤差もランダムに生じる。すなわち、撮像画像のノイズに起因したデプスマップの差分は偏りなくランダムに生じる。一方、法線の算出に用いる光源方向の誤差の場合、光源方向の誤差が生じている方向に応じて法線に誤差が生じる。そのため、デプスマップの差分にも光源方向の誤差の方向に応じた分布が生じる。   Here, the relationship between the light emitting unit position and the distribution of the difference between the depth maps will be described. If an accurate normal map without error can be measured by the illuminance difference stereo method, the depth difference should be zero in all coordinates. However, an error occurs in the measured normal line due to a variation in luminance value due to noise in the captured image and an error in the light source direction due to the fact that the position of the light emitting unit has not been correctly acquired. As a result, a difference between the approximate shape calculated from the normal and the correct approximate shape is generated. Here, since the luminance value of the noise of the captured image generally varies randomly, a normal error due to the influence of the luminance value also randomly occurs. That is, the difference in the depth map due to the noise of the captured image is randomly generated without bias. On the other hand, in the case of an error in the light source direction used for calculating the normal, an error occurs in the normal depending on the direction in which the error in the light source direction occurs. Therefore, a distribution corresponding to the direction of the error in the light source direction also occurs in the difference in the depth map.

例えば、法線の算出に用いる各発光部位置が真の位置に対しX方向に誤差が生じている場合、法線から算出されたデプスマップと正解デプスマップとの間はX方向の変動量が大きいが、Y方向の変動はほとんど生じない。このとき、各発光部位置の真の位置に対するX方向の誤差が大きくなるほど、デプスマップ間のX方向の変動量も大きくなる。同様に、法線の算出に用いる各発光部位置が真の位置に対しY方向に誤差が生じている場合、法線から算出されたデプスマップと正解デプスマップとの間はY方向の変動量が大きいが、X方向の変動はほとんど生じない。また、各発光部位置の真の位置に対するY方向の誤差が大きくなるほど、デプスマップ間のY方向の変動量も大きくなる。法線の算出に用いる各発光部位置が真の位置に対しZ方向に誤差が生じている場合、法線から算出されたデプスマップと正解デプスマップとの間はX方向、Y方向のどちらの方向にも変動がほとんど生じない。そのため、デプスマップ間の変動量が大きい方向を見ることによって、法線の算出に用いる各発光部の位置をどちらの方向に更新するべきかを決定することができる。   For example, when each light emitting unit position used for calculating the normal has an error in the X direction with respect to the true position, there is a variation in the X direction between the depth map calculated from the normal and the correct depth map. Although large, there is almost no variation in the Y direction. At this time, as the error in the X direction with respect to the true position of each light emitting unit position increases, the amount of variation in the X direction between the depth maps also increases. Similarly, when each light emitting unit position used for normal calculation has an error in the Y direction with respect to the true position, the amount of fluctuation in the Y direction is between the depth map calculated from the normal and the correct depth map. However, the fluctuation in the X direction hardly occurs. In addition, as the error in the Y direction with respect to the true position of each light emitting unit position increases, the amount of variation in the Y direction between the depth maps also increases. When there is an error in the Z direction with respect to the true position of each light emitting unit used for calculating the normal, the distance between the depth map calculated from the normal and the correct depth map is either the X direction or the Y direction. Almost no change in direction. Therefore, it is possible to determine in which direction the position of each light emitting unit used for calculating the normal line should be updated by looking at the direction in which the variation amount between the depth maps is large.

本実施例では、デプスマップの差分の分布についてX方向の統計量及びY方向の統計量をX方向の変動量Vx及びY方向の変動量Vyとして算出する。算出されたX方向の統計量とY方向の統計量を比較することで、法線の算出に用いる各発光部の位置をどちらの方向に沿って更新するべきかを決定する。尚、統計量として、例えば分散を用いることができる。具体的には、デプスマップの差分の分布をd(n,m)として、X方向の変動量Vxは、下記の式(10)のように算出することができる。   In the present embodiment, the X direction statistic and the Y direction statistic are calculated as the X direction variation amount Vx and the Y direction variation amount Vy for the distribution of the difference in the depth map. By comparing the calculated statistic in the X direction and the statistic in the Y direction, it is determined in which direction the position of each light emitting unit used for calculating the normal line should be updated. For example, variance can be used as the statistic. Specifically, assuming that the distribution of the difference in the depth map is d (n, m), the variation amount Vx in the X direction can be calculated as in the following equation (10).

Figure 2018009927
Figure 2018009927

同様に、Y方向の変動量Vyは下記の式(11)のように算出することができる。   Similarly, the fluctuation amount Vy in the Y direction can be calculated as in the following equation (11).

Figure 2018009927
Figure 2018009927

そして、上記の変動量Vxと変動量Vyの大きさを比較することで各発光部をX、Y、Zのどの軸に沿って更新するかを決定することができる。具体的には、X方向の変動量VxとY方向の変動量Vyが略等しい(差が所定値以下である)場合には各発光部をZ軸に沿って更新する(各発光部の位置情報のZ成分を更新する)。差が所定値を超える場合は、X方向の変動量VxがY方向の変動量Vyよりも大きい場合に各発光部をX軸に沿って更新する(各発光部の位置情報のX成分を更新する)。一方、Y方向の変動量VyがX方向の変動量Vxよりも大きい場合に各発光部をY軸に沿って更新する(各発光部の位置情報のY成分を更新する)。尚、変動量Vxと変動量Vyの大きさを比較する際に、変動量VxとVyの比を用いてもよい。具体的に、変動量VxとVyの比が予め決められた範囲内である場合に、両者が略等しいと判定し、各発光部をZ軸に沿って更新する。算出された比が上記範囲の最大値よりも大きい場合、X方向の変動量Vxが大きいと判定し、各発光部をX軸に沿って更新する。算出された比が上記範囲の最小値よりも小さい場合、Y方向の変動量Vyが大きいと判定し、各発光部をY軸に沿って更新する。   Then, by comparing the magnitudes of the fluctuation amount Vx and the fluctuation amount Vy, it is possible to determine which axis of X, Y, and Z is to update each light emitting unit. Specifically, when the variation amount Vx in the X direction and the variation amount Vy in the Y direction are substantially equal (the difference is equal to or less than a predetermined value), each light emitting unit is updated along the Z axis (the position of each light emitting unit). Update the Z component of the information). When the difference exceeds a predetermined value, each light emitting unit is updated along the X axis when the amount of variation Vx in the X direction is larger than the amount of variation Vy in the Y direction (the X component of the position information of each light emitting unit is updated). To do). On the other hand, when the variation amount Vy in the Y direction is larger than the variation amount Vx in the X direction, each light emitting unit is updated along the Y axis (the Y component of the position information of each light emitting unit is updated). Note that, when the magnitudes of the fluctuation amount Vx and the fluctuation amount Vy are compared, the ratio of the fluctuation amounts Vx and Vy may be used. Specifically, when the ratio between the fluctuation amounts Vx and Vy is within a predetermined range, it is determined that both are substantially equal, and each light emitting unit is updated along the Z axis. When the calculated ratio is larger than the maximum value in the above range, it is determined that the variation amount Vx in the X direction is large, and each light emitting unit is updated along the X axis. When the calculated ratio is smaller than the minimum value in the above range, it is determined that the fluctuation amount Vy in the Y direction is large, and each light emitting unit is updated along the Y axis.

また、上記の方法で各発光部位置をX、Y、Zのどの軸に沿って更新するか決定した後に、各軸のプラスの方向か、マイナスの方向に更新するかを以下の方法により決定することができる。すなわち、各軸のプラス、マイナスの両方向に同一の量だけ更新した発光部位置に対する法線マップをそれぞれ算出する。算出された各法線マップについて変動量Vx、VyまたはPSNR値を再度算出する。再度算出された変動量Vx、Vyの値が小さくなる方向、または再度算出されたPSNR値が大きくなる方向として決定する。   In addition, after determining which X, Y, and Z axis each light emitting unit position is updated by the above method, the following method is used to determine whether to update each axis in a positive direction or a negative direction. can do. That is, the normal map for the light emitting portion position updated by the same amount in both the positive and negative directions of each axis is calculated. The fluctuation amount Vx, Vy or PSNR value is calculated again for each calculated normal map. The direction is determined as a direction in which the recalculated fluctuation amounts Vx and Vy are decreased or a direction in which the recalculated PSNR value is increased.

尚、上記では式(10)及び式(11)のようにデプスマップの差分の分布d(n,m)についてX方向の分散及びY方向の分散を算出し、変動量Vx及びVyとして用いる例を示したが、変動を表す指標としてはこれに限らず、他の指標を用いてもよい。   In the above example, the dispersion in the X direction and the dispersion in the Y direction are calculated and used as the fluctuation amounts Vx and Vy for the distribution d (n, m) of the depth map difference as in the expressions (10) and (11). However, the index representing the fluctuation is not limited to this, and other indices may be used.

また、上記では各発光部を更新する方向を決定する方法を説明したが、変動量VxおよびVyから、各発光部位置の更新量を決定してもよい。例えば、予め設定された係数αを用いて各発光部の更新量Cは下記の式(12)ように決定することができる。ここで、max(Vx,Vy)はVx、Vyのうちの大きい方の値を返すものとする。   Moreover, although the method for determining the direction in which each light emitting unit is updated has been described above, the update amount of each light emitting unit position may be determined from the variation amounts Vx and Vy. For example, the update amount C of each light emitting unit can be determined as shown in the following equation (12) using a preset coefficient α. Here, max (Vx, Vy) returns the larger value of Vx and Vy.

Figure 2018009927
Figure 2018009927

上述のように本実施例では、照度差ステレオ法によって測定された法線から算出されたデプスマップと正解概略形状から得たデプスマップとの差分の分布に応じて発光部位置を更新する際の方向や量を決定する。すなわち、法線から算出されたデプスマップと正解概略形状から算出されたデプスマップとの類似度が高くなるよう発光部位置を更新する際の方向や量を決定する。これによって、高精度な法線を得るまでに必要な算出量を削減することが可能となる。   As described above, in the present embodiment, when the light emitting unit position is updated according to the difference distribution between the depth map calculated from the normal measured by the illuminance difference stereo method and the depth map obtained from the correct approximate shape. Determine direction and amount. That is, the direction and amount when the light emitting unit position is updated are determined so that the similarity between the depth map calculated from the normal line and the depth map calculated from the correct approximate shape increases. This makes it possible to reduce the amount of calculation required to obtain a high-precision normal.

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

604 光源方向算出部
605 法線算出部
606 評価部
607 発光部位置更新部
604 Light source direction calculation unit 605 Normal calculation unit 606 Evaluation unit 607 Light emitting unit position update unit

Claims (12)

測定対象物に対し照射方向が異なる3つ以上の光源のそれぞれから順次に照射した状態で撮像した3枚以上の画像と、前記光源の位置情報とに基づいて、照度差ステレオ法により前記測定対象物の表面の法線を画素毎に保持した法線マップを算出する算出手段と、
前記算出手段にて算出された前記法線マップに基づいて前記測定対象物の概略形状を算出し、算出された概略形状を予め取得された前記測定対象物の基準概略形状と比較することで、前記光源の位置情報を更新する必要があるか否かを判定する判定手段と、
前記判定手段にて前記光源の位置情報を更新する必要があると判定された場合に、前記光源の位置情報を更新する更新手段と
を有し、前記算出手段は、前記更新手段にて更新された前記光源の位置情報を用いて前記法線マップを算出し直すことを特徴とする画像処理装置。
Based on the illuminance difference stereo method, the measurement target is based on three or more images captured in a state where the measurement target is sequentially irradiated from each of three or more light sources having different irradiation directions and the position information of the light source. A calculation means for calculating a normal map that holds the normal of the surface of the object for each pixel;
By calculating the approximate shape of the measurement object based on the normal map calculated by the calculation means, and comparing the calculated approximate shape with the reference approximate shape of the measurement object acquired in advance, Determination means for determining whether or not the position information of the light source needs to be updated;
An update unit that updates the position information of the light source when the determination unit determines that the position information of the light source needs to be updated, and the calculation unit is updated by the update unit. An image processing apparatus that recalculates the normal map using position information of the light source.
前記法線マップは、前記画像の解像度と同じ解像度を有し、前記基準概略形状及び前記算出された概略形状は、前記画像の前記解像度よりも低い解像度を有することを特徴とする請求項1に記載の画像処理装置。   The normal map has the same resolution as the resolution of the image, and the reference approximate shape and the calculated approximate shape have a resolution lower than the resolution of the image. The image processing apparatus described. 前記判定手段は、前記算出された概略形状と前記基準概略形状との類似度を表す評価値を算出し、算出された評価値が所定の評価基準を満たさない場合に、前記光源の位置情報を更新する必要があると判定することを特徴とする請求項1または2に記載の画像処理装置。   The determination unit calculates an evaluation value representing a degree of similarity between the calculated approximate shape and the reference approximate shape. If the calculated evaluation value does not satisfy a predetermined evaluation criterion, the position information of the light source is calculated. The image processing apparatus according to claim 1, wherein the image processing apparatus determines that updating is necessary. 前記判定手段は、前記法線マップに基づいて第1のデプスマップを前記概略形状として算出し、前記基準概略形状から第2のデプスマップを算出し、算出された前記第1のデプスマップと前記第2のデプスマップとについて前記類似度を表す前記評価値を算出することを特徴とする請求項3に記載の画像処理装置。   The determination means calculates a first depth map as the approximate shape based on the normal map, calculates a second depth map from the reference approximate shape, and calculates the calculated first depth map and the calculated depth map The image processing apparatus according to claim 3, wherein the evaluation value representing the degree of similarity is calculated with respect to a second depth map. 前記判定手段は、前記第1のデプスマップと前記第2のデプスマップとの差分のPSNR値を前記評価値として算出し、算出されたPSNR値が所定の基準値以下である場合に、前記光源の位置情報を更新する必要があると判定することを特徴とする請求項4に記載の画像処理装置。   The determination unit calculates a PSNR value of a difference between the first depth map and the second depth map as the evaluation value, and when the calculated PSNR value is equal to or less than a predetermined reference value, the light source The image processing apparatus according to claim 4, wherein it is determined that the position information of the image needs to be updated. 前記更新手段は、前記第1のデプスマップと前記第2のデプスマップとの差分の分布に応じて前記光源の位置情報を更新することを特徴とする請求項4または5に記載の画像処理装置。   The image processing apparatus according to claim 4, wherein the update unit updates position information of the light source according to a difference distribution between the first depth map and the second depth map. . 前記光源の位置情報はX成分、Y成分及びZ成分からなり、
前記更新手段は、前記第1のデプスマップと前記第2のデプスマップとの差分の分布について算出されたX方向の統計量及びY方向の統計量に基づいて、前記光源の位置情報におけるどの成分を更新するかを決定することを特徴とする請求項6に記載の画像処理装置。
The position information of the light source includes an X component, a Y component, and a Z component,
The updating means determines which component in the position information of the light source based on the statistics in the X direction and the statistics in the Y direction calculated for the difference distribution between the first depth map and the second depth map. The image processing apparatus according to claim 6, wherein it is determined whether or not to update.
前記更新手段は、
前記X方向の統計量と前記Y方向の統計量がほぼ等しい場合に、前記光源の位置情報における前記Z成分を更新し、そうでない場合に、
前記X方向の統計量が前記Y方向の統計量よりも大きい場合に、前記光源の位置情報における前記X成分を更新し、
前記Y方向の統計量が前記X方向の統計量よりも大きい場合に、前記光源の位置情報における前記Y成分を更新する
ことを特徴とする請求項7に記載の画像処理装置。
The updating means includes
When the statistics in the X direction and the statistics in the Y direction are substantially equal, the Z component in the position information of the light source is updated; otherwise,
When the statistic in the X direction is larger than the statistic in the Y direction, the X component in the position information of the light source is updated;
The image processing apparatus according to claim 7, wherein the Y component in the position information of the light source is updated when the statistics in the Y direction is larger than the statistics in the X direction.
前記更新手段は、前記第1のデプスマップと前記第2のデプスマップとの差分の分布について算出されたX方向の統計量及びY方向の統計量に基づいて、前記光源の位置情報を更新する際の量を決定することを特徴とする請求項6乃至8のいずれか1項に記載の画像処理装置。   The updating unit updates the position information of the light source based on a statistic in the X direction and a statistic in the Y direction calculated for the difference distribution between the first depth map and the second depth map. The image processing apparatus according to claim 6, wherein an amount is determined. 前記統計量は、分散であることを特徴とする請求項7乃至9のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 7, wherein the statistic is variance. 測定対象物に対し照射方向が異なる3つ以上の光源のそれぞれから順次に照射した状態で撮像した3枚以上の画像と、前記光源の位置情報とに基づいて、照度差ステレオ法により前記測定対象物の表面の法線を画素毎に保持した法線マップを算出する算出工程と、
前記算出工程にて算出された前記法線マップに基づいて前記測定対象物の概略形状を算出し、算出された概略形状を予め取得された前記測定対象物の基準概略形状と比較することで、前記光源の位置情報を更新する必要があるか否かを判定する判定工程と、
前記判定工程にて前記光源の位置情報を更新する必要があると判定された場合に、前記光源の位置情報を更新する更新工程と
を含み、
前記算出工程では、前記更新工程にて前記光源の位置情報が更新された場合に、更新された前記光源の位置情報を用いて前記法線マップを算出し直すことを特徴とする画像処理方法。
Based on the illuminance difference stereo method, the measurement target is based on three or more images captured in a state where the measurement target is sequentially irradiated from each of three or more light sources having different irradiation directions and the position information of the light source. A calculation step of calculating a normal map holding the normal of the surface of the object for each pixel;
By calculating the approximate shape of the measurement object based on the normal map calculated in the calculation step, and comparing the calculated approximate shape with the reference approximate shape of the measurement object acquired in advance, A determination step of determining whether or not the position information of the light source needs to be updated;
An update step of updating the position information of the light source when it is determined in the determination step that the position information of the light source needs to be updated, and
In the calculating step, when the position information of the light source is updated in the updating step, the normal map is recalculated using the updated position information of the light source.
コンピュータを請求項1乃至10のいずれか1項に記載の画像処理装置として機能させるためのプログラム。   The program for functioning a computer as an image processing apparatus of any one of Claims 1 thru | or 10.
JP2016140288A 2016-07-15 2016-07-15 Image processing device, image processing method and program Pending JP2018009927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2016140288A JP2018009927A (en) 2016-07-15 2016-07-15 Image processing device, image processing method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2016140288A JP2018009927A (en) 2016-07-15 2016-07-15 Image processing device, image processing method and program

Publications (1)

Publication Number Publication Date
JP2018009927A true JP2018009927A (en) 2018-01-18

Family

ID=60993806

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2016140288A Pending JP2018009927A (en) 2016-07-15 2016-07-15 Image processing device, image processing method and program

Country Status (1)

Country Link
JP (1) JP2018009927A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114166863A (en) * 2021-11-29 2022-03-11 苏州注视科技有限公司 High-precision sheet detection system based on machine vision
WO2022113934A1 (en) * 2020-11-26 2022-06-02 株式会社堀場製作所 Surface roughness measuring device, and surface roughness measuring method
WO2022137901A1 (en) * 2020-12-22 2022-06-30 ソニーセミコンダクタソリューションズ株式会社 Information processing device and information processing method
CN115035294A (en) * 2022-06-15 2022-09-09 灵图数据(杭州)有限公司 Refrigerator temperature controller gear detection method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022113934A1 (en) * 2020-11-26 2022-06-02 株式会社堀場製作所 Surface roughness measuring device, and surface roughness measuring method
WO2022137901A1 (en) * 2020-12-22 2022-06-30 ソニーセミコンダクタソリューションズ株式会社 Information processing device and information processing method
CN114166863A (en) * 2021-11-29 2022-03-11 苏州注视科技有限公司 High-precision sheet detection system based on machine vision
CN115035294A (en) * 2022-06-15 2022-09-09 灵图数据(杭州)有限公司 Refrigerator temperature controller gear detection method and device

Similar Documents

Publication Publication Date Title
JP6363863B2 (en) Information processing apparatus and information processing method
CN111566437B (en) Three-dimensional measurement system and three-dimensional measurement method
JP6503906B2 (en) Image processing apparatus, image processing method and image processing program
JP5961945B2 (en) Image processing apparatus, projector and projector system having the image processing apparatus, image processing method, program thereof, and recording medium recording the program
JP5132832B1 (en) Measuring apparatus and information processing apparatus
JP5951043B2 (en) Image measuring device
US20120089364A1 (en) Three-dimensional measurement apparatus, three-dimensional measurement method, and computer-readable medium storing control program
JP5633058B1 (en) 3D measuring apparatus and 3D measuring method
JP6566768B2 (en) Information processing apparatus, information processing method, and program
CN107517346B (en) Photographing method and device based on structured light and mobile device
CN107808398B (en) Camera parameter calculation device, calculation method, program, and recording medium
JP2012058076A (en) Three-dimensional measurement device and three-dimensional measurement method
US10713810B2 (en) Information processing apparatus, method of controlling information processing apparatus, and storage medium
KR20180105875A (en) Camera calibration method using single image and apparatus therefor
JP2007304801A (en) Solidity authenticating method, solidity authenticating apparatus, and solidity authenticating program
JP2016100698A (en) Calibration device, calibration method, and program
JP2018009927A (en) Image processing device, image processing method and program
JP2016024052A (en) Three-dimensional measurement system, three-dimensional measurement method and program
JP2019530059A (en) Method for independently processing multiple target areas
JP6282377B2 (en) Three-dimensional shape measurement system and measurement method thereof
KR102129206B1 (en) 3 Dimensional Coordinates Calculating Apparatus and 3 Dimensional Coordinates Calculating Method Using Photo Images
CN110691228A (en) Three-dimensional transformation-based depth image noise marking method and device and storage medium
WO2015159835A1 (en) Image processing device, image processing method, and program
KR101996226B1 (en) Apparatus for measuring three-dimensional position of subject and method thereof
JP6486083B2 (en) Information processing apparatus, information processing method, and program