JP5564349B2 - Image processing apparatus and appearance inspection method - Google Patents

Image processing apparatus and appearance inspection method Download PDF

Info

Publication number
JP5564349B2
JP5564349B2 JP2010160994A JP2010160994A JP5564349B2 JP 5564349 B2 JP5564349 B2 JP 5564349B2 JP 2010160994 A JP2010160994 A JP 2010160994A JP 2010160994 A JP2010160994 A JP 2010160994A JP 5564349 B2 JP5564349 B2 JP 5564349B2
Authority
JP
Japan
Prior art keywords
image
inspection
distance
workpiece
processing apparatus
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2010160994A
Other languages
Japanese (ja)
Other versions
JP2012021914A (en
Inventor
和人 佐伯
泰平 井上
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Keyence Corp
Original Assignee
Keyence Corp
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 Keyence Corp filed Critical Keyence Corp
Priority to JP2010160994A priority Critical patent/JP5564349B2/en
Publication of JP2012021914A publication Critical patent/JP2012021914A/en
Application granted granted Critical
Publication of JP5564349B2 publication Critical patent/JP5564349B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Length Measuring Devices By Optical Means (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Description

本発明は、ワークをカメラで撮像して、得られた画像データを用いて計測処理を実行する画像処理装置及び外観検査方法に関する。   The present invention relates to an image processing apparatus and an appearance inspection method for capturing a workpiece with a camera and performing measurement processing using the obtained image data.

工場など数多くの生産現場では、人の目視に頼っていた検査を自動化・高速化するために、画像処理装置が導入されている。画像処理装置は、ベルトコンベア等の生産ラインを流れてくるワークをカメラによって撮像し、得られた画像データを用いて所定領域のエッジ検出や面積計算などの計測処理を実行する。そして、計測処理の処理結果に基づいて、ワークの欠けやバリの有無について検査を行い、ワークの良否を判定する。FA現場では、画像処理装置は、ワークの良否を判定するFAセンサの一つとして利用される。   In many production sites such as factories, image processing devices have been introduced in order to automate and speed up inspections that depend on human visual inspection. The image processing apparatus captures an image of a workpiece flowing on a production line such as a belt conveyor with a camera, and executes measurement processing such as edge detection and area calculation of a predetermined region using the obtained image data. Then, based on the processing result of the measurement process, the workpiece is inspected for chipping or burrs, and the quality of the workpiece is determined. At the FA site, the image processing apparatus is used as one of FA sensors for determining the quality of a workpiece.

このような画像処理装置を用いて、例えば印字等によりワークに所定形状の図形が正しく形成されているか否かを検査する場合には、まず、所定形状と同一の基準図形を画像処理装置に予め記憶しておく。そして、ワークをカメラによって撮像し、得られた画像データ上にて基準図形を用いたパターンマッチング処理(例えば正規化相関演算など)を行い、処理結果に基づいてワークの良否を判定する。ただし、実際の運用場面では、大量のワークの良否判定を高速に行う必要があるため、得られた画像データの全領域でパターンマッチング処理を施すのではなく、得られた画像データのうち検査したい図形が含まれる領域(検査領域)を特定して、この検査領域内でのみパターンマッチング処理を施すようにしている。これにより、検査領域外に存在する図形に起因した誤検出を防ぎ、ワークの良否判定精度を高めることができる。また、パターンマッチング処理やエッジ抽出処理など、画像処理装置における各種計測処理や前処理の演算量を減らし、ひいてはワークの良否判定の高速化を図ることができる。   When using such an image processing apparatus to check whether or not a figure of a predetermined shape is correctly formed on a work, for example, by printing or the like, first, a reference figure that is the same as the predetermined shape is previously stored in the image processing apparatus. Remember. Then, the workpiece is imaged by the camera, pattern matching processing (for example, normalized correlation calculation) using the reference graphic is performed on the obtained image data, and the quality of the workpiece is determined based on the processing result. However, in actual operation situations, it is necessary to judge the quality of a large amount of work at high speed, so instead of performing pattern matching processing on the entire area of the obtained image data, you want to inspect the obtained image data. An area (inspection area) including a figure is specified, and pattern matching processing is performed only within this inspection area. Thereby, the erroneous detection resulting from the figure which exists out of a test | inspection area | region can be prevented, and the quality determination accuracy of a workpiece | work can be improved. In addition, it is possible to reduce the amount of calculation of various measurement processes and pre-processes in the image processing apparatus such as pattern matching process and edge extraction process, thereby speeding up the work quality determination.

ここで、生産ライン上を流れてくるワークが規則正しく整列している場合には、得られた画像データにおける検査領域は固定しておけばよい。そのため、この場合、検査領域の特定は容易である(例えば、得られた画像データの中央部分を対角線の交点とする矩形領域を検査領域とする等)。しかし、ワークが常に規則正しく整列しているとは限らず、本来あるべき位置からずれた状態、或いは、その基本姿勢から傾いた状態で流れてくることもある。このようなときには、検査したい図形も、本来あるべき位置からずれた状態、或いは、その基本姿勢から傾いた状態になってしまうことから、画像データにおける検査領域の位置や傾きを補正する必要がある。そこで、例えばワークに位置決め用のアライメントマークを予め形成しておき、このアライメントマークを利用することで、検査領域の位置や傾きを補正する技術が知られている(例えば特許文献1参照)。   Here, when the workpieces flowing on the production line are regularly arranged, the inspection area in the obtained image data may be fixed. Therefore, in this case, it is easy to specify the inspection area (for example, a rectangular area having a central portion of the obtained image data as an intersection of diagonal lines is used as the inspection area). However, the workpieces are not always regularly arranged, and the workpiece may flow in a state shifted from the original position or tilted from the basic posture. In such a case, since the figure to be inspected is also shifted from the original position or inclined from the basic posture, it is necessary to correct the position and inclination of the inspection area in the image data. . Thus, for example, a technique is known in which an alignment mark for positioning is formed in advance on a workpiece and the position and inclination of the inspection region are corrected by using this alignment mark (see, for example, Patent Document 1).

具体的には、まず、ワークに位置決め用のアライメントマーク(例えば十字マーク)を形成しておく。このアライメントマークは、検査したい図形がワークに形成されている位置と一定の位置関係・角度関係を有している。例えば得られた画像データにおいて、アライメントマークが検査したい図形の重心位置から上方に500ピクセル、左方に500ピクセルの位置に現れるように、アライメントマークを形成しておく。実際の運用場面では、カメラによって得られた画像データからアライメントマークの位置を検出するとともに、その基準姿勢からの傾きも検出する。そして、検出したアライメントマークの位置に基づいて、検査したい図形が含まれる検査領域(例えば矩形領域)の位置を補正し、かつ、検出したアライメントマークの傾きに基づいて、その検査領域の傾きを補正する。このような補正処理を経て確定した検査領域内で、基準図形を用いてパターンマッチング処理を行い、処理結果に基づいてワークの良否を判定する。   Specifically, first, alignment marks (for example, cross marks) for positioning are formed on the workpiece. This alignment mark has a certain positional / angular relationship with the position where the figure to be inspected is formed on the workpiece. For example, in the obtained image data, the alignment mark is formed so that the alignment mark appears at a position of 500 pixels upward and 500 pixels to the left from the center of gravity of the figure to be inspected. In an actual operational situation, the position of the alignment mark is detected from the image data obtained by the camera, and the inclination from the reference posture is also detected. Based on the position of the detected alignment mark, the position of the inspection area (for example, a rectangular area) including the figure to be inspected is corrected, and the inclination of the inspection area is corrected based on the detected inclination of the alignment mark. To do. A pattern matching process is performed using the reference graphic within the inspection area determined through such a correction process, and the quality of the workpiece is determined based on the processing result.

このように、得られた画像データにおいて検査領域の位置や傾きを補正するためには、予めワークに形成したアライメントマークを得られた画像データから検出することが重要になる。   As described above, in order to correct the position and inclination of the inspection region in the obtained image data, it is important to detect the alignment mark formed in advance on the workpiece from the obtained image data.

特開平07−270331号公報Japanese Patent Laid-Open No. 07-270331

しかしながら、ワークに形成されたアライメントマークを安定して検出できない場合がある。例えば、アライメントマークが周囲の色(例えば白)と異なる色(例えば黒)で描かれた十字マークの場合には、エッジ処理等によって検出可能である。しかし、アライメントマークがプレスによる僅かな凹凸で構成される十字マークの場合には、得られた画像データのうちアライメントマーク部分の各画素の濃淡が大きく変化しないため、エッジ処理等によっても検出困難になる虞がある。アライメントマークを検出できない場合には、上述したように検査領域の位置や傾きを補正することができず、結果として、ワークの良否判定を適切に行うことができない。   However, the alignment mark formed on the workpiece may not be detected stably. For example, when the alignment mark is a cross mark drawn in a color (for example, black) different from the surrounding color (for example, white), it can be detected by edge processing or the like. However, when the alignment mark is a cross mark composed of slight unevenness by pressing, the shade of each pixel of the alignment mark portion in the obtained image data does not change greatly, so it is difficult to detect even by edge processing etc. There is a risk of becoming. If the alignment mark cannot be detected, the position and inclination of the inspection area cannot be corrected as described above, and as a result, the quality of the workpiece cannot be properly determined.

この点、例えば検査時にワークを照らす照明の当て方を工夫して、凹凸に起因する陰影を検出してアライメントマークを検出することも考えられる。しかし、周囲の照明環境によって常に明瞭な陰影が検出されるとは限らないし、また、照明の当て方を工夫しなければならないとなると照明を設置する作業の手間が掛かる。   In this regard, for example, it is conceivable to devise a method of applying illumination for illuminating the workpiece at the time of inspection to detect an alignment mark by detecting a shadow caused by unevenness. However, a clear shadow is not always detected depending on the surrounding lighting environment, and if it is necessary to devise how to apply the illumination, it takes time to install the illumination.

本発明は、以上の点に鑑みてなされたものであり、その目的は、安定的に検査領域を特定することが可能な画像処理装置及び外観検査方法を提供することにある。   The present invention has been made in view of the above points, and an object thereof is to provide an image processing apparatus and an appearance inspection method capable of stably specifying an inspection region.

本発明に係る画像処理装置は、ワークを撮像するカメラを有し、当該カメラから取得した画像に基づいてワーク表面における所定の検査範囲を検査し、ワークの良否を判定する画像処理装置において、各画素が、カメラの受光量に応じた濃淡値を有する濃淡画像を取得する濃淡画像取得手段と、カメラから取得した画像を用いて、カメラからワーク表面までの距離を算出する距離算出手段と、各画素が、算出された距離に応じた濃淡値を有する距離画像を生成する距離画像生成手段と、濃淡画像と距離画像の一方の画像において、他方の画像上で検査範囲に相当する検査領域を特定するための特定パターンを検出する特定パターン検出手段と、濃淡画像と距離画像の他方の画像において、特定パターン検出手段により検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、検査領域を特定する検査領域特定手段と、特定された検査領域から特徴量を算出する特徴量算出手段と、算出された特徴量に基づいて、ワークの良否を判定する判定手段と、を備える。   An image processing apparatus according to the present invention includes a camera that captures a workpiece, inspects a predetermined inspection range on the surface of the workpiece based on an image acquired from the camera, and determines whether the workpiece is acceptable. Each pixel has a grayscale image acquisition means for acquiring a grayscale image having a grayscale value corresponding to the amount of light received by the camera, a distance calculation means for calculating the distance from the camera to the workpiece surface using the image acquired from the camera, and A distance image generating means for generating a distance image having a gray value corresponding to the calculated distance, and an inspection area corresponding to the inspection range on one of the gray image and the distance image is specified on the other image Specific pattern detecting means for detecting a specific pattern to detect, and a specific pattern detected by the specific pattern detecting means in the other image of the grayscale image and the distance image Based on at least one of the position and the inclination angle, the inspection area specifying means for specifying the inspection area, the feature quantity calculating means for calculating the feature quantity from the specified inspection area, and the workpiece based on the calculated feature quantity Determination means for determining pass / fail.

すなわち、一般的な濃淡画像と、カメラからワーク表面までの距離に応じた濃淡値を有する距離画像との一方の画像で特定パターンを検出し、他方の画像で検出した特定パターンの位置又は傾斜角度の少なくとも一方に基づいて検査領域を特定し、特定された検査領域から特徴量を算出してワークの良否を判定するようにしているので、例えば特定パターンとしてのアライメントマークが、プレスによる僅かな凹凸で構成されるような場合であっても、その凹凸の検出が可能な距離画像において、アライメントマークを検出することができる。これにより、検出されたアライメントマークの位置及び傾斜角度の少なくとも一方に基づいて濃淡画像上で検査領域を特定することができるので、安定的に検査領域を特定することができる。なお、ワークが流れてくる生産ラインの制約上、アライメントマークが傾かない場合には、アライメントマークの位置のみに基づいて検査領域を特定してもよい。逆に、アライメントマークの(重心)位置が定位置である場合には、アライメントマークの傾斜角度のみに基づいて検査領域を特定してもよい。   That is, a specific pattern is detected in one image of a general gray image and a distance image having a gray value corresponding to the distance from the camera to the workpiece surface, and the position or inclination angle of the specific pattern detected in the other image Since the inspection area is specified based on at least one of the above, the feature amount is calculated from the specified inspection area, and the quality of the work is determined, for example, the alignment mark as the specific pattern has slight unevenness due to the press. Even in such a case, it is possible to detect the alignment mark in the distance image where the unevenness can be detected. Accordingly, since the inspection area can be specified on the grayscale image based on at least one of the detected position and inclination angle of the alignment mark, the inspection area can be specified stably. If the alignment mark does not tilt due to restrictions on the production line through which the workpiece flows, the inspection area may be specified based only on the position of the alignment mark. Conversely, if the (centroid) position of the alignment mark is a fixed position, the inspection area may be specified based only on the inclination angle of the alignment mark.

また、本発明に係る画像処理装置は、検査領域特定手段により検査領域を特定するにあたって、他方の画像上で特定パターンと一定の相対位置関係にある基準検査領域の設定を受け付け、一方の画像上で検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、他方の画像上の基準検査領域を位置補正することによって検査領域を特定してもよい。これにより、ユーザは所望の基準検査領域を設定することができるので、画像処理装置の使い勝手を向上させることができる。   The image processing apparatus according to the present invention also accepts a setting of a reference inspection area having a certain relative positional relationship with a specific pattern on the other image when the inspection area is specified by the inspection area specifying means. The inspection area may be specified by correcting the position of the reference inspection area on the other image based on at least one of the position and the inclination angle of the specific pattern detected in (1). Thereby, since the user can set a desired reference inspection region, the usability of the image processing apparatus can be improved.

また、本発明に係る画像処理装置は、検査領域特定手段により検査領域を特定するにあたって、一方の画像上で抽出されたエッジに基づくエッジパターンを特定パターンとし、この特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、他方の画像上でエッジパターンに対応する領域を生成することによって検査領域を特定してもよい。これにより、ユーザは上述した基準検査領域を設定しなくても、検出領域を適切に特定することができ、設定作業の手間を省くことができる。   Further, the image processing apparatus according to the present invention uses an edge pattern based on the edge extracted on one image as the specific pattern when specifying the inspection region by the inspection region specifying means, and the position and inclination angle of the specific pattern are determined. The inspection region may be specified by generating a region corresponding to the edge pattern on the other image based on at least one. Thereby, even if the user does not set the above-described reference inspection area, the detection area can be appropriately specified, and the setting work can be saved.

また、本発明に係る画像処理装置は、特定パターンを検出するための検出条件(例えば前処理に用いるフィルタの種類や、検出に用いるしきい値としてのエッジ強度の大きさ、或いは、正規化相関演算により特定パターンを検出するための基準画像など)の設定を受け付ける検出条件設定受付手段と、その検出条件を記憶する検出条件記憶手段とを備え、特定パターン検出出手段は、記憶された検出条件に基づいて、他方の画像上で検査範囲に相当する検査領域を特定するための特定パターンを検出するような構成にしてもよい。これにより、最適な検出条件を設定しておくことにより、特定パターンの検出精度を高めることができ、ひいては検出領域の特定精度を高めることができる。   In addition, the image processing apparatus according to the present invention can detect a detection condition for detecting a specific pattern (for example, the type of filter used for preprocessing, the magnitude of edge strength as a threshold used for detection, or a normalized correlation). A detection condition setting receiving unit that receives a setting of a reference image for detecting a specific pattern by calculation, and a detection condition storage unit that stores the detection condition, and the specific pattern detection and output unit stores the detected detection condition On the other hand, a configuration may be adopted in which a specific pattern for specifying an inspection area corresponding to the inspection range is detected on the other image. Thereby, by setting the optimal detection condition, the detection accuracy of the specific pattern can be increased, and as a result, the detection accuracy of the detection region can be increased.

また、濃淡画像を取得するカメラと距離画像の生成に用いるカメラとは同一であるような構成にしてもよい。これにより、同一ワークの同一領域について濃淡画像と距離画像を得ることができるので、カメラ内部およびカメラ間の相対的なパラメータを求める為のキャリブレーションおよび、求められたパラメータに基づいた検出位置の補正をする必要がなく、計測処理の処理負荷を軽減することができる。   Further, the camera for acquiring the grayscale image and the camera used for generating the distance image may be the same. As a result, a grayscale image and a distance image can be obtained for the same region of the same work, so calibration for obtaining relative parameters inside and between cameras and correction of the detection position based on the obtained parameters There is no need to perform measurement, and the processing load of the measurement process can be reduced.

また、検査領域特定手段は、濃淡画像と距離画像の一方の画像においても、特定パターン検出手段により検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、検査領域を特定し、特徴量算出手段は、濃淡画像及び距離画像において特定された検査領域から、それぞれ第一及び第二の特徴量を算出するとともに、判定手段は、第一及び第二の特徴量のうち少なくとも一方に基づいて、ワークの良否を判定するような構成にしてもよい。これにより、第一及び第二の特徴量のいずれか一方を用いた外観検査を行うこともできるし、第一及び第二の特徴量の両方を用いた外観検査を行うこともできるので、画像処理装置のユーザビリティを高めることができる。   Further, the inspection area specifying means specifies the inspection area based on at least one of the position and the inclination angle of the specific pattern detected by the specific pattern detection means in one of the gray image and the distance image, and the feature amount The calculating means calculates the first and second feature amounts from the inspection regions specified in the grayscale image and the distance image, respectively, and the determining means is based on at least one of the first and second feature amounts. A configuration may be adopted in which the quality of the workpiece is determined. As a result, it is possible to perform an appearance inspection using one of the first and second feature amounts, or to perform an appearance inspection using both the first and second feature amounts. Usability of the processing apparatus can be improved.

また、第一及び第二の特徴量の両方に基づいてワークの良否を判定するような構成にしてもよい。これにより、ユーザは、例えば濃淡画像上で検出可能な汚れと距離画像上で検出可能な凹みとのうち、いずれか一方は許容するが他方は許容しない(例えばワークの多少の凹みは許容するが、ワークの汚れは許容しない)、といったようなバリエーション豊富な外観検査を行うことができ、ひいては使い勝手を更に向上させることができる。   Moreover, you may make it the structure which determines the quality of a workpiece | work based on both the 1st and 2nd feature-value. As a result, for example, the user allows one of the dirt detectable on the grayscale image and the dent detectable on the distance image, but does not allow the other (for example, some dents on the workpiece are allowed. In addition, it is possible to perform a variety of appearance inspections such as that the workpiece is not allowed to be contaminated), and the usability can be further improved.

以上説明したように、本発明によれば、安定的に検査領域を特定することができ、ひいては外観検査精度を高めることができる。   As described above, according to the present invention, it is possible to stably specify the inspection region, and consequently improve the appearance inspection accuracy.

本発明の実施の形態に係る画像処理装置を含む画像システムのシステム構成例を示す図である。1 is a diagram illustrating a system configuration example of an image system including an image processing apparatus according to an embodiment of the present invention. 距離画像について説明するための説明図である。It is explanatory drawing for demonstrating a distance image. 本実施形態に係る画像処理装置のハードウェア構成例を示すブロック図である。It is a block diagram which shows the hardware structural example of the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置の機能構成例を示す図である。It is a figure which shows the function structural example of the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置において検査領域が特定される様子に関する説明図である。It is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 本実施形態に係る画像処理装置においてモニタに表示されるユーザインターフェース画面の一例を示す図である。It is a figure which shows an example of the user interface screen displayed on a monitor in the image processing apparatus which concerns on this embodiment. 、本実施形態に係る画像処理装置の処理動作を示すフローチャートである。5 is a flowchart showing a processing operation of the image processing apparatus according to the present embodiment. 図4に示す機能構成において濃淡画像取得手段と距離算出手段及び距離画像生成手段とを入れ替えたときのアプリケーション具体例を示す図である。It is a figure which shows the application specific example when the grayscale image acquisition means, the distance calculation means, and the distance image generation means are replaced in the functional structure shown in FIG. アライメントマークを用いずに検査領域を特定するアプリケーション具体例を示す図である。It is a figure which shows the application specific example which specifies an test | inspection area | region, without using an alignment mark. 本実施形態に係る画像処理装置の別の機能構成例を示す図である。It is a figure which shows another example of a function structure of the image processing apparatus which concerns on this embodiment. 検査領域が特定される(検査領域が生成される)様子を示すアプリケーション具体例(外観検査例)である。It is an application specific example (appearance inspection example) showing a state in which an inspection area is specified (inspection area is generated). 距離画像又は濃淡画像からエッジパターンを生成する方法の一例について説明するための説明図である。It is explanatory drawing for demonstrating an example of the method of producing | generating an edge pattern from a distance image or a grayscale image. 濃淡画像と距離画像の両方を用いた外観検査を行うアプリケーション例である。It is an example of an application that performs an appearance inspection using both a grayscale image and a distance image. 特徴量算出手段によって第一及び第二の特徴量が算出され、これらのうち少なくとも一方を用いるための選択画面の一例を示す図である。It is a figure which shows an example of the selection screen for calculating the 1st and 2nd feature-value by the feature-value calculation means, and using at least one of these. 特徴量算出手段によって算出された第一及び第二の特徴量の両方を用いて、ワークの良否判定を行うアプリケーション具体例を示す図である。It is a figure which shows the application specific example which performs the quality determination of a workpiece | work using both the 1st and 2nd feature-value calculated by the feature-value calculation means.

以下、本発明の実施の形態に係る画像処理装置について、図面に基づいて具体的に説明する。   Hereinafter, an image processing apparatus according to an embodiment of the present invention will be specifically described with reference to the drawings.

[システム構成]
図1は、本発明の実施の形態に係る画像処理装置10を含む画像システム1のシステム構成例を示す図である。
[System configuration]
FIG. 1 is a diagram showing a system configuration example of an image system 1 including an image processing apparatus 10 according to an embodiment of the present invention.

図1に示す画像システム1は、エッジ検出や面積計算などの計測処理を実行する画像処理装置10と、ワーク(検査対象物)を撮像するカメラ30と、液晶パネル等のモニタ40と、ユーザがモニタ40上で各種操作するためのコンソール50と、ワークを照らす照明装置60と、を有している。カメラ30、モニタ40、コンソール50、及び照明装置60は、画像処理装置10と着脱可能に接続される。これらのうち照明装置60は、距離画像(詳細は後述する)を生成するためにワークを照らす照明手段として用いられ、例えば、ワークに対してライン状のレーザ光を投光する光投影器であってもよいし、ワークに正弦波縞模様パターンを投影するためのパターン投影器であってもよい。図1では省略するが、明視野照明や暗視野照明を行うための一般的な照明装置(例えばリング照明器など)が別途設けられてもよい(照明装置60に、一般的な照明装置としての機能をもたせることも可能である)。   An image system 1 shown in FIG. 1 includes an image processing apparatus 10 that performs measurement processing such as edge detection and area calculation, a camera 30 that captures a workpiece (inspection object), a monitor 40 such as a liquid crystal panel, and a user. A console 50 for performing various operations on the monitor 40 and a lighting device 60 for illuminating the work are provided. The camera 30, the monitor 40, the console 50, and the illumination device 60 are detachably connected to the image processing device 10. Among these, the illuminating device 60 is used as an illuminating means for illuminating the workpiece in order to generate a distance image (details will be described later). Alternatively, it may be a pattern projector for projecting a sinusoidal fringe pattern onto the workpiece. Although omitted in FIG. 1, a general illumination device (for example, a ring illuminator) for performing bright-field illumination and dark-field illumination may be separately provided (the illumination device 60 includes a general illumination device). It is also possible to have a function).

画像処理装置10は、カメラ30から得られた画像データを用いて画像処理を実行し、外部接続されたPLC(Programmable Logic Controller)70などの制御機器に対し、ワークの良否などの判定結果を示す信号として判定信号を出力する。   The image processing apparatus 10 executes image processing using image data obtained from the camera 30, and indicates a determination result such as the quality of a work to a control device such as an externally connected PLC (Programmable Logic Controller) 70. A determination signal is output as a signal.

カメラ30は、PLC70から入力される制御信号、例えばカメラ30から画像データを取り込むタイミングを規定する撮像トリガ信号に基づいて、検査対象物の撮像を行う。モニタ40は、検査対象物を撮像して得られた画像データや、その画像データを用いた計測処理の結果を表示するための表示装置である。コンソール50は、モニタ40上でフォーカス位置を移動させたり、メニュー項目を選択したりするための入力装置である。一般に、ユーザは、モニタ40を視認することによって、画像処理装置10の運転中の動作状態を確認することができる。また、後述するように、ユーザは、モニタ40を視認しつつ、コンソール50を操作することによって、必要に応じて各種設定や各種編集を行うことができる。   The camera 30 images the inspection object based on a control signal input from the PLC 70, for example, an imaging trigger signal that defines a timing for capturing image data from the camera 30. The monitor 40 is a display device for displaying the image data obtained by imaging the inspection object and the result of the measurement process using the image data. The console 50 is an input device for moving the focus position on the monitor 40 and selecting menu items. In general, the user can confirm the operating state of the image processing apparatus 10 during operation by viewing the monitor 40. In addition, as will be described later, the user can perform various settings and various edits as necessary by operating the console 50 while viewing the monitor 40.

また、画像処理装置10は、画像処理装置10の制御プログラムを生成するためのPC80を接続することもでき、このPC80上で動作するソフトウェアによって、画像処理の処理順序を規定する処理順序プログラムを生成することができる。画像処理装置10では、その処理順序に沿って各画像処理が順次実行される。PC80と画像処理装置10とは、通信ネットワークを介して接続されており、PC80上で生成された処理順序プログラムは、例えばモニタ40の表示態様を規定するレイアウト情報などとともに、画像処理装置10に転送される。また逆に、画像処理装置10から処理順序プログラムやレイアウト情報などを取り込んで、PC80上で編集することもできる。なお、この処理順序プログラムは、PC80だけでなく、画像処理装置10においても生成できるようにしてもよい。   The image processing apparatus 10 can also be connected to a PC 80 for generating a control program for the image processing apparatus 10, and generates a processing order program that defines the processing order of image processing by software operating on the PC 80. can do. In the image processing apparatus 10, each image processing is sequentially executed according to the processing order. The PC 80 and the image processing apparatus 10 are connected via a communication network, and the processing order program generated on the PC 80 is transferred to the image processing apparatus 10 together with layout information that defines the display mode of the monitor 40, for example. Is done. Conversely, a processing order program, layout information, and the like can be taken from the image processing apparatus 10 and edited on the PC 80. This processing order program may be generated not only by the PC 80 but also by the image processing apparatus 10.

[距離画像の生成]
図1に示すカメラ30と照明装置60を利用することで得られる「距離画像」とは、ワークを撮像するカメラ30から、ワークまでの距離に応じて各画素の濃淡値が変化する画像をいう。換言すれば、カメラ30からワークまでの距離に基づいて濃淡値が決定される画像ともいえるし、ワークまでの距離に応じた濃淡値を有する多値画像ともいえるし、或いは、ワークの高さに応じた濃淡値を有する多値画像ともいえる。さらに、濃淡画像の画素ごとに、カメラ30からの距離を濃淡値に変換した多値画像ともいえる。例えば、図2(a)に示すように、半径の異なる円柱が2段重なったようなワークの距離画像を考える。ワークの最上面Sとカメラ30までの距離はlであり、ワークの中段面Sとカメラ30までの距離はlであり、ワークの載置面Sとカメラ30までの距離はlであり、ワークの高さはL(=l−l)である。このようなワークから、例えば図2(b)に示すような距離画像を得ることができる。図2(b)によれば、ワークの最上面Sが最も濃く(例えば黒色)、ワークの載置面Sが最も薄く(例えば白色)、ワークの中段面Sがこれらの中間色(例えば灰色)となっている。すなわち、ワークとカメラ30までの距離l,l,l(l<l<l)に応じて、最上面S,中段面S,載置面Sという順番で各画素の濃淡値が小さくなっている。このように、距離画像では、カメラ30からワークまでの距離に応じて各画素の濃淡値が変化する。
[Generate distance image]
A “distance image” obtained by using the camera 30 and the illumination device 60 shown in FIG. 1 refers to an image in which the gray value of each pixel changes according to the distance from the camera 30 that captures the workpiece to the workpiece. . In other words, it can be said that the gray value is determined based on the distance from the camera 30 to the workpiece, can be said to be a multi-value image having a gray value corresponding to the distance to the workpiece, or the height of the workpiece. It can also be said to be a multi-value image having a corresponding gray value. Furthermore, it can be said that it is a multi-value image in which the distance from the camera 30 is converted into a gray value for each pixel of the gray image. For example, as shown in FIG. 2A, consider a distance image of a work in which cylinders having different radii are stacked in two stages. The distance to the top surface S 1 and the camera 30 of the workpiece is l 1, the distance to the middle plane S 2 and the camera 30 of the workpiece is l 2, the distance to the surface S 3 and the camera 30 mounting the workpiece l 3 and the height of the workpiece is L (= l 3 −l 1 ). From such a workpiece, for example, a distance image as shown in FIG. 2B can be obtained. According to FIG. 2 (b), the darkest (e.g., black) is uppermost surface S 1 of the work, the thinnest mounting surface S 3 of the workpiece (for example, white), the middle plane S 2 of these intermediate colors of the workpiece (e.g. Gray). That is, according to the distances l 1 , l 2 , and l 3 (l 1 <l 2 <l 3 ) between the workpiece and the camera 30, the top surface S 1 , the middle surface S 2 , and the placement surface S 3 The gray value of the pixel is small. Thus, in the distance image, the gray value of each pixel changes according to the distance from the camera 30 to the workpiece.

距離画像を生成するための手法としては、大きく分けて2つの方式があり、一つは、通常の画像を得るための照明条件で撮像した画像を用いて距離画像を生成するパッシブ方式(受動計測方式)、もう一つは、高さ方向の計測をするために光を能動的に照射して距離画像を生成するアクティブ方式(能動計測方式)である。パッシブ方式の代表的な手法は、ステレオ計測法である。これは、カメラ30を2台用意し、これら2台のカメラを所定の位置関係で配置するだけで距離画像を生成できることから、濃淡画像を生成するための一般的な画像システムを利用して距離画像を生成でき、システム構築コストを抑制することができる。しかし、ステレオ計測法では、一方のカメラによって得られる画像中の一点が、他方のカメラによって得られる画像中のどの点に対応しているのかを決定しなければならず、いわゆる対応点の決定処理に時間が掛かるという問題がある。また、全画素において対応点を特定するのは困難であり、この点においても外観検査の高速化には向かない。一方で、アクティブ方式の代表的な手法は、光切断法とパターン投影法である。光切断法は、上述したステレオ計測法において、一方のカメラを光投影器に置き換えて、ワークに対してライン状のレーザ光を投光し、物体表面の形状に応じたライン光の像の歪み具合からワークの3次元形状を復元する。光切断法は、対応点の決定が容易であるため、ステレオ計測法と比べてある程度、計測処理の高速化が期待できる。しかし、それでも1回の計測で1ライン分しか計測できないため、全画素の計測値を得ようとすると、レーザ光の投光を複数回行う必要があり、且つ、対象物又はカメラを走査しなければならず、高速化に限界がある。パターン投影法は、ワークに投影された所定パターンの形状や位相などをずらして複数枚の画像を撮像し、撮像した複数枚の画像を解析することでワークの3次元形状を復元するものである。パターン投影法には幾つか種類があり、正弦波縞模様パターンの位相をずらして複数枚(最低3枚以上)の画像を撮像し、複数枚の画像から画素ごとに正弦波の位相を求め、求めた位相を利用してワーク表面上の3次元座標を求める位相シフト法や、2つの規則的なパターンが合成されるときに生じる一種の空間周波数のうなり現象を利用して3次元形状を復元するモアレポトグラフィ法などが代表的である。   There are roughly two methods for generating a distance image. One is a passive method (passive measurement) that generates a distance image using an image captured under illumination conditions to obtain a normal image. The other method is an active method (active measurement method) in which a distance image is generated by actively irradiating light in order to measure in the height direction. A typical passive method is a stereo measurement method. This is because a distance image can be generated simply by preparing two cameras 30 and arranging these two cameras in a predetermined positional relationship, so that a distance can be obtained using a general image system for generating a gray image. Images can be generated, and system construction costs can be reduced. However, in the stereo measurement method, it is necessary to determine which point in the image obtained by one camera corresponds to the point in the image obtained by the other camera. There is a problem that it takes time. Also, it is difficult to specify corresponding points in all pixels, and this point is also not suitable for speeding up the appearance inspection. On the other hand, typical methods of the active method are a light cutting method and a pattern projection method. The light cutting method is the above-described stereo measurement method, in which one camera is replaced with an optical projector, a line-shaped laser beam is projected onto the workpiece, and the line light image is distorted according to the shape of the object surface. Restore the 3D shape of the workpiece from the condition. Since the light section method can easily determine the corresponding points, it can be expected to speed up the measurement process to some extent as compared with the stereo measurement method. However, since only one line can be measured in one measurement, it is necessary to project the laser beam multiple times to obtain the measurement value of all pixels, and the object or camera must be scanned. There is a limit to speedup. The pattern projection method captures a plurality of images by shifting the shape and phase of a predetermined pattern projected onto a workpiece, and restores the three-dimensional shape of the workpiece by analyzing the captured images. . There are several types of pattern projection methods, taking multiple images (at least 3 images) by shifting the phase of the sinusoidal fringe pattern, obtaining the phase of the sine wave for each pixel from the multiple images, Reconstruct 3D shape using phase shift method to obtain 3D coordinates on workpiece surface using the obtained phase and a kind of spatial frequency beat phenomenon that occurs when two regular patterns are synthesized. A typical example is the moire repography method.

本実施形態に係る画像処理装置10では、上述した位相シフト法によって距離画像を生成することとしている。これにより、外観検査の高速化に資することができる。なお、本発明は、位相シフト法によって距離画像を生成することに限られず、位相シフト法以外の上述した方法によって距離画像を生成しても構わない。また、上述した方法以外の方法、例えば光レーダ法(タイムオブフライト)、合焦点法、共焦点法、白色光干渉法など、距離画像を生成するために考え得る如何なる手法を採用しても構わない。   In the image processing apparatus 10 according to the present embodiment, a distance image is generated by the phase shift method described above. This can contribute to speeding up the appearance inspection. The present invention is not limited to generating a distance image by the phase shift method, and the distance image may be generated by the above-described method other than the phase shift method. Any method other than the method described above, such as an optical radar method (time-of-flight), a focusing method, a confocal method, a white light interferometry, can be considered. Absent.

[ハードウェア構成]
図3は、本実施形態に係る画像処理装置10のハードウェア構成例を示すブロック図である。図3に示すように、画像処理装置10は、各種プログラムに基づき数値計算や情報処理を行うとともに、ハードウェア各部の制御を行う主制御部11を有している。主制御部11は、例えば、中央演算処理装置としてのCPU11aと、主制御部11が各種プログラムを実行する際のワークエリアとして機能するRAMなどのワークメモリ11bと、起動プログラムや初期化プログラムなどが格納されたROM,フラッシュROM,又はEEPROMなどのプログラムメモリ11cとを有している。
[Hardware configuration]
FIG. 3 is a block diagram illustrating a hardware configuration example of the image processing apparatus 10 according to the present embodiment. As shown in FIG. 3, the image processing apparatus 10 includes a main control unit 11 that performs numerical calculation and information processing based on various programs, and controls each part of the hardware. The main control unit 11 includes, for example, a CPU 11a as a central processing unit, a work memory 11b such as a RAM that functions as a work area when the main control unit 11 executes various programs, a startup program, an initialization program, and the like. And a program memory 11c such as a stored ROM, a flash ROM, or an EEPROM.

また、画像処理装置10は、上述した距離画像を生成するために、ワークに対して正弦波縞模様パターンを位相ずらして投影するための照明制御部12と、カメラ30での撮像により得られた画像データを取り込むASIC(Application Specific Integrated Circuit)などから構成される画像入力部13と、コンソール50からの操作信号が入力される操作入力部14と、液晶パネル等のモニタ40に対して画像を表示させる表示用DSPなどから構成される表示制御部15と、外部のPLC70やPC80などと通信可能に接続される通信部16と、エッジ検出や面積計算などの計測処理を実行する演算用DSPなどから構成される画像処理部17と、を有している。なお、画像入力部13には、画像データをバッファリングするためのフレームバッファが含まれていてもよく、画像処理部17には、計測処理用に画像データを記憶するメモリが含まれていてもよく、表示制御部15には、画像を表示させる際に画像データを一時記憶するVRAMなどのビデオメモリが含まれていてもよい。これらの各ハードウェアは、バスなどの電気的な通信路(配線)を介し、通信可能に接続されている。   In addition, the image processing apparatus 10 is obtained by imaging with the illumination control unit 12 for projecting the sine wave stripe pattern pattern with a phase shift on the work and the camera 30 in order to generate the above-described distance image. An image is displayed on an image input unit 13 composed of an ASIC (Application Specific Integrated Circuit) that captures image data, an operation input unit 14 that receives an operation signal from the console 50, and a monitor 40 such as a liquid crystal panel. A display control unit 15 composed of a display DSP, etc., a communication unit 16 communicably connected to an external PLC 70, PC 80, etc., and an arithmetic DSP that performs measurement processing such as edge detection and area calculation And an image processing unit 17 configured. The image input unit 13 may include a frame buffer for buffering image data, and the image processing unit 17 may include a memory for storing image data for measurement processing. The display control unit 15 may include a video memory such as a VRAM that temporarily stores image data when an image is displayed. These pieces of hardware are communicably connected via an electrical communication path (wiring) such as a bus.

主制御部11内のプログラムメモリ11cには、照明制御部12、画像入力部13、操作入力部14、表示制御部15、通信部16、及び画像処理部17の各部を、CPU11aのコマンド等により制御するための制御プログラムが格納されている。また、上述した処理順序プログラム、すなわち、PC80において生成され、PC80から転送されてきた処理順序プログラムは、プログラムメモリ11cに格納される。   In the program memory 11c in the main control unit 11, the illumination control unit 12, the image input unit 13, the operation input unit 14, the display control unit 15, the communication unit 16, and the image processing unit 17 are stored by commands of the CPU 11a. A control program for controlling is stored. The above-described processing order program, that is, the processing order program generated in the PC 80 and transferred from the PC 80 is stored in the program memory 11c.

通信部16は、外部のPLC70に接続されたセンサ(光電センサ等)でトリガ入力があったときに、PLC70から撮像トリガ信号を受信するインターフェース(I/F)として機能する。また、PC80から転送されてくる画像処理装置10の画像処理プログラムやモニタ40の表示態様を規定するレイアウト情報などを受信するインターフェース(I/F)としても機能する。   The communication unit 16 functions as an interface (I / F) that receives an imaging trigger signal from the PLC 70 when a trigger is input from a sensor (photoelectric sensor or the like) connected to the external PLC 70. It also functions as an interface (I / F) that receives the image processing program of the image processing apparatus 10 transferred from the PC 80, the layout information that defines the display mode of the monitor 40, and the like.

主制御部11のCPU11aは、通信部16を介してPLC70から撮像トリガ信号を受信すると、画像入力部13に対して撮像指令(コマンド)を送る。また、処理順序プログラムに基づいて、画像処理部17に対して、実行すべき画像処理を指示するコマンドを送信する。なお、撮像トリガ信号を生成する装置として、PLC70ではなく、光電センサなどのトリガ入力用のセンサを、通信部16に直接接続することができるようにしてもよい。   When receiving the imaging trigger signal from the PLC 70 via the communication unit 16, the CPU 11 a of the main control unit 11 sends an imaging command (command) to the image input unit 13. Further, a command for instructing image processing to be executed is transmitted to the image processing unit 17 based on the processing order program. In addition, as a device for generating an imaging trigger signal, a trigger input sensor such as a photoelectric sensor may be directly connected to the communication unit 16 instead of the PLC 70.

操作入力部14は、ユーザの操作に基づきコンソール50からの操作信号を受信するインターフェース(I/F)として機能する。モニタ40には、コンソール50を用いたユーザの操作内容が表示される。具体的に説明すると、コンソール50には、モニタ40上に表示されるカーソルを上下左右に移動させる十字キー、決定ボタン、又はキャンセルボタンなどの各部品が配置されており、これらの各部品を操作することによって、ユーザはモニタ40上で、画像処理の処理順序を規定するフローチャートを作成したり、各画像処理のパラメータ値を編集したり、或いは後述するように、基準検査領域の設定をしたり、特定パターンの検出条件の設定をしたりする。   The operation input unit 14 functions as an interface (I / F) that receives an operation signal from the console 50 based on a user operation. On the monitor 40, the user's operation content using the console 50 is displayed. More specifically, the console 50 is provided with various parts such as a cross key, a determination button, and a cancel button for moving the cursor displayed on the monitor 40 up, down, left, and right. As a result, the user creates a flowchart for defining the processing order of the image processing on the monitor 40, edits the parameter value of each image processing, or sets the reference inspection area as will be described later. Or setting detection conditions for a specific pattern.

画像入力部13は、画像データの取り込みを行う。具体的には、例えばCPU11aからカメラ30の撮像指令を受信すると、カメラ30に対して画像データ取り込み信号を送信する。そして、カメラ30で撮像が行われた後、撮像して得られた画像データを取り込む。取り込んだ画像データは、一旦バッファリング(キャッシュ)され、予め用意しておいた画像変数に代入される。なお、「画像変数」とは、数値を扱う通常の変数と異なり、対応する画像処理ユニットの入力画像として割り付けることで、計測処理や画像表示の参照先となる変数をいう。   The image input unit 13 takes in image data. Specifically, for example, when an imaging command for the camera 30 is received from the CPU 11 a, an image data capture signal is transmitted to the camera 30. And after image pick-up with camera 30, image data obtained by image pick-up is taken in. The captured image data is temporarily buffered (cached) and substituted for an image variable prepared in advance. The “image variable” is a variable that is a reference destination for measurement processing and image display by being assigned as an input image of a corresponding image processing unit, unlike a normal variable that handles numerical values.

画像処理部17は、画像データに対する計測処理を実行する。具体的には、まず画像入力部13が上述した画像変数を参照しつつ、フレームバッファから画像データを読み出して、画像処理部17内のメモリへ内部転送を行う。そして、画像処理部17は、そのメモリに記憶された画像データを読み出して、計測処理を実行する。   The image processing unit 17 performs a measurement process on the image data. Specifically, first, the image input unit 13 reads image data from the frame buffer while referring to the image variables described above, and performs internal transfer to the memory in the image processing unit 17. Then, the image processing unit 17 reads out the image data stored in the memory and executes measurement processing.

表示制御部15は、CPU11aから送られてきた表示指令(表示コマンド)に基づいて、モニタ40に対して所定画像(映像)を表示させるための制御信号を送信する。例えば、計測処理前又は計測処理後の画像データを表示するために、モニタ40に対して制御信号を送信する。また、表示制御部15は、コンソール50を用いたユーザの操作内容をモニタ40に表示させるための制御信号も送信する。   The display control unit 15 transmits a control signal for displaying a predetermined image (video) on the monitor 40 based on a display command (display command) sent from the CPU 11a. For example, a control signal is transmitted to the monitor 40 in order to display image data before or after the measurement process. The display control unit 15 also transmits a control signal for causing the monitor 40 to display the user's operation content using the console 50.

[機能構成]
図4は、本実施形態に係る画像処理装置10の機能構成例を示す図である。
[Function configuration]
FIG. 4 is a diagram illustrating a functional configuration example of the image processing apparatus 10 according to the present embodiment.

図4に示すように、画像処理装置10は、上述したCPU11aやプログラムメモリ11cに格納された各種プログラムなどによって、ソフトウェア的に、各手段を有する構成となっている。具体的には、画像処理装置10は、濃淡画像取得手段110と、距離算出手段120と、距離画像生成手段130と、検出条件設定受付手段140と、特定パターン検出手段150と、基準検査領域設定受付手段160と、検査領域特定手段170と、特徴量算出手段180と、判定手段190と、を有している。   As shown in FIG. 4, the image processing apparatus 10 is configured to have each means in terms of software by various programs stored in the CPU 11a and the program memory 11c described above. Specifically, the image processing apparatus 10 includes a grayscale image acquisition unit 110, a distance calculation unit 120, a distance image generation unit 130, a detection condition setting reception unit 140, a specific pattern detection unit 150, and a reference inspection area setting. A receiving unit 160, an inspection area specifying unit 170, a feature amount calculating unit 180, and a determining unit 190 are provided.

濃淡画像取得手段110は、各画素が、カメラ30の受光量に応じた濃淡値を有する濃淡画像を取得する手段である。例えば、図3に示す主制御部11及び画像入力部13等の機能によって具現化することができる。生成された濃淡画像は、上述した画像入力部13のフレームバッファに記憶してもよいし、他のメモリに記憶してもよい。距離算出手段120は、カメラ30から取得した画像を用いて、カメラ30からワーク表面までの距離を算出する手段であり、距離画像生成手段130は、各画素が、算出された距離に応じた濃淡値を有する距離画像を生成する手段である。例えば、図3に示す主制御部11並びに照明制御部12及び画像入力部13等によって具現化することができる。生成された距離画像は、上述した画像入力部13のフレームバッファに記憶してもよいし、他のメモリに記憶してもよい。また、位相シフト法を採用して距離画像を生成する本実施形態では、照明制御部12が、ワークに対して正弦波縞模様パターンを位相ずらして投影するように、照明60を制御し、画像入力部13が、それに応じて正弦波縞模様パターンの位相がずれた画像を複数枚撮像するように、カメラ30を制御する。そして、画像入力部13は、複数枚の画像から画素ごとに正弦波の位相を求め、求めた位相を利用して距離画像を生成する。   The grayscale image acquisition unit 110 is a unit that acquires a grayscale image in which each pixel has a grayscale value corresponding to the amount of light received by the camera 30. For example, it can be realized by the functions of the main control unit 11 and the image input unit 13 shown in FIG. The generated grayscale image may be stored in the frame buffer of the image input unit 13 described above, or may be stored in another memory. The distance calculation means 120 is a means for calculating the distance from the camera 30 to the workpiece surface using the image acquired from the camera 30, and the distance image generation means 130 is used for each pixel according to the calculated distance. A means for generating a distance image having a value. For example, it can be realized by the main control unit 11, the illumination control unit 12, the image input unit 13, and the like shown in FIG. 3. The generated distance image may be stored in the frame buffer of the image input unit 13 described above or may be stored in another memory. Further, in the present embodiment that employs the phase shift method to generate a distance image, the illumination control unit 12 controls the illumination 60 so as to project a sinusoidal fringe pattern with a phase shift on the work, and the image The input unit 13 controls the camera 30 so as to capture a plurality of images in which the phase of the sine wave stripe pattern is shifted accordingly. And the image input part 13 calculates | requires the phase of a sine wave for every pixel from several images, and produces | generates a distance image using the calculated | required phase.

なお、本実施形態では画像入力部13が距離画像の生成処理を行うようにしているが、例えば図3に示す主制御部11や画像処理部17などが距離画像の生成処理を担うこともできる。また、本実施形態では、濃淡画像取得手段110により濃淡画像を取得するカメラと、距離算出手段120によりワーク表面までの距離を算出するカメラとは、同一のカメラ30で構成している。これにより、同一ワークの同一領域について濃淡画像と距離画像を得ることができるので、濃淡画像全体と距離画像全体とを別途位置補正する必要がなく、計測処理の処理負荷を軽減することができる。仮に、濃淡画像取得手段110により濃淡画像を取得するカメラと、距離算出手段120によりワーク表面までの距離を算出するカメラとを別々のカメラで構成する場合には、これらのカメラ間の位置関係から、ワークの任意の箇所について、一方のカメラ画像上の位置と他方のカメラ画像上の位置との対応関係を求めておき、その対応関係を用いて位置補正(キャリブレーション補正)すればよい。また、本実施形態では、濃淡画像取得手段110と距離画像生成手段130を分けた機能構成としているが、一の画像取得手段又は一の画像生成手段という形で纏めることも勿論可能である。   In the present embodiment, the image input unit 13 performs the distance image generation process. However, for example, the main control unit 11 and the image processing unit 17 illustrated in FIG. 3 can also perform the distance image generation process. . In the present embodiment, the camera that acquires the grayscale image by the grayscale image acquisition unit 110 and the camera that calculates the distance to the workpiece surface by the distance calculation unit 120 are configured by the same camera 30. Thereby, since the gray image and the distance image can be obtained for the same region of the same work, it is not necessary to separately correct the position of the entire gray image and the entire distance image, and the processing load of the measurement process can be reduced. If the camera that acquires the grayscale image by the grayscale image acquisition unit 110 and the camera that calculates the distance to the workpiece surface by the distance calculation unit 120 are configured as separate cameras, from the positional relationship between these cameras. The correspondence between the position on one camera image and the position on the other camera image is obtained for an arbitrary part of the workpiece, and the position correction (calibration correction) may be performed using the correspondence. In this embodiment, the grayscale image acquisition unit 110 and the distance image generation unit 130 are separated from each other. However, it is of course possible to combine them in the form of one image acquisition unit or one image generation unit.

検出条件設定受付手段140は、ワークの検査範囲に相当する検査領域を特定するための特定パターンを検出するための検出条件の設定を受け付ける手段である。例えば、図3に示すモニタ40及び表示制御部15、コンソール50及び操作入力部14、及び主制御部11等の機能によって具現化することができる。本実施形態では、特定パターンとして、ワークを位置決めするためのアライメントマーク(十字マークなど)を想定する。ただし、本発明はこれに限られず、ワークの検査範囲に相当する検査領域を特定するためのパターンは全て含むものとする。具体的には、第2実施形態で後述するように、距離画像から抽出されたエッジを含むエッジパターンを想定することも可能である。特定パターンを検出するための検出条件としては、種々の条件が考えられる。例えば、前処理に用いるフィルタの種類(2値化フィルタ、膨張フィルタ、収縮フィルタ、平均化フィルタ、メディアンフィルタ、エッジ強調フィルタ、ソーベルフィルタ、ラプラシアンフィルタ、ガウシアンフィルタ等)や、検出に用いるしきい値としてのエッジ強度(階調変化)の大きさ(エッジ強度の上限や下限など)などが考えられる。また、本実施形態における検出条件には、特定パターンの少なくとも一部を含むように、ユーザにより設定されるパターン領域が含まれる(パターン領域の設定については後述する)。本実施形態では、この設定されたパターン領域において、上述した前処理のうちユーザ所望の前処理を施し(前処理の省略も可能である)、上述したエッジ強度に関する情報(エッジ強度の大きさやエッジ角度など)を検出条件として予め記憶する。このとき、特定パターンを表す特徴量とみなせるエッジ強度の上限や下限の値なども併せて記憶しておくことが好ましい。このように、本実施形態に係る画像処理装置10では、特定パターンを検出するために必要なエッジ強度等の情報を、検出条件として記憶するようにしているため、一般に容量の大きな画像データを記憶しておく必要がない。これにより、メモリ資源の有効活用(効率的に利用)することができる。なお、検出条件記憶手段に記憶される検出条件として画像データを記憶することも可能である。例えば、特定パターンを検出するための基準画像(予め画像処理装置に保存されている基準画像でもよいし、設定作業中に入力された基準画像でもよい)のデータを記憶しておいてもよい。すなわち、正規化相関演算により特定パターンを検出する場合には、正規化相関演算に用いる基準画像が必要になるため、所定の基準画像を検出条件として設定し、記憶しておくこともできる。適宜基準画像を読み出すことができれば、一度設定したパターン領域を自由に編集することができる。   The detection condition setting accepting unit 140 is a unit that accepts setting of a detection condition for detecting a specific pattern for specifying an inspection area corresponding to the inspection range of the workpiece. For example, it can be realized by the functions of the monitor 40 and the display control unit 15, the console 50 and the operation input unit 14, the main control unit 11, and the like shown in FIG. In the present embodiment, an alignment mark (such as a cross mark) for positioning the workpiece is assumed as the specific pattern. However, the present invention is not limited to this, and includes all patterns for specifying an inspection area corresponding to the inspection range of a workpiece. Specifically, as will be described later in the second embodiment, an edge pattern including an edge extracted from a distance image can be assumed. Various conditions can be considered as detection conditions for detecting the specific pattern. For example, the type of filter used for preprocessing (binarization filter, expansion filter, contraction filter, averaging filter, median filter, edge enhancement filter, Sobel filter, Laplacian filter, Gaussian filter, etc.) and the threshold used for detection The magnitude of the edge strength (gradation change) as a value (upper limit or lower limit of the edge strength) can be considered. Further, the detection condition in the present embodiment includes a pattern area set by the user so as to include at least a part of the specific pattern (the setting of the pattern area will be described later). In the present embodiment, user-desired preprocessing among the above-described preprocessing is performed on the set pattern area (the preprocessing can be omitted), and information on the above-described edge strength (the size of the edge strength and the edge Angle, etc.) are stored in advance as detection conditions. At this time, it is preferable to also store the upper and lower limit values of the edge strength that can be regarded as the feature amount representing the specific pattern. As described above, in the image processing apparatus 10 according to the present embodiment, information such as edge strength necessary for detecting a specific pattern is stored as a detection condition, so that generally large-capacity image data is stored. There is no need to keep it. As a result, the memory resources can be effectively utilized (utilized efficiently). Note that it is also possible to store image data as detection conditions stored in the detection condition storage means. For example, data of a reference image for detecting a specific pattern (which may be a reference image stored in advance in the image processing apparatus or may be a reference image input during a setting operation) may be stored. That is, when a specific pattern is detected by a normalized correlation calculation, a reference image used for the normalized correlation calculation is required. Therefore, a predetermined reference image can be set as a detection condition and stored. If the reference image can be read as appropriate, the pattern area once set can be freely edited.

図4に示すように、本実施形態に係る検出条件設定受付手段140は、距離画像生成手段130により生成された距離画像に対し、ユーザから検出条件の設定、すなわち上述した前処理の種類やエッジ強度の大きさなどを受け付けるようにしているが、もちろん、濃淡画像取得手段110により取得された濃淡画像に対して検出条件の設定を受け付けるようにすることもできる。また、例えば画像処理装置10において検出条件が固定されている場合には、ユーザから検出条件の設定を受け付けること、つまり検出条件設定受付手段140を省略することも可能である。   As shown in FIG. 4, the detection condition setting accepting unit 140 according to the present embodiment sets detection conditions from the user for the distance image generated by the distance image generating unit 130, that is, the above-described preprocessing type and edge. Although the magnitude of the intensity is received, it is of course possible to receive the setting of the detection condition for the gray image acquired by the gray image acquisition unit 110. For example, when the detection condition is fixed in the image processing apparatus 10, it is possible to accept the setting of the detection condition from the user, that is, to omit the detection condition setting accepting unit 140.

特定パターン検出手段150は、検出条件設定受付手段140により設定された検出条件に基づいて、濃淡画像上で特定パターンを検出する手段である。例えば、図3に示す主制御部11及び画像入力部13等の機能によって具現化することができる。   The specific pattern detection unit 150 is a unit that detects a specific pattern on the grayscale image based on the detection condition set by the detection condition setting reception unit 140. For example, it can be realized by the functions of the main control unit 11 and the image input unit 13 shown in FIG.

基準検査領域設定受付手段160は、濃淡画像取得手段110により取得された濃淡画像において、ワークの検査範囲に相当する検査領域を特定するための特定パターンと一定の相対位置関係にある基準検査領域の設定を受け付ける手段である。例えば、図3に示すモニタ40及び表示制御部15、コンソール50及び操作入力部14、及び主制御部11等の機能によって具現化することができる。基準検査領域が特定パターンと一定の相対位置関係にある、とは、例えば、濃淡画像上において左右にXピクセル、上下にYピクセルだけ離間しているとか、特定パターン(本実施形態では後述するようにパターン領域)に対して所定角度θ(一般には0度)だけ傾いている、といった相対位置関係である。つまり、本実施形態でいう相対位置関係には、X軸方向・Y軸方向の相対位置関係のみならず、相対角度関係も含まれている。   The reference inspection area setting receiving unit 160 includes a reference inspection area having a certain relative positional relationship with a specific pattern for specifying the inspection area corresponding to the inspection area of the workpiece in the grayscale image acquired by the grayscale image acquiring unit 110. It is a means for accepting settings. For example, it can be realized by the functions of the monitor 40 and the display control unit 15, the console 50 and the operation input unit 14, the main control unit 11, and the like shown in FIG. The reference inspection area has a certain relative positional relationship with the specific pattern. For example, the reference inspection area is separated by X pixels on the left and right and Y pixels on the top and bottom on the grayscale image, or the specific pattern (as will be described later in this embodiment). Relative to the pattern area) by a predetermined angle θ (generally 0 degrees). That is, the relative positional relationship in this embodiment includes not only the relative positional relationship in the X-axis direction and the Y-axis direction but also the relative angular relationship.

