JP2021092439A - Illumination optimization method, control device, and program - Google Patents
Illumination optimization method, control device, and program Download PDFInfo
- Publication number
- JP2021092439A JP2021092439A JP2019222948A JP2019222948A JP2021092439A JP 2021092439 A JP2021092439 A JP 2021092439A JP 2019222948 A JP2019222948 A JP 2019222948A JP 2019222948 A JP2019222948 A JP 2019222948A JP 2021092439 A JP2021092439 A JP 2021092439A
- Authority
- JP
- Japan
- Prior art keywords
- lighting
- image
- illumination
- inspection device
- interest
- 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
Links
Images
Abstract
Description
本開示は、照明最適化方法、制御装置、及びプログラムに関する。 The present disclosure relates to lighting optimization methods, controls, and programs.
外観画像を解析して対象物の表面にある欠陥を自動的に検出する検査技術が様々な分野で広く利用されている。外観画像を利用する検査技術は、錠剤、食品容器、半導体チップなど、大きさ、材質、形状が異なる様々な対象物に対して適用されうる。対象物の検査には、その対象物の外観画像を撮影するカメラ、対象物を照明する照明装置、及び外観画像から欠陥の有無を判定するコンピュータを含む検査装置が用いられる。 Inspection techniques that analyze external images and automatically detect defects on the surface of an object are widely used in various fields. Inspection techniques that utilize external images can be applied to various objects of different sizes, materials, and shapes, such as tablets, food containers, and semiconductor chips. An inspection device including a camera that captures an external image of the object, a lighting device that illuminates the object, and a computer that determines the presence or absence of defects from the external image is used for the inspection of the object.
上記の検査技術では外観画像を解析して欠陥の有無を判定するため、欠陥検出の精度を高めるには、欠陥検出に適した外観画像を得ることが重要になる。例えば、表面に凹凸がある対象物を扱う場合、光の当て方によっては凹凸の部分に生じる陰影が誤って欠陥と判定されてしまう可能性がある。また、表面に光沢がある対象物の場合、光源の種類や光の当て方によっては外観画像におけるコントラストが大きくなり、一方で、欠陥部分のコントラストが相対的に低下するため、対象物の表面にある細かいキズなどの欠陥が見落とされてしまう可能性がある。 In the above inspection technique, the appearance image is analyzed to determine the presence or absence of defects. Therefore, in order to improve the accuracy of defect detection, it is important to obtain an appearance image suitable for defect detection. For example, when handling an object having an uneven surface, the shadow generated on the uneven portion may be erroneously determined as a defect depending on how the light is applied. Further, in the case of an object having a glossy surface, the contrast in the appearance image increases depending on the type of light source and how the light is applied, while the contrast of the defective portion relatively decreases, so that the surface of the object has a glossy surface. Defects such as small scratches can be overlooked.
上記の事情に関し、下記の特許文献1では、複数の照明を備える検査装置の利用を前提に、評価用の点灯パターンを複数用意し、各点灯パターンで照明を点灯して撮影した外観画像を評価して計測用の点灯パターンを決定する方法が提案されている。この提案方法では、数理最適化問題を解く手法により、キズが設けられている対象物の領域(特徴領域)と、それ以外の領域とで特徴量の差が最大となる点灯パターンを求めている。
Regarding the above circumstances, in
上記の提案方法では、外観画像をそのまま利用して特徴領域及びそれ以外の領域から特徴量を抽出し、抽出した特徴量に基づいて点灯パターンを決定している。つまり、この提案方法は外観画像に対する画像フィルタの適用を想定しておらず、欠陥検出に適した画像フィルタを外観画像に適用した場合、画像フィルタの特性に合わない点灯パターンになる可能性がある。この場合、キズでない箇所が画像フィルタによって強調され、その箇所がキズであると誤判定されるリスクが生じる。 In the above proposed method, the feature amount is extracted from the feature area and other areas by using the appearance image as it is, and the lighting pattern is determined based on the extracted feature amount. That is, this proposed method does not assume the application of an image filter to an external image, and when an image filter suitable for defect detection is applied to an external image, a lighting pattern that does not match the characteristics of the image filter may occur. .. In this case, the non-scratched portion is emphasized by the image filter, and there is a risk that the portion is erroneously determined to be a scratch.
本開示の1つの観点によれば、本開示の目的は、欠陥検出の精度を向上できる照明最適化方法、制御装置、及びプログラムを提供することにある。 According to one aspect of the present disclosure, an object of the present disclosure is to provide a lighting optimization method, a control device, and a program capable of improving the accuracy of defect detection.
本開示の一態様によれば、複数の照明群による照明を利用して撮影した対象物の撮影画像に基づいて対象物を検査する検査装置の照明パラメータを決定する照明最適化方法であって、複数の照明群についての複数の照明条件のそれぞれを適用して検査装置により撮影された対象物の第1画像を取得するステップと、複数の照明条件に対応する複数の第1画像に対し、対象物の検査時に検査装置で利用される画像フィルタを適用して複数の第2画像を生成するステップと、対象物の注目領域に対応する、複数の第2画像内の対応する画素値の重み付き線形和と目標値との誤差を最小化する重み値を、複数の照明群を制御するための照明パラメータとして計算するステップと、を含む処理をコンピュータが実行する、照明最適化方法が提供される。 According to one aspect of the present disclosure, it is a lighting optimization method for determining a lighting parameter of an inspection device that inspects an object based on a photographed image of the object taken by using illumination by a plurality of lighting groups. A step of acquiring a first image of an object taken by an inspection device by applying each of a plurality of lighting conditions for a plurality of lighting groups, and a target for a plurality of first images corresponding to a plurality of lighting conditions. A step of generating a plurality of second images by applying an image filter used in an inspection device when inspecting an object, and weighting of corresponding pixel values in the plurality of second images corresponding to a region of interest of the object. A lighting optimization method is provided in which a computer performs a process that includes a step of calculating a weight value that minimizes the error between the linear sum and the target value as a lighting parameter for controlling multiple lighting groups. ..
また、本開示の他の一態様によれば、上記の各ステップを実行する制御装置、当該制御装置を含む検査装置、上記の各ステップをコンピュータに実行させるプログラム、及び当該プログラムが格納された非一時的なコンピュータ可読記録媒体(Non-transitory computer-readable storage medium)が提供されうる。 Further, according to another aspect of the present disclosure, a control device that executes each of the above steps, an inspection device that includes the control device, a program that causes a computer to execute each of the above steps, and a non-stored program. A non-transitory computer-readable storage medium may be provided.
本開示によれば、欠陥検出の精度を向上できる。 According to the present disclosure, the accuracy of defect detection can be improved.
以下に添付図面を参照しながら、本開示の実施形態(以下、本実施形態)について説明する。なお、本明細書及び図面において実質的に同一の機能を有する要素については、同一の符号を付することにより重複説明を省略する場合がある。 An embodiment of the present disclosure (hereinafter referred to as the present embodiment) will be described below with reference to the accompanying drawings. In the present specification and the drawings, elements having substantially the same function may be designated by the same reference numerals to omit duplicate description.
本実施形態に係る技術は、検査対象物(以下、対象物)の撮影画像に基づいて対象物を検査する検査装置に適用されうる。特に、本実施形態に係る技術は、撮影時の照明を、検査に適した照明に最適化するための照明最適化方法に関する。以下では、本実施形態に係る技術を適用可能な検査装置について説明しつつ、さらに本実施形態に係る照明最適化方法について詳細に説明する。 The technique according to the present embodiment can be applied to an inspection device that inspects an object based on a photographed image of the object to be inspected (hereinafter referred to as the object). In particular, the technique according to the present embodiment relates to a lighting optimization method for optimizing the lighting at the time of photographing to the lighting suitable for inspection. In the following, the inspection device to which the technique according to the present embodiment can be applied will be described, and the lighting optimization method according to the present embodiment will be described in detail.
[1.検査装置]
図1を参照しながら、本実施形態に係る検査装置の構成例について説明する。図1は、本実施形態に係る検査装置の構成を模式的に示した図である。なお、図1に示した検査装置10は、本実施形態に係る検査装置の一例である。以下の説明では、説明を容易にするため、各種錠剤を検査するための錠剤検査装置を想定して説明を進める。但し、本実施形態に係る技術は、錠剤とは形状や材質が異なる他の対象物を検査するための様々な検査装置に対して適用可能であり、そのような変形例については後述する。
[1. Inspection device]
A configuration example of the inspection device according to the present embodiment will be described with reference to FIG. FIG. 1 is a diagram schematically showing a configuration of an inspection device according to the present embodiment. The
図1に示すように、検査装置10は、表示装置11、制御装置12、及びカメラ13、照明ユニット14を含む。また、検査装置10は、対象物Pを搬送するための搬送ベルト15、及び搬送ベルト15を駆動するためのローラ16a、16bを含む。
As shown in FIG. 1, the
表示装置11は、LCD(Liquid Crystal Display)やELD(Electro-Luminescence Display)などのディスプレイデバイスであってよい。制御装置12は、PC(Personal Computer)、サーバ装置、ワークステーションなどのコンピュータ、又はこれらと実質的に同等の機能を有する制御用コンピュータであってよい。カメラ13は、レンズなどの光学系、及びCCD(Charged-coupled devices)センサやCMOS(Complementary metal-oxide-semiconductor)センサなどのイメージセンサを備える撮像装置である。
The
照明ユニット14は、搬送ベルト15によってカメラ13の撮影領域(光学系の光軸と搬送ベルト15との交点又はその付近)に搬送された対象物Pに光を照射するための複数の照明を含む。また、照明ユニット14は、各照明から射出する光及び対象物Pで反射した光の偏光状態を制御するための偏光板、及び、対象物Pで反射した光をカメラ13の光学系に導光するための光学部材(プリズムなど)を含んでもよい。
The
図1の矢印aで示唆するように、対象物Pは、搬送ベルト15の上に順次載置される。ローラ16a、16bの回転によって搬送ベルト15の載置面が矢印bの方向に移動し、搬送ベルト15上の対象物Pが照明ユニット14の内部へと搬送される。なお、図1の例では、照明ユニット14の内部に位置する対象物Pが破線で表現されている。照明ユニット14の内部に搬送された対象物Pは、さらにカメラ13の撮影領域まで運ばれ、照明ユニット14の各照明によって照明される。そして、その外観がカメラ13によって撮影される。
As suggested by the arrow a in FIG. 1, the object P is sequentially placed on the
図示しないが、照明ユニット14の外へ搬送された対象物Pをピックアップして、対象物Pを裏側から撮影する機構が設けられてもよい。例えば、対象物Pの上面に載置面が当接して吸着する他の搬送ベルト、及び、他の搬送ベルトで搬送される対象物Pの外観画像を撮影する撮影ユニットが設けられてもよい。この場合、撮影ユニットは、カメラ13及び照明ユニット14と実質的に同じ機能を提供する。このような機構を設けることで、対象物Pの表面、裏面、及び各側面を効率的に検査することが可能になる。
Although not shown, a mechanism may be provided for picking up the object P transported to the outside of the
(内部構造)
ここで、図2を参照しながら、本実施形態に係る検査装置に搭載されるカメラ、照明、及び偏光板について、さらに説明する。図2は、本実施形態に係る検査装置に搭載されるカメラ、照明、及び偏光板の配置例を模式的に示した図である。なお、図2に示した配置例は一例に過ぎず、カメラ、照明、及び偏光板の位置関係、照明の数、照明の種類、偏光板の有無は変更されてもよい。
(Internal structure)
Here, the camera, the illumination, and the polarizing plate mounted on the inspection device according to the present embodiment will be further described with reference to FIG. FIG. 2 is a diagram schematically showing an arrangement example of a camera, lighting, and a polarizing plate mounted on the inspection device according to the present embodiment. The arrangement example shown in FIG. 2 is only an example, and the positional relationship between the camera, the illumination, and the polarizing plate, the number of illuminations, the type of illumination, and the presence or absence of the polarizing plate may be changed.
図2は、カメラ13の光軸を含む面でカメラ13及び照明ユニット14を切断した横断面を模式的に示している。図2の例では、対象物Pがカメラ13の直下に位置し、対象物Pの上面中心が光軸に一致している。なお、撮影時における対象物Pの位置は図2の例に限定されず、対象物Pの種類などに応じて基準となる位置が設定されてよい。以下では、説明を簡単にするため、対象物Pがカメラ13の直下に位置するタイミングでカメラ13によって対象物Pが撮影されるものとする。
FIG. 2 schematically shows a cross section of the
既に述べたように、照明ユニット14は、複数の照明を有する。各照明は、LED(Light Emitting Diode)などの発光素子及び発光素子を載置する基板で構成される。各照明の基板上には複数の発光素子が載置されてもよく、それら複数の発光素子で1つの照明が形成されてもよい。また、各照明は、白色光を発する発光素子のみで構成されてもよいし、有色光(例えば、赤色、緑色、青色の光)を発する発光素子を含んでもよい。また、各照明は、白色光を発する発光素子及びカラーフィルタを含んでもよい。なお、図2では平板状の発光面を持つLED照明を例示しているが、ドーム型照明やリングライトなどが用いられてもよい。
As already mentioned, the
図2には、照明ユニット14が有する照明のうち、照明21a、21b、22a、22b、23a、23bが模式的に示されている。図2の例において、照明21a、21bは、対象物Pの上面と発光面が略平行になるように配置され、カメラ13の光軸に平行な向き及びその周辺に向け光を照射しうる。照明22a、22bは、対象物Pの斜め上方に配置され、対象物Pの上面及び側面を含む領域に向け光を照射する。照明23a、23bは、対象物Pの側面と発光面とが略平行になるように配置され、対象物Pの側面及び上面を含む領域に向け光を照射する。
FIG. 2 schematically shows the
また、図2には、照明ユニット14が有する偏光板31、32、33a、33bが模式的に示されている。以下では、説明を簡単にするため、偏光板32のうち主に照明22aの発光面に対向する面を偏光板面32a、主に照明22bの発光面に対向する面を偏光板面32bと表記する場合がある。また、偏光板32のうち、光軸に対して略垂直に配置される面を偏光板32の上面と表記する場合がある。
Further, FIG. 2 schematically shows the
図2の例では、偏光板31は、カメラ13の光軸と略垂直になるように配置されている。また、偏光板32の上面は、照明21a、21bに対して対向配置されている。また、偏光板33aは、照明23aの発光面と対向する位置に配置されている。また、偏光板33bは、照明23bの発光面と対向する位置に配置されている。
In the example of FIG. 2, the
偏光板31、32、33a、33bは、通過する光の一偏光成分(以下、第1偏光成分)をカットする光学特性を有する。そのため、偏光板31は、対象物Pで反射した光のうちカメラ13の光軸付近を通って光学系に入射する光の第1偏光成分をカットしうる。また、偏光板面32aは、照明22aから出た光の第1偏光成分をカットしうる。また、偏光板面32bは、照明22bから出た光の第1偏光成分をカットしうる。また、偏光板32の上面は、主に照明21a、21bから出た光の第1偏光成分をカットしうる。また、偏光板33aは、照明23aから出た光の第1偏光成分をカットしうる。また、偏光板33bは、照明23bから出た光の第1偏光成分をカットしうる。
The
上記のように、照明21a、21b、22a、22b、23a、23bから出た光は偏光板31、32、33a、33bで第1偏光成分がカットされる。そのため、偏光方向が第1偏光成分と直交する第2偏光成分で構成される光が対象物Pに当たる。対象物Pで反射した光は、偏光板31を通ってカメラ13の光学系に入る。
As described above, the light emitted from the
対象物Pで反射した光のうち正反射成分は、主に第1偏光成分で構成される。そのため、正反射成分は偏光板31によってカットされうる。一方、対象物Pで反射した光のうち拡散反射成分は第2偏光成分を含む。そのため、拡散反射成分の第2偏光成分は、偏光板31を透過してカメラ13の光学系に入る。
Of the light reflected by the object P, the specular reflection component is mainly composed of the first polarization component. Therefore, the specular reflection component can be cut by the
正反射成分をカットすることで、光沢のある対象物Pを強い照明で撮影した場合でも、光源の映り込みや、強い光が光学系に入射した際に生じるフレアやゴーストなどの発生を抑制することができる。光源の映り込みやゴーストの発生は、対象物Pの外観と関係ないコントラストを撮影画像に生じさせ、誤検出の原因になりうる。また、フレアの発生はコントラストを全体的に低下させるため、検出精度の低下要因になりうる。しかし、上記のように偏光板を配置することで、誤検出の原因を除去し、検出精度の低下を抑制できる。 By cutting the specular reflection component, even when the glossy object P is photographed with strong lighting, the reflection of the light source and the occurrence of flare and ghost that occur when strong light enters the optical system are suppressed. be able to. The reflection of the light source and the generation of ghosts cause a contrast irrelevant to the appearance of the object P in the captured image, which may cause erroneous detection. Further, since the occurrence of flare lowers the contrast as a whole, it can be a factor of lowering the detection accuracy. However, by arranging the polarizing plate as described above, the cause of erroneous detection can be eliminated and the decrease in detection accuracy can be suppressed.
なお、上述した仕組みで正反射成分を除去できれば各偏光板の形状は任意に変形可能であるが、例えば、偏光板32は、図3に示すような形状であってもよい。
The shape of each polarizing plate can be arbitrarily deformed as long as the specular reflection component can be removed by the mechanism described above. For example, the
ここで、図3を参照しながら、本実施形態に係る検査装置に搭載される偏光板の例及び偏光板と照明との位置関係について、さらに説明する。図3は、本実施形態に係る検査装置に搭載される偏光板の例及び偏光板と照明との位置関係を模式的に示した図である。なお、図3に示した偏光板の構造及び偏光板と照明との位置関係は一例に過ぎず、その構造及び位置関係は変更されてもよい。 Here, with reference to FIG. 3, an example of the polarizing plate mounted on the inspection apparatus according to the present embodiment and the positional relationship between the polarizing plate and the illumination will be further described. FIG. 3 is a diagram schematically showing an example of a polarizing plate mounted on the inspection device according to the present embodiment and the positional relationship between the polarizing plate and the illumination. The structure of the polarizing plate and the positional relationship between the polarizing plate and the illumination shown in FIG. 3 are merely examples, and the structure and the positional relationship may be changed.
図3には、偏光板32の上面が模式的に示されている。図3に示すように、偏光板32は、中央に円形の孔が開けられた8角形の上面と、8角形の一辺を上辺とする台形の偏光板面32a、…、32hとで構成される。偏光板32の光学特性は、例えば、偏光板32の基材となる透明板の表面に偏光フィルムを貼り付けることで実現されうる。透明板は、光を透過する素材であればよく、ガラス板やアクリル板などであってよい。また、偏光フィルムの貼り付け面は、透明板の表面であってもよいし、裏面であってもよい。
FIG. 3 schematically shows the upper surface of the
図3において、偏光板32の上面及び偏光板面32a、32b、32c、32dの部分に破線で描かれた矩形は、照明が配置される領域を示している。例えば、偏光板面32aと発光面とが正対するように照明22aが配置される。照明22aの発光面と偏光板面32aとは接触していなくてよい。図2を参照しながら説明したように、照明22aと対象物Pの撮影位置との間に偏光板面32aが配置される形になる。偏光板面32b、32c、32dと、照明22b、22c、22dとの位置関係についても同様である。
In FIG. 3, the rectangles drawn with broken lines on the upper surface of the
偏光板32の上面に対向する位置には、照明21a、…、21hが配置される。図3の例では、8つの照明(照明21a、…、21h)がリング状に配置されているが、代わりに、1つのドーム型照明やリングライトが設けられてもよい。また、照明21a、…、21hの一部が省略されてもよい。例えば、照明21a、21b、21c、21dが省略されてもよいし、照明21e、21f、21g、21hが省略されてもよい。
図3の例では、偏光板面32e、32f、32g、32hに対向する位置に照明が配置されていない。これは、図4を参照しながら後述するように、偏光板面32e、32f、32g、32hを通して見える対象物Pの画をカメラ13で撮影するためである。なお、変形例として、図2に破線で示した光路でカメラ13の光学系に入る光だけを捉える仕組みにする場合には、偏光板面32e、32f、32g、32hに対向する位置にそれぞれ照明が配置されてもよい。
In the example of FIG. 3, the illumination is not arranged at the positions facing the
ここで、図4を参照しながら、本実施形態に係る検査装置に搭載されるカメラ、照明、偏光板、及びプリズムの配置例と反射光の光路とについて説明する。図4は、本実施形態に係る検査装置に搭載されるカメラ、照明、偏光板、及びプリズムの配置例と反射光の光路とを模式的に示した図である。なお、図4の配置例は一例に過ぎず、カメラ、照明、偏光板、及びプリズムの位置関係、照明の数、偏光板の有無は変更されてもよい。 Here, with reference to FIG. 4, an arrangement example of a camera, an illumination, a polarizing plate, and a prism mounted on the inspection device according to the present embodiment and an optical path of reflected light will be described. FIG. 4 is a diagram schematically showing an arrangement example of a camera, lighting, a polarizing plate, and a prism mounted on the inspection device according to the present embodiment and an optical path of reflected light. The arrangement example of FIG. 4 is only an example, and the positional relationship between the camera, the illumination, the polarizing plate, and the prism, the number of illuminations, and the presence or absence of the polarizing plate may be changed.
既に説明した図2の例は、カメラ13の光軸を含み、且つ偏光板面32a、32bの中央付近を通る面でカメラ13及び照明ユニット14を切断した断面図を模式的に示していた。一方、図4の例は、カメラ13の光軸を含み、且つ偏光板面32e、32fの中央付近を通る面でカメラ13及び照明ユニット14を切断した断面図を模式的に示している。また、図4には、対象物Pを斜め上方から見た画をカメラ13で撮影するために、偏光板面32e、32fを透過した光をカメラ13の光学系へと導くためのプリズム41e、41fが模式的に示されている。
The example of FIG. 2 described above schematically shows a cross-sectional view of the
図4に破線で示した矢印は、図2の例と同様に、偏光板31を透過してカメラ13の光学系に入る光の光路を示している。図4に太実線で示した矢印は、偏光板32の偏光板面32e、32fのいずれかを透過してカメラ13の光学系に入る光の光路を示している。図4の例では、偏光板面32eを透過する光の光路をL1、偏光板面32fを透過する光の光路をL2と表記している。
The arrow shown by the broken line in FIG. 4 indicates an optical path of light that passes through the
既に図2を参照しながら説明したように、対象物Pに入射する光は、偏光板32、33a、33b、…によって第1偏向成分がカットされた光である。そのため、対象物Pで反射した光のうち、主に第1偏光成分で構成される正反射成分は、光路L1、L2に沿って進むと偏光板32でカットされる。そのため、プリズム41e、41fに入る光は、第2偏光成分を含む拡散反射成分である。図4に示すように、プリズム41e、41fにより光路L1、L2は曲げられ、光はカメラ13の光学系へと導かれる。
As already described with reference to FIG. 2, the light incident on the object P is the light whose first deflection component is cut by the
プリズム41e、41fを用いると、対象物Pを複数の視点から捉えた画を1台のカメラ(カメラ13)で同時に撮影することができる。言い換えると、複数の視点から見た対象物Pの画を1枚の撮影画像に収めることができる。なお、図示しないが、図3に示した偏光板面32g、32hにも、それぞれプリズム41e、41fと同じ構造のプリズムが配置されてよい。この場合、対象物Pを5つの視点(偏光板31を通して見る視点、及び各プリズムを通して見る視点)から捉えた画(図5を参照)が同時に得られる。
By using the
ここで、図5を参照しながら、本実施形態に係る検査装置により撮影される撮影画像について説明する。図5は、本実施形態に係る検査装置により撮影される撮影画像の例を模式的に示した図である。なお、図5に示した撮影画像は、図2〜図4の構造を適用した場合に得られる撮影画像を模式的に示したものである。 Here, a photographed image taken by the inspection apparatus according to the present embodiment will be described with reference to FIG. FIG. 5 is a diagram schematically showing an example of a photographed image taken by the inspection device according to the present embodiment. The photographed image shown in FIG. 5 schematically shows the photographed image obtained when the structures of FIGS. 2 to 4 are applied.
図5には、撮影画像Imgが模式的に示されている。撮影画像Imgは、5つの視点に対応する5つの画像領域R1、…、R5を含む。画像領域R1には、偏光板31を通して見た視点からの画が含まれる。画像領域R2、…、R5には、それぞれ対応するプリズムを通して見た視点からの画が含まれる。図5の例から分かるように、対象物Pの上面及び各側面が1枚の撮影画像Imgに収められる。なお、各視点に対応する光路長は同じになるように設計される。そのため、同じ照明条件、且つ同じ露光条件で、複数の視点からの画が得られる。
FIG. 5 schematically shows the photographed image Img. The captured image Img includes five image regions R1, ..., R5 corresponding to the five viewpoints. The image region R1 includes an image from a viewpoint viewed through the
図5に例示した撮影画像Imgのような対象物Pの撮影画像が得られると、この撮影画像を制御装置12が解析し、撮影画像における欠陥抽出処理を実行して、対象物Pが良品であるか、不良品であるかを判定する。以下、制御装置12について、さらに説明する。
When a photographed image of the object P such as the photographed image Img illustrated in FIG. 5 is obtained, the
(制御装置のハードウェア)
まず、図6を参照しながら、本実施形態に係る制御装置の機能を実現可能なハードウェアについて説明する。図6は、本実施形態に係る制御装置の機能を実現可能なハードウェアの例を示したブロック図である。
(Hardware of control device)
First, with reference to FIG. 6, the hardware capable of realizing the function of the control device according to the present embodiment will be described. FIG. 6 is a block diagram showing an example of hardware capable of realizing the function of the control device according to the present embodiment.
制御装置12の機能は、例えば、図6に示すハードウェア資源を用いて実現することが可能である。つまり、制御装置12の機能は、コンピュータプログラムを用いて図6に示すハードウェアを制御することにより実現されうる。
The function of the
図6に例示したハードウェアは、プロセッサ12a、メモリ12b、表示IF(Interface)12c、通信IF12d、及び接続IF12eを有する。
The hardware illustrated in FIG. 6 includes a
プロセッサ12aは、CPU(Central Processing Unit)、DSP(Digital Signal Processor)、ASIC(Application Specific Integrated Circuit)、FPGA(Field Programmable Gate Array)、GPU(Graphic Processing Unit)などであってよい。メモリ12bは、ROM(Read Only Memory)、RAM(Random Access Memory)、HDD(Hard Disk Drive)、SSD(Solid State Drive)、フラッシュメモリなどであってよい。
The
表示IF12cは、LCDやELDなどのディスプレイデバイス(図1の例では表示装置11)を接続するためのインターフェースである。例えば、表示IF12cは、プロセッサ12aや表示IF12cに搭載されたGPUにより表示制御を行う。通信IF12dは、有線及び/又は無線のネットワークに接続するためのインターフェースである。通信IF12dは、有線LAN(Local Area Network)、無線LAN、光通信ネットワークなどに接続されうる。
The display IF12c is an interface for connecting a display device such as an LCD or ELD (
接続IF12eは、各種デバイスを接続するためのインターフェースである。接続IF12eは、USB(Universal Serial Bus)ポート、IEEE1394ポート、SCSI(Small Computer System Interface)などであってよい。接続IF12eには、キーボード、マウス、タッチパネル、タッチパッドなどの入力インターフェース、スピーカなどのオーディオデバイス、或いはプリンタなどが接続されうる。また、接続IF12eには、磁気記録媒体、光ディスク、光磁気ディスク、半導体メモリなどの可搬性の記録媒体12fが接続されうる。
The connection IF12e is an interface for connecting various devices. The connection IF12e may be a USB (Universal Serial Bus) port, an IEEE1394 port, a SCSI (Small Computer System Interface), or the like. An input interface such as a keyboard, mouse, touch panel, and touch pad, an audio device such as a speaker, a printer, or the like can be connected to the connection IF12e. Further, a
上述したプロセッサ12aは、記録媒体12fに格納されたプログラムを読み出してメモリ12bに格納し、メモリ12bから読み出したプログラムに従って制御装置12の動作を制御しうる。制御装置12の動作を制御するプログラムは、メモリ12bに予め格納されてもよいし、通信IF12dを介してネットワークからダウンロードされてもよい。なお、実施の態様に応じて、図6に例示した要素のうち一部の要素が省略されてもよい。また、図6に例示したハードウェアと同様の要素を含むコンピュータが複数利用されてもよい。
The
(制御装置の機能)
次に、図7を参照しながら、本実施形態に係る制御装置の機能について説明する。図7は、本実施形態に係る制御装置の機能について説明するためのブロック図である。
(Function of control device)
Next, the function of the control device according to the present embodiment will be described with reference to FIG. 7. FIG. 7 is a block diagram for explaining the function of the control device according to the present embodiment.
図7に示すように、制御装置12は、記憶部121、照明制御部122、撮像制御部123、欠陥検出部124、及び照明最適化部125を有する。記憶部121の機能は、上述したメモリ12bを用いて実現されうる。照明制御部122、撮像制御部123、欠陥検出部124、及び照明最適化部125の機能は、主に上述したプロセッサ12aを用いて実現されうる。
As shown in FIG. 7, the
記憶部121には、欠陥抽出フィルタ121a、照明パラメータ121b、及び画像データ121cなどの情報及びデータが格納されうる。
Information and data such as the
欠陥抽出フィルタ121aは、対象物Pの撮影画像に適用され、欠陥検出に適した画像を生成するための画像フィルタである。例えば、対象物Pが錠剤の場合、欠陥抽出フィルタ121aは、適用後の画像において錠剤本来の表面形状(割線や刻印など)が強調されにくく、且つキズや汚れが強調されるようにするための画像フィルタであってよい。これにより、表面形状に比して、相対的に、キズや汚れなどが強調されうる。
The
欠陥抽出フィルタ121aは、対象物Pの種類、形状、材質、及び大きさなどの様々な要素を考慮して設計される。例えば、欠陥抽出フィルタ121aは、エッジ関連フィルタ(エッジ強調フィルタ/エッジ抽出フィルタ)や平均化フィルタなどを組み合わせて構成されうる。エッジ強調フィルタはフィルタ係数の合計が1になるように設計されたフィルタであり、エッジ抽出フィルタはフィルタ係数の合計が0になるように設計されたフィルタである。なお、実際の検査時に用いる欠陥抽出フィルタと、後述する照明最適化方法に適用する欠陥抽出フィルタとは異なっていてもよい。例えば、実際の検査時に用いる欠陥抽出フィルタに収縮フィルタ、メディアンフィルタ、2値化フィルタのいずれか又はこれらの組み合わせを含む非線形フィルタを適用する場合、照明最適化方法を実施する際には、その非線形フィルタと似た特徴量を抽出する畳み込みフィルタが用いられてよい。
The
エッジ関連フィルタは、微分フィルタで構成されうる。微分フィルタには、プレヴィットフィルタやソーベルフィルタなどの1次微分フィルタ、及びラプラシアンフィルタなどの2次微分フィルタがある。プレヴィットフィルタやソーベルフィルタは、行方向及び列方向にそれぞれエッジ処理(エッジ強調/エッジ抽出)を実行し、両者の結果を合成してエッジ処理の結果を出力する。行方向又は列方向のみのエッジ処理を実行したい場合には、所望の方向にエッジ処理を実行する方向指定エッジ関連フィルタを利用してもよい。例えば、縦縞模様又は縦方向に延びた線状の凹凸がある対象物Pの場合、方向指定エッジ強調フィルタを組み合わせると、より欠陥検出に適した欠陥抽出フィルタ121aが得られることがある。
The edge-related filter may consist of a differential filter. The differential filter includes a first-order differential filter such as a Previt filter and a Sobel filter, and a second-order differential filter such as a Laplacian filter. The Previt filter and the Sobel filter execute edge processing (edge enhancement / edge extraction) in the row direction and the column direction, respectively, combine the results of both, and output the result of the edge processing. When it is desired to execute edge processing only in the row direction or the column direction, a direction-designated edge-related filter that executes edge processing in a desired direction may be used. For example, in the case of an object P having a vertical striped pattern or linear unevenness extending in the vertical direction, a
照明パラメータ121bは、照明ユニット14を制御するためのパラメータである。例えば、照明パラメータ121bは、各照明の強さ(明るさ)を指定する強度パラメータや、照明の色を指定する色パラメータを含んでよい。強度パラメータは、電圧、電流、パルス幅、パルス間隔などの値であってもよいし、予め定義された明るさの指標値(例えば、輝度値に相当する0〜255の値)であってもよい。色パラメータは、白色、赤色(R)、緑色(G)、青色(B)を表すインデックスであってもよいし、R、G、Bの混合割合を表すパラメータセットであってもよい。
The
画像データ121cは、カメラ13によって撮影された撮影画像のデータ、及び撮影画像に欠陥抽出フィルタ121aを適用して得られる画像(以下、畳み込み画像)のデータを含んでよい。例えば、記憶部121には、点灯する照明の組み合わせ(以下、点灯パターン)を変えながら同じ対象物Pを撮影した複数の撮影画像のデータが格納されうる。また、記憶部121には、撮影画像に欠陥抽出フィルタ121aを適用して得られた畳み込み画像のデータが格納されうる。
The
照明制御部122は、後述する欠陥検出部124及び照明最適化部125による指示に従って、照明ユニット14に含まれる各照明の動作を制御する。撮像制御部123は、後述する欠陥検出部124及び照明最適化部125による指示に従って、カメラ13の動作を制御する。
The
例えば、照明制御部122及び撮像制御部123は、図示しない検査装置10のセンサ類と連携し、対象物Pが照明ユニット14内の基準位置(例えば、カメラ13の光軸と対象物Pの中心とが一致する位置)に来たタイミングで対象物Pに光を照射し且つ対象物Pを撮影するように照明ユニット14及びカメラ13の動作を制御する。また、撮像制御部123は、カメラ13から撮影画像を取得し、撮影画像のデータを記憶部121に格納する。
For example, the
欠陥検出部124は、照明制御部122及び撮像制御部123を動作させて対象物Pを撮影する。このとき、欠陥検出部124は、後述する照明最適化方法によって求められた照明パラメータを照明制御部122に設定し、その照明パラメータに基づく照明条件で照明制御部122及び撮像制御部123を動作させる。また、欠陥検出部124は、撮像制御部123が記憶部121に格納した対象物Pの撮影画像を解析して対象物Pの良品/不良品を判定する。
The
上記の判定に関する機能として、欠陥検出部124は、前処理機能124a、フィルタ処理機能124b、及び判定処理機能124cを有する。
As the functions related to the above determination, the
前処理機能124aは、撮影画像の前処理を実施する機能である。例えば、撮影時にカメラ13側で撮影画像が補正されているとき、欠陥検出部124は、前処理機能124aにより、ブラックレベルゲインが0、且つガンマ値が1になるように補正の逆処理を実施してよい。なお、外乱光の影響が無視できない場合、欠陥検出部124は、前処理機能124aにより、点灯時の撮影画像から外乱光成分を除去するための処理を実行してもよい。例えば、検査時に対象物を停止できる場合、対象物の姿勢が一定で事前に外乱光成分を含む撮影画像が得られる場合、外乱光成分が単純な特性を有していてモデル化が可能な場合など、特定の場合には検査時に外乱光成分の除去が可能である。但し、こうした条件を満たさず、検査時に外乱光成分の除去が難しい場合には、外乱光成分の除去に関する機能は省略されてよい。
The
フィルタ処理機能124bは、前処理後の撮影画像に欠陥抽出フィルタ121aを適用して畳み込み画像を生成する機能である。判定処理機能124cは、畳み込み画像に基づいて対象物Pの良品/不良品を判定する機能である。欠陥検出部124は、判定処理機能124cにより、畳み込み画像から欠陥部分を抽出し、抽出した欠陥部分が所定の条件を満たさない場合には不良品であると判定し、それ以外の場合には良品であると判定する。
The
一例として、欠陥抽出フィルタ121aとしてエッジ強調フィルタを利用する場合、畳み込み画像においてキズなどの欠陥部分が強調され、欠陥部分の画素値が大きくなる一方、それ以外の部分の画素値は相対的に小さくなる。この場合、欠陥部分の画素値を判定するための閾値(第1閾値)を利用し、第1閾値と各画素値とを比較することで、欠陥検出部124は、欠陥部分に対応する画素を判定できる。また、不良品と判定すべき欠陥部分の面積を定めた閾値(第2閾値)を利用し、第2閾値と欠陥部分の画素数(面積)とを比較することで、欠陥検出部124は、良品/不良品を判定できる。なお、これ以外の判定方法が適用されてもよい。
As an example, when an edge enhancement filter is used as the
照明最適化部125は、後述する最適化計算のアルゴリズムを用いて、欠陥検出部124による判定に適した照明パラメータ(以下、最適パラメータ)を計算する。なお、最適パラメータは、同じ照明ユニット14を利用していても、対象物Pの形状、材質、サイズによって異なりうる。そのため、搬送ベルト15によって搬送されてくる対象物Pの特徴を自動的に検出し、異なる特徴が検出された場合に照明最適化部125が自動的に最適パラメータを再計算してもよいし、ユーザ操作に応じて最適パラメータを再計算してもよい。
The
最適パラメータの計算に関する機能として、照明最適化部125は、画像取得機能125a、前処理機能125b、フィルタ処理機能125c、注目領域設定機能125d、及び最適化計算機能125eを有する。
As a function related to the calculation of the optimum parameter, the
画像取得機能125aは、照明制御部122及び撮像制御部123を動作させ、最適パラメータの計算に用いる撮影画像を取得する機能である。前処理機能125bは、欠陥検出部124の前処理機能124aと同様に撮影画像に対する前処理を実施する機能である。フィルタ処理機能125cは、欠陥検出部124のフィルタ処理機能124bと同様に、前処理後の撮影画像に欠陥抽出フィルタ121aを適用して畳み込み画像を生成する機能である。
The
注目領域設定機能125dは、最適パラメータを計算する際に注目する対象物Pの領域(注目領域:ROI(Region Of Interest))を設定する機能である。ROIの形状、サイズ、設定位置、及び設定されるROIの数は任意に設定可能である。また、ROIは、照明最適化部125により自動で設定されてもよいし、ユーザ操作により手動で設定されてもよい。手動で設定される場合、注目領域設定機能125dは、ROIの設定操作を補助するためのUI(User Interface)を提供してもよい。また、ROIは、対象物Pの種類毎に事前に設定されていてもよい。
The attention
最適化計算機能125eは、最適化計算に用いる目的関数を設定し、設定した目的関数に基づく最適化計算を実行して最適な照明条件を決定する機能である。以下、目的関数の構成及び最適化計算のアルゴリズムについて詳細に説明する。
The
最適化計算には、K(K>1)個の異なる照明条件で撮影されたK枚の撮影画像を利用する。照明条件としては、照明の点灯パターン、各照明の色、各照明の明るさ、偏光特定の違いなどがある。以下では、説明を簡単にするために、K通りの点灯パターンを用意し、点灯パターンの異なるK枚の撮影画像を利用して最適化計算を行う方法について説明する。また、簡単のために、k番目(1≦k≦K)の照明セットを点灯し、他の照明を全て消灯する点灯パターンを例に説明を進める。 For the optimization calculation, K (K> 1) captured images taken under different lighting conditions are used. The lighting conditions include a lighting pattern of lighting, a color of each lighting, a brightness of each lighting, and a difference in specific polarization. In the following, in order to simplify the explanation, a method of preparing K different lighting patterns and performing optimization calculation using K captured images having different lighting patterns will be described. Further, for the sake of simplicity, the description will proceed with an example of a lighting pattern in which the kth (1 ≦ k ≦ K) lighting set is turned on and all other lights are turned off.
照明最適化部125は、画像取得機能125aにより、点灯パターンを変えながら対象物Pを撮影したK枚の撮影画像を取得する。以下、k番目の点灯パターンに対応する撮影画像を画像Ikと表記し、画像Ikのx行y列目に位置する画素の画素値をIk(x,y)と表記する。K個の照明セットを全て点灯した状態で対象物Pを撮影した撮影画像Iのx行y列目に位置する画素の画素値I(x,y)は、下記の式(1)の条件(以下、線形性)を満たしうる。
The
上記の線形性は、対象物Pの各ROIにおいて満たされる必要がある。そのため、各点灯パターンにおいて、カメラ13の視野に入る対象物Pの領域全体(以下、ROI設定可能領域)が満遍なく照明されることが好ましい。例えば、カメラ13の光軸を中心に対称な位置に配置される複数の照明を1つの照明セットとみなせば、その照明セットを点灯する点灯パターンでROI設定可能領域が満遍なく照明されうる。
The above linearity needs to be satisfied in each ROI of the object P. Therefore, in each lighting pattern, it is preferable that the entire region of the object P in the field of view of the camera 13 (hereinafter, the ROI settable region) is evenly illuminated. For example, if a plurality of lights arranged symmetrically with respect to the optical axis of the
図2〜図4の例では、照明21a、…、21hで構成される照明セットを点灯する点灯パターン、照明22a、…、22dで構成される照明セットを点灯する点灯パターン、照明23a、…、23fで構成される照明セットを点灯する点灯パターンを設定しうる。この設定によれば、いずれの点灯パターンを適用した場合でも、ROI設定可能領域に対して満遍なく光を当てることができる。そして、上記の線形性が満たされうる。なお、ドーム型照明やリングライトを利用する場合にも同様に上記の線形性が満たされうる。
In the examples of FIGS. 2 to 4, a lighting pattern for lighting a lighting set composed of
上記の線形性が満たされる場合、k=1〜Kについて、k番目の照明セットの明るさが基準値のwk倍になるように各照明セットの明るさを調整して撮影した撮影画像I’のx行y列目に位置する画素の画素値I’(x,y)は、下記の式(2)で与えられうる。なお、k番目の照明セットにおける明るさの基準値は、画像Ikを撮影したときのk番目の照明セットにおける明るさである。 When the above linearity is satisfied, the captured image I taken by adjusting the brightness of each illumination set so that the brightness of the kth illumination set becomes wk times the reference value for k = 1 to K. The pixel value I'(x, y) of the pixel located in the x-th row and y-th column of'can be given by the following equation (2). The reference value of the brightness in the k-th lighting set is the brightness in the k-th lighting set when the image I k is taken.
なお、外乱光の影響が無視できない場合や、撮影時にカメラ13側で撮影画像が補正されている場合、上記の式(1)及び式(2)の条件を満たすためには、撮影画像に対する前処理が必要になる。そのため、撮影画像が補正されている場合、照明最適化部125は、前処理機能125bにより、ブラックレベルゲインが0、且つガンマ値が1になるように補正の逆処理を実施する。また、外乱光の影響が無視できない場合、照明最適化部125は、前処理機能125bにより、点灯時の撮影画像と全消灯時の撮影画像との差に基づいて点灯時の撮影画像から外乱光成分を除去する。
If the influence of ambient light cannot be ignored, or if the captured image is corrected on the
上記の式(2)の条件は、白飛びが発生するほど重み値wkが大きい場合には満たされないことがある。また、上記の式(2)の条件は、ランダムノイズが目立つほど重み値wkが小さい場合には満たされないことがある。そのため、上記の重み値wkは、上記の式(2)の条件を十分に満たす範囲内で設定されることが好ましい。以下の説明において、各撮影画像は、前処理後の画像であるとする。 The condition of the above equation (2) may not be satisfied when the weight value w k is large enough to cause overexposure. Further, the condition of the above equation (2) may not be satisfied when the weight value w k is so small that the random noise is conspicuous. Therefore, it is preferable that the weight value w k is set within a range that sufficiently satisfies the condition of the above equation (2). In the following description, it is assumed that each captured image is an image after preprocessing.
照明最適化部125は、フィルタ処理機能125cにより、前処理後の各撮影画像に欠陥抽出フィルタ121aを適用し、各撮影画像から畳み込み画像を生成する。以下、画像Ikに対応する畳み込み画像を画像Fkと表記し、画像Fkのx行y列目に位置する画素の画素値をFk(x,y)と表記する。
The
照明最適化部125は、最適化計算機能125eにより、ROI内の各画素に対応する画素値Fk(x,y)を取得し、そのROIに対応する画素値Fk(x,y)のセットを用いてベクトルakを生成する。例えば、画像Fkの2行2列目、2行3列目、3行2列目、3行3列目の画素で構成される領域がROIに設定された場合、ベクトルakは、Fk(2,2)、Fk(2,3)、Fk(3,2)、Fk(3,3)を要素とするベクトルになる。
なお、説明を容易にするために画素値のセットをベクトルに変換する方法を例示しているが、実装上は、画素値のセットをベクトルに変換せず、画素値のセットをそのまま用いて以下で述べる計算と等価な計算を実施する仕組みに変形してもよい。このような変形例についても当然に本実施形態の技術的範囲に属する。 In addition, a method of converting a set of pixel values into a vector is illustrated for ease of explanation, but in terms of implementation, the set of pixel values is not converted into a vector, and the set of pixel values is used as it is. It may be transformed into a mechanism for performing a calculation equivalent to the calculation described in. Naturally, such a modification also belongs to the technical scope of the present embodiment.
ここで、画像I’に欠陥抽出フィルタ121aを適用して得られる畳み込み画像を画像F’と表記すると、上記のベクトルakと同様に、画像F’のROIに対応する画素値F’(x,y)のセットを用いて得られるベクトルaoptは、ベクトルak及び重み値wk(スカラー)を用いて、下記の式(3)のように表現されうる。また、K個のベクトルakを並べた行列A、K個の重み値wkを要素とするベクトルwを下記の式(4a)のように定義すると、ベクトルaoptは、下記の式(4b)のように表現されうる。
Here, if the convoluted image obtained by applying the
照明最適化部125は、最適化計算機能125eにより、最適化計算に用いる目的関数を設定する。最適パラメータに対応する照明条件は、少なくとも次の3条件を満たすものとする。第1の条件は、良品とみなせる対象物Pの領域に対して欠陥抽出フィルタ121aを適用した場合にベクトルaoptの要素の絶対値が十分に小さな値になることである。第2の条件は、ROIにおける平均画素値が一定値c(c>0)となることである。第3の条件は、重み値wkが正の値になることである。つまり、第3の条件は、照明パラメータが非負値となることを保証するものである。なお、対象物を静止させた状態で複数の撮影画像を取得し、それら複数の撮影画像の差分を利用して照明条件を最適化する場合(変形例)には第3の条件は省略されうる。但し、以下では第3の条件を課すケースについて説明する。
The
まず、上記第1の条件を満たす目的関数f(w)は、下記の式(5a)で与えられる。なお、下記の式(5a)において|…|はL2ノルムを表し、ベクトルbは、ベクトルaoptの目標値を表す。例えば、欠陥抽出フィルタ121aがエッジ強調フィルタの場合、ベクトルbは、0ベクトルに設定される。また、欠陥抽出フィルタ121aが恒等関数の場合、ベクトルbは、ベクトルaoptの要素と平均輝度値cとの誤差が最小化されるような照明条件を得るべく、全ての要素がcのベクトルに設定される。
First, the objective function f (w) that satisfies the first condition is given by the following equation (5a). In the following equation (5a), | ... | represents the L2 norm, and the vector b represents the target value of the vector a opt. For example, when the
上記の目的関数f(w)を最小化するベクトルwは0ベクトルになりうる。そのため、上記第2の条件を制約条件(下記の式(6a)による等式制約h)として課す。さらに、上記第3の条件(下記の式(6b)による不等式制約gk)も課す。 The vector w that minimizes the above objective function f (w) can be a 0 vector. Therefore, the second condition is imposed as a constraint condition (equal constraint h according to the following equation (6a)). Further, the third condition (inequality constraint g k according to the following equation (6b)) is also imposed.
上記の式(5a)、式(5b)、式(6a)及び式(6b)を組み合わせると、ベクトルwを変数とする制約条件付き2次計画問題となる。照明最適化部125は、最適化計算機能125eにより、この2次計画問題を解き、最適パラメータとしてベクトルwを求める。
Combining the above equations (5a), (5b), equations (6a) and equations (6b) results in a constrained quadratic programming problem with the vector w as a variable. The
なお、各照明の明るさに調整可能な上限値がある場合、下記の式(6c)で与えられる制約条件をさらに課してもよい。下記の式(6c)において上限値wULは、上記の調整可能な上限値に対応するwkの値を表す。なお、下記の式(6c)で与えられる制約条件を課す代わりに、最適化計算手法で求められたベクトルwをスケール調整してもよい。例えば、ベクトルwの最大値が上限値wULより小さくなるように、ベクトルwの各要素をスケール調整する方法が適用されうる。 If the brightness of each illumination has an adjustable upper limit, the constraint condition given by the following equation (6c) may be further imposed. In the following equation (6c), the upper limit value w UL represents the value of w k corresponding to the above-mentioned adjustable upper limit value. Instead of imposing the constraint condition given by the following equation (6c), the vector w obtained by the optimization calculation method may be scale-adjusted. For example, a method of scaling each element of the vector w so that the maximum value of the vector w is smaller than the upper limit w UL can be applied.
ところで、上記の2次計画問題は、ラグランジュ未定乗数法などの最適化計算手法を用いて解くことができる。例えば、上記の式(5a)、式(5b)、式(6a)及び式(6b)にラグランジュ未定乗数法を適用すると、下記の式(7a)が得られる。μ、λiは未定乗数である。また、下記の式(7a)に含まれる∇f(w)及び∇h(w)は、それぞれ下記の式(7b)及び式(7c)で与えられる。上記の式(6a)、式(6b)、式(7a)〜式(7c)を解くことで最適なベクトルwが得られる。なお、ラグランジュ未定乗数法以外の最適化計算手法が適用されてもよい。 By the way, the above quadratic programming problem can be solved by using an optimization calculation method such as the Lagrange undetermined multiplier method. For example, when the Lagrange undetermined multiplier method is applied to the above equations (5a), (5b), equations (6a) and (6b), the following equation (7a) is obtained. μ and λ i are undetermined multipliers. Further, ∇f (w) and ∇h (w) included in the following formula (7a) are given by the following formulas (7b) and (7c), respectively. The optimum vector w can be obtained by solving the above equations (6a), (6b), and equations (7a) to (7c). An optimization calculation method other than the Lagrange undetermined multiplier method may be applied.
照明最適化部125は、上記の最適化計算により求めたベクトルwを最適パラメータとして記憶部121に格納する。なお、記憶部121には、ベクトルwが最適パラメータとして格納されてもよいし、ベクトルwに基づいて計算された各照明に適用される電圧、電流、パルス幅、パルス間隔などの強度パラメータが最適パラメータとして格納されてもよい。
The
また、照明最適化部125は、計算された最適なベクトルwを用い、上記の式(2)に基づく合成画像を表示装置11に表示してもよい。つまり、照明最適化部125は、最適化計算の結果を用いて画像Fkを合成した合成画像を生成して表示装置11に表示してよい。なお、照明最適化部125は、最適な照明条件で対象物Pを撮影した場合に得られる畳み込み画像の推定画像を確認用に表示してもよい。
Further, the
以上、検査装置10について説明した。
The
[2.照明最適化方法]
次に、図8を参照しながら、上述した制御装置12による最適化計算の流れについて述べることにより、本実施形態に係る照明最適化方法について説明する。図8は、本実施形態に係る照明最適化方法について説明するためのフロー図である。以下では、図8に示したフロー図の各処理を上述した制御装置12で実行する方法について説明するが、一部の処理は検査装置10の外部にあるコンピュータを用いて実行されてもよい。
[2. Lighting optimization method]
Next, the lighting optimization method according to the present embodiment will be described by describing the flow of the optimization calculation by the
(S101、S103)制御装置12の照明最適化部125は、照明セットを示すインデックスkを1からKまで変化させながら、S102の処理を繰り返し実行する。インデックスkがKのときに処理がS103へ到達すると、処理はS104へと進む。
(S101, S103) The
(S102)照明最適化部125は、照明制御部122及び撮像制御部123を動作させ、k番目の照明条件で対象物Pを撮影する。例えば、k番目の照明条件は、k番目の照明セットを点灯し、それ以外の照明セットを消灯する点灯パターンで照明されることであってよい。なお、対象物Pは良品であるか、良品とみなせる対象物Pの領域に後述するROIが設定されるものとする。
(S102) The
(S104)照明最適化部125は、各撮影画像の前処理を実行する。カメラ13側で撮影画像が補正されている場合、照明最適化部125は、ブラックレベルゲインが0、且つガンマ値が1になるように補正の逆処理を実施する。外乱光の影響が無視できない場合、照明最適化部125は、点灯時の撮影画像と全消灯時の撮影画像との差に基づいて点灯時の撮影画像から外乱光成分を除去する。
(S104) The
(S105)照明最適化部125は、欠陥抽出フィルタ121aを各撮影画像に適用して畳み込み画像を生成する。例えば、欠陥抽出フィルタ121aは、適用後の画像において対象物Pの表面形状(割線や刻印など)を目立たせず、且つキズや汚れが強調されるようにするための画像フィルタである。
(S105) The
(S106)照明最適化部125は、注目領域(ROI)を設定する。ROIの形状、サイズ、設定位置、及び設定されるROIの数は任意に設定可能である。ROIは、照明最適化部125により自動で設定されてもよいし、ユーザ操作により手動で設定されてもよい。手動で設定される場合、照明最適化部125は、ROIの設定操作を補助するためのUIを提供してもよい。
(S106) The
(S107)照明最適化部125は、各畳み込み画像のROIから得た画素値のセットを用いて、最適化計算に用いる目的関数を設定する。例えば、照明最適化部125は、ROIに対応する画素値Fk(x,y)のセットを用いてベクトルakを生成し、ベクトルak及び所定の目標値(ベクトルb)を用いてベクトルwを変数とする目的関数f(w)(上記の式(5a)を参照)を設定する。
(S107) The
(S108)照明最適化部125は、所定の最適化計算手法を適用して、設定した目的関数を最小化する重み値のセットを計算する。例えば、照明最適化部125は、上記の式(6a)〜式(6c)で与えられる制約条件の下で、ラグランジュ未定乗数法を適用して上記の式(5a)及び式(5b)で与えられる2次計画問題を解き、最適なベクトルwを計算する。
(S108) The
(S109)照明最適化部125は、計算した重み値のセットを用いて合成画像を生成し、確認用に合成画像を表示する。例えば、ベクトルak及びベクトルwを用いると、上記の式(3)に基づいてベクトルaoptを計算することができる。ベクトルaoptは、最適なベクトルwを最適パラメータとして適用した場合に得られる畳み込み画像のROIを構成する各画素値を与える。そのため、照明最適化部125は、確認用の合成画像としてベクトルaoptに基づく画像を表示装置11に表示しうる。
(S109) The
S109の処理が完了すると、図8に示した一連の処理は終了する。 When the process of S109 is completed, the series of processes shown in FIG. 8 is completed.
なお、図8に示した照明最適化計算は、検査装置10の出荷前に実施させるだけでなく、検査装置10を実際に使用するユーザが実施できるようにしてもよい。例えば、ユーザが照明最適化計算の実施操作を行うと、ユーザが用意した対象物Pが照明ユニット14内の基準位置に搬送され、上述したS101〜S109の処理が実行されるようにしてもよい。このような仕組みを設けることで、ユーザが実際に検査する検査対象物に適した照明条件に最適化されるため、検査装置10による検査精度が向上する。また、照明条件の最適化をユーザサイドで行うことができるため、利便性の向上にも寄与する。
The lighting optimization calculation shown in FIG. 8 may be performed not only before the
以上、照明最適化方法について説明した。 The lighting optimization method has been described above.
[3.変形例]
以下では、本実施形態に係る変形例について説明する。
[3. Modification example]
Hereinafter, a modified example according to the present embodiment will be described.
(第1の変形例:複数ROIの設定)
第1の変形例として、対象物Pの様々な位置に複数のROIを設定可能にする照明最適化方法の変形例について説明する。図2〜図5に例示したように、本実施形態に係る検査装置10は、複数の視点から対象物Pを同時に撮影することができる。そのため、対象物Pが完全に同じ位置にあり、同じ時刻で、同じ照明条件にて複数の視点から対象物Pを撮影した画(画像領域R1〜R5に相当)が得られる。
(First modification: setting of multiple ROIs)
As a first modification, a modification of the lighting optimization method that enables a plurality of ROIs to be set at various positions of the object P will be described. As illustrated in FIGS. 2 to 5, the
上述した照明最適化方法では、例えば、画像領域R1〜R5のいずれかにROIを設定して、そのROIに最適な照明条件を与える最適パラメータを求めることができる。しかし、画像領域R1のROIに最適化した照明条件は、画像領域R2〜R4においても十分な精度の検査結果を得られる照明条件であることが多いが、画像領域R2〜R4において最適な照明条件ではないこともありうる。 In the illumination optimization method described above, for example, an ROI can be set in any of the image areas R1 to R5, and an optimum parameter that gives an optimum illumination condition to the ROI can be obtained. However, the lighting conditions optimized for the ROI of the image area R1 are often the lighting conditions that can obtain the inspection result with sufficient accuracy also in the image areas R2 to R4, but the optimum lighting conditions in the image areas R2 to R4. It may not be.
そこで、第1の変形例では、例えば、画像領域R1〜R5のうち2以上の領域にROIを設定し、設定された複数のROIにおいて最適な照明条件を与える最適パラメータを計算できるようにする仕組みを提案する。なお、第1の変形例においても、K枚の撮影画像を取得し、前処理を実施し、欠陥抽出フィルタ121aを用いて畳み込み画像を生成する処理(図8のS101〜S105に相当する処理)については上述した照明最適化方法と同じである。
Therefore, in the first modification, for example, ROIs are set in two or more regions of the image regions R1 to R5, and the optimum parameters that give the optimum lighting conditions can be calculated in the set plurality of ROIs. To propose. Also in the first modification, a process of acquiring K shot images, performing preprocessing, and generating a convolution image using the
上記のように、第1の変形例では、複数のROIが設定される。例えば、画像領域R1に第1のROIが設定され、画像領域R2に第2のROIが設定されるケースについて考える。第1のROIに関する上記の式(4a)で与えられる行列A、及び上記の式(5a)で与えられる目的関数fをそれぞれA1、f1と表記する。第2のROIに関する上記の式(4a)で与えられる行列A、及び上記の式(5a)で与えられる目的関数fをそれぞれA2、f2と表記する。 As described above, in the first modification, a plurality of ROIs are set. For example, consider a case where the first ROI is set in the image area R1 and the second ROI is set in the image area R2. The matrix A given by the above equation (4a) and the objective function f given by the above equation (5a) regarding the first ROI are expressed as A 1 and f 1 , respectively. The matrix A given by the above equation (4a) and the objective function f given by the above equation (5a) regarding the second ROI are expressed as A 2 and f 2 , respectively.
照明最適化部125は、各畳み込み画像における第1のROI及び第2のROIから画素値を抽出して行列A1、A2を生成する。また、照明最適化部125は、行列A1、A2、ベクトルw、及び目標値のベクトルbを用いて、上記の式(5)の目的関数fに相当する目的関数f1(w)、f2(w)を設定する。さらに、照明最適化部125は、下記の式(8a)で与えられる目的関数f12(w)を最小化するベクトルwを計算する。
The
上記の式(8a)及び式(8b)で与えられる2次計画問題を解く際に課される制約条件は、下記の式(9)及び式(10)で与えられる等式制約h’、h”、及び、上記の式(6b)で与えられる不等式制約gkである。等式制約h’、h”は、上述した第2の条件に相当する。なお、下記の式(9)では、第1のROIをROI1、ROI1の画素数をn1、ROI1の平均輝度値をc1と表記している。同様に、下記の式(10)では、第2のROIをROI2、ROI2の画素数をn2、ROI2の平均輝度値をc2と表記している。画素数n1、n2は同じであってもよいし、異なっていてもよい。 The constraints imposed when solving the quadratic programming problem given by the above equations (8a) and (8b) are the equality constraints h'and h given by the following equations (9) and (10). "And the inequality constraint g k given by the above equation (6b). The equation constraint h', h" corresponds to the above-mentioned second condition. In the following equation (9), the first ROI is expressed as ROI1, the number of pixels of ROI1 is expressed as n1, and the average brightness value of ROI1 is expressed as c1. Similarly, in the following equation (10), the second ROI is expressed as ROI2, the number of pixels of ROI2 is expressed as n2, and the average brightness value of ROI2 is expressed as c2. The number of pixels n1 and n2 may be the same or different.
第1のROI及び第2のROIが設定されている場合、照明最適化部125は、上記の式(8a)〜式(10b)を組み合わせた制約条件付き2次計画問題を解いて、最適パラメータとしてベクトルwを求める。なお、上記の式(6c)に相当する制約条件が追加されてもよい。また、上記の2次計画問題は、ラグランジュ未定乗数法などの最適化計算手法を用いて解くことができる。
When the first ROI and the second ROI are set, the
上記の例では2つのROIを設定するケースを示したが、3つ以上のROIを設定する場合にも同様にして最適パラメータを求めることができる。N個(N≧2)のROIを設定する場合、上記の例と同様にしてN個の目的関数を設定し、それぞれ対応する制約条件を課して制約付き2次計画問題を解くことで、照明条件を与えるN個のベクトルを最適パラメータとして求めることができる。この例のように、複数の目的関数を組み合わせて最適なパラメータを求める手法はパレート最適化と呼ばれることがある。 In the above example, the case where two ROIs are set is shown, but the optimum parameters can be obtained in the same manner when three or more ROIs are set. When setting N ROIs (N ≧ 2), set N objective functions in the same way as in the above example, impose the corresponding constraints, and solve the constrained quadratic programming problem. N vectors that give lighting conditions can be obtained as optimum parameters. As in this example, the method of finding the optimum parameters by combining a plurality of objective functions is sometimes called Pareto optimization.
(第2の変形例:点灯パターンのバリエーション)
次に、第2の変形例として、点灯パターンのバリエーションについて説明する。上記の説明では、ある1つの照明セットを点灯し、他の照明セットを全て消灯する点灯パターンを例示した。この点灯パターンは一例であり、本実施形態に係る技術の適用範囲はこの例に限定されない。例えば、適当な重み値で各照明セットを点灯させるL通り(L≧K)の点灯パターンを用意し、各点灯パターンでの照明下で撮影されたL枚の撮影画像を利用して照明条件を最適化してもよい。
(Second modification: variation of lighting pattern)
Next, as a second modification, variations of the lighting pattern will be described. In the above description, a lighting pattern in which one lighting set is turned on and all the other lighting sets are turned off is illustrated. This lighting pattern is an example, and the scope of application of the technique according to the present embodiment is not limited to this example. For example, an L-way (L ≧ K) lighting pattern for lighting each lighting set with an appropriate weight value is prepared, and the lighting conditions are set by using L shot images taken under the lighting of each lighting pattern. It may be optimized.
この場合、照明最適化部125は、上述した照明最適化方法と同様に、K枚の撮影画像に対応するベクトルu1,…,uKを生成する。また、照明最適化部125は、k番目の撮影画像を撮影した際に用いた照明条件に対応するベクトルvkを取得する。ベクトルvkの各要素は、各照明セットの照明強度(明るさ)に対応する重み値である。第2の変形例におけるベクトルu1,…,uKは、上記の式(4a)で定義される行列Aを用いると、下記の式(11a)で与えられる。但し、行列Vは、下記の式(11b)で与えられる。行列Vがフルランクであれば、上記の行列Aは、下記の式(11c)のように逆行列計算によって求められる。
In this case, the
なお、ノイズ低減などの目的でK枚以上の画像を利用し、疑似逆行列を用いて上記の行列Aを求めてもよい。上記の行列Aが求まると、照明最適化部125は、上記の式(5a)のように目的関数を設定し、最適化計算手法によって制約条件付き2次計画問題を解くことで最適パラメータを求めることができる。
The above matrix A may be obtained by using K or more images for the purpose of noise reduction or the like and using a pseudo inverse matrix. When the above matrix A is obtained, the
なお、ATAのランクがKより小さく、上記の行列Aがランク落ちしている場合、最適パラメータを与えるベクトルwは、下記の式(12)のような一次従属の関係を満たす。なお、下記の式(12)に含まれる行列Bは、(K−rankATA)行K列の行列である。 Incidentally, less than the rank of A T A is K, if the above matrix A is rank deficient, vector w to give the optimum parameter satisfies linear dependence relationship of Equation (12) below. Note that the matrix B included in the following formula (12) is a matrix of (K-Ranka T A) rows and K columns.
上記の式(12)を満たすようにベクトルwを選んだ場合、上記の式(5a)で与えられる目的関数fの値は変化しない。この場合、上記の式(7a)及び式(12)を満たせばベクトルwを自由に決定することができる。例えば、上記の式(7a)に対して次元削減を行ってベクトルwの値を求め、求めたベクトルwから、上記の式(12)に従うようにベクトルwを選択することで最適な照明条件を求めることができる。 When the vector w is selected so as to satisfy the above equation (12), the value of the objective function f given by the above equation (5a) does not change. In this case, the vector w can be freely determined by satisfying the above equations (7a) and (12). For example, the dimension reduction is performed on the above equation (7a) to obtain the value of the vector w, and the vector w is selected from the obtained vector w so as to follow the above equation (12) to obtain the optimum lighting conditions. Can be sought.
(第3の変形例:微小な位置ズレへの対策)
第3の変形例として、対象物Pの微小な位置ズレが生じる場合への対策について説明する。照明最適化の際に用いるK枚の撮影画像を取得する際、対象物Pの位置は固定されていてよい。この場合、K枚の撮影画像は、同じ位置にある対象物Pを撮影した画像になりうる。しかし、カメラの構成(例えば、ラインカメラなど)や、撮影時の環境によっては1〜数画素単位での微小な位置ズレが生じないとも限らない。位置ズレが生じると、上記の式(1)で表される線形性が成り立たず、照明条件が必ずしも最適化されたものにならないことがある。
(Third modification example: Countermeasures against minute misalignment)
As a third modification, a countermeasure for a case where a minute positional deviation of the object P occurs will be described. The position of the object P may be fixed when acquiring K shot images used for lighting optimization. In this case, the K shot images can be images of the objects P at the same position. However, depending on the configuration of the camera (for example, a line camera, etc.) and the environment at the time of shooting, a minute positional deviation in units of 1 to several pixels may not occur. When the positional deviation occurs, the linearity represented by the above equation (1) does not hold, and the lighting conditions may not always be optimized.
上述したラグランジュ未定乗数法を適用した場合における上記の式(7b)の各要素を列挙すると、下記の式(13a)、式(13b)、及び式(14)のようになる。なお、説明を簡単にするため、ベクトルbの要素は全て定数bであるとする。また、ATA(p,q)は、ATAのp行q列目の要素を表す。また、ベクトルのi番目の要素には(i)を付する。 When the above-mentioned Lagrange undetermined multiplier method is applied, each element of the above equation (7b) is listed as the following equations (13a), (13b), and (14). For the sake of simplicity, it is assumed that all the elements of the vector b are constants b. Also, A T A (p, q) represents a p-q-th column element of A T A. Further, (i) is attached to the i-th element of the vector.
ここで、位置ズレのない撮影画像についてのベクトルakをak、位置ズレのある撮影画像についてのベクトルakをa’kと表記し、下記の式(15a)及び式(15b)の関係が成り立つと仮定する。この関係を用いると、位置ズレのある撮影画像に基づいて上記の式(13a)及び式(13b)の計算が可能になる。上記の式(7b)を解くためには、上記の式(14)に含まれるATAが計算できればよく、また、下記の式(15a)及び式(15b)によれば、ATAに含まれる要素のうちp=qの条件を満たす要素は位置ズレの影響を受けない。 Here, the vector a k a k of no positional deviation captured image, the vector a k of the captured image with a positional deviation is denoted as a 'k, the relationship of the following equation (15a) and formula (15b) Is assumed to hold. Using this relationship, the above equations (13a) and (13b) can be calculated based on the captured images having a positional deviation. To solve the above equation (7b) is, as long calculations A T A included in equation (14) above, also according to the following equation (15a) and formula (15b), the A T A Of the included elements, the element satisfying the condition of p = q is not affected by the positional deviation.
ここで、p番目の照明セット及びq番目の照明セットを同時に点灯する照明条件で撮影された撮影画像に対応するベクトルapqは、下記の式(16)で与えられる。ベクトルapqの要素の二乗和は、下記の式(17)のようになる。下記の式(17)に上記の式(15a)及び式(15b)で与えられる関係を適用すると、下記の式(18)の関係が得られる。つまり、2つの照明セットを同時に点灯して撮影した撮影画像のベクトルapqを利用することで、微小な位置ズレがある場合でも下記の式(18)に基づいて上記の式(14)を計算でき、その計算結果を上記の式(7b)に適用することで、微小な位置ズレが生じても上記の最適化計算が可能になる。 Here, the vector a pq corresponding to the photographed image taken under the illumination condition in which the p-th illumination set and the q-th illumination set are turned on at the same time is given by the following equation (16). The sum of squares of the elements of the vector a pq is as shown in Eq. (17) below. Applying the relationships given by the above equations (15a) and (15b) to the following equation (17), the following equation (18) can be obtained. That is, by using the vector a pq of the captured image taken by turning on the two lighting sets at the same time, the above equation (14) is calculated based on the following equation (18) even if there is a slight positional deviation. By applying the calculation result to the above equation (7b), the above optimization calculation becomes possible even if a slight positional deviation occurs.
(第4の変形例:欠陥領域への影響を考慮する方法)
次に、第4の変形例として、欠陥領域についての目的関数を最大化する条件を考慮に入れた照明最適化方法について説明する。これまで説明してきた照明最適化方法では、良品とみなせる対象物Pの領域(良品領域)にROIを設定し、設定したROIについて上記の式(5a)で与えられる目的関数fを最小化する最適パラメータを求めていた。第4変形例では、これに加え、欠陥とみなせる対象物Pの領域(欠陥領域)についての第2の目的関数を設定し、良品領域に対応する第1の目的関数を最小化し、且つ欠陥領域に対応する第2の目的関数を最大化する最適パラメータを求める。
(Fourth modification: How to consider the effect on the defect area)
Next, as a fourth modification, a lighting optimization method that takes into consideration the condition for maximizing the objective function for the defect region will be described. In the lighting optimization method described so far, the ROI is set in the region (non-defective region) of the object P that can be regarded as a non-defective product, and the optimization function f given by the above equation (5a) is minimized for the set ROI. I was looking for parameters. In the fourth modification, in addition to this, a second objective function for the region (defect region) of the object P that can be regarded as a defect is set, the first objective function corresponding to the non-defective region is minimized, and the defect region. Find the optimal parameter that maximizes the second objective function corresponding to.
第4の変形例においても、照明最適化部125は、良品領域について、上記の式(4a)で与えられる行列Aを求め、上記の式(5a)で与えられる目的関数f(w)を設定する。同様に、照明最適化部125は、欠陥領域について上記の行列A及び目的関数f(w)を設定する。ここで、良品領域についての行列AをA1、目的関数fをf1と表記し、欠陥領域についての行列AをA2、目的関数fをf2と表記する。また、照明最適化部125は、下記の式(19a)で与えられる目的関数f’(w)を最小化するベクトルwを計算する(下記の式(19b))。
Also in the fourth modification, the
下記の式(19a)に含まれるα1、α2は重み係数(正の実数)である。また、目的関数f1、f2は、下記の式(19c)及び式(19d)で与えられる。なお、目的関数f1に含まれる目標値のベクトルb1と、目的関数f2に含まれる目標値のベクトルb2とは異なりうる。また、重み係数α2は、目的関数f’(w)が下に凸な関数となるように十分に小さい値に設定されることが好ましい。 Α 1 and α 2 included in the following equation (19a) are weighting coefficients (positive real numbers). Further, the objective functions f 1 and f 2 are given by the following equations (19c) and (19d). Note that the vector b 1 of the target values in the objective function f 1, may be different from the vector b 2 of targeted values included in the objective function f 2. Further, the weighting coefficient α 2 is preferably set to a sufficiently small value so that the objective function f'(w) becomes a downwardly convex function.
上記の式(19a)〜式(19d)と等価な問題を解く方法を以下で説明する。 A method for solving a problem equivalent to the above equations (19a) to (19d) will be described below.
(ステップ1)目的関数f1(w)=ε(ε≧0)が解を持つようなεを設定する。なお、以下では、表記を簡単にするため、目的関数f1、f2を纏めて目的関数fと表記する場合がある。また、目的関数fは、ROIの面積が増加するほど値が大きくなるため、下記の式(20)〜式(22)の形に問題を再定義する。また、下記の式(20)〜式(22)の要素は、下記の式(23a)〜式(23c)のように展開される。 (Step 1) Set ε such that the objective function f 1 (w) = ε (ε ≧ 0) has a solution. In the following, in order to simplify the notation, the objective functions f 1 and f 2 may be collectively referred to as the objective function f. Further, since the value of the objective function f increases as the area of the ROI increases, the problem is redefined in the form of the following equations (20) to (22). Further, the elements of the following equations (20) to (22) are developed as the following equations (23a) to (23c).
上記の式(20)のように目的関数fを再定義することで、εの値は、誤差の分散を表すものと考えられ、ROIの大きさに依らずεを決めることが可能になる。良品領域についての目的関数f1として上記の式(20)で定義した目的関数fを用いる場合、εの値は、下記の式(24)に示すように、目的関数f1を最小化した際のf1の値より大きくなるように設定される。 By redefining the objective function f as in the above equation (20), the value of ε is considered to represent the variance of the error, and it becomes possible to determine ε regardless of the magnitude of the ROI. When the objective function f defined in the above equation (20) is used as the objective function f 1 for the non-defective product region , the value of ε is when the objective function f 1 is minimized as shown in the following equation (24). It is set to be larger than the value of f 1 of.
(ステップ2)f1(w)≦εを制約条件として目的関数f2(w)を最大化するベクトルwを求める。制約条件f1(w)≦εを満たすように目的関数f2(w)を最大化するベクトルwを求める場合には、ベクトルwは発散しない。また、この制約条件は、目的関数f1で表現される良品領域についての誤差が許容範囲(ε)内であることを示しており、欠陥を検出しやすく、且つ誤検出が発生しづらいという2条件を満たす最適なベクトルwを導きうるものである。つまり、第4の変形例を適用することで、より欠陥検出に都合が良い照明条件が得られる可能性がある。 (Step 2) Find the vector w that maximizes the objective function f 2 (w) with f 1 (w) ≦ ε as a constraint condition. When the vector w that maximizes the objective function f 2 (w) is obtained so as to satisfy the constraint condition f 1 (w) ≤ ε, the vector w does not diverge. Further, this constraint condition indicates that the error in the non-defective product region expressed by the objective function f 1 is within the permissible range (ε), and it is easy to detect defects and it is difficult for false detection to occur. The optimum vector w that satisfies the condition can be derived. That is, by applying the fourth modification, there is a possibility that lighting conditions more convenient for defect detection can be obtained.
(第5の変形例:印刷領域の処理)
次に、第5の変形例として、対象物Pの表面にある印刷の処理について説明する。なお、第5の変形例に係る技術は、印刷以外でも汚れなどの処理にも適用されうる。
(Fifth modification: processing of print area)
Next, as a fifth modification, a printing process on the surface of the object P will be described. The technique according to the fifth modification can be applied not only to printing but also to treatment of stains and the like.
ROIと印刷領域とが重なる場合、印刷された文字などのエッジ部分が欠陥抽出フィルタ121aの適用によって強調されることがあり、その影響で、欠陥検出に最適な照明条件を与える最適パラメータとならないことがありうる。例えば、対象物Pが錠剤の場合、錠剤周辺の領域が極端に明るくなるような照明条件が計算結果として得られることがある。このような印刷領域による影響を受けないようにする方法としては、例えば、印刷領域を避けてROIを設定する方法と、画像の輝度値に基づいて正規化された目的関数を用いて照明最適化を実施する方法などがある。
When the ROI and the print area overlap, the edge part such as printed characters may be emphasized by applying the
ROIを手作業で設定する場合、ユーザが注意深く印刷領域を避けてROIを設定すれば最適な照明条件が得られる。この場合、照明最適化部125は、ROIを設定するためのUIにおいて、対象物Pの撮影画像を表示すると共に、対象物Pの印刷領域を自動的に検知して印刷領域を示す枠を表示したり、印刷領域の部分を強調色で表示したり、或いは、印刷領域にROIを設定できないようにしてもよい。
When setting the ROI manually, the user should carefully avoid the print area and set the ROI to obtain the optimum lighting conditions. In this case, the
ROIを制御装置12側で自動設定する場合、照明最適化部125は、対象物Pの表面にある印刷領域を検出し、検出した印刷領域をマスキングする。そして、照明最適化部125は、印刷領域を除いた残りの領域にROIを設定して最適な照明条件を計算する。なお、印刷領域の検出方法としては、照明条件を変化させた際に、エッジの二乗誤差と、輝度値の二乗との相関が高い領域を印刷領域として検出する方法が考えられる。また、正規化された目的関数に対して非線形最適化アルゴリズム(例えば、QE(Quantifier Elimination)アルゴリズム)を適用して最適解を求めてもよい。
When the ROI is automatically set on the
以上、添付図面を参照しながら本開示の好適な実施形態について説明したが、本開示は係る例に限定されない。当業者であれば、特許請求の範囲に記載された範疇内において、各種の変更例又は修正例に想到し得ることは明らかであり、それらについても当然に本開示の技術的範囲に属する。例えば、上記の説明では対象物Pとして錠剤を例に挙げたが、シート状の検査対象物や、複雑な立体形状を有する容器などの検査対象物も上述した検査装置10にて扱いうる。
Although preferred embodiments of the present disclosure have been described above with reference to the accompanying drawings, the present disclosure is not limited to such examples. It is clear that a person skilled in the art can come up with various modifications or modifications within the scope described in the scope of patent claims, which naturally belong to the technical scope of the present disclosure. For example, in the above description, a tablet is taken as an example of the object P, but a sheet-shaped inspection object or an inspection object such as a container having a complicated three-dimensional shape can also be handled by the above-mentioned
10 検査装置
11 表示装置
12 制御装置
13 カメラ
14 照明ユニット
15 搬送ベルト
16a、16b ローラ
21a〜21h、22a〜22d、23a、23b、23e、23f 照明
31、32、33a、33b、33e、33f 偏光板
32a〜32h 偏光板面
41f、41e プリズム
121 記憶部
121a 欠陥抽出フィルタ
121b 照明パラメータ
121c 画像データ
122 照明制御部
123 撮像制御部
124 欠陥検出部
125 照明最適化部
A1〜A5 画像領域
Img 撮影画像
L1、L2 光路
P 対象物
10
Claims (12)
前記複数の照明群についての複数の照明条件のそれぞれを適用して前記検査装置により撮影された前記対象物の第1画像を取得するステップと、
前記複数の照明条件に対応する複数の第1画像に対し、前記対象物の検査時に前記検査装置で利用される画像フィルタを適用して複数の第2画像を生成するステップと、
前記対象物の注目領域に対応する、前記複数の第2画像内の対応する画素値の重み付き線形和と目標値との誤差を最小化する重み値を、前記複数の照明群を制御するための照明パラメータとして計算するステップと、
を含む処理をコンピュータが実行する、照明最適化方法。 It is a lighting optimization method that determines the lighting parameters of an inspection device that inspects an object based on a photographed image of the object taken by using illumination by a plurality of lighting groups.
A step of acquiring a first image of the object taken by the inspection device by applying each of the plurality of lighting conditions for the plurality of lighting groups, and
A step of applying an image filter used by the inspection device at the time of inspecting the object to generate a plurality of second images on the plurality of first images corresponding to the plurality of lighting conditions.
To control the plurality of illumination groups with a weight value that minimizes an error between the weighted linear sum of the corresponding pixel values in the plurality of second images and the target value corresponding to the region of interest of the object. Steps to calculate as lighting parameters of
A lighting optimization method in which a computer performs processing including.
前記計算するステップは、前記複数の注目領域のそれぞれについて前記重み付き線形和と目標値との誤差を表す目的関数を設定すること、及び、設定された複数の目的関数の和を最小化する重み値を算出することを含む、
請求項1に記載の照明最適化方法。 Further including the step of setting a plurality of areas of interest for the object.
The calculation step is to set an objective function representing the error between the weighted linear sum and the target value for each of the plurality of areas of interest, and to minimize the sum of the set objective functions. Including calculating the value,
The lighting optimization method according to claim 1.
前記複数の注目領域のうち第1の注目領域は、第1の視点から見える前記対象物の部分に設定され、第2の注目領域は、前記第1の視点とは異なる第2の視点から見える前記対象物の部分に設定される、
請求項2に記載の照明最適化方法。 The inspection device can simultaneously capture images of the object viewed from different viewpoints.
Of the plurality of areas of interest, the first area of interest is set to a portion of the object visible from the first viewpoint, and the second area of interest is visible from a second viewpoint different from the first viewpoint. Set on the part of the object,
The lighting optimization method according to claim 2.
前記第2の注目領域は、前記対象物の側面部に設定される、
請求項3に記載の照明最適化方法。 The first area of interest is set on the upper surface of the object.
The second area of interest is set on the side surface of the object.
The lighting optimization method according to claim 3.
前記取得するステップでは、前記第1の注目領域に対応する画像領域と、前記第2の注目領域に対応する画像領域とが含まれる前記第1画像が取得される、
請求項3又は4に記載の照明最適化方法。 The inspection device includes a first optical means for guiding the light reflected in the region of the object seen from the first viewpoint to the image sensor, and the light reflected in the region of the object seen from the second viewpoint. A second optical means for guiding the light generated to the image sensor is provided.
In the acquisition step, the first image including the image region corresponding to the first attention region and the image region corresponding to the second attention region is acquired.
The lighting optimization method according to claim 3 or 4.
前記複数の照明群についての複数の照明条件のそれぞれを適用して前記検査装置により撮影された前記対象物の第1画像が格納された記憶部と、
前記複数の照明条件に対応する複数の第1画像に対し、前記対象物の検査時に前記検査装置で利用される画像フィルタを適用して複数の第2画像を生成し、
前記対象物の注目領域に対応する、前記複数の第2画像内の対応する画素値の重み付き線形和と目標値との誤差を最小化する重み値を、前記複数の照明群を制御するための照明パラメータとして計算する、制御部と
を有する、制御装置。 A control device that determines the lighting parameters of an inspection device that inspects an object based on captured images of the object taken by using illumination by a plurality of lighting groups.
A storage unit in which a first image of the object taken by the inspection device by applying each of the plurality of lighting conditions for the plurality of lighting groups is stored, and a storage unit.
A plurality of second images are generated by applying an image filter used by the inspection apparatus at the time of inspection of the object to the plurality of first images corresponding to the plurality of lighting conditions.
To control the plurality of illumination groups with a weight value that minimizes an error between the weighted linear sum of the corresponding pixel values in the plurality of second images and the target value corresponding to the region of interest of the object. A control device that has a control unit that calculates as the lighting parameters of.
請求項6に記載の制御装置。 The control unit sets a plurality of areas of interest for the object, sets an objective function representing an error between the weighted linear sum and the target value for each of the plurality of areas of interest, and sets a plurality of objectives. The weight value that minimizes the sum of the functions is calculated as the lighting parameter.
The control device according to claim 6.
前記制御部は、前記複数の注目領域のうち第1の注目領域を、第1の視点から見える前記対象物の部分に設定し、第2の注目領域を、前記第1の視点とは異なる第2の視点から見える前記対象物の部分に設定する、
請求項7に記載の制御装置。 The inspection device can simultaneously capture images of the object viewed from different viewpoints.
The control unit sets a first attention region among the plurality of attention regions to a portion of the object that can be seen from the first viewpoint, and sets the second attention region to a portion different from the first viewpoint. Set to the part of the object that can be seen from the viewpoint of 2.
The control device according to claim 7.
前記第2の注目領域は、前記対象物の側面部に設定される、
請求項8に記載の制御装置。 The first area of interest is set on the upper surface of the object.
The second area of interest is set on the side surface of the object.
The control device according to claim 8.
前記記憶部には、前記第1の注目領域に対応する画像領域と、前記第2の注目領域に対応する画像領域とが含まれる前記第1画像が格納されている、
請求項8又は9に記載の制御装置。 The inspection device includes a first optical means for guiding the light reflected in the region of the object seen from the first viewpoint to the image sensor, and the light reflected in the region of the object seen from the second viewpoint. A second optical means for guiding the light generated to the image sensor is provided.
The storage unit stores the first image including an image area corresponding to the first attention area and an image area corresponding to the second attention area.
The control device according to claim 8 or 9.
前記制御部は、計算された前記照明パラメータ及び前記複数の照明条件に基づいて前記複数の照明群を制御して対象物の検査を実行する、
請求項6〜10のいずれか1項に記載の制御装置。 The control device is included in the inspection device, and the control device is included in the inspection device.
The control unit controls the plurality of lighting groups based on the calculated lighting parameters and the plurality of lighting conditions to execute the inspection of the object.
The control device according to any one of claims 6 to 10.
プログラム。 A computer is made to execute the lighting optimization method according to any one of claims 1 to 5.
program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019222948A JP2021092439A (en) | 2019-12-10 | 2019-12-10 | Illumination optimization method, control device, and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019222948A JP2021092439A (en) | 2019-12-10 | 2019-12-10 | Illumination optimization method, control device, and program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2021092439A true JP2021092439A (en) | 2021-06-17 |
Family
ID=76312161
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019222948A Pending JP2021092439A (en) | 2019-12-10 | 2019-12-10 | Illumination optimization method, control device, and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2021092439A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023090152A1 (en) * | 2021-11-17 | 2023-05-25 | 三菱電機株式会社 | Image processing device and image processing method |
WO2024070338A1 (en) * | 2022-09-29 | 2024-04-04 | オムロン株式会社 | Position measuring system, and illumination condition optimizing system |
-
2019
- 2019-12-10 JP JP2019222948A patent/JP2021092439A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023090152A1 (en) * | 2021-11-17 | 2023-05-25 | 三菱電機株式会社 | Image processing device and image processing method |
WO2024070338A1 (en) * | 2022-09-29 | 2024-04-04 | オムロン株式会社 | Position measuring system, and illumination condition optimizing system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100367293C (en) | Method and apparatus for optical inspection of a display | |
US8103061B2 (en) | Method and apparatus for identifying facial regions | |
US20070047801A1 (en) | Defect detecting method and defect detecting device | |
WO2011052332A1 (en) | Image processing device for defect inspection and image processing method for defect inspection | |
US11317067B2 (en) | Method and system for inspecting display image | |
JP5659623B2 (en) | Exposure attribute setting method and computer-readable storage medium | |
US11321860B2 (en) | Three-dimensional measurement apparatus, three-dimensional measurement method and non-transitory computer readable medium | |
JP2000324314A (en) | Correction of surface defect by infrared reflection scanning | |
JP2021092439A (en) | Illumination optimization method, control device, and program | |
US20170011502A1 (en) | Defect inspection apparatus for inspecting sheet-like inspection object, computer-implemented method for inspecting sheet-like inspection object, and defect inspection system for inspecting sheet-like inspection object | |
KR20170052297A (en) | Device and method for inspecting external appearance of display panel | |
JPH0792104A (en) | Method for inspecting defective point of object | |
JP2010223809A (en) | Inspection apparatus, inspection method, program and recording medium | |
JP2007299434A (en) | Large-screen touch panel system, and retrieval/display system | |
WO2023034441A1 (en) | Imaging test strips | |
JP2004326188A (en) | Large screen touch panel system and search/display system | |
TWI753424B (en) | Appearance inspection management system, appearance inspection management device, appearance inspection management method, and program | |
US11825211B2 (en) | Method of color inspection by using monochrome imaging with multiple wavelengths of light | |
KR102015620B1 (en) | System and Method for detecting Metallic Particles | |
TWI655412B (en) | Light source detection system and method | |
CN114450579A (en) | Image processing system, setting method, and program | |
WO2023032312A1 (en) | Imaging system and method for controlling same | |
Mirhashemi | Configuration and registration of multi-camera spectral image database of icon paintings | |
WO2023032318A1 (en) | Image capturing system, and control method for same | |
US20090034834A1 (en) | System and method for image processing |