検査領域特定手段170は、特定パターン検出手段150により検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、ワークの検査範囲に相当する検査領域を特定する手段である。例えば、図3に示す主制御部11及び画像処理部17等の機能によって具現化することができる。本実施形態では、特定パターン検出手段150により検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、基準検査領域設定受付手段160により設定された基準検査領域を位置補正することにより、検査領域を特定するようにしている。なお、この検査領域の特定については、図5以降で更に詳しく説明する。   The inspection region specifying unit 170 is a unit that specifies an inspection region corresponding to the inspection range of the workpiece based on at least one of the position and the inclination angle of the specific pattern detected by the specific pattern detection unit 150. For example, it can be realized by the functions of the main control unit 11 and the image processing unit 17 shown in FIG. In the present embodiment, the position of the reference inspection area set by the reference inspection area setting receiving means 160 is corrected based on at least one of the position and the inclination angle of the specific pattern detected by the specific pattern detection means 150, thereby performing inspection. The area is specified. The specification of the inspection area will be described in more detail with reference to FIG.

特徴量算出手段180は、特定された検査領域から特徴量を算出する手段であり、判定手段190は、算出された特徴量に基づいて、ワークの良否を判定する手段である。これらは、例えば、図3に示す主制御部11及び画像処理部17等の機能によって具現化することができる。特徴量算出手段180による特徴量の算出には、様々なものが考えられ、例えば、検査領域内から(2値化等により)検出された計測対象の面積を計測する「エリア」、特定のパターンを検出する「パターンサーチ」、エッジの位置や幅を計測する「エッジ位置」や「エッジ幅」、濃淡変化によって傷を検出する「傷」、2値画像内で同一の濃度をもった画素の集合であるブロブの数・面積・重心位置などを計測する「ブロブ」などである。判定手段190は、算出された特徴量をもとに、例えば所定面積以上のブロブが存在しなかったらOK判定、逆に、所定面積以上のブロブが存在したらNG判定、というように、OK・NGの判定を行う。また、パターンマッチングにより特定のパターンが存在したらOK判定、逆に存在しなかったらNG判定を行う。判定結果は、通信部16により判定信号として外部機器(PLC70等)に出力される。   The feature amount calculation unit 180 is a unit that calculates a feature amount from the specified inspection region, and the determination unit 190 is a unit that determines the quality of the workpiece based on the calculated feature amount. These can be realized by, for example, functions of the main control unit 11 and the image processing unit 17 shown in FIG. There are various ways of calculating the feature amount by the feature amount calculation unit 180. For example, an “area” for measuring the area of the measurement target detected from the inspection region (by binarization or the like), a specific pattern "Pattern search" to detect edge, "Edge position" and "Edge width" to measure edge position and width, "Scratch" to detect scratches by shading change, For pixels with the same density in binary image “Blob” that measures the number, area, center of gravity, etc. of the blob that is a set. Based on the calculated feature value, for example, the determination unit 190 determines OK when there is no blob larger than a predetermined area, and NG determination when there is a blob larger than a predetermined area. Judgment is made. Further, if a specific pattern exists by pattern matching, OK determination is performed, and conversely, NG determination is performed if it does not exist. The determination result is output as a determination signal by the communication unit 16 to an external device (PLC 70 or the like).

[検査領域の特定]
図5〜図12は、本実施形態に係る画像処理装置10において検査領域が特定される様子に関する説明図である。なお、図5〜図12は、モニタ40に表示される画面の一部である。
[Specify inspection area]
5-12 is explanatory drawing regarding a mode that an inspection area | region is specified in the image processing apparatus 10 which concerns on this embodiment. 5 to 12 are a part of screens displayed on the monitor 40. FIG.

まず、図5〜図7を用いて、従来の濃淡画像のみを用いた従来の外観検査における検査領域の特定について説明する。図5に示すように、カメラ30を介して取得される濃淡画像には、十字マークからなるアライメントマークM1と、検査対象となる文字「ABC」とが存在している。ここでいうアライメントマークM1は、上述したいわゆる特定パターンの一例である。ユーザは、コンソール50を用いてアライメントマークM1を囲むようにパターン領域R1を設定する。また、計測対象となる文字「ABC」を囲むように基準となる検査領域、すなわち基準検査領域R2を設定する。このとき、基準検査領域R2は、パターン領域R1内のアライメントマークM1と一定の相対位置関係にあり、この相対位置関係は画像処理装置10(例えば主制御部11又は画像処理部17)に記憶される。なお、基準検査領域R2とパターン領域R1との相対的位置関係を一定としてもよい。   First, using FIG. 5 to FIG. 7, the specification of the inspection area in the conventional appearance inspection using only the conventional grayscale image will be described. As shown in FIG. 5, the grayscale image acquired via the camera 30 includes an alignment mark M <b> 1 composed of a cross mark and a character “ABC” to be inspected. The alignment mark M1 here is an example of the so-called specific pattern described above. The user uses the console 50 to set the pattern region R1 so as to surround the alignment mark M1. In addition, a reference inspection region, that is, a reference inspection region R2 is set so as to surround the character “ABC” to be measured. At this time, the reference inspection region R2 has a certain relative positional relationship with the alignment mark M1 in the pattern region R1, and this relative positional relationship is stored in the image processing apparatus 10 (for example, the main control unit 11 or the image processing unit 17). The The relative positional relationship between the reference inspection region R2 and the pattern region R1 may be constant.

次に、実際に画像処理装置10の運転中において、ワークの位置や姿勢がずれて、結果的に、濃淡画像上で「ABC」が図5に示す位置からずれる場合がある。このような場合であっても、アライメントマークM1が検出されれば、位置補正が可能となり、検査領域の特定が可能になる。例えば図6に示すように、濃淡画像上でワークが図の右上の方に平行移動したとしても、これに伴い右上の方に平行移動したアライメントマークM1(パターン領域R1’)の位置を検出して、検出したアライメントマークM1の位置に基づいて、基準検査領域R2を位置補正した検査領域R2’を特定することができる。また、例えば図7に示すように、濃淡画像上でワークが図の右の方に平行移動し、上の方に少し平行移動し、左回りに約20度回転したとしても、これに伴い移動したアライメントマークM1(パターン領域R1’’)の位置を検出して、検出したアライメントマークM1の傾斜角度に基づいて、基準検査領域R2を位置補正した検査領域R2‘’を特定することができる。   Next, during the operation of the image processing apparatus 10, the position and posture of the work may be shifted, and as a result, “ABC” may deviate from the position shown in FIG. 5 on the grayscale image. Even in such a case, if the alignment mark M1 is detected, the position can be corrected and the inspection area can be specified. For example, as shown in FIG. 6, even if the work is translated in the upper right direction in the figure on the grayscale image, the position of the alignment mark M1 (pattern region R1 ′) translated in the upper right direction is detected. Thus, based on the detected position of the alignment mark M1, the inspection region R2 ′ obtained by correcting the position of the reference inspection region R2 can be specified. Further, for example, as shown in FIG. 7, even if the work moves parallel to the right side of the figure on the grayscale image, moves slightly upward, and rotates counterclockwise by about 20 degrees, it moves accordingly. The position of the alignment mark M1 (pattern region R1 ″) detected can be detected, and the inspection region R2 ″ obtained by correcting the position of the reference inspection region R2 can be specified based on the detected inclination angle of the alignment mark M1.

しかし、アライメントマークM1が検出不可能なときには、検査領域の特定は困難になる。例えば図8に示すように、アライメントマークM1が凹凸で形成されているような場合である(説明の便宜上、凹凸で形成されたアライメントマークM1の輪郭部分を太い点線で示すが、実際は、図8に示す濃淡画像上にはアライメントマークM1は殆ど現れない)。この場合、例えば図8に示すようなパターン領域R1と基準検査領域R2を設定したとしても、画像処理装置10の運転中に、様々な位置に移動するアライメントマークM1の位置の傾斜角度を検出することができない。その結果、例えば図9に示すようにアライメントマークM1の位置や傾斜角度を検出できず、基準検査領域R2の位置補正を行うことができない。   However, when the alignment mark M1 cannot be detected, it is difficult to specify the inspection area. For example, as shown in FIG. 8, the alignment mark M1 is formed with unevenness (for convenience of explanation, the outline portion of the alignment mark M1 formed with unevenness is indicated by a thick dotted line. The alignment mark M1 hardly appears on the gray image shown in FIG. In this case, for example, even if the pattern region R1 and the reference inspection region R2 as shown in FIG. 8 are set, the inclination angle of the position of the alignment mark M1 that moves to various positions is detected during the operation of the image processing apparatus 10. I can't. As a result, for example, as shown in FIG. 9, the position and inclination angle of the alignment mark M1 cannot be detected, and the position of the reference inspection region R2 cannot be corrected.

そこで、本実施形態に係る画像処理装置10では、ユーザは、濃淡画像ではなく距離画像において、アライメントマークM1を囲むようにパターン領域R1を設定できるようになっている。図10〜図12を用いて、本実施形態に係る画像処理装置10において検査領域が特定される様子について説明する。   Therefore, in the image processing apparatus 10 according to the present embodiment, the user can set the pattern region R1 so as to surround the alignment mark M1 in the distance image instead of the grayscale image. The manner in which the inspection area is specified in the image processing apparatus 10 according to the present embodiment will be described with reference to FIGS.

図10に示すように、アライメントマークM1の輪郭部分が凹凸で形成されているような場合であっても、距離画像にはそれが明瞭に現れる。なぜなら、距離画像はワークとカメラ30との距離に応じた濃淡値を有するからである。図10では、アライメントマークM1の輪郭部分のうち凹みの箇所の色が薄くなっている。ユーザは、図10に示す距離画像において、コンソール50を用いてアライメントマークM1を囲むようにパターン領域R1を設定する。なお、計測対象となる文字「ABC」は、ワークに印字等されただけの平面形状からなる文字であり、凹凸形状の文字ではないため、距離画像には現れない。基準検査領域R2は、図8に示すように、文字「ABC」が明瞭に現れる濃淡画像において設定する。   As shown in FIG. 10, even when the contour portion of the alignment mark M1 is formed with irregularities, it clearly appears in the distance image. This is because the distance image has a gray value corresponding to the distance between the workpiece and the camera 30. In FIG. 10, the color of the recessed portion in the contour portion of the alignment mark M <b> 1 is lighter. In the distance image shown in FIG. 10, the user uses the console 50 to set the pattern region R1 so as to surround the alignment mark M1. Note that the character “ABC” to be measured is a character having a planar shape only printed on a workpiece and is not an uneven character, and therefore does not appear in the distance image. The reference inspection region R2 is set in a grayscale image in which the character “ABC” appears clearly as shown in FIG.

このような設定作業が完了した後、実際に画像処理装置10の運転を開始すると、図11に示すように、アライメントマークM1が明瞭に現れる距離画像を用いれば、このアライメントマークM1を検出することができる。そして、図10に示すアライメントマークM1と、図11に示す運転中に検出されたアライメントマークM1との位置および傾斜角度(の差)を計算することにより、画像処理装置10(画像処理部17)は、図8に示す基準検査領域R2をどれくらい位置補正すればよいか、また、どれくらい角度補正すればよいかを認識することができる。したがって、図12に示すように、今度は濃淡画像上で、位置補正された検査領域R2’’を特定することができる。なお、本実施形態では、図8において、図10に示すパターン領域R1の設定を行ったが、図8においてこれを行わなくてもよい。また逆に、図10において、図8に示す基準検査領域R2の設定を行っていないが、図10においてこれを行ってもよい。要は、少なくとも距離画像上でパターン領域の設定が行われ、少なくとも距離画像上で基準検査領域の設定が行われればよい。また、本実施形態では、パターン領域を設定する際にアライメントマークM1の全てを囲むように設定しているが、アライメントマークM1の一部を囲むように設定してもよい。   When the operation of the image processing apparatus 10 is actually started after such setting work is completed, the alignment mark M1 is detected by using a distance image in which the alignment mark M1 clearly appears as shown in FIG. Can do. Then, by calculating the position and inclination angle (difference) between the alignment mark M1 shown in FIG. 10 and the alignment mark M1 detected during the operation shown in FIG. 11, the image processing apparatus 10 (image processing unit 17). Can recognize how much the position of the reference inspection region R2 shown in FIG. 8 should be corrected and how much the angle should be corrected. Therefore, as shown in FIG. 12, the position-corrected inspection region R <b> 2 ″ can be specified this time on the grayscale image. In the present embodiment, the pattern region R1 shown in FIG. 10 is set in FIG. 8, but this need not be performed in FIG. Conversely, in FIG. 10, the reference inspection region R2 shown in FIG. 8 is not set, but this may be performed in FIG. In short, the pattern area should be set at least on the distance image, and the reference inspection area should be set at least on the distance image. Further, in the present embodiment, when setting the pattern region, it is set so as to surround all of the alignment marks M1, but may be set so as to surround a part of the alignment marks M1.

図13〜図19は、本実施形態に係る画像処理装置10においてモニタ40に表示されるユーザインターフェース画面の一例を示す図である。   13 to 19 are diagrams illustrating examples of user interface screens displayed on the monitor 40 in the image processing apparatus 10 according to the present embodiment.

図13に示すように、ウィンドウ名「設定0000」の内部には、設定の編集1001が表示されている。ユーザは、コンソール50を用いて「ウィンドウ」ボタンを選択すると、その右側に、「ウィンドウ追加」なる名称の更なるウィンドウが現れる。このウィンドウには、ウィンドウ番号1002と計測方法1003とが表示されている。ここでは、ウィンドウ番号1002として「000」、計測方法1003として「パターンサーチ」を選択し、その下方のOKボタンをクリックする。そうすると、図14に示すように、ウィンドウ番号「000」、ウィンドウ名「パターンサーチ」からなるウィンドウの詳細設定画面が現れる(この設定画面の上部バーには、「W000:パターンサーチ」と表示されている)。この詳細設定画面では、使用画像1006と、サーチ領域1007と、パターン領域1008と、前処理1009と、詳細設定1010のそれぞれについて、ユーザ所望の項目を選択できるようになっている。使用画像1006は、アライメントマークM1を検出するための検出条件を設定する際に使用する画像を意味しており、例えば、入力画像か登録画像かをチェックボックスにより選択可能となっている。なお、図14では登録画像にチェックが入っているが、これは、予め画像処理装置10に保存しておいた画像を使用する場合である。登録画像の保存は、設定の編集1001内の「画像登録」ボタンから行うことができる(設定方法の詳細は省略する)。使用画像として登録画像を用いれば、パターン領域やサーチ領域の設定だけでなく、一度設定したパターン領域やサーチ領域の編集を、後々に自由に行うことができる。一方、使用画像にチェックを入れた場合には、パターン領域やサーチ領域を設定しようとする度に、カメラ30から濃淡画像又は距離画像を取得しなければならないが、画像登録が不要になるため、メモリ資源を有効活用することができる。また、ユーザは、濃淡画像と登録画像をチェックボックスにより選択可能となっており、図14では、距離画像が選択されている。したがって、まずは、距離画像に関する設定を行うことになる。また、ユーザは、画像番号を選択することも可能となり、入力画像や登録画像が複数ある場合には、どの画像を使用画像1006とするかを選択できる。図14では、「000−2」が選択されているが、これは000番の登録画像を意味している。ハイフンより後の「2」は、登録画像が濃淡画像と距離画像のうちの距離画像であることを示している。サーチ領域1007とパターン領域1008については、後述する。前処理1009は、設定したパターン領域R1(図10参照)の中からアライメントマークM1の特徴量を抽出しやすくするための前処理である。例えば、上述した各種フィルタのうちどのフィルタを用いるか等である。ここでは「ガウシンフィルタ」を用いるように選択している。詳細設定1010は、その他の詳細な設定であり、例えば、上述したエッジ強度の大きさなどが挙げられる。   As shown in FIG. 13, a setting edit 1001 is displayed inside the window name “setting 0000”. When the user selects the “window” button using the console 50, a further window named “add window” appears on the right side of the button. In this window, a window number 1002 and a measurement method 1003 are displayed. Here, “000” is selected as the window number 1002 and “pattern search” is selected as the measurement method 1003, and the OK button below it is clicked. Then, as shown in FIG. 14, a window detailed setting screen including window number “000” and window name “pattern search” appears (“W000: pattern search” is displayed on the upper bar of this setting screen. ) On this detailed setting screen, items desired by the user can be selected for each of the use image 1006, the search area 1007, the pattern area 1008, the pre-processing 1009, and the detailed setting 1010. The use image 1006 means an image used when setting the detection condition for detecting the alignment mark M1, and for example, an input image or a registered image can be selected by a check box. In FIG. 14, the registered image is checked, but this is a case where an image stored in advance in the image processing apparatus 10 is used. The registered image can be saved from an “image registration” button in the setting editing 1001 (details of the setting method are omitted). If a registered image is used as the use image, not only the pattern area and search area can be set, but also the pattern area and search area once set can be freely edited later. On the other hand, when the use image is checked, every time an attempt is made to set a pattern area or a search area, a grayscale image or a distance image must be acquired from the camera 30, but image registration becomes unnecessary. Memory resources can be used effectively. In addition, the user can select a grayscale image and a registered image using check boxes, and a distance image is selected in FIG. Therefore, first, the setting related to the distance image is performed. In addition, the user can select an image number, and when there are a plurality of input images and registered images, the user can select which image is the use image 1006. In FIG. 14, “000-2” is selected, which means the 000th registered image. “2” after the hyphen indicates that the registered image is a distance image of the grayscale image and the distance image. The search area 1007 and the pattern area 1008 will be described later. The preprocessing 1009 is preprocessing for facilitating extraction of the feature amount of the alignment mark M1 from the set pattern region R1 (see FIG. 10). For example, which filter is used among the various filters described above. Here, the “gaussin filter” is selected to be used. The detailed setting 1010 is another detailed setting, and includes, for example, the size of the edge strength described above.

次に、図14において、サーチ領域1007とパターン領域1008にチェックを入れた状態でOKボタンをクリックすると、画面は図15に示す画面に切り替わる。サーチ領域1007は、上述した000番の登録画像(距離画像)のうち、アライメントマークM1のサーチ対象となる領域を示すものである。パターン領域1008は、アライメントマークM1の少なくとも一部を囲むように設定され、アライメントマークM1を検出するために設定される領域である。図15では、既にサーチ領域S1が設定され、アライメントマークM1の全部を囲むようにパターン領域R1(本実施形態では、「ウィンドウW000」と別称する)が設定されている。このようにしてサーチ領域1007とパターン領域1008の設定が終わり、OKボタンをクリックすると、上述したようにアライメントマークM1の特徴量を抽出するための処理が行われる。具体的には、主制御部11は、000番の登録画像のうちウィンドウW000の領域内で、例えば、ガウシアンフィルタのフィルタ処理を施してノイズを削減し、エッジ処理を施し、設定したエッジ強度を用いてエッジとみなすべき箇所を認識し、必要に応じてX方向又はY方向に投影処理を行い、処理結果をアライメントマークM1の特徴量としてワークメモリ11b等に記憶する。このように、本実施形態ではウィンドウW000内の画像データを記憶しておくのではなく、ウィンドウW000内にあるアライメントマークM1の特徴量を記憶している。これにより、使用メモリ容量を削減することができる。なお、ウィンドウW000内の画像データをワークメモリ11b等に記憶しておいても構わない。   Next, in FIG. 14, when the OK button is clicked with the search area 1007 and the pattern area 1008 checked, the screen is switched to the screen shown in FIG. A search area 1007 indicates an area to be searched for the alignment mark M1 in the above-described registered image No. 000 (distance image). The pattern region 1008 is a region that is set so as to surround at least a part of the alignment mark M1 and is set for detecting the alignment mark M1. In FIG. 15, the search area S1 has already been set, and the pattern area R1 (also referred to as “window W000” in the present embodiment) is set so as to surround the entire alignment mark M1. When the setting of the search area 1007 and the pattern area 1008 is completed in this way and the OK button is clicked, the process for extracting the feature amount of the alignment mark M1 is performed as described above. Specifically, the main control unit 11 performs, for example, Gaussian filter processing to reduce noise and perform edge processing in the area of the window W000 of the registered image of the number 000, and sets the set edge strength. The position to be regarded as an edge is recognized, projection processing is performed in the X direction or Y direction as necessary, and the processing result is stored in the work memory 11b or the like as the feature amount of the alignment mark M1. As described above, in this embodiment, the image data in the window W000 is not stored, but the feature amount of the alignment mark M1 in the window W000 is stored. Thereby, the used memory capacity can be reduced. Note that the image data in the window W000 may be stored in the work memory 11b or the like.

次に、再び図14において、今度は濃淡画像を選択し、上述同様、サーチ領域とパターン領域の設定を行う。例えば図16に示すように、検査対象となる「ABC」を囲むようにパターン領域R1(本実施形態では、「ウィンドウW001」と別称する)を設定する。これにより、このウィンドウW001で囲まれる領域が、基準検査領域となる。つまり、ユーザは、パターン領域R1を設定し、画像上にウィンドウを設定する作業を繰り返すことによって(結果的に、濃淡画像又は距離画像に複数枚のウィンドウを設定することによって)、特定パターンとしてのアライメントマークM1の特徴量を検出するための領域設定を行うこともできるし(図15のW000)、検査対象となる文字等を検出するための領域設定を行うこともできるようになっている(図16のW0001)。   Next, in FIG. 14 again, this time, the gray image is selected, and the search area and the pattern area are set as described above. For example, as shown in FIG. 16, a pattern region R1 (also referred to as “window W001” in this embodiment) is set so as to surround “ABC” to be inspected. Thereby, the area surrounded by the window W001 becomes the reference inspection area. In other words, the user sets the pattern region R1 and repeats the operation of setting a window on the image (as a result, by setting a plurality of windows in the grayscale image or the distance image), as a specific pattern. Region setting for detecting the feature amount of the alignment mark M1 can be performed (W000 in FIG. 15), or region setting for detecting a character or the like to be inspected can be performed (FIG. 15). (W0001 in FIG. 16).

次に、図17に示すように、設定の編集1001のうち位置補正を選択し、補正元1011と補正先1012のウィンドウを選択する。補正元1011は、位置補正をする際の基準となるウィンドウであり、補正先1012は、補正元1011のウィンドウを用いて位置補正の対象となるウィンドウである。図17では、補正元1011として、ウィンドウW000が選択され、補正先1012として、ウィンドウW0001が選択されている。また、ウィンドウW000とウィンドウW001の間には、X方向,Y方向,θ方向(回転方向)のいずれの方向に位置補正を施すかを選択するためのチェックボックスが表示されている。図17では、全てのチェックボックスにチェックが入っているため、水平方向の位置補正、傾斜角度の角度補正を行う設定となっている。   Next, as shown in FIG. 17, position correction is selected from the setting editing 1001, and correction source 1011 and correction destination 1012 windows are selected. The correction source 1011 is a window serving as a reference when performing position correction, and the correction destination 1012 is a window subjected to position correction using the window of the correction source 1011. In FIG. 17, the window W000 is selected as the correction source 1011 and the window W0001 is selected as the correction destination 1012. In addition, a check box for selecting whether to perform position correction in the X direction, the Y direction, or the θ direction (rotation direction) is displayed between the window W000 and the window W001. In FIG. 17, since all the check boxes are checked, it is set to perform horizontal position correction and inclination angle correction.

最後に、設定の編集1001のうち出力設定を選択し、その右方に表示された判定ウィンドウ1013において、判定対象とするウィンドウを選択する。つまり、設定したウィンドウW000とW001のうち、基準検査領域として扱うウィンドウを選択する。図18では、(濃淡画像上で設定された)ウィンドウW001を基準検査領域として選択している。なお、仮に、(距離画像上で設定された)ウィンドウW000を基準検査領域として選択すると、計測対象であった文字「ABC」がアライメントマークになり、アライメントマークM1が計測対象(検査対象)になる。なお、図13〜図18の右上には「設定中」1004の表示がなされており、これは、画像処理装置10の運転を開始する前の設定作業をしている最中であることを示す。つまり、画像処理装置10は、ユーザ又はPLC70などから外観検査に必要な各種設定作業を受け付ける設定機能と、ワークの良否を判定する運転機能とを併有する装置であるといえる。   Finally, an output setting is selected from the setting editing 1001, and a determination target window is selected in the determination window 1013 displayed on the right side. That is, the window to be handled as the reference inspection area is selected from the set windows W000 and W001. In FIG. 18, the window W001 (set on the gray image) is selected as the reference inspection area. If the window W000 (set on the distance image) is selected as the reference inspection area, the character “ABC” that was the measurement object becomes the alignment mark, and the alignment mark M1 becomes the measurement object (inspection object). . In the upper right of FIGS. 13 to 18, “setting” 1004 is displayed, which indicates that the setting work before starting the operation of the image processing apparatus 10 is being performed. . That is, it can be said that the image processing apparatus 10 is an apparatus that has both a setting function for accepting various setting operations necessary for appearance inspection from the user or the PLC 70 and a driving function for determining the quality of the workpiece.

図19は、本実施形態に係る画像処理装置10において、運転中にモニタ40に表示されるユーザインターフェース画面の一例を示す図である。図19の右上には、運転中1015の表示がなされている。この表示がなされているときは、画像処理装置10は、生産ラインを高速で流れてくるワークをカメラ30により撮像し、距離画像を生成し、検査領域を特定(位置補正)し、各種計測処理を行う、という一連の処理を、複数のワークに対して例えば数十ms間隔で高速に行っている。なお、例えばコンソール50の切り替えスイッチ(図示せず)を押すことによって、或いは、PLC70等から外部信号を受信することによって、設定中1004の表示がなされる設定モードから、運転中1015の表示がなされる運転モードに切り替えることができる。   FIG. 19 is a diagram illustrating an example of a user interface screen displayed on the monitor 40 during driving in the image processing apparatus 10 according to the present embodiment. In the upper right of FIG. 19, “1015 during operation” is displayed. When this display is made, the image processing apparatus 10 captures a workpiece flowing at a high speed on the production line with the camera 30, generates a distance image, specifies an inspection region (position correction), and performs various measurement processes. A series of processes of performing the above are performed at high speed, for example, at intervals of several tens of ms for a plurality of works. In addition, for example, by pressing a changeover switch (not shown) of the console 50 or by receiving an external signal from the PLC 70 or the like, the display 1015 during operation is displayed from the setting mode in which the setting 1004 is displayed. The operation mode can be switched.

図19に示すように、左上には設定番号が表示され、その下方には、計測回数、NG回数、計測時間、トリガ間隔、判定ウィンドウ1013が表示されている。この判定ウィンドウ1013は、W001に設定されており、図18を用いて設定したウィンドウである。画面上の中央から右下にかけて、カメラ30から取得される濃淡画像が表示されている。一方、生成された距離画像は表示されていないが、裏でアライメントマークM1の検出が行われ、検出したアライメントマークM1の位置や傾斜角度に基づいて、基準検査領域R2の位置補正が行われ、検査領域R2’’が特定される。このようにして、本実施形態に係る画像処理装置10によれば、安定的に検査領域を特定することが可能になる。   As shown in FIG. 19, a setting number is displayed at the upper left, and a measurement number, an NG number, a measurement time, a trigger interval, and a determination window 1013 are displayed below the setting number. This determination window 1013 is set to W001 and is a window set using FIG. A grayscale image acquired from the camera 30 is displayed from the center to the lower right on the screen. On the other hand, the generated distance image is not displayed, but the alignment mark M1 is detected on the back side, and the position of the reference inspection region R2 is corrected based on the detected position and inclination angle of the alignment mark M1, The inspection area R2 ″ is specified. In this way, according to the image processing apparatus 10 according to the present embodiment, it is possible to stably specify the inspection region.

なお、図19では、濃淡画像のみを表示させる表示態様にしているが、表示切替1014のボタンを操作する等により、濃淡画像と距離画像とを一画面中に分割表示させる表示態様にしてもよい。或いは、表示切替1014のボタン操作により、濃淡画像と距離画像の表示が交互に切り替わるような構成にしてもよい。また、ここではW000もW001も検査方法はパターンサーチとしているが、例えばW000は傷検査にしてもよい。   In FIG. 19, only the grayscale image is displayed. However, the grayscale image and the distance image may be displayed separately in one screen by operating the display switching 1014 button or the like. . Alternatively, the display of the grayscale image and the distance image may be switched alternately by the button operation of the display switching 1014. Here, the inspection method for both W000 and W001 is a pattern search, but W000 may be a scratch inspection, for example.

図20は、本実施形態に係る画像処理装置10の処理動作を示すフローチャートである。   FIG. 20 is a flowchart showing the processing operation of the image processing apparatus 10 according to the present embodiment.

図20に示すように、濃淡画像取得手段110によって濃淡画像の取得処理(ステップS1)が行われる一方で、距離算出手段120及び距離画像生成手段130によって距離画像の生成処理(ステップS2)が行われる。本フローチャートでは同時平行して行うようにしているが、例えば濃淡画像の取得処理をした後に距離画像を生成するなど、シリアル処理にしても構わない。   As shown in FIG. 20, the grayscale image acquisition unit 110 performs the grayscale image acquisition process (step S1), while the distance calculation unit 120 and the distance image generation unit 130 perform the distance image generation process (step S2). Is called. In this flowchart, the processing is performed simultaneously in parallel, but serial processing may be performed, for example, a distance image is generated after a grayscale image acquisition process.

次いで、特定パターン検出手段150により特定パターンの検出が行われる(ステップS3)。本実施形態では、検出条件設定受付手段140により設定された検出条件(パターン領域やエッジ強度など)に従って(図14、図15参照)、特定パターンが検出される。   Next, the specific pattern is detected by the specific pattern detecting means 150 (step S3). In the present embodiment, the specific pattern is detected according to the detection conditions (pattern region, edge strength, etc.) set by the detection condition setting receiving unit 140 (see FIGS. 14 and 15).

次いで、検査領域特定手段170により検査領域の特定が行われる(ステップS4)。本実施形態では、基準検査領域設定受付手段160によって設定された基準検査領域とアライメントマークM1とに従って(図16参照)、検査領域が特定される。すなわち、本実施形態では、基準検査領域設定受付手段160によって設定された基準検査領域が、ステップS150で検出された特定パターン(アライメントマークM1)の位置や傾斜角度に基づいて位置補正・角度補正される。   Next, the inspection area is specified by the inspection area specifying means 170 (step S4). In the present embodiment, the inspection region is specified according to the reference inspection region set by the reference inspection region setting receiving unit 160 and the alignment mark M1 (see FIG. 16). That is, in this embodiment, the reference inspection area set by the reference inspection area setting receiving unit 160 is position-corrected and angle-corrected based on the position and inclination angle of the specific pattern (alignment mark M1) detected in step S150. The

そして、特徴量算出手段180により特徴量の算出が行われ(ステップS5)、判定手段190によりワークの良否判定が行われ(ステップS6)、一連の処理が終了する。このような一連の処理を、生産ラインを流れてくるワークの一つ一つに対して行う。すなわち、図20に示す処理動作は、所定の間隔(例えば数十ms)で高速に繰り返し実行される。   Then, the feature amount calculation unit 180 calculates the feature amount (step S5), the determination unit 190 determines the quality of the workpiece (step S6), and the series of processing ends. Such a series of processing is performed for each workpiece flowing through the production line. That is, the processing operation shown in FIG. 20 is repeatedly executed at a high speed at a predetermined interval (for example, several tens of ms).

以上説明したように、例えば特定パターンとしてのアライメントマークM1がプレスによる僅かな凹凸で構成されるような場合であっても(図8参照)、その凹凸の検出が可能な距離画像において、アライメントマークM1を検出することができるので(図19参照)、検出されたアライメントマークM1の位置及び傾斜角度の少なくとも一方に基づいて、濃淡画像上で検査領域を特定することができ、ひいては安定的に検査領域を特定することができる。   As described above, for example, even when the alignment mark M1 as the specific pattern is configured by slight unevenness by pressing (see FIG. 8), the alignment mark can be detected in the distance image where the unevenness can be detected. Since M1 can be detected (see FIG. 19), the inspection area can be specified on the grayscale image based on at least one of the position and the inclination angle of the detected alignment mark M1, and thus stably inspected. An area can be specified.

[変形例]
上述した実施形態では、アライメントマークM1がプレスによる僅かな凹凸で構成されることにより、アライメントマークM1を濃淡画像上で検出できない例について説明したが、例えば図21に示すように、アライメントマークM2を距離画像上で検出できないケースも考えられる。図21は、図4に示す機能構成において濃淡画像取得手段110と距離算出手段120及び距離画像生成手段130とを入れ替えたときのアプリケーション具体例を示す図である。具体的には、図21(a)に示すように、アライメントマークM2がワークの左端に(凹凸を無視できる程度で)印字されており、ワークの中央付近には、(正しい位置に形成されているか否かの)検査対象となる4個の凸部が形成されている。このようなワークの濃淡画像では、図21(b)に示すように、アライメントマークM2は明瞭に現れる一方、4個の凸部は明瞭に現れない。しかし、図21(c)に示すように、距離画像では、アライメントマークM2は全く現れないが、4個の凸部は明瞭に現れる。したがって、図21(b)に示す濃淡画像において、図15を用いて説明したようなパターン領域R1を設定し、図21(c)に示す距離画像において、図16を用いて説明したような基準検査領域R2−1〜R2−4を設定する。これにより、画像処理装置10の運転中に、ワークの位置がずれたとしても、濃淡画像からアライメントマークM2を検出し、検出したアライメントマークM2に基づいて、基準検査領域R2−1〜R2−4の位置を補正することができる。
[Modification]
In the above-described embodiment, an example in which the alignment mark M1 cannot be detected on the grayscale image because the alignment mark M1 is configured by slight unevenness by pressing has been described. For example, as illustrated in FIG. There may be a case where it cannot be detected on the distance image. FIG. 21 is a diagram showing a specific application example when the grayscale image acquisition unit 110, the distance calculation unit 120, and the distance image generation unit 130 are replaced in the functional configuration shown in FIG. Specifically, as shown in FIG. 21A, the alignment mark M2 is printed on the left end of the workpiece (to an extent that the unevenness can be ignored), and is formed at the correct position near the center of the workpiece. There are four convex portions to be inspected (whether or not they are present). In such a gray image of the workpiece, as shown in FIG. 21B, the alignment mark M2 appears clearly, but the four convex portions do not appear clearly. However, as shown in FIG. 21C, in the distance image, the alignment mark M2 does not appear at all, but the four convex portions appear clearly. Accordingly, in the grayscale image shown in FIG. 21B, the pattern region R1 as described with reference to FIG. 15 is set, and in the distance image shown in FIG. 21C, the reference as described with reference to FIG. Inspection areas R2-1 to R2-4 are set. Thereby, even if the position of the workpiece is shifted during the operation of the image processing apparatus 10, the alignment mark M2 is detected from the grayscale image, and the reference inspection areas R2-1 to R2-4 are based on the detected alignment mark M2. Can be corrected.

次に、上述した実施形態ではワークにアライメントマークが形成されていたが、本発明はこれに限られず、他の変形例として、ワークにアライメントマークが形成されていない場合も想定される。図22には、アライメントマークを用いずに検査領域を特定するアプリケーション具体例を示す図である。具体的には、図22(a)に示すように、上段と下段からなるワークにおいて、上段に検査対象となる文字「ABC」が(凹凸を無視できる程度で)印字されているものとする。このようなワークの濃淡画像では、図22(b)に示すように、文字「ABC」が明瞭に現れる一方、上段と下段の段差部分は現れない(段差に起因する影などの影響は無視するものとする。また、図22(b)中のR2は、濃淡画像に重ねて表示した基準検査領域を示すウィンドウであり、段差部分が画像として現れているわけではない)。一方で、距離画像では、図22(c)に示すように、上段と下段の段差部分が画像の濃淡として明瞭に現れる。したがって、図15を用いて説明したようなパターン領域R1を予め設定しておかなくても、図22(c)に示す距離画像においてエッジ抽出し、抽出されたエッジを含むパターンをエッジパターンR1とし、図22(b)に示す濃淡画像上で、このエッジパターンR1に対応する領域を生成することによって、検査領域R2を特定することも可能である。要は、上述した実施形態のように、予め設定した基準検査領域を位置補正するのではなく、抽出されたエッジパターンに基づいて対応領域を生成することによって、検査領域を特定することも可能である。   Next, although the alignment mark is formed on the workpiece in the above-described embodiment, the present invention is not limited to this, and a case where the alignment mark is not formed on the workpiece is assumed as another modification. FIG. 22 is a diagram illustrating a specific example of an application that specifies an inspection region without using an alignment mark. Specifically, as shown in FIG. 22A, it is assumed that the character “ABC” to be inspected is printed on the upper stage (to the extent that the unevenness can be ignored) in the upper and lower works. In such a gray-scale image of the work, as shown in FIG. 22B, the character “ABC” appears clearly, but the upper and lower step portions do not appear (the influence of shadows and the like due to the step is ignored). In addition, R2 in Fig. 22B is a window indicating the reference inspection area displayed superimposed on the grayscale image, and the stepped portion does not appear as an image). On the other hand, in the distance image, as shown in FIG. 22C, the upper and lower step portions appear clearly as light and shade of the image. Therefore, even if the pattern region R1 described with reference to FIG. 15 is not set in advance, edge extraction is performed on the distance image shown in FIG. 22C, and a pattern including the extracted edge is defined as the edge pattern R1. It is also possible to specify the inspection region R2 by generating a region corresponding to the edge pattern R1 on the grayscale image shown in FIG. In short, it is also possible to specify the inspection area by generating the corresponding area based on the extracted edge pattern, instead of correcting the position of the preset reference inspection area as in the above-described embodiment. is there.

図23は、本実施形態に係る画像処理装置10の別の機能構成例を示す図である。なお、図4と主に異なるところは、エッジ検出手段200が存在することである。   FIG. 23 is a diagram illustrating another functional configuration example of the image processing apparatus 10 according to the present embodiment. The main difference from FIG. 4 is that the edge detection means 200 exists.

エッジ検出手段200は、図23においては距離画像からエッジを抽出する手段である。この際、エッジ抽出条件としてエッジ強度等が挙げられるが、検出条件設定受付手段140により設定された検出条件を用いることが可能である。もちろん、予めエッジ抽出条件を画像処理装置10に記憶させておくことで、ユーザが検出条件設定受付手段140を通じて検出条件を設定する手間を省いてもよい。   The edge detection means 200 is a means for extracting an edge from a distance image in FIG. In this case, the edge extraction condition includes edge strength and the like, but the detection condition set by the detection condition setting receiving unit 140 can be used. Of course, by storing the edge extraction conditions in the image processing apparatus 10 in advance, it is possible to save the user from setting the detection conditions through the detection condition setting receiving unit 140.

検査領域特定手段170は、エッジ検出手段により検出されたエッジを含むエッジパターンR1の位置と傾斜角度の少なくとも一方に基づいて、濃淡画像上でエッジパターンに対応する領域R2を生成する。これにより、検査領域R2を特定することが可能になる。このように、基準検査領域の設定を省いた上で、検査領域を安定的に特定することも可能である。   The inspection region specifying unit 170 generates a region R2 corresponding to the edge pattern on the grayscale image based on at least one of the position and the inclination angle of the edge pattern R1 including the edge detected by the edge detecting unit. This makes it possible to specify the inspection region R2. As described above, it is also possible to stably specify the inspection area without setting the reference inspection area.

図24は、図23に示す機能構成に基づいて、基準検査領域設定受付手段160により基準検査領域が設定されることなく、また、検出条件設定受付手段140により検出条件のうちパターン領域が設定されることなく、検査領域が特定される(検査領域が生成される)様子を示すアプリケーション具体例(外観検査例)である。   In FIG. 24, based on the functional configuration shown in FIG. 23, the reference inspection area setting receiving unit 160 does not set the reference inspection area, and the detection condition setting receiving unit 140 sets the pattern area of the detection conditions. It is an application specific example (appearance inspection example) showing a state in which an inspection region is specified (inspection region is generated) without any inspection.

図24(a)に示すように、ワークが上段面A1と下段面A2からなる二段の平面を有する場合において、上段面A1にも下段面A2にも汚れが付着しているが、上段面A1に汚れが付着しているか否かのみの外観検査を行いたいとする(すなわち、下段面A2に汚れが付着することは許容する外観検査を行いたいとする)。このような場合において、図24(b)に示すように、ワークの濃淡画像には、汚れが2箇所付着していることが明瞭に現れる一方、図24(c)に示すように、ワークの距離画像には、汚れが付着していることは全く現れない。その代わり、上段面A1と下段面A2とが濃淡の差により明瞭に現れる。仮に、図24(d)のように、ワークが位置ずれし、濃淡画像上において上段面A1の位置が右上の方に移動した場合には、当然のことながら、図24(e)に示すように、距離画像においても上段面A1の位置が右上に移動する。   As shown in FIG. 24 (a), when the work has a two-step plane composed of the upper step surface A1 and the lower step surface A2, dirt is attached to both the upper step surface A1 and the lower step surface A2. It is desired to perform an appearance inspection only for whether or not dirt is attached to A1 (that is, to perform an appearance inspection that allows the dirt to adhere to lower surface A2). In such a case, as shown in FIG. 24B, it can be clearly seen that two spots of dirt are attached to the gray image of the work, whereas as shown in FIG. The distance image does not show any contamination. Instead, the upper surface A1 and the lower surface A2 appear clearly due to the difference in shading. As shown in FIG. 24D, if the workpiece is displaced as shown in FIG. 24D and the position of the upper step surface A1 moves toward the upper right on the grayscale image, as shown in FIG. In addition, the position of the upper surface A1 also moves to the upper right in the distance image.

したがって、図22及び図23を用いて説明したように、距離画像からエッジを検出し、抽出されたエッジに基づくエッジパターンの位置及び傾斜角度に基づいて、濃淡画像上でエッジパターンに対応する領域を生成することにより、図24(f)に示すように、検査領域R3を安定的に特定することができる。検査領域R3を安定的に特定できれば、例えば上述したブロブ演算等、検査領域R3内で特徴量算出処理を行うことによって、上段面A1に汚れが付着しているか否かのみの外観検査を行うことができる。なお、ここでは、距離画像からエッジを検出するようにしたが、濃淡画像からエッジを検出するような構成であってもよいことは勿論である。   Therefore, as described with reference to FIGS. 22 and 23, the edge is detected from the distance image, and the region corresponding to the edge pattern on the grayscale image based on the position and the inclination angle of the edge pattern based on the extracted edge. As shown in FIG. 24F, the inspection region R3 can be identified stably. If the inspection area R3 can be identified stably, for example, by performing the feature amount calculation process in the inspection area R3 such as the blob calculation described above, the appearance inspection is performed only on whether or not the upper surface A1 is contaminated. Can do. Although the edge is detected from the distance image here, it is needless to say that the edge may be detected from the grayscale image.

ここで、距離画像又は濃淡画像からエッジパターンを生成する方法の一例について、図25を用いて説明する。図25は、距離画像又は濃淡画像からエッジパターンを生成する方法の一例について説明するための説明図である。   Here, an example of a method for generating an edge pattern from a distance image or a grayscale image will be described with reference to FIG. FIG. 25 is an explanatory diagram for describing an example of a method for generating an edge pattern from a distance image or a grayscale image.

図25(a)に示すように、画像上でエッジ検出領域E1〜E4の設定を行う。このエッジ検出領域は、検出条件設定受付手段140を通じて、ユーザがエッジを含むと思う領域にウィンドウを設定する。その結果、エッジ検出領域E1〜E4の位置情報などは、検出条件の中に含まれる。画像処理装置10の運転時において、図25(b)に示すように、エッジ検出領域E1〜E4においてエッジが検出され、検出されたエッジを基にして4本からなるエッジを含む直線が推定される(図25(c))。そして、これら4本の直線に基づく四角枠をエッジパターンにすることができる(図25(d))。このようにして、エッジパターンを生成することができる。なお、図24のアプリケーション例では、図24(e)に示す距離画像から生成されたエッジパターンの内部の画像領域を外観検査の検査対象としたが、例えば、図24(e)に示す距離画像から生成されたエッジパターンの外部の画像領域を外観検査の検査対象としてもよい。この場合、ワークの下段面に汚れが付着しているか否かを外観検査することができる。   As shown in FIG. 25A, the edge detection areas E1 to E4 are set on the image. In the edge detection area, a window is set in an area that the user thinks includes an edge through the detection condition setting reception unit 140. As a result, the position information of the edge detection areas E1 to E4 is included in the detection conditions. During operation of the image processing apparatus 10, as shown in FIG. 25B, edges are detected in the edge detection areas E1 to E4, and a straight line including four edges is estimated based on the detected edges. (FIG. 25C). A square frame based on these four straight lines can be used as an edge pattern (FIG. 25D). In this way, an edge pattern can be generated. In the application example of FIG. 24, the image area inside the edge pattern generated from the distance image shown in FIG. 24E is the inspection target of the appearance inspection. For example, the distance image shown in FIG. An image area outside the edge pattern generated from the above may be used as an inspection target for appearance inspection. In this case, it is possible to inspect whether or not dirt is attached to the lower surface of the work.

図26は、濃淡画像と距離画像の両方を用いた外観検査を行うアプリケーション例である。より具体的には、ボールグリッドアレイ(BGA)の外観検査を行う例である。図26(a)は、BGAの濃淡画像であり、図26(b)は、BGAの距離画像である。図26(a)に示すように、濃淡画像には、ワークの左上にアライメントマーク(十字)が明瞭に現れている一方で、図26(b)に示すように、距離画像には、アライメントマークが明瞭に現れていない。これはアライメントマークが平面形状の十字マークだからである。このような場合には、図26(c)に示すように、濃淡画像を用いてアライメントマークの座標(x,y)を検出する。そして、上述した各実施例で検査領域を特定したように、BGAの各凸部を検査領域と考えた場合、BGAの各凸部の座標位置を座標(x,y)に基づき補正することができる。そして、補正されたBGAの凸部の座標位置を(x,y)としたとき、(x,y)−(x,y)=(x,y)を算出するとともに、距離画像から、座標位置(x,y)における濃淡値に基づいて凸部の高さzを算出する。そして、算出された(x,y)と高さzが所定の範囲内に収まっていれば、ワーク良品と判定する。このように、濃淡画像と距離画像の双方を用いて、安定的に検査領域の位置補正を行うとともに、BGAの各凸部の位置が正しい位置にあり、かつ、正しい高さにあるか否か、といった特殊な外観検査を行うことが可能になる。 FIG. 26 is an example of an application that performs an appearance inspection using both a grayscale image and a distance image. More specifically, this is an example in which an appearance inspection of a ball grid array (BGA) is performed. FIG. 26A is a BGA grayscale image, and FIG. 26B is a BGA distance image. As shown in FIG. 26 (a), an alignment mark (cross) appears clearly in the upper left corner of the work in the grayscale image, while in the distance image, the alignment mark appears in the grayscale image. Does not appear clearly. This is because the alignment mark is a planar cross mark. In such a case, as shown in FIG. 26C, the coordinates (x p , y p ) of the alignment mark are detected using the grayscale image. Then, as specifying the inspection area in each embodiment described above, when considering an inspection area of each convex portion of the BGA, the correction is based on the coordinate positions of the respective convex portions of the BGA coordinates (x p, y p) in be able to. When the coordinate position of the corrected convex part of the BGA is (x b , y b ), (x b , y b ) − (x p , y p ) = (x 0 , y 0 ) is calculated. At the same time, the height z of the convex portion is calculated from the distance image based on the gray value at the coordinate position (x b , y b ). If the calculated (x 0 , y 0 ) and the height z are within a predetermined range, it is determined that the workpiece is non-defective. In this way, the position of the inspection area is stably corrected using both the grayscale image and the distance image, and whether or not each convex portion of the BGA is at the correct position and at the correct height. It becomes possible to perform a special appearance inspection such as.

このように、本実施形態に係る画像処理装置10によれば、濃淡画像と距離画像の双方を用いた外観検査も可能になる。なお、例えば濃淡画像と距離画像のいずれの特徴量を用いて外観検査を行うかの選択を行うことができるようにしてもよい。図27は、特徴量算出手段180によって第一及び第二の特徴量が算出され、これらのうち少なくとも一方を用いるための選択画面の一例を示す図である(例えばモニタ40でコンソール50を用いて選択可能としてもよい)。図27に示すように、ウィンドウW000から得られる特徴量に基づく判定がOKで、ウィンドウW001から得られる特徴量に基づく判定がOKのとき、OK判定を出すか(図27の上から2段目)、ウィンドウW000から得られる特徴量に基づく判定がOKで、ウィンドウW001から得られる特徴量に基づく判定がNGのとき、OK判定を出すか(図27の上から3段目)、ウィンドウW000から得られる特徴量に基づく判定がNGで、ウィンドウW001から得られる特徴量に基づく判定がOKのとき、OK判定を出すか(図27の上から4段目)、をユーザが選択できるようにしてもよい。   As described above, according to the image processing apparatus 10 according to the present embodiment, it is possible to perform an appearance inspection using both a grayscale image and a distance image. It should be noted that, for example, it may be possible to select which of the grayscale image and the distance image is used for the appearance inspection. FIG. 27 is a diagram illustrating an example of a selection screen for calculating at least one of the first and second feature amounts by the feature amount calculation unit 180 (for example, using the console 50 on the monitor 40). Selectable). As shown in FIG. 27, when the determination based on the feature value obtained from the window W000 is OK and the determination based on the feature value obtained from the window W001 is OK, whether the OK determination is issued (second step from the top in FIG. 27). ) When the determination based on the feature value obtained from the window W000 is OK and the determination based on the feature value obtained from the window W001 is NG, whether to make an OK determination (third stage from the top in FIG. 27) or from the window W000 When the determination based on the obtained feature quantity is NG and the judgment based on the feature quantity obtained from the window W001 is OK, the user can select whether to issue the OK judgment (fourth row from the top in FIG. 27). Also good.

つまり、検査領域特定手段170が、濃淡画像と距離画像の両方の画像において、特定パターン検出手段150により検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、検査領域を特定し、特徴量算出手段180が、濃淡画像及び距離画像において特定された検査領域から、それぞれ第一及び第二の特徴量を算出し、判定手段190が、第一及び第二の特徴量のうち少なくとも一方に基づいて、ワークの良否を判定するようにしてもよい。   That is, the inspection region specifying unit 170 specifies the inspection region based on at least one of the position and the inclination angle of the specific pattern detected by the specific pattern detection unit 150 in both the grayscale image and the distance image. The amount calculation unit 180 calculates the first and second feature amounts from the inspection regions specified in the grayscale image and the distance image, respectively, and the determination unit 190 sets at least one of the first and second feature amounts. Based on this, the quality of the workpiece may be determined.

特に、上述したように第一及び第二の特徴量に基づいてワークの良否を判定するようにすれば、特殊な外観検査が可能になる。図26とは別の例について説明する。   In particular, if the quality of the workpiece is determined based on the first and second feature amounts as described above, a special appearance inspection can be performed. An example different from FIG. 26 will be described.

例えば、ワークの多少の凹みは許容するが(OK判定にしたい)、ワークの汚れは許容しない(NG判定にしたい)、という特殊な外観検査を考えた場合に、濃淡画像のみを用いた外観検査では、凹み部分に生じる影の影響で、実際には凹み部分は汚れていなくても濃淡画像上でその凹み部分に汚れが付着しているように見えるときがある。このとき、濃淡画像上で特定された検査領域から算出した第一の特徴量(例えば暗い部分の面積など)だけでは、実際に汚れている部分のみならず、上述した凹み部分もNG判定となってしまい、ワークの多少の凹みを許容することができない。一方で、距離画像上で特定される検査領域から算出した第二の特徴量(例えば暗い部分の面積など)だけでは、そもそもワークの汚れをNG判定にすることができない。そこで、本実施形態に係る画像処理装置10によれば、濃淡画像上で特定された検査領域から算出した第一の特徴量に基づいて、NG判定の要因となる検査領域内の一又は複数の第一特定箇所(つまり汚れている箇所)を抽出するとともに、距離画像上で特定される検査領域から算出した第二の特徴量に基づいて、NG判定の要因となる検査領域内の位置又は複数の第二特定箇所(つまり凹んでいる箇所)を抽出することができる。したがって、第一特定箇所から第二特定箇所を差し引いてもなお第一特定箇所が残る場合には、その残った第一特定箇所は汚れてはいるが凹んではいない箇所となるため、このような第一特定箇所が存在する場合にNG判定とすることにより、ワークの多少の凹みは許容するが(OK判定にしたい)、ワークの汚れは許容しない(NG判定にしたい)、という外観検査を行うことができる。   For example, when considering a special appearance inspection that allows some dents in the workpiece (I want to make an OK determination) but does not allow contamination of the workpiece (I want to make an NG decision), an appearance inspection using only a gray image Then, due to the influence of the shadow generated in the dent portion, even if the dent portion is not actually dirty, it may appear that the dent portion is stained on the grayscale image. At this time, only the first feature amount (for example, the area of the dark portion) calculated from the inspection region specified on the grayscale image is determined as NG not only for the actually dirty portion but also for the above-described recessed portion. Therefore, some dents in the workpiece cannot be allowed. On the other hand, the contamination of the work cannot be determined as NG in the first place only by the second feature amount (for example, the area of the dark portion) calculated from the inspection region specified on the distance image. Therefore, according to the image processing apparatus 10 according to the present embodiment, one or a plurality of inspection areas in the inspection area that cause NG determination based on the first feature amount calculated from the inspection area specified on the grayscale image. While extracting the 1st specific location (namely, dirty location) and based on the 2nd feature-value calculated from the test area specified on a distance image, the position in the inspection field which becomes a factor of NG determination, or two or more It is possible to extract the second specific part (that is, the recessed part). Therefore, if the first specific location still remains after subtracting the second specific location from the first specific location, the remaining first specific location becomes a dirty but not recessed portion. By making an NG determination when the first specific location exists, an appearance inspection is performed to allow a slight dent of the workpiece (to make an OK determination) but not to allow the workpiece to be dirty (to make an NG determination). be able to.

図28は、特徴量算出手段180によって算出された第一及び第二の特徴量の両方を用いて、ワークの良否判定を行うアプリケーション具体例を示す図である。   FIG. 28 is a diagram illustrating a specific example of an application that performs quality determination of a workpiece using both the first and second feature amounts calculated by the feature amount calculation unit 180.

図28(a)に示すように、ワークの上段面には汚れと凹みがある。このときの濃淡画像は、図28(b)に示すものとなり、このときの距離画像は図28(c)に示すものとなる。図28(b)に示す濃淡画像上では、凹みの部分が影によって汚れが付着しているように見えている。ワークが位置ずれした場合には、それぞれ図28(d)、図28(e)となる。ここで、距離画像のエッジパターンに基づいて濃淡画像上の検査領域R4を特定するとともに、距離画像上においても検査領域R5を特定する(図28(f),図28(g))。そして、検査領域R4及び検査領域R5においてブロブ処理等を行えば、図28(h)及び図28(i)に示すように、濃淡の変化を検出することができるが、上述したように、検査領域R5において検出された濃淡の変化は凹みによるものであるため、濃淡画像において、それに相当する汚れ部分を除く。その結果、図28(j)に示すように、それでも濃淡の変化(ブロブ)が残っていることから、このワークには汚れが付着していることがわかり、NG判定になる。このように、ワークの多少の凹みは許容するが(OK判定にしたい)、ワークの汚れは許容しない(NG判定にしたい)、といった外観検査を行うことができる。なお、画像処理装置10に、外観検査における画像処理の実行条件の設定をユーザから受け付けるための実行条件設定受付手段(コンソール50、操作入力部14、主制御部11等からなる)を設けて、あるウィンドウでの検査(画像処理)がOKだった場合に、別のウィンドウでの検査(画像処理)を行う、といった実行条件や、或いは、あるウィンドウでの検査(画像処理)がNGだった場合には、その後の検査は行わず検査終了にする、といった実行条件などをユーザが設定可能にしてもよい。図28の例でいえば、距離画像を用いた検査領域R5でNG判定がされたとき、NG判定の対象となった特定のブロブの位置に基づいて、検査領域R4で対応する位置にあるブロブは削除(無視)し、それ以外でもブロブが検出された場合には(図28(i)参照)、NG判定を行う、といった実行条件を設定してもよい。その他、実行条件の設定内容は、種々の内容が考えられる。   As shown in FIG. 28 (a), the upper surface of the work has dirt and dents. The gray image at this time is as shown in FIG. 28 (b), and the distance image at this time is as shown in FIG. 28 (c). On the grayscale image shown in FIG. 28 (b), it appears that the dents are stained with shadows. When the workpiece is displaced, the result is as shown in FIG. 28 (d) and FIG. 28 (e), respectively. Here, the inspection region R4 on the grayscale image is specified based on the edge pattern of the distance image, and the inspection region R5 is also specified on the distance image (FIG. 28 (f), FIG. 28 (g)). Then, if blob processing or the like is performed in the inspection region R4 and the inspection region R5, as shown in FIG. 28 (h) and FIG. 28 (i), the change in shading can be detected. Since the change in light and darkness detected in the region R5 is due to the dent, the corresponding dirt portion is removed from the light and dark image. As a result, as shown in FIG. 28 (j), the change in density (blob) still remains, so that it can be seen that the work is contaminated, and an NG determination is made. As described above, it is possible to perform an appearance inspection that allows a slight dent of the workpiece (want to make an OK determination) but does not allow the workpiece to be dirty (want to make an NG determination). The image processing apparatus 10 is provided with execution condition setting accepting means (consisting of the console 50, the operation input unit 14, the main control unit 11 and the like) for accepting the setting of the image processing execution condition in the appearance inspection from the user. When the inspection condition (image processing) in a certain window is OK, the execution condition that inspection (image processing) is performed in another window, or the inspection (image processing) in a certain window is NG Alternatively, the user may be able to set an execution condition such that the subsequent inspection is not performed and the inspection is terminated. In the example of FIG. 28, when an NG determination is made in the inspection region R5 using the distance image, the blob at the corresponding position in the inspection region R4 based on the position of the specific blob that is the target of the NG determination. May be deleted (ignored), and if a blob is detected in other cases (see FIG. 28 (i)), an execution condition such as performing an NG determination may be set. In addition, various contents are conceivable as the execution condition setting contents.

また、他のアプリケーション例として、距離画像において、一定高さ以上の部分を計測領域とすることが考えられる。これにより、動的に変化したり変形したりする製品や、濃淡画像上不安定でノイズのある製品においても、輪郭ぎりぎりまで検査領域とすることができる。例えば、製品輪郭が垂直ではなくR面をもっているような製品について、凹凸検査や異物検査(濃淡変化)を画像処理によって行う場合、一定以上の高さを持つ領域を検査領域にすることによって、輪郭付近を含めてぎりぎりまで計測することができる。また、画面内の一定高さ以上を全て計測領域とする、という設定によれば、2次元空間上の位置ずれを気にすることなく、また、検査領域を2次元座標で指定することなく、目的のエリア内の検査を行うことが可能になる。設定手順としては、例えば、(1)コンソール50等によって距離画像上で一定の高さ以上(一定の階調以上)、というパラメータを設定する、(2)画面内で一定の高さ以上の部分が切り出される、(3)切り出された一定の高さ以上の部分を検査領域として、高さ情報による凹凸検査や濃淡情報による異物(濃淡変化)検査を行う、(4)切り出された領域は固定ではなく、検査ごとに一定高さ以上の部分を領域として切り出すため、動的な製品形状変化に対し、検査領域として追従させることができる。毎回追従する必要がない場合には、マスター画像(基準距離画像)より切り出した領域をテンプレートとしてもち、検査領域とすることができる。   As another application example, in a distance image, a portion having a certain height or more may be considered as a measurement region. As a result, even in a product that dynamically changes or deforms, or in a product that is unstable and noisy on a grayscale image, it is possible to set the inspection region to the edge of the contour. For example, when an unevenness inspection or a foreign matter inspection (shading change) is performed by image processing on a product whose product contour is not vertical but has an R surface, the contour is determined by setting a region having a certain height or more as the inspection region. It is possible to measure to the last minute including the vicinity. In addition, according to the setting that all of a certain height or more in the screen is set as the measurement region, without worrying about the positional deviation in the two-dimensional space, and without specifying the inspection region with the two-dimensional coordinates, It becomes possible to perform inspection in the target area. As a setting procedure, for example, (1) a parameter of a certain height or more (a certain gradation or more) on the distance image is set by the console 50 or the like, and (2) a portion having a certain height or more in the screen. (3) Perform a concavo-convex inspection by height information and a foreign matter (shading change) inspection by shading information, using a cut-out portion of a certain height or more as an inspection area. (4) Fix the cutting area. Instead, a portion of a certain height or more is cut out as a region for each inspection, so that a dynamic product shape change can be followed as the inspection region. When it is not necessary to follow each time, an area cut out from the master image (reference distance image) is used as a template and can be used as an inspection area.

10 画像処理装置
11 主制御部
12 照明制御部
13 画像入力部
14 操作入力部
15 表示制御部
16 通信部
17 画像処理部
30 カメラ
40 モニタ
50 コンソール
60 照明
70 PLC
80 PC
110 濃淡画像取得手段
120 距離算出手段
130 距離画像生成手段
140 検出条件設定受付手段
150 特定パターン検出手段
160 基準検査領域設定受付手段
170 検査領域特定手段
180 特徴量算出手段
190 判定手段
DESCRIPTION OF SYMBOLS 10 Image processing apparatus 11 Main control part 12 Illumination control part 13 Image input part 14 Operation input part 15 Display control part 16 Communication part 17 Image processing part 30 Camera 40 Monitor 50 Console 60 Illumination 70 PLC
80 PC
DESCRIPTION OF SYMBOLS 110 Gray image acquisition means 120 Distance calculation means 130 Distance image generation means 140 Detection condition setting reception means 150 Specific pattern detection means 160 Reference inspection area setting reception means 170 Inspection area specification means 180 Feature quantity calculation means 190 Determination means

Claims (8)

ワークを撮像するカメラを有し、当該カメラから取得した画像に基づいてワーク表面における所定の検査範囲を検査し、ワークの良否を判定する画像処理装置において、
各画素が、前記カメラの受光量に応じた濃淡値を有する濃淡画像を取得する濃淡画像取得手段と、
前記カメラから取得した画像を用いて、前記カメラからワーク表面までの距離を算出する距離算出手段と、
各画素が、算出された距離に応じた濃淡値を有する距離画像を生成する距離画像生成手段と、
前記濃淡画像と前記距離画像の一方の画像において、他方の画像上で前記検査範囲に相当する検査領域を特定するための特定パターンを検出する特定パターン検出手段と、
前記濃淡画像と前記距離画像の他方の画像において、前記特定パターンと一定の相対位置関係にある基準検査領域の設定を受け付ける基準検査領域設定受付手段と、
前記特定パターン検出手段により前記濃淡画像と前記距離画像の一方の画像において検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、前記濃淡画像と前記距離画像の他方の画像において設定された前記基準検査領域を位置補正することにより前記検査領域を特定する検査領域特定手段と、
特定された前記検査領域から特徴量を算出する特徴量算出手段と、
算出された特徴量に基づいて、ワークの良否を判定する判定手段と、を備えることを特徴とする画像処理装置。
In an image processing apparatus that has a camera for imaging a workpiece, inspects a predetermined inspection range on the surface of the workpiece based on an image acquired from the camera, and determines whether the workpiece is good or bad,
Each pixel has a grayscale image acquisition means for acquiring a grayscale image having a grayscale value corresponding to the amount of light received by the camera;
Distance calculation means for calculating a distance from the camera to the workpiece surface using an image acquired from the camera;
A distance image generating means for generating a distance image in which each pixel has a gray value corresponding to the calculated distance;
Specific pattern detection means for detecting a specific pattern for specifying an inspection area corresponding to the inspection range on the other image in one of the grayscale image and the distance image;
In the other image of the grayscale image and the distance image, a reference inspection region setting receiving unit that receives a setting of a reference inspection region that is in a certain relative positional relationship with the specific pattern;
Based on at least one of the position and the inclination angle of the specific pattern detected in one of the gray image and the distance image by the specific pattern detection means, the specific pattern is set in the other image of the gray image and the distance image. Inspection area specifying means for specifying the inspection area by correcting the position of the reference inspection area ;
A feature amount calculating means for calculating a feature amount from the specified inspection region;
An image processing apparatus comprising: a determination unit that determines the quality of the workpiece based on the calculated feature amount.
前記濃淡画像と前記距離画像の一方の画像からエッジを抽出するエッジ抽出手段を備え、
前記検査領域特定手段は、前記エッジ抽出手段により抽出されたエッジに基づくエッジパターンの位置及び傾斜角度の少なくとも一方に基づいて、他方の画像上で当該エッジパターンに対応する領域を生成することにより、前記検査領域を特定することを特徴とする請求項1記載の画像処理装置。
Edge extraction means for extracting an edge from one of the grayscale image and the distance image;
The inspection area specifying unit generates an area corresponding to the edge pattern on the other image based on at least one of the position and the inclination angle of the edge pattern based on the edge extracted by the edge extracting unit, The image processing apparatus according to claim 1, wherein the inspection area is specified.
前記特定パターンを検出するための検出条件の設定を受け付ける検出条件設定受付手段と、
受け付けた検出条件を記憶する検出条件記憶手段と、を備え、
前記特定パターン検出出手段は、前記検出条件記憶手段に記憶された検出条件に基づいて、他方の画像上で前記検査範囲に相当する検査領域を特定するための特定パターンを検出することを特徴とする請求項1又は2記載の画像処理装置。
Detection condition setting accepting means for accepting setting of a detection condition for detecting the specific pattern;
Detection condition storage means for storing the received detection condition,
The specific pattern detection and output means detects a specific pattern for specifying an inspection area corresponding to the inspection range on the other image based on the detection condition stored in the detection condition storage means. The image processing apparatus according to claim 1 or 2 .
前記検出条件は、少なくとも前記特定パターンを検出するためのエッジ強度が含まれることを特徴とする請求項記載の画像処理装置。 The image processing apparatus according to claim 3 , wherein the detection condition includes at least an edge strength for detecting the specific pattern. 前記濃淡画像取得手段により受光量に応じた濃淡値を有する濃淡画像を取得するカメラと、前記距離算出手段によりワーク表面までの距離を算出するカメラとは、同一のカメラであることを特徴とする請求項1からのいずれか記載の画像処理装置。 The camera that acquires a grayscale image having a grayscale value corresponding to the amount of received light by the grayscale image acquisition unit and the camera that calculates the distance to the workpiece surface by the distance calculation unit are the same camera. the image processing apparatus according to any one of claims 1 to 4. 前記検査領域特定手段は、前記濃淡画像と前記距離画像の一方の画像においても、前記特定パターン検出手段により検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、前記検査領域を特定し、
前記特徴量算出手段は、前記濃淡画像及び前記距離画像において特定された検査領域から、それぞれ第一及び第二の特徴量を算出するとともに、
前記判定手段は、前記第一及び第二の特徴量のうち少なくとも一方に基づいて、ワークの良否を判定することを特徴とする請求項1からのいずれか記載の画像処理装置。
The inspection area specifying unit specifies the inspection area based on at least one of a position and an inclination angle of the specific pattern detected by the specific pattern detection unit in one of the grayscale image and the distance image. ,
The feature amount calculating means calculates first and second feature amounts from the inspection regions specified in the grayscale image and the distance image, respectively.
Said determining means, said first and second on the basis of at least one of the features of the image processing apparatus according to any of claims 1, characterized in that to determine the quality of the work 5.
前記判定手段は、前記第一及び第二の特徴量に基づいて、ワークの良否を判定することを特徴とする請求項記載の画像処理装置。 The image processing apparatus according to claim 6 , wherein the determination unit determines the quality of the workpiece based on the first and second feature amounts. ワークを撮像するカメラを有し、当該カメラから取得した画像に基づいてワーク表面における所定の検査範囲を検査し、ワークの良否を判定する画像処理装置を用いた外観検査方法において、
各画素が、前記カメラの受光量に応じた濃淡値を有する濃淡画像を取得するステップと、
前記カメラから取得した画像を用いて、前記カメラからワーク表面までの距離を算出するステップと、
各画素が、算出された距離に応じた濃淡値を有する距離画像を生成するステップと、
前記濃淡画像と前記距離画像の一方の画像において、他方の画像上で前記検査範囲に相当する検査領域を特定するための特定パターンを検出するステップと、
前記濃淡画像と前記距離画像の一方の画像において検出された特定パターンの位置及び傾斜角度の少なくとも一方に基づいて、前記濃淡画像と前記距離画像の他方の画像において設定された前記特定パターンと一定の相対位置関係にある基準検査領域を位置補正することにより前記検査領域を特定するステップと、
特定された前記検査領域から特徴量を算出するステップと、
算出された特徴量に基づいて、ワークの良否を判定するステップと、を含むことを特徴とする画像処理装置を用いた外観検査方法。
In an appearance inspection method using an image processing apparatus that has a camera for imaging a workpiece, inspects a predetermined inspection range on the surface of the workpiece based on an image acquired from the camera, and determines whether the workpiece is good or bad.
Each pixel obtaining a grayscale image having a grayscale value corresponding to the amount of light received by the camera;
Using the image acquired from the camera, calculating the distance from the camera to the workpiece surface;
Each pixel generating a distance image having a gray value according to the calculated distance;
Detecting a specific pattern for specifying an inspection region corresponding to the inspection range on the other image in one of the grayscale image and the distance image;
The grayscale image and the distance on the basis of at least one of the one position and the inclination angle of the specific pattern is detected in the image of the image, the grayscale image and the distance image other image have been the specific pattern and a constant setting at the Identifying the inspection area by correcting the position of a reference inspection area in a relative positional relationship ;
Calculating a feature amount from the identified inspection region;
And a step of determining the quality of the workpiece based on the calculated feature amount, and an appearance inspection method using the image processing apparatus.
JP2010160994A 2010-07-15 2010-07-15 Image processing apparatus and appearance inspection method Expired - Fee Related JP5564349B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010160994A JP5564349B2 (en) 2010-07-15 2010-07-15 Image processing apparatus and appearance inspection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010160994A JP5564349B2 (en) 2010-07-15 2010-07-15 Image processing apparatus and appearance inspection method

Publications (2)

Publication Number Publication Date
JP2012021914A JP2012021914A (en) 2012-02-02
JP5564349B2 true JP5564349B2 (en) 2014-07-30

Family

ID=45776306

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010160994A Expired - Fee Related JP5564349B2 (en) 2010-07-15 2010-07-15 Image processing apparatus and appearance inspection method

Country Status (1)

Country Link
JP (1) JP5564349B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180133217A (en) * 2017-06-05 2018-12-13 오츠카덴시가부시끼가이샤 Optical measurement apparatus and optical measurement method
KR102311595B1 (en) * 2021-03-31 2021-10-13 (주)아이프리즘 Vision inspection system of date printing status for product and method thereof

Families Citing this family (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5815434B2 (en) * 2012-02-10 2015-11-17 株式会社キーエンス Manual creation support device and manual creation support method
JP6266243B2 (en) * 2013-07-16 2018-01-24 株式会社キーエンス 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6207270B2 (en) * 2013-07-16 2017-10-04 株式会社キーエンス 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6246513B2 (en) * 2013-07-16 2017-12-13 株式会社キーエンス 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6266244B2 (en) * 2013-07-16 2018-01-24 株式会社キーエンス 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6207283B2 (en) * 2013-07-31 2017-10-04 株式会社キーエンス Image processing apparatus, image processing system, inspection method, and program
JP2015060493A (en) * 2013-09-20 2015-03-30 大日本印刷株式会社 Pattern inspection apparatus and pattern inspection method
JP6184339B2 (en) * 2014-02-07 2017-08-23 株式会社キーエンス Appearance inspection apparatus, appearance inspection method, and program
JP6405124B2 (en) * 2014-06-09 2018-10-17 株式会社キーエンス Inspection device, inspection method, and program
JP6587894B2 (en) * 2015-10-13 2019-10-09 株式会社キーエンス Image processing sensor, image processing method, and computer program
JP6685776B2 (en) * 2016-03-09 2020-04-22 キヤノン株式会社 Imaging system, measuring system, production system, imaging method, program, recording medium and measuring method
JP6161775B2 (en) * 2016-09-06 2017-07-12 株式会社キーエンス Shape measuring device, shape measuring method, and shape measuring program
JP2018112478A (en) * 2017-01-12 2018-07-19 リコーエレメックス株式会社 Image inspection device and image inspection method
JP6944829B2 (en) * 2017-07-21 2021-10-06 サッポロビール株式会社 Can lid detection device and can lid detection method
JP2019078630A (en) * 2017-10-24 2019-05-23 株式会社Ihi Non-contact measurement device
JP7069772B2 (en) * 2018-02-06 2022-05-18 株式会社アイシン Vehicle control system, parking lot control system and automatic valley parking system
JP6791182B2 (en) 2018-03-14 2020-11-25 オムロン株式会社 Neural network type image processing device
KR102177638B1 (en) * 2018-04-11 2020-11-12 한국전자통신연구원 Automatic teaching apparatus and method of machine vision inspection apparatus
JP6585793B2 (en) * 2018-09-18 2019-10-02 株式会社キーエンス Inspection device, inspection method, and program
JP7231461B2 (en) * 2019-04-05 2023-03-01 株式会社キーエンス Image inspection system and image inspection method
JP2020193867A (en) * 2019-05-28 2020-12-03 キヤノン株式会社 Image processing device, control method, control program, and computer-readable recording medium
CN112611763B (en) * 2019-09-20 2023-03-07 深圳市腾盛精密装备股份有限公司 Transparent body detection method and system based on spectrum confocal
TW202119019A (en) * 2019-11-05 2021-05-16 華碩電腦股份有限公司 Appearance image capturing device and appearance detecting device including the same
CN116453132B (en) * 2023-06-14 2023-09-05 成都锦城学院 Japanese kana and Chinese character recognition method, equipment and memory based on machine translation

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0282367A (en) * 1988-09-20 1990-03-22 Fujitsu Ltd Three-dimensional shape inspecting device
JPH02165004A (en) * 1988-12-20 1990-06-26 Fujitsu Ltd Object testing apparatus
JP2919284B2 (en) * 1994-02-23 1999-07-12 松下電工株式会社 Object recognition method
JPH10267628A (en) * 1997-01-23 1998-10-09 Hitachi Ltd Method and apparatus for detection of three-dimensional shape as well as manufacture of board
JP2000283748A (en) * 1999-03-31 2000-10-13 Suzuki Motor Corp Method and device for detecting defect
JP2002257528A (en) * 2001-03-02 2002-09-11 Ricoh Co Ltd Three-dimensional shape measuring device by phase shift method
JP2006317408A (en) * 2005-05-16 2006-11-24 Sumitomo Metal Electronics Devices Inc Warpage checker
JP2010025803A (en) * 2008-07-22 2010-02-04 Fuji Electric Holdings Co Ltd Inspection device having positioning function, program therefor, inspection method of inspection device having positioning function

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180133217A (en) * 2017-06-05 2018-12-13 오츠카덴시가부시끼가이샤 Optical measurement apparatus and optical measurement method
KR102549058B1 (en) 2017-06-05 2023-06-28 오츠카덴시가부시끼가이샤 Optical measurement apparatus and optical measurement method
KR102311595B1 (en) * 2021-03-31 2021-10-13 (주)아이프리즘 Vision inspection system of date printing status for product and method thereof

Also Published As

Publication number Publication date
JP2012021914A (en) 2012-02-02

Similar Documents

Publication Publication Date Title
JP5564349B2 (en) Image processing apparatus and appearance inspection method
JP7150105B2 (en) 3D image processing device and 3D image processing method
JP6270361B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6242098B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP5564348B2 (en) Image processing apparatus and appearance inspection method
JP4811272B2 (en) Image processing apparatus and image processing method for performing three-dimensional measurement
JP5947169B2 (en) Appearance inspection apparatus, appearance inspection method and program
JP6184289B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP5218177B2 (en) Image processing apparatus and method
JP5861462B2 (en) Inspection standard registration method for solder inspection and board inspection apparatus using the method
JP6649802B2 (en) Three-dimensional image inspection device, three-dimensional image inspection method, three-dimensional image inspection program, computer-readable recording medium, and recorded device
JP6246513B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP2015021759A (en) Three-dimensional image processor, head unit for the three-dimensional image processor, and three-dimensional image processing method
JP6571831B2 (en) Appearance inspection device
JP2015021763A (en) Three-dimensional image processor, three-dimensional image processing method, three-dimensional image processing program, and computer-readable recording medium
JP6571830B2 (en) Appearance inspection device
JP6334861B2 (en) Appearance inspection apparatus, appearance inspection method, appearance inspection program, and computer-readable recording medium
TWI427263B (en) Method and apparatus of measuring height of projections, and program therefor
JP6207270B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6557319B2 (en) 3D image processing apparatus, 3D image processing apparatus head unit, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6266244B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP6266243B2 (en) 3D image processing apparatus, 3D image processing method, 3D image processing program, computer-readable recording medium, and recorded apparatus
JP2020148664A (en) Image inspection device and image inspection method
JP2014055913A (en) Appearance inspection device, and control method and program of appearance inspection device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20130409

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20131120

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20131203

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140130

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

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140603

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140616

R150 Certificate of patent or registration of utility model

Ref document number: 5564349

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees