JP5402182B2 - Appearance inspection method and appearance inspection apparatus - Google Patents

Appearance inspection method and appearance inspection apparatus Download PDF

Info

Publication number
JP5402182B2
JP5402182B2 JP2009095962A JP2009095962A JP5402182B2 JP 5402182 B2 JP5402182 B2 JP 5402182B2 JP 2009095962 A JP2009095962 A JP 2009095962A JP 2009095962 A JP2009095962 A JP 2009095962A JP 5402182 B2 JP5402182 B2 JP 5402182B2
Authority
JP
Japan
Prior art keywords
image
value
inspection object
average
pixels
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2009095962A
Other languages
Japanese (ja)
Other versions
JP2010249522A (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.)
TDK Corp
Original Assignee
TDK 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 TDK Corp filed Critical TDK Corp
Priority to JP2009095962A priority Critical patent/JP5402182B2/en
Publication of JP2010249522A publication Critical patent/JP2010249522A/en
Application granted granted Critical
Publication of JP5402182B2 publication Critical patent/JP5402182B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、検査対象物の外観を検査するための外観検査方法及び外観検査装置に関する。   The present invention relates to an appearance inspection method and an appearance inspection apparatus for inspecting the appearance of an inspection object.

従来から、検査対象物を撮像し、その画像データに対して所定の画像処理を行うことにより、検査対象物に欠陥が存在するか否かを判別する外観検査方法が知られている(例えば、下記特許文献1参照)。具体的には、特許文献1の外観検査方法は、X方向及びY方向についてそれぞれ検査対象物の平均輝度分布を算出する工程と、撮像画像と、各平均輝度分布に基づいて生成されたマスタ画像とから第1補正画像を生成する工程と、ソーベルフィルタを用いて第1補正画像からソーベル処理画像を生成する工程と、ソーベル処理画像と第1補正画像とから第2補正画像を生成する工程と、第2補正画像を2値化して連結領域を特定し、連結領域の画素数と閾値とを対比する工程とを有している。このように、検査対象物の曲面形状等に起因する輝度むらの影響を補正すること(いわゆるシェーディング補正)は、従来から知られている。   Conventionally, there is known an appearance inspection method for determining whether or not a defect exists in an inspection object by imaging the inspection object and performing predetermined image processing on the image data (for example, See Patent Document 1 below). Specifically, the appearance inspection method of Patent Document 1 includes a step of calculating an average luminance distribution of an inspection object in each of the X direction and the Y direction, a captured image, and a master image generated based on each average luminance distribution. Generating a first correction image from the first correction image, generating a Sobel processing image from the first correction image using a Sobel filter, and generating a second correction image from the Sobel processing image and the first correction image. And a step of binarizing the second corrected image to identify a connected area, and comparing the number of pixels in the connected area with a threshold value. As described above, it is conventionally known to correct the influence of luminance unevenness caused by the curved surface shape of an inspection object (so-called shading correction).

特開2007−078540号公報(特許第4150390号)JP 2007-0785540 A (Patent No. 4150390)

上記特許文献1では、円柱面状とされた外周面を有するマグネットを検査対象物とし、その外周面に照明しその反射光をカメラにて撮像することで、撮像画像と取得している。そのため、撮像画像において、マグネットの中央部分が明るく写し出され(輝度値:大)、マグネットの両側部分が暗く写し出される(輝度値:小)。   In Patent Document 1, a magnet having a cylindrical outer peripheral surface is used as an inspection target, and the outer peripheral surface is illuminated and the reflected light is captured by a camera to obtain a captured image. For this reason, in the captured image, the central portion of the magnet is projected brightly (luminance value: large), and both side portions of the magnet are projected darkly (luminance value: small).

ところで、検査対象物に欠けや割れ等の欠陥が存在している場合、それらの欠陥に対して照明しても反射光がカメラに向かわないことが多いので、撮像画像に写し出される欠陥は暗くなりやすい(輝度値:小)。そのため、マグネットの中央部分に欠陥が存在している場合には、欠陥とそれ以外の部分との輝度差(明暗差、コントラストともいう)が鮮明となるが、マグネットの両側部分に欠陥が存在している場合には、欠陥とそれ以外の部分との輝度差が小さくなりやすい。従って、暗部に存在する欠陥を検出しにくい傾向にあった。   By the way, if there are defects such as chips or cracks in the inspection object, the reflected light often does not go to the camera even if the defect is illuminated, so the defect that appears in the captured image becomes dark. Easy (luminance value: small). Therefore, if there is a defect in the central part of the magnet, the brightness difference between the defect and the other part (also called brightness difference or contrast) becomes clear, but there is a defect on both sides of the magnet. In such a case, the luminance difference between the defect and the other part tends to be small. Therefore, there is a tendency that it is difficult to detect a defect existing in a dark part.

そこで、本発明は、欠陥が暗部に存在する場合であっても、欠陥を精度よく確実に検出することが可能な外観検査方法及び外観検査装置を提供することを目的とする。   Accordingly, an object of the present invention is to provide an appearance inspection method and an appearance inspection apparatus capable of accurately and reliably detecting a defect even when the defect exists in a dark part.

本発明に係る外観検査方法は、検査対象物の外観検査を行うための外観検査方法であって、検査対象物を撮像して検査対象物画像を含む撮像画像を取得する工程と、撮像画像において外観検査処理を行う対象となる処理領域を決定する工程と、処理領域内に設定されると共に処理領域を区分する第1〜第K(Kは2以上の自然数)の区画のうち、第k(kは1〜Kの自然数)の区画に含まれる各画素の輝度値の平均値である第kの平均輝度値MBkを算出する工程と、第1〜第Kの平均輝度値のうち最も大きい値を最高値MBmaxとして選択する工程と、第kの区画に含まれる各画素の輝度値を、下記の式(1)
Ik(x,y)×MBmax/MBk・・・(1)
(ただし、Ik(x,y)は、前記第kの区画に含まれる任意座標(x,y)の画素の輝度値を表す。)
によって得られた値でそれぞれ置換して、置換画像を生成する工程と、置換画像の外縁に沿う第1の方向に平行な一連の画素からなる第1の画素列毎に該第1の画素列に含まれる一連の画素の輝度値の平均を算出すると共に、第1の方向と直交する第2の方向に平行な一連の画素からなる第2の画素列毎に該第2の画素列に含まれる一連の画素の輝度値の平均を算出することで、第1の方向及び第2の方向における置換画像の平均輝度分布を算出する工程と、置換画像に対して基準となる基準画像を平均輝度分布に基づいて生成する工程と、基準画像を用いて、撮像画像をシェーディング補正する工程とを有することを特徴とする。
An appearance inspection method according to the present invention is an appearance inspection method for performing an appearance inspection of an inspection object, and includes a step of imaging the inspection object and obtaining a captured image including the inspection object image; Of the steps of determining the processing area to be subjected to the appearance inspection process, and the first to Kth sections (K is a natural number of 2 or more) that are set in the processing area and divide the processing area, the kth ( k is a natural number of 1 to K), the step of calculating the k-th average luminance value MBk, which is the average value of the luminance values of each pixel, and the largest value among the first to K-th average luminance values Is selected as the maximum value MBmax, and the luminance value of each pixel included in the kth section is expressed by the following equation (1).
Ik (x, y) × MBmax / MBk (1)
(However, Ik (x, y) represents a luminance value of a pixel at an arbitrary coordinate (x, y) included in the kth section.)
Each of the first pixel columns including a series of pixels parallel to the first direction along the outer edge of the replacement image, and a step of generating a replacement image by replacing each of the values obtained by And calculating the average of the luminance values of a series of pixels included in the second pixel column for each second pixel column consisting of a series of pixels parallel to a second direction orthogonal to the first direction. Calculating the average luminance distribution of the replacement image in the first direction and the second direction by calculating the average of the luminance values of the series of pixels, and calculating the average luminance of the reference image as a reference for the replacement image It has the process of producing | generating based on distribution, and the process of carrying out the shading correction | amendment of the captured image using a reference | standard image, It is characterized by the above-mentioned.

本発明に係る外観検査方法では、撮像画像において外観検査処理を行う対象となる処理領域を、第1〜第Kの区画に区分している。そして、第kの区画に含まれる各画素の輝度値の平均値である第kの平均輝度値Bkを算出し、第1〜第Kの平均輝度値のうち最も大きい値を最高値MBmaxとして選択している。そのため、第kの区画に含まれる各画素が暗い(輝度値:小)ほど平均輝度値MBkが小さくなり、第kの区画に含まれる各画素が明るい(輝度値:大)ほど平均輝度値MBkが大きくなることから、上記の式(1)のうちの係数MBmax/MBkは、全体的に暗い区画ほど大きな値となり、全体的に明るい区画ほど1に近い値となる(MBmax/MBk≧1)。従って、上記の式(1)による演算を全ての区画で行うことで、処理領域内の検査対象物画像のうち、全体的に暗い区画を構成する画素の輝度値が、全体的に明るい区画を構成する画素の輝度値と同等の大きさに置換される。つまり、全体的に暗い区画が全体的に明るくなるので、欠陥が暗部に存在する場合であっても、置換画像において欠陥とそれ以外の部分との輝度差が鮮明となる。その結果、置換画像から基準画像を生成し、この基準画像を用いて、撮像画像をシェーディング補正することによって、欠陥を精度よく確実に検出することが可能なる。   In the appearance inspection method according to the present invention, a processing area to be subjected to appearance inspection processing in a captured image is divided into first to Kth sections. Then, the kth average luminance value Bk, which is the average value of the luminance values of the pixels included in the kth section, is calculated, and the largest value among the first to Kth average luminance values is selected as the maximum value MBmax. doing. Therefore, the average luminance value MBk decreases as each pixel included in the kth section is darker (luminance value: small), and the average luminance value MBk decreases as each pixel included in the kth section is brighter (luminance value: large). Therefore, the coefficient MBmax / MBk in the above formula (1) has a larger value for a generally dark section and a value closer to 1 for a generally bright section (MBmax / MBk ≧ 1). . Therefore, by performing the calculation according to the above equation (1) in all the sections, the luminance values of the pixels constituting the generally dark section of the inspection object image in the processing region are all bright sections. It is replaced with the same size as the luminance value of the constituent pixels. That is, since the entire dark section is brightened as a whole, even if the defect exists in the dark part, the brightness difference between the defect and the other part in the replacement image becomes clear. As a result, it is possible to detect a defect accurately and reliably by generating a reference image from the replacement image and using the reference image to perform shading correction of the captured image.

好ましくは、区画は、処理領域内の検査対象物画像のうち輝度値の変化が大きい方向に沿って並ぶように設定されている。このようにすると、区画に含まれる画素の輝度値が各区画毎にある程度均一となる(各区画毎に同じような輝度分布となる)。つまり、処理領域内の検査対象物画像のうち、暗部と明部とが明瞭に区分され、同一区画に暗部と明部とが共に存在する可能性が低くなる。従って、上記の式(1)のうちの係数MBmax/MBkによって、処理領域内の検査対象物画像のうち暗部の輝度値が高利得で増幅されることとなる。その結果、置換画像において欠陥とそれ以外の部分との輝度差をより鮮明化することが可能となる。   Preferably, the sections are set so as to be arranged along a direction in which a change in luminance value is large in the inspection object image in the processing region. In this way, the luminance values of the pixels included in the section are uniform to some extent for each section (the same brightness distribution is obtained for each section). That is, in the inspection object image in the processing area, the dark part and the bright part are clearly divided, and the possibility that both the dark part and the bright part exist in the same section is reduced. Therefore, the luminance value of the dark part of the inspection object image in the processing region is amplified with high gain by the coefficient MBmax / MBk in the above equation (1). As a result, the brightness difference between the defect and the other part in the replacement image can be made clearer.

一方、本発明に係る外観検査装置は、検査対象物の外観検査を行うための外観検査装置であって、検査対象物を照明する照明手段と、照明手段によって照明された検査対象物を撮像して、検査対象物画像を含む撮像画像を取得する撮像手段と、撮像手段によって撮像された撮像画像において外観検査処理を行う対象となる処理領域を決定する手段と、処理領域内に設定されると共に処理領域を区分する第1〜第K(Kは2以上の自然数)の区画のうち、第k(kは1〜Kの自然数)の区画に含まれる各画素の輝度値の平均値である第kの平均輝度値MBkを算出する手段と、第1〜第Kの平均輝度値のうち最も大きい値を最高値MBmaxとして選択する手段と、第kの区画に含まれる各画素の輝度値を、下記の式(2)
Ik(x,y)×MBmax/MBk・・・(2)
(ただし、Ik(x,y)は、前記第kの区画に含まれる任意座標(x,y)の画素の輝度値を表す。)
によって得られた値でそれぞれ置換して、置換画像を生成する手段と、置換画像の外縁に沿う第1の方向に平行な一連の画素からなる第1の画素列毎に該第1の画素列に含まれる一連の画素の輝度値の平均を算出すると共に、第1の方向と直交する第2の方向に平行な一連の画素からなる第2の画素列毎に該第2の画素列に含まれる一連の画素の輝度値の平均を算出することで、第1の方向及び第2の方向における置換画像の平均輝度分布を算出する手段と、置換画像に対して基準となる基準画像を平均輝度分布に基づいて生成する手段と、基準画像を用いて、撮像画像をシェーディング補正する手段とを有することを特徴とする。
On the other hand, an appearance inspection apparatus according to the present invention is an appearance inspection apparatus for performing an appearance inspection of an inspection object, and illuminates an inspection object and illuminates the inspection object illuminated by the illumination means. An imaging unit that obtains a captured image including an inspection object image, a unit that determines a processing region to be subjected to an appearance inspection process in the captured image captured by the imaging unit, and is set in the processing region Of the first to Kth sections (K is a natural number of 2 or more) that divides the processing area, the brightness value of each pixel included in the kth section (k is a natural number of 1 to K) is the average value. means for calculating an average luminance value MBk of k, means for selecting the largest value among the first to Kth average luminance values as the maximum value MBmax, and the luminance value of each pixel included in the kth section, The following formula (2)
Ik (x, y) × MBmax / MBk (2)
(However, Ik (x, y) represents a luminance value of a pixel at an arbitrary coordinate (x, y) included in the kth section.)
Means for generating a replacement image by substituting each of the values obtained by the above, and for each first pixel column comprising a series of pixels parallel to the first direction along the outer edge of the replacement image, the first pixel column And calculating the average of the luminance values of a series of pixels included in the second pixel column for each second pixel column consisting of a series of pixels parallel to a second direction orthogonal to the first direction. Means for calculating an average luminance distribution of the replacement image in the first direction and the second direction by calculating an average of the luminance values of the series of pixels, and an average luminance of the reference image serving as a reference for the replacement image It has the means to produce | generate based on distribution, and the means to carry out the shading correction | amendment of the captured image using a reference | standard image, It is characterized by the above-mentioned.

本発明に係る外観検査装置では、撮像画像において外観検査処理を行う対象となる処理領域を、第1〜第Kの区画に区分している。そして、第kの区画に含まれる各画素の輝度値の平均値である第kの平均輝度値MBkを算出し、第1〜第Kの平均輝度値のうち最も大きい値を最高値MBmaxとして選択している。そのため、第kの区画に含まれる各画素が暗い(輝度値:小)ほど平均輝度値MBkが小さくなり、第kの区画に含まれる各画素が明るい(輝度値:大)ほど平均輝度値MBkが大きくなることから、上記の式(2)のうちの係数MBmax/MBkは、全体的に暗い区画ほど大きな値となり、全体的に明るい区画ほど1に近い値となる(MBmax/MBk≧1)。従って、上記の式(2)による演算を全ての区画で行うことで、処理領域内の検査対象物画像のうち、全体的に暗い区画を構成する画素の輝度値が、全体的に明るい区画を構成する画素の輝度値と同等の大きさに置換される。つまり、全体的に暗い区画が全体的に明るくなるので、欠陥が暗部に存在する場合であっても、置換画像において欠陥とそれ以外の部分との輝度差が鮮明となる。その結果、置換画像から基準画像を生成し、この基準画像を用いて、撮像画像をシェーディング補正することによって、欠陥を精度よく確実に検出することが可能なる。   In the appearance inspection apparatus according to the present invention, a processing area to be subjected to appearance inspection processing in a captured image is divided into first to Kth sections. Then, the kth average luminance value MBk, which is the average value of the luminance values of the pixels included in the kth section, is calculated, and the largest value among the first to Kth average luminance values is selected as the maximum value MBmax. doing. Therefore, the average luminance value MBk decreases as each pixel included in the kth section is darker (luminance value: small), and the average luminance value MBk decreases as each pixel included in the kth section is brighter (luminance value: large). Therefore, the coefficient MBmax / MBk in the above equation (2) becomes a larger value as the overall dark section becomes closer to 1 as the overall bright section (MBmax / MBk ≧ 1). . Therefore, by performing the calculation according to the above equation (2) in all the sections, the luminance value of the pixels constituting the entire dark section of the inspection object image in the processing region is the entire bright section. It is replaced with the same size as the luminance value of the constituent pixels. That is, since the entire dark section is brightened as a whole, even if the defect exists in the dark part, the brightness difference between the defect and the other part in the replacement image becomes clear. As a result, it is possible to detect a defect accurately and reliably by generating a reference image from the replacement image and using the reference image to perform shading correction of the captured image.

好ましくは、区画は、処理領域内の検査対象物画像のうち輝度値の変化が大きい方向に沿って並ぶように設定されている。このようにすると、区画に含まれる画素の輝度値が各区画毎にある程度均一となる(各区画毎に同じような輝度分布となる)。つまり、処理領域内の検査対象物画像のうち、暗部と明部とが明瞭に区分され、同一区画に暗部と明部とが共に存在する可能性が低くなる。従って、上記の式(2)のうちの係数MBmax/MBkによって、処理領域内の検査対象物画像のうち暗部の輝度値が高利得で増幅されることとなる。その結果、置換画像において欠陥とそれ以外の部分との輝度差をより鮮明化することが可能となる。   Preferably, the sections are set so as to be arranged along a direction in which a change in luminance value is large in the inspection object image in the processing region. In this way, the luminance values of the pixels included in the section are uniform to some extent for each section (the same brightness distribution is obtained for each section). That is, in the inspection object image in the processing area, the dark part and the bright part are clearly divided, and the possibility that both the dark part and the bright part exist in the same section is reduced. Accordingly, the luminance value of the dark part of the inspection object image in the processing region is amplified with high gain by the coefficient MBmax / MBk in the above equation (2). As a result, the brightness difference between the defect and the other part in the replacement image can be made clearer.

本発明によれば、欠陥が暗部に存在する場合であっても、欠陥を精度よく確実に検出することが可能な外観検査方法及び外観検査装置を提供することができる   ADVANTAGE OF THE INVENTION According to this invention, even if a defect exists in a dark part, the external appearance inspection method and external appearance inspection apparatus which can detect a defect accurately and reliably can be provided.

図1の(a)は、外観検査装置の構成を概略的に示す斜視図であり、図1の(b)は、検査対象物の斜視図である。FIG. 1A is a perspective view schematically showing a configuration of an appearance inspection apparatus, and FIG. 1B is a perspective view of an inspection object. 図2は、外観検査処理の開始から終了までの手順を示すフローチャートである。FIG. 2 is a flowchart showing a procedure from the start to the end of the appearance inspection process. 図3は、補正画像作成処理の開始から終了までの手順を示すフローチャートである。FIG. 3 is a flowchart showing a procedure from the start to the end of the corrected image creation process. 図4は、第1欠陥検出処理の開始から終了までの手順を示すフローチャートである。FIG. 4 is a flowchart showing a procedure from the start to the end of the first defect detection process. 図5は、第2欠陥検出処理の開始から終了までの手順を示すフローチャートである。FIG. 5 is a flowchart showing a procedure from the start to the end of the second defect detection process. 図6は、第3欠陥検出処理の開始から終了までの手順を示すフローチャートである。FIG. 6 is a flowchart showing a procedure from the start to the end of the third defect detection process. 図7は、第1補正画像生成処理における各画像を示し、図7の(a)は撮像画像を示す図であり、図7の(b)は置換画像を示す図であり、図7の(c)はマスタ画像を示す図であり、図7の(d)は第1補正画像を示す図である。FIG. 7 shows each image in the first corrected image generation processing, FIG. 7A is a diagram showing a captured image, FIG. 7B is a diagram showing a replacement image, and FIG. FIG. 7C is a diagram showing a master image, and FIG. 7D is a diagram showing a first corrected image. 図8の(a)は、平均輝度値の算出方法を説明するための検査対象物画像を示す図であり、図8の(b)は、軸X方向における平均輝度値の分布を示す図であり、図8の(c)は、軸Y方向における平均輝度値の分布を示す図である。FIG. 8A is a diagram showing an inspection object image for explaining a method of calculating the average luminance value, and FIG. 8B is a diagram showing a distribution of average luminance values in the axis X direction. FIG. 8C is a diagram showing a distribution of average luminance values in the axis Y direction. 図9は、置換画像の生成方法を説明するための図であり、図9の(a)は、処理領域に複数の領域が設定された検査対象物画像を示す図であり、図9の(b)は、図9の(a)のB−B線における輝度値の分布を示す図であり、図9の(c)は、コントラスト強調処理後の、図9の(a)のB−B線における輝度値の分布を示す図である。FIG. 9 is a diagram for explaining a method of generating a replacement image. FIG. 9A is a diagram illustrating an inspection object image in which a plurality of regions are set as processing regions. FIG. 9B is a diagram showing a distribution of luminance values along the line BB in FIG. 9A, and FIG. 9C is a diagram showing the BB in FIG. 9A after the contrast enhancement processing. It is a figure which shows distribution of the luminance value in a line. 図10は、欠陥検出第1処理における各画像を示し、図10の(a)はソーベル処理画像を示す図であり、図10の(b)は第2補正画像を示す図であり、図10の(c)は2値化画像を示す図であり、図10の(d)は欠陥検出結果画像を示す図である。10A and 10B show images in the defect detection first process, FIG. 10A shows a Sobel processed image, FIG. 10B shows a second corrected image, and FIG. FIG. 10C is a diagram showing a binarized image, and FIG. 10D is a diagram showing a defect detection result image. 図11は、欠陥検出第2処理における各画像を示し、図11の(a)は第1補正画像を示す図であり、図11の(b)は微分処理画像を示す図であり、図11の(c)は第3補正画像を示す図であり、図11の(d)は2値化画像を示す図であり、図11の(e)は欠陥検出結果画像を示す図である。11 shows each image in the defect detection second process, FIG. 11A shows the first corrected image, FIG. 11B shows the differential process image, and FIG. (C) of FIG. 11 is a diagram showing a third corrected image, (d) of FIG. 11 is a diagram showing a binarized image, and (e) of FIG. 11 is a diagram showing a defect detection result image. 図12は、欠陥検出第3処理における各画像を示し、図12の(a)は撮像画像を示す図であり、図12の(b)は2値化画像を示す図である。FIG. 12 shows each image in the third defect detection process, FIG. 12A shows a captured image, and FIG. 12B shows a binarized image. 図13は、検査対象物がチップ型電子部品の素体である場合の、処理領域に複数の領域が設定された検査対象物画像を示す図である。FIG. 13 is a diagram illustrating an inspection object image in which a plurality of areas are set as processing areas when the inspection object is an element body of a chip-type electronic component.

本発明に係る外観検査装置10の好適な実施形態について、図面を参照して説明する。なお、説明において、同一要素又は同一機能を有する要素には同一符号を用いることとし、重複する説明は省略する。   A preferred embodiment of an appearance inspection apparatus 10 according to the present invention will be described with reference to the drawings. In the description, the same reference numerals are used for the same elements or elements having the same function, and a duplicate description is omitted.

(外観検査装置の構成)
図1を参照して、本実施形態に係る外観検査装置10の構成について説明する。
(Configuration of appearance inspection equipment)
With reference to FIG. 1, the structure of the external appearance inspection apparatus 10 which concerns on this embodiment is demonstrated.

外観検査装置10は、後述する検査対象物22の外観を検査するための装置である。そのために、外観検査装置10は、カメラ12と、画像処理部14と、ディスプレイ16と、LED照明器18a,18bとを有している(図1の(a)参照)。   The appearance inspection apparatus 10 is an apparatus for inspecting the appearance of an inspection object 22 to be described later. For this purpose, the appearance inspection apparatus 10 includes a camera 12, an image processing unit 14, a display 16, and LED illuminators 18a and 18b (see (a) of FIG. 1).

カメラ12は、LED照明器18a,18bによって照明された検査対象物22の外側面を撮像するものであり、例えばCCD(Charge Coupled Device)カメラを用いることができる。カメラ12では、検査対象物22の撮像画像P1,P13(図7の(a)、図12の(a)参照)を取得すると、その撮像画像P1のデータを画像処理部14に出力する。なお、カメラ12は、少なくとも輝度情報が得られればよいので、CMOS(Complementary Metal Oxide Semiconductor)カメラ、赤外線カメラ、白黒カメラ、カラーカメラ等であってもよい。   The camera 12 images the outer surface of the inspection object 22 illuminated by the LED illuminators 18a and 18b. For example, a CCD (Charge Coupled Device) camera can be used. When the camera 12 acquires the captured images P1 and P13 (see FIG. 7A and FIG. 12A) of the inspection target 22, the data of the captured image P1 is output to the image processing unit 14. The camera 12 may be a CMOS (Complementary Metal Oxide Semiconductor) camera, an infrared camera, a black and white camera, a color camera, or the like, as long as it can obtain at least luminance information.

画像処理部14は、CPU(CentralProcessing Unit)、ROM(Read Only Memory)、RAM(Random Access Memory)等を含む図示しないECU(Electronic Control Unit)等を有し、カメラ12によって出力された撮像画像の画像処理を行うものである。画像処理部14では、撮像画像P1,P13等の画像処理を行うと、その処理された画像をディスプレイ16に表示させるように、ディスプレイ16に画像信号を出力する。   The image processing unit 14 includes an unillustrated ECU (Electronic Control Unit) including a CPU (Central Processing Unit), a ROM (Read Only Memory), a RAM (Random Access Memory), and the like. Image processing is performed. When the image processing unit 14 performs image processing on the captured images P1, P13, and the like, the image processing unit 14 outputs an image signal to the display 16 so that the processed image is displayed on the display 16.

ディスプレイ16は、撮像画像P1,P13、後述する第1補正画像P3等の各種画像や欠陥の有無を表示するものである。このため、ディスプレイ16に表示される各種画像をオペレータが観察することで、人間の目視によっても検査対象物22の外観を検査することができるようになっている。   The display 16 displays various images such as captured images P1 and P13, a first corrected image P3 described later, and the presence or absence of defects. Therefore, the appearance of the inspection object 22 can be inspected by human eyes by observing various images displayed on the display 16 by the operator.

LED照明器18a,18bは、検査対象物22をその周囲360°方向から照明することのできるリング状の照明器具であり、検査対象物22の上方に検査対象物22が載置される載置板20と対向するようにそれぞれ設けられている。LED照明器18aは、載置板20側に配置されており、略円筒形状を呈し、その内側面に複数のLED光源が配列されている。このため、LED照明器18aでは、その内側面からLED照明器18aの中心方向に向かって照明することとなる。一方、LED照明器18bは、カメラ12側に配置されており、内側面が略円錐形状となっており、その内側面に複数のLED光源が配列されている。このため、LED照明器18bでは、その内側面から所定の角度をもって下方に向かって照明することとなる。これらのLED照明器18a,18bを用いることによって、検査対象物22に対して均一に照明を行っている。   The LED illuminators 18a and 18b are ring-shaped lighting fixtures that can illuminate the inspection object 22 from the direction of 360 ° around the LED illuminators 18a and 18b, and the inspection object 22 is placed above the inspection object 22. Each is provided so as to face the plate 20. The LED illuminator 18a is disposed on the mounting plate 20 side, has a substantially cylindrical shape, and a plurality of LED light sources are arranged on the inner surface thereof. For this reason, the LED illuminator 18a illuminates from the inner side surface toward the center of the LED illuminator 18a. On the other hand, the LED illuminator 18b is disposed on the camera 12 side, and has an inner surface of a substantially conical shape, and a plurality of LED light sources are arranged on the inner surface. For this reason, the LED illuminator 18b illuminates downward from the inner surface with a predetermined angle. By using these LED illuminators 18a and 18b, the inspection object 22 is uniformly illuminated.

ここで、検査対象物22は、本実施形態において、円柱面状とされた外周面22a及び内周面22bを有し、且つ、側面22cが円弧状となっている(図1の(b)参照)。この検査対象物22の外周面22a及び内周面22bには、検査対象物22を製造する工程において、円柱面状をなす外周面22a及び内周面22bの軸方向に沿うと共に、各検査対象物22毎に異なる研磨筋が形成されている。検査対象物22は、例えば、クーラー等のモータ用のマグネットとして用いられる。   Here, in this embodiment, the inspection object 22 has an outer peripheral surface 22a and an inner peripheral surface 22b that are formed into cylindrical surfaces, and the side surface 22c has an arc shape ((b) in FIG. 1). reference). The outer peripheral surface 22a and the inner peripheral surface 22b of the inspection object 22 are in the axial direction of the outer peripheral surface 22a and the inner peripheral surface 22b that form a cylindrical surface in the process of manufacturing the inspection object 22, and each inspection object Different polishing streaks are formed for each object 22. The inspection object 22 is used as a magnet for a motor such as a cooler, for example.

検査対象物22に生じうる欠陥としては、例えば、クラック、欠け、剥離がある。クラックは、他の欠陥と比べてその欠陥の大きさ(面積)が比較的小さい。クラックは、検査対象物22の表面からの欠陥の深さ(欠陥深さ)が深いため、撮像画像の欠陥部分における輝度値の変化量が大きな値となる傾向にある。欠けは、欠陥の大きさ(面積)として小さなものから大きなものまで生じうる。欠けは、欠陥深さが浅いものから深いものまであるために、撮像画像の欠陥部分における輝度値の変化量についても小さな値から大きな値をとりうる。剥離は、欠陥の大きさ(面積)が比較的大きい。剥離では、欠陥深さが比較的浅いため、撮像画像の欠陥部分における輝度値の変化量が小さな値となる傾向にある。   Examples of defects that can occur in the inspection object 22 include cracks, chips, and peeling. A crack has a relatively small size (area) compared to other defects. Since the crack has a deep defect depth (defect depth) from the surface of the inspection object 22, the amount of change in the luminance value in the defect portion of the captured image tends to be a large value. The chipping can occur from a small to a large defect size (area). Since the defect has a defect depth from a shallow depth to a deep depth, the amount of change in the luminance value in the defective portion of the captured image can take a small value to a large value. In peeling, the size (area) of defects is relatively large. In peeling, since the defect depth is relatively shallow, the amount of change in the luminance value in the defective portion of the captured image tends to be a small value.

(外観検査装置による外観検査方法)
次に、図2〜図12を参照して、以上の構成を有する外観検査装置10を用いた検査対象物22の外観検査処理方法について説明する。ここでは特に、検査対象物22のうち円柱面状となっている外周面22a又は内周面22bの外観検査を行う場合について説明する。なお、図2〜図6に示されるフローチャートでは、ステップをSと略記している。また、図7、図11及び図12では、それぞれ異なる検査対象物22を用いて、欠陥検出第1処理、欠陥検出第2処理及び欠陥検出第3処理を説明している。
(Appearance inspection method using appearance inspection equipment)
Next, with reference to FIGS. 2 to 12, an appearance inspection processing method for the inspection object 22 using the appearance inspection apparatus 10 having the above configuration will be described. Here, in particular, a case will be described in which an appearance inspection is performed on the outer peripheral surface 22a or the inner peripheral surface 22b having a cylindrical surface shape in the inspection object 22. In the flowcharts shown in FIGS. 2 to 6, the step is abbreviated as S. 7, 11, and 12, the defect detection first process, the defect detection second process, and the defect detection third process are described using different inspection objects 22.

外観検査装置10によって外観検査処理が開始されると、図2に示されるステップ1に進んで、外観検査装置20のオペレータによる検査対象物22の位置決めが行われる。具体的には、載置板20に設けられたピン(図示せず)に対して検査対象物22をバネで押しつけることによって、検査対象物22の研磨筋が検査対象物画像P1aの短辺(図8(a)に示される軸Y方向)に沿うように、検査対象物22を載置板20に固定する。こうすると、撮像画像P1と撮像画像P1における検査対象物22を示す画像(検査対象物画像)P1aとの外縁が平行となり、撮像画像P1から後述する第1補正画像P3が容易に得られることとなる。   When the appearance inspection process is started by the appearance inspection apparatus 10, the process proceeds to Step 1 shown in FIG. 2, and the inspection object 22 is positioned by the operator of the appearance inspection apparatus 20. Specifically, by pressing the inspection object 22 against a pin (not shown) provided on the mounting plate 20 with a spring, the polishing streaks of the inspection object 22 become short sides (in the inspection object image P1a). The inspection object 22 is fixed to the mounting plate 20 along the axis Y direction shown in FIG. In this way, the outer edges of the captured image P1 and the image (inspection object image) P1a indicating the inspection object 22 in the captured image P1 are parallel, and a first corrected image P3 described later can be easily obtained from the captured image P1. Become.

続いて、ステップ2に進むと、各LED照明器18a,18bによって照明された検査対象物22をカメラ12によって撮像する(図7(a)参照)。カメラ12による検査対象物22の撮像が行われると、撮像された撮像画像P1のデータが画像処理部14に出力される。以下に述べる第1補正画像生成処理、欠陥検出第1処理、欠陥検出第2処理、欠陥検出第3処理では、撮像画像P1のデータに基づき、画像処理部14によって検査対象物22の欠陥を検出するための各種処理が行われることとなる。   Subsequently, when proceeding to Step 2, the inspection object 22 illuminated by the LED illuminators 18a and 18b is imaged by the camera 12 (see FIG. 7A). When the inspection object 22 is imaged by the camera 12, data of the captured image P <b> 1 is output to the image processing unit 14. In the first corrected image generation process, the defect detection first process, the defect detection second process, and the defect detection third process described below, the defect of the inspection target 22 is detected by the image processing unit 14 based on the data of the captured image P1. Various processes are performed for this purpose.

(第1補正画像生成処理)
続くステップ3では、第1補正画像生成処理が行われる。第1補正画像生成処理が開始されると、図3に示されるステップ11に進んで、撮像画像P1において輝度値が0でない連続する画素の領域を求めた後、その画素の領域に外接する長方形を求めることで、撮像画像P1における検査対象物画像P1aの外形領域A1を決定する処理を行う。このとき、決定された外形領域A1の面積(画素数)及び外形領域A1の位置する座標を算出する処理も行われる。ステップ12に進むと、ステップ11において決定された外形領域A1の面積が所定の閾値以上であるか否かを判定する。すなわち、欠陥を検出する対象である検査対象物画像P1aの面積(画素数)は、各検査対象物22において略同一であるから、外形領域A1の面積(画素数)が閾値以上であれば撮像されたものが検査対象物22であると判定してステップ13に進むが、そうでなければ撮像されたものが検査対象物22ではない(例えば、検査対象物22の破片)と判定して図2に示されるステップ8に進んで、外観検査処理を終了するようにしている。
(First corrected image generation process)
In the subsequent step 3, a first corrected image generation process is performed. When the first corrected image generation process is started, the process proceeds to step 11 shown in FIG. 3, and after obtaining a region of continuous pixels whose luminance value is not 0 in the captured image P <b> 1, a rectangle circumscribing the region of the pixel Is obtained to determine the outer shape area A1 of the inspection object image P1a in the captured image P1. At this time, a process of calculating the determined area (number of pixels) of the outer region A1 and the coordinates where the outer region A1 is located is also performed. In step 12, it is determined whether or not the area of the outer shape area A1 determined in step 11 is equal to or larger than a predetermined threshold value. That is, since the area (number of pixels) of the inspection object image P1a that is a target for detecting a defect is substantially the same in each inspection object 22, imaging is performed if the area (number of pixels) of the outer region A1 is equal to or greater than the threshold value. If it is determined that the object to be inspected is the inspection object 22 and the process proceeds to step 13, otherwise, it is determined that the imaged object is not the inspection object 22 (for example, a fragment of the inspection object 22). The process proceeds to step 8 shown in FIG. 2 to end the appearance inspection process.

ステップ13に進むと、外形領域A1に基づいて、撮像画像P1において処理を行う対象となる領域(処理領域)A2を決定する。この処理領域A2を決定する処理について、図8を参照して、以下に具体的に説明する。なお、図8の(a)に示される外形領域A1においては、白実線の格子によって囲まれる矩形の各領域がそれぞれ画素に相当しており(図示の都合上、実際よりも大きさを誇張して描いている)、長辺と平行な軸X方向に沿う画素の座標が1〜xmax、短辺と平行で軸Xと直交する軸Y方向に沿う画素の座標が1〜ymaxとなっている。また、外形領域A1における任意座標(x,y)の画素の輝度値をI(x、y)と表すこととする。 In step 13, an area (processing area) A2 to be processed in the captured image P1 is determined based on the outer area A1. The processing for determining the processing area A2 will be specifically described below with reference to FIG. In addition, in the outer area A1 shown in FIG. 8A, each rectangular area surrounded by a white solid line grid corresponds to a pixel (for the sake of illustration, the size is exaggerated from the actual size). The coordinates of the pixels along the axis X direction parallel to the long side are 1 to x max , and the coordinates of the pixels along the axis Y direction parallel to the short side and orthogonal to the axis X are 1 to y max. ing. In addition, the luminance value of a pixel at an arbitrary coordinate (x, y) in the outer region A1 is represented as I (x, y).

処理領域A2を決定する際、まず、軸X方向に平行な一連の画素についての輝度値I(1,y)〜I(xmax,y)の平均(平均輝度値)Yを、軸Y方向毎に算出する。また、軸Y方向に平行な一連の画素についての輝度値I(x,1)〜I(x、ymax)の平均(平均輝度値)Xを、軸X方向毎に算出する。図8の(b),(c)に示される平均輝度分布L1、L2は、このように算出された平均輝度値X,Yの変化をそれぞれ表している。なお、Y座標がnであるときの平均輝度値Ynは下記の式(3)で表され、X座標がmであるときの平均輝度値Xmは下記の式(4)で表される。


これらの平均輝度値X,Yを求めた後、図8の(b),(c)においてそれぞれ破線で示される閾値と平均輝度値X,Yとを比較して、閾値と等しい平均輝度値X,Yを示すx座標及びy座標をそれぞれ求める。そして、このように求められた各座標を通り、各座標が存在する軸X又は軸Yに垂直な直線によって囲まれる領域を、処理領域A2に決定する。なお、外形領域A1を複数に分割し、それぞれの領域について平均輝度値を求めることで、処理領域A2を決定してもよい。
When determining the processing area A2, first, the average (average luminance value) Y of the luminance values I (1, y) to I (x max , y) for a series of pixels parallel to the axis X direction is calculated in the axis Y direction. Calculate every time. Further, an average (average luminance value) X of the luminance values I (x, 1) to I (x, y max ) for a series of pixels parallel to the axis Y direction is calculated for each axis X direction. The average luminance distributions L1 and L2 shown in FIGS. 8B and 8C represent changes in the average luminance values X and Y calculated in this way, respectively. The average luminance value Yn when the Y coordinate is n is expressed by the following equation (3), and the average luminance value Xm when the X coordinate is m is expressed by the following equation (4).


After obtaining these average luminance values X and Y, the threshold values indicated by the broken lines in FIGS. 8B and 8C are compared with the average luminance values X and Y, respectively, and the average luminance value X equal to the threshold value is compared. , Y indicating x and y coordinates respectively. Then, a region that passes through the coordinates thus obtained and is surrounded by a straight line perpendicular to the axis X or the axis Y where the coordinates exist is determined as the processing region A2. The processing area A2 may be determined by dividing the outer area A1 into a plurality of areas and obtaining an average luminance value for each area.

続いて、ステップ14に進むと、処理領域A2内における撮像画像P1(検査対象物画像P1a)に対してコントラスト強調処理を行い、置換画像Prを生成する。置換画像Prの生成の際には、まず、矩形状の処理領域A2を複数の矩形状の区画B1〜BK(Kは2以上の自然数)に区分(本実施形態においては区画B1〜B9の9つに区分)する(図9の(a)参照)。本実施形態において、区画B1〜B9は、処理領域A2の長手方向に沿って並ぶように設定されている。   Subsequently, when proceeding to step 14, contrast enhancement processing is performed on the captured image P1 (inspection object image P1a) in the processing area A2 to generate a replacement image Pr. When generating the replacement image Pr, first, the rectangular processing area A2 is divided into a plurality of rectangular sections B1 to BK (K is a natural number of 2 or more) (in the present embodiment, 9 of the sections B1 to B9). (Refer to FIG. 9A). In the present embodiment, the sections B1 to B9 are set so as to be aligned along the longitudinal direction of the processing area A2.

ここで、本実施形態の検査対象物22は、円柱面状とされた外周面22aを有している。そのため、図9の(a)の撮像画像P1では、中央部分が明るく写し出されており、左右側部分が暗く写し出されている一方、上下方向においては輝度値の変化が小さくなっている。つまり、区画B1〜B9は、処理領域A2内の検査対象物画像P1aのうち輝度値の変化が大きい方向に沿って並ぶように設定されているともいえる。なお、本実施形態に係る外観検査装置10では、同じ形の検査対象物22を大量に検査することを目的としており、欠陥がない限りいずれの撮像画像も似たものとなることが予想されるので、検査対象物22の検査に先立って予め複数の区画を設定していてもよく、検査対象物22ごとに区画を設定し直すようにしてもよい。   Here, the inspection object 22 of the present embodiment has an outer peripheral surface 22a having a cylindrical surface shape. For this reason, in the captured image P1 in FIG. 9A, the central portion is projected brightly, and the left and right side portions are projected darkly, while the change in luminance value is small in the vertical direction. That is, it can be said that the sections B1 to B9 are set so as to be arranged along the direction in which the change in the luminance value is large in the inspection object image P1a in the processing area A2. Note that the appearance inspection apparatus 10 according to the present embodiment aims to inspect a large number of inspection objects 22 having the same shape, and it is expected that any captured image will be similar as long as there is no defect. Therefore, a plurality of sections may be set in advance prior to the inspection of the inspection object 22, or the sections may be reset for each inspection object 22.

次に、区画内の全画素の輝度値の平均値である平均輝度値MBを、全ての区画について算出する。すなわち、区画B1〜BKが存在する場合に、区画Bk(kは1〜Kの自然数)における任意座標(x,y)の画素の輝度値をIk(x、y)と表すこととすると、区画kの平均輝度値MBkは下記の式(5)によって算出される。なお、本実施形態では、9つの区画B1〜B9が存在するため、各区画B1〜B9についての平均輝度値MB1〜MB9が算出される。
Next, an average luminance value MB, which is an average value of the luminance values of all the pixels in the section, is calculated for all the sections. That is, when there are sections B1 to BK, the luminance value of a pixel at an arbitrary coordinate (x, y) in the section Bk (k is a natural number of 1 to K) is expressed as Ik (x, y). The average luminance value MBk of k is calculated by the following equation (5). In the present embodiment, since there are nine sections B1 to B9, the average luminance values MB1 to MB9 for the sections B1 to B9 are calculated.

次に、平均輝度値MB1〜MBK(本実施形態ではMB1〜MB9)のうち最も大きい値(最高値MBmax)を、下記の式(6)によって算出する。
MBmax=max(MB1,MB2,・・・,MBK)・・・(6)
(max(引数1,引数2,・・・)は、引数1、引数2、・・・の中で最大の引数を返す関数を表す。)
なお、本実施形態では、区画B5が最も明るくなっていることから(図9の(a)参照)、平均輝度値MB5が最高値MBmaxとなる(MBmax=MB5)。
Next, the largest value (maximum value MBmax) among the average luminance values MB1 to MBK (MB1 to MB9 in the present embodiment) is calculated by the following equation (6).
MBmax = max (MB1, MB2,..., MBK) (6)
(Max (argument 1, argument 2,...) Represents a function that returns the largest argument among argument 1, argument 2,...)
In the present embodiment, since the section B5 is brightest (see FIG. 9A), the average luminance value MB5 becomes the maximum value MBmax (MBmax = MB5).

次に、区画Bkに含まれる各画素の輝度値を、下記の式(7)
Ik(x,y)×MBmax/MBk・・・(7)
によって得られた値でそれぞれ置換する処理を全ての区画B1〜BKにおいて行い、置換画像Prを生成する。ここで、上記の式(6)より、MBmax/MBk≧1であるから、上記の式(7)は、区画Bkに含まれる各画素の輝度値Ik(x,y)を、係数MBmax/MBkによって増幅することを意味する。なお、一例として、上記の式(7)による演算前の輝度値の分布の様子を図9の(b)に示し、上記の式(7)による演算後の輝度値の分布の様子を図9の(c)に示した。図9の(b),(c)に示されるように、区画B2,B8では平均輝度値MB2,MB8が小さいため、係数MBmax/MBkによって上記の式(7)の演算後における輝度値が大きく増幅されているのに対して、区画B5では平均輝度値MB5が最高値MBmaxとなっているので、上記の式(7)の演算後における輝度値は演算前と同じ値となっている。
Next, the luminance value of each pixel included in the section Bk is expressed by the following equation (7).
Ik (x, y) × MBmax / MBk (7)
The replacement process is performed in all the sections B1 to BK with the values obtained by the above steps, and the replacement image Pr is generated. Here, from the above equation (6), since MBmax / MBk ≧ 1, the above equation (7) expresses the luminance value Ik (x, y) of each pixel included in the section Bk as the coefficient MBmax / MBk. Means to amplify. As an example, FIG. 9B shows the distribution of luminance values before the calculation according to the above equation (7), and FIG. 9 shows the distribution of luminance values after the calculation according to the above equation (7). (C). As shown in (b) and (c) of FIG. 9, since the average luminance values MB2 and MB8 are small in the sections B2 and B8, the luminance value after the calculation of the above equation (7) is increased by the coefficient MBmax / MBk. On the other hand, since the average luminance value MB5 is the highest value MBmax in the section B5, the luminance value after the calculation of the above equation (7) is the same value as before the calculation.

続いて、ステップ15に進むと、置換画像Prに基づいてマスタ画像(基準画像)P2を生成する。マスタ画像P2の生成の際には、まず、置換画像Prの処理領域A2において再び平均輝度値X´,Y´を求める。これらの平均輝度値X´,Y´に基づいて、下記の式(8)から座標(m,n)における画素の輝度値I´(m,n)を処理領域A2の全画素について算出し、マスタ画像P2を生成する(図7の(c)参照)。
ここで、式(8)におけるα,βは、それぞれ軸X,Y方向における平均輝度値の寄与率となっている。マスタ画像P2を生成する際、寄与率α,βのうち平均輝度値X´,Y´について優先させたい側の値を大きく設定することで、生成されるマスタ画像P2を調節することができる。なお、本実施形態では、軸X方向に沿う研磨筋の影響を考慮するため、βよりもαの値を大きくしている。
Subsequently, when proceeding to Step 15, a master image (reference image) P2 is generated based on the replacement image Pr. When generating the master image P2, first, average luminance values X ′ and Y ′ are obtained again in the processing area A2 of the replacement image Pr. Based on these average luminance values X ′ and Y ′, the luminance value I ′ (m, n) of the pixel at the coordinates (m, n) is calculated for all the pixels in the processing area A2 from the following equation (8). A master image P2 is generated (see FIG. 7C).
Here, α and β in Expression (8) are the contribution ratios of the average luminance values in the directions of the axes X and Y, respectively. When generating the master image P2, the master image P2 to be generated can be adjusted by setting a larger value on the side of the contribution ratios α and β to be prioritized with respect to the average luminance values X ′ and Y ′. In the present embodiment, the value of α is made larger than β in order to take into account the influence of the polishing bars along the axis X direction.

続いて、ステップ16に進むと、処理領域A2における検査対象物画像P1aとマスタ画像P2とで対応する座標に位置する画素毎に、検査対象物画像P1aの各画素における輝度値からマスタ画像P2の各画素における輝度値を減算する。これにより、第1補正画像P3が生成され(図7の(d)参照)、第1補正画像生成処理が終了する。   Subsequently, when proceeding to Step 16, for each pixel located at the corresponding coordinates in the inspection object image P1a and the master image P2 in the processing area A2, the master image P2 is calculated from the luminance value in each pixel of the inspection object image P1a. The luminance value at each pixel is subtracted. Thereby, the 1st correction image P3 is produced | generated (refer (d) of FIG. 7), and a 1st correction image production | generation process is complete | finished.

(欠陥検出第1処理)
図2に戻り、ステップ4に進むと、欠陥検出第1処理が行われる。この欠陥検出第1処理では、例えば検査対象物22のクラックや検査対象物22に付着した異物による欠陥を検出している。欠陥検出第1処理が開始されると、図4に示されるステップ21に進んで、処理領域A2において第1補正画像P3をソーベルフィルタによって処理し、第1補正画像P3中における濃淡変化(エッジ部分)を検出する処理を行う。具体的には、第1補正画像P3における所定の画素とその画素の周囲における隣接画素とで、下記の式(9)による演算を第1補正画像P3の全ての画素について行う。これにより、第1補正画像P3における各画素の輝度値I´の変化量E1が求められ、濃淡変化が生じている箇所でエッジの検出が行われたソーベル処理画像P4が生成される(図10の(a)参照)。
また、ソーベル処理画像P4を生成した後、ソーベル処理画像P4における所定の画素とその画素の周囲における隣接画素とで、下記の式(10)による演算をソーベル処理画像P4の全ての画素について行う。これにより、ソーベル処理画像P4における各画素の輝度値I´の平均M1が求められ、ソーベル処理画像P4に生じているランダムなノイズを除去する平滑化が行われる。
なお、本実施形態では、階調を256階調(8bit)としているため、変化量E1を求める際に、変化量E1が下限値である0を下回る場合には変化量E1を下限値である0に固定し、変化量E1が上限値である255を上回る場合には変化量E1を上限値である255に固定する処理を行っているが、階調を256階調以外として同様の処理を行ってもよい。
(Defect detection first process)
Returning to FIG. 2 and proceeding to step 4, the first defect detection process is performed. In this defect detection first process, for example, a defect due to a crack in the inspection object 22 or a foreign substance attached to the inspection object 22 is detected. When the first defect detection process is started, the process proceeds to step 21 shown in FIG. 4, where the first corrected image P3 is processed by the Sobel filter in the processing area A2, and the change in density (edge) in the first corrected image P3 is processed. (Part) is detected. Specifically, the calculation according to the following equation (9) is performed for all the pixels of the first corrected image P3 with a predetermined pixel in the first corrected image P3 and adjacent pixels around the pixel. As a result, a change amount E1 of the luminance value I ′ of each pixel in the first corrected image P3 is obtained, and a Sobel processed image P4 is generated in which the edge is detected at the portion where the shade change occurs (FIG. 10). (See (a)).
In addition, after generating the Sobel processed image P4, the calculation according to the following equation (10) is performed for all the pixels of the Sobel processed image P4 with a predetermined pixel in the Sobel processed image P4 and adjacent pixels around the pixel. Thereby, the average M1 of the luminance values I ′ of each pixel in the Sobel processed image P4 is obtained, and smoothing is performed to remove random noise generated in the Sobel processed image P4.
In the present embodiment, since the gradation is set to 256 gradations (8 bits), when the change amount E1 is obtained, if the change amount E1 falls below the lower limit of 0, the change amount E1 is the lower limit value. When the change amount E1 exceeds the upper limit value of 255, the change amount E1 is fixed to 255, which is the upper limit value. However, the same processing is performed with gradations other than 256 gradations. You may go.

続いて、ステップ22に進むと、処理領域A2における第1補正画像P3とソーベル処理画像P4とで対応する座標に位置する画素毎に、第1補正画像P3の各画素における輝度値からソーベル処理画像P4の各画素における輝度値を減算する。これにより、第2補正画像P5が生成される(図10の(b)参照)。また、第2補正画像P5を生成後、第2補正画像P5に生じているランダムなノイズを除去するために、ステップ21と同じく第2補正画像P5の平滑化を行う。   Subsequently, when proceeding to step 22, for each pixel located at the corresponding coordinates in the first corrected image P3 and the Sobel processed image P4 in the processing area A2, the Sobel processed image is calculated from the luminance value in each pixel of the first corrected image P3. The luminance value in each pixel of P4 is subtracted. Thereby, the 2nd correction image P5 is produced | generated (refer FIG.10 (b)). Further, after generating the second corrected image P5, the second corrected image P5 is smoothed in the same manner as in step 21 in order to remove random noise generated in the second corrected image P5.

続いて、ステップ23に進むと、得られた第2補正画像P5を所定の閾値によって2値化処理し、その閾値以上の輝度値である画素を黒、その閾値より小さな輝度値である画素を白として表示した2値化画像P6を生成する(図10の(c)参照)。ここで、このステップ23の2値化処理において用いられる閾値は、事前に実験を行うことによって得られた値となっている(後述するステップ33,41において用いられる閾値も同じ)。また、本実施形態では、ステップ23,33の閾値の大きさは共に同じになっており、ステップ41の閾値の大きさはステップ23,33の閾値の大きさよりも大きくなっている。これは、ステップ23,33で2値化処理を行う前の第2補正画像及び第3補正画像では、ソーベルフィルタ及び微分フィルタによって欠陥部分以外の領域における輝度値が略均一となっているので閾値を設定することのできる範囲が広いのに対し、ステップ41で2値化処理を行う前の検査対象物画像P13aでは、欠陥部分以外の領域における輝度値が略均一となっていないので閾値を設定することのできる範囲が狭いためである。そして、ステップ24に進むと、2値化画像P6のラベリング処理を行い、2値化画像P6において白で表示される画素が連結している連結領域を特定する。また、ステップ24では、特定された連結領域の数、各連結領域の面積(画素数)及び処理領域A2における各連結領域の位置を検出する処理を行う。   Subsequently, when proceeding to Step 23, the obtained second corrected image P5 is binarized by a predetermined threshold value, pixels having a luminance value equal to or higher than the threshold value are black, and pixels having a luminance value smaller than the threshold value are selected. A binarized image P6 displayed as white is generated (see FIG. 10C). Here, the threshold value used in the binarization process in step 23 is a value obtained by conducting an experiment in advance (the threshold values used in steps 33 and 41 described later are also the same). In this embodiment, the threshold values in steps 23 and 33 are the same, and the threshold value in step 41 is larger than the threshold values in steps 23 and 33. This is because in the second and third corrected images before the binarization processing in steps 23 and 33, the luminance values in the regions other than the defective portion are substantially uniform by the Sobel filter and the differential filter. While the range in which the threshold can be set is wide, in the inspection object image P13a before the binarization processing in step 41, the luminance value in the region other than the defective portion is not substantially uniform, so the threshold is set. This is because the range that can be set is narrow. Then, when proceeding to step 24, the binarized image P6 is labeled, and a connected area where pixels displayed in white in the binarized image P6 are connected is specified. In step 24, processing is performed to detect the number of identified connected regions, the area (number of pixels) of each connected region, and the position of each connected region in the processing region A2.

続いて、ステップ25に進むと、ステップ24で検出された各連結領域について、各連結領域の面積(画素数)が所定の閾値より小さいか否かを判定する。その結果、全ての連結領域について連結領域の面積が閾値よりも小さいと判定された場合には欠陥検出第1処理が終了するが、そうでなければ図2のステップ8に進んで、現在外観検査が行われている検査対象物22に欠陥があると判定して、外観検査処理を終了する。ここで、このステップ25の判定において用いられる閾値も、事前に実験を行うことによって得られた値となっている(後述するステップ35,43において用いられる閾値も同じ)。また、本実施形態では、ステップ25,35の閾値の大きさは共に同じになっており、ステップ43の閾値の大きさはステップ25,35の閾値の大きさよりも大きくなっている。これは、欠陥検出第1処理で検出対象となっているクラックによる欠陥及び欠陥検出第2処理で検出対象となっている欠けによる欠陥の面積(画素数)が、欠陥検出第3処理で検出対象となっている剥離による欠陥の面積(画素数)よりも小さい傾向にあるためである。なお、図10の(d)は、処理領域A2における検査対象物画像P1aと2値化画像P6とで対応する座標に位置する画素毎に、検査対象物画像P1aの各画素と2値化画像P6の各画素とを加算して得られた欠陥検出結果画像P7となっている。   Subsequently, when proceeding to step 25, it is determined whether or not the area (number of pixels) of each connected region is smaller than a predetermined threshold for each connected region detected in step 24. As a result, if it is determined that the area of the connected region is smaller than the threshold value for all the connected regions, the first defect detection process ends. If not, the process proceeds to step 8 in FIG. It is determined that there is a defect in the inspection object 22 on which the inspection is performed, and the appearance inspection process is terminated. Here, the threshold value used in the determination of step 25 is also a value obtained by conducting an experiment in advance (the threshold values used in steps 35 and 43 described later are also the same). In this embodiment, the threshold values in steps 25 and 35 are the same, and the threshold value in step 43 is larger than the threshold values in steps 25 and 35. This is because the area (number of pixels) of the defect due to the crack that is the detection target in the defect detection first process and the defect that is the defect that is the detection target in the defect detection second process is the detection target in the defect detection third process. This is because the area (number of pixels) of the defect due to the peeling tends to be smaller. FIG. 10D shows each pixel of the inspection object image P1a and the binarized image for each pixel located at the corresponding coordinates in the inspection object image P1a and the binarized image P6 in the processing area A2. It is a defect detection result image P7 obtained by adding each pixel of P6.

(欠陥検出第2処理)
図2に戻り、ステップ5に進むと、欠陥検出第2処理が行われる。この欠陥検出第1処理では、例えば検査対象物22の欠けによる欠陥を検出している。欠陥検出第2処理が開始されると、図5に示されるステップ31に進んで、処理領域A2において第1補正画像P8(図11の(a)参照)を微分フィルタによって処理し、第1補正画像P8中における濃淡変化(エッジ部分)を検出する処理を行う。具体的には、第1補正画像P8における所定の画素とその画素の周囲における隣接画素とで、下記の式(11)による演算を第1補正画像P8の全ての画素について行う。これにより、第1補正画像P8における各画素の輝度値I´の変化量E2が求められ、濃淡変化が生じている箇所でエッジの検出が行われた微分処理画像P9が生成される(図11の(b)参照)。
また、微分処理画像P9を生成した後、微分処理画像P9における所定の画素とその画素の周囲における隣接画素とで、下記の式(12)による演算を微分処理画像P9の全ての画素について行う。これにより、微分処理画像P9における各画素の輝度値I´の平均M2が求められ、微分処理画像P9に生じているランダムなノイズを除去する平滑化が行われる。
なお、欠陥検出第2処理においても、変化量E2が下限値を下回る場合には変化量E2を下限値に固定し、変化量E2が上限値を上回る場合には変化量E2を上限値に固定する処理を行っている。
(Defect detection second process)
Returning to FIG. 2 and proceeding to step 5, the second defect detection process is performed. In this defect detection first process, for example, a defect due to a chip of the inspection object 22 is detected. When the second defect detection process is started, the process proceeds to step 31 shown in FIG. 5, where the first correction image P8 (see FIG. 11A) is processed by the differential filter in the processing area A2, and the first correction is performed. Processing for detecting a change in shading (edge portion) in the image P8 is performed. Specifically, the calculation according to the following equation (11) is performed for all the pixels of the first corrected image P8 with a predetermined pixel in the first corrected image P8 and adjacent pixels around the pixel. As a result, a change amount E2 of the luminance value I ′ of each pixel in the first corrected image P8 is obtained, and a differentiated image P9 is generated in which the edge is detected at the portion where the shading change occurs (FIG. 11). (See (b)).
In addition, after generating the differential processing image P9, the calculation according to the following expression (12) is performed on all the pixels of the differential processing image P9 with a predetermined pixel in the differential processing image P9 and adjacent pixels around the pixel. Thereby, the average M2 of the luminance values I ′ of each pixel in the differential processing image P9 is obtained, and smoothing is performed to remove random noise generated in the differential processing image P9.
In the second defect detection process, the change amount E2 is fixed to the lower limit value when the change amount E2 is lower than the lower limit value, and the change amount E2 is fixed to the upper limit value when the change amount E2 exceeds the upper limit value. Processing to do.

続いて、ステップ32に進むと、処理領域A2における第1補正画像P8と微分処理画像P9とで対応する座標に位置する画素毎に、第1補正画像P8の各画素における輝度値と微分処理画像P9の各画素における輝度値とを加算する。これにより、第3補正画像P10が生成される(図11の(c)参照)。また、第3補正画像P10の生成後、第3補正画像P10に生じているランダムなノイズを除去するために、ステップ21と同じく第3補正画像P10の平滑化を行う。   Subsequently, when the process proceeds to step 32, the luminance value and the differential processing image in each pixel of the first correction image P8 are determined for each pixel located at the corresponding coordinates in the processing area A2 in the first correction image P8 and the differential processing image P9. The luminance value in each pixel of P9 is added. Thereby, the 3rd correction image P10 is produced | generated (refer (c) of FIG. 11). Further, after the generation of the third corrected image P10, the third corrected image P10 is smoothed in the same manner as in step 21 in order to remove random noise generated in the third corrected image P10.

続いて、ステップ33に進むと、得られた第3補正画像P10を所定の閾値によって2値化処理し、その閾値以上の輝度値である画素を白、その閾値より小さな輝度値である画素を黒として表示した2値化画像P11を生成する(図11の(d)参照)。そして、ステップ34に進むと、2値化画像P11のラベリング処理を行い、2値化画像P11において白で表示される画素が連結している連結領域を特定する。また、ステップ34では、特定された連結領域の数、各連結領域の面積(画素数)及び処理領域A2における各連結領域の位置を検出する処理を行う。   Subsequently, when proceeding to Step 33, the obtained third corrected image P10 is binarized by a predetermined threshold value, pixels having a luminance value equal to or higher than the threshold value are white, and pixels having a luminance value smaller than the threshold value are selected. A binarized image P11 displayed as black is generated (see FIG. 11D). Then, when proceeding to step 34, the binarized image P11 is labeled, and a connected area where pixels displayed in white in the binarized image P11 are connected is specified. In step 34, processing is performed to detect the number of identified connected regions, the area (number of pixels) of each connected region, and the position of each connected region in the processing region A2.

続いて、ステップ35に進むと、ステップ34で検出された各連結領域について、各連結領域の面積(画素数)が所定の閾値より小さいか否かを判定する。その結果、全ての連結領域について連結領域の面積が閾値よりも小さいと判定された場合には欠陥検出第2処理が終了するが、そうでなければ図2のステップ8に進んで、現在外観検査が行われている検査対象物22に欠陥があると判定して、外観検査処理を終了する。なお、図11の(e)は、処理領域A2における図示しない検査対象物画像と2値化画像P11とで対応する座標に位置する画素毎に、検査対象物画像の各画素と2値化画像P11の各画素とを加算して得られた欠陥検出結果画像P12となっている。   Subsequently, when proceeding to step 35, it is determined whether or not the area (number of pixels) of each connected region is smaller than a predetermined threshold for each connected region detected in step 34. As a result, if it is determined that the area of the connected area is smaller than the threshold value for all the connected areas, the second defect detection process ends. If not, the process proceeds to step 8 in FIG. It is determined that there is a defect in the inspection object 22 on which the inspection is performed, and the appearance inspection process is terminated. Note that (e) in FIG. 11 shows each pixel of the inspection object image and the binarized image for each pixel located at coordinates corresponding to the inspection object image (not shown) and the binarized image P11 in the processing area A2. It is a defect detection result image P12 obtained by adding each pixel of P11.

(欠陥検出第3処理)
図2に戻り、ステップ6に進むと、欠陥検出第3処理が行われる。この欠陥検出第1処理では、例えば検査対象物22の剥離による欠陥を検出している。欠陥検出第3処理が開始されると、図6に示されるステップ41に進んで、処理領域A2における検査対象物画像P13aを所定の閾値によって2値化処理し、その閾値以上の輝度値である画素を白、その閾値より小さな輝度値である画素を黒として表示した2値化画像P14を生成する(図12の(b)参照)。そして、ステップ42に進むと、2値化画像P14のラベリング処理を行い、2値化画像P14において白で表示される画素が連結している連結領域を特定する。また、ステップ42では、特定された連結領域の数、各連結領域の面積(画素数)及び処理領域A2における各連結領域の位置を検出する処理を行う。
(Defect detection third process)
Returning to FIG. 2 and proceeding to step 6, a third defect detection process is performed. In the first defect detection process, for example, a defect due to peeling of the inspection object 22 is detected. When the third defect detection process is started, the process proceeds to step 41 shown in FIG. 6, where the inspection object image P13a in the processing area A2 is binarized by a predetermined threshold value, and the luminance value is equal to or higher than the threshold value. A binarized image P14 is generated in which the pixels are displayed as white and the pixels having a luminance value smaller than the threshold value are displayed as black (see FIG. 12B). Then, when proceeding to step 42, the binarized image P14 is labeled, and a connected region where pixels displayed in white in the binarized image P14 are connected is specified. In step 42, processing is performed to detect the number of identified connected regions, the area (number of pixels) of each connected region, and the position of each connected region in the processing region A2.

続いて、ステップ43に進むと、ステップ42で検出された各連結領域について、各連結領域の面積(画素数)が所定の閾値より小さいか否かを判定する。その結果、全ての連結領域について連結領域の面積が閾値よりも小さいと判定された場合には2値化処理が終了し、図2のステップ7に進んで、現在外観検査が行われている検査対象物22に欠陥がないと判定して、外観検査処理が終了する。一方、いずれかの連結領域の面積が閾値以上であると判定された場合には図2のステップ8に進んで、現在外観検査が行われている検査対象物22に欠陥があると判定して、外観検査処理が終了する。   Subsequently, when proceeding to step 43, it is determined whether or not the area (number of pixels) of each connected region is smaller than a predetermined threshold for each connected region detected in step 42. As a result, when it is determined that the area of the connected region is smaller than the threshold value for all the connected regions, the binarization process is completed, and the process proceeds to step 7 in FIG. It is determined that the object 22 is not defective, and the appearance inspection process is completed. On the other hand, if it is determined that the area of any of the connected regions is greater than or equal to the threshold, the process proceeds to step 8 in FIG. 2 to determine that the inspection object 22 currently undergoing visual inspection is defective. Then, the appearance inspection process ends.

以上のような本実施形態においては、撮像画像P1において外観検査処理を行う対象となる処理領域A2を、区画B1〜BKに区分している。そして、区画Bkに含まれる各画素の輝度値の平均値である平均輝度値Bkを算出し、平均輝度値B1〜BKのうち最も大きい値を最高値MBmaxとして選択している。そのため、区画Bkに含まれる各画素が暗い(輝度値:小)ほど平均輝度値MBkが小さくなり、区画Bkに含まれる各画素が明るい(輝度値:大)ほど平均輝度値MBkが大きくなることから、上記の式(7)のうちの係数MBmax/MBkは、全体的に暗い区画ほど大きな値となり、全体的に明るい区画ほど1に近い値となる(MBmax/MBk≧1)。従って、上記の式(7)による演算を全ての区画で行うことで、処理領域内の検査対象物画像のうち、全体的に暗い区画を構成する画素の輝度値が、全体的に明るい区画を構成する画素の輝度値と同等の大きさに置換される。つまり、全体的に暗い区画が全体的に明るくなるので、欠陥が暗部に存在する場合であっても、置換画像において欠陥とそれ以外の部分との輝度差が鮮明となる。その結果、置換画像から基準画像を生成し、この基準画像を用いて、撮像画像をシェーディング補正することによって、欠陥を精度よく確実に検出することが可能なる。   In the present embodiment as described above, the processing area A2 to be subjected to the appearance inspection process in the captured image P1 is divided into sections B1 to BK. Then, an average luminance value Bk that is an average value of the luminance values of the pixels included in the section Bk is calculated, and the largest value among the average luminance values B1 to BK is selected as the maximum value MBmax. Therefore, the average luminance value MBk decreases as the pixels included in the section Bk become darker (luminance value: small), and the average luminance value MBk increases as the pixels included in the section Bk become brighter (luminance value: large). Therefore, the coefficient MBmax / MBk in the above equation (7) becomes a larger value as the overall dark section becomes closer to 1 (MBmax / MBk ≧ 1) as the overall bright section. Therefore, by performing the calculation according to the above equation (7) in all the sections, the luminance value of the pixels constituting the entire dark section of the inspection object image in the processing region is the entire bright section. It is replaced with the same size as the luminance value of the constituent pixels. That is, since the entire dark section is brightened as a whole, even if the defect exists in the dark part, the brightness difference between the defect and the other part in the replacement image becomes clear. As a result, it is possible to detect a defect accurately and reliably by generating a reference image from the replacement image and using the reference image to perform shading correction of the captured image.

また、本実施形態においては、処理領域内の検査対象物画像のうち輝度値の変化が大きい方向に沿って並ぶように、区画B1〜区画BKが設定されている。このようにすると、区画に含まれる画素の輝度値が各区画毎にある程度均一となる(各区画毎に同じような輝度分布となる)。つまり、処理領域A2内の検査対象物画像P1aのうち、暗部と明部とが明瞭に区分され、同一区画に暗部と明部とが共に存在する可能性が低くなる。従って、上記の式(7)のうちの係数MBmax/MBkによって、処理領域A2内の検査対象物画像P1aのうち暗部の輝度値が高利得で増幅されることとなる。その結果、置換画像Prにおいて欠陥とそれ以外の部分との輝度差をより鮮明化することが可能となる。   Further, in the present embodiment, the sections B1 to BK are set so as to be arranged along the direction in which the change in the luminance value is large in the inspection object image in the processing region. In this way, the luminance values of the pixels included in the section are uniform to some extent for each section (the same brightness distribution is obtained for each section). That is, in the inspection object image P1a in the processing area A2, the dark part and the bright part are clearly divided, and the possibility that both the dark part and the bright part exist in the same section is reduced. Therefore, the luminance value of the dark part of the inspection object image P1a in the processing area A2 is amplified with high gain by the coefficient MBmax / MBk in the above equation (7). As a result, the brightness difference between the defect and the other portion in the replacement image Pr can be made clearer.

以上、本発明の好適な実施形態について詳細に説明したが、本発明は上記した実施形態に限定されるものではない。例えば、本実施形態では外観検査処理において欠陥検出第1〜第3処理を行っているが、これらの処理のうち欠陥検出第1処理だけを行うものであってもよい。また、欠陥検出第1及び第2処理を行うものであってもよく、欠陥検出第1及び第3処理を行うものであってもよい。さらに、欠陥検出第1〜第3処理の各処理のうち、いずれの処理から実行を開始してもよい。   Although the preferred embodiments of the present invention have been described in detail above, the present invention is not limited to the above-described embodiments. For example, in the present embodiment, the defect detection first to third processes are performed in the appearance inspection process, but only the defect detection first process may be performed among these processes. Further, the defect detection first and second processes may be performed, or the defect detection first and third processes may be performed. Furthermore, execution may be started from any of the processes of the defect detection first to third processes.

また、本実施形態では曲面を有する検査対象物22について外観検査を行っていたが、これに限られず、平面状の検査対象物の外観検査を行ってもよい。また、チップコンデンサやチップインダクタ等の略直方体形状の電子部品(チップ型電子部品)やその素体を検査対象物として外観検査を行ってもよい。   In the present embodiment, the appearance inspection is performed on the inspection target 22 having a curved surface. However, the present invention is not limited to this, and the appearance inspection of a planar inspection target may be performed. Further, an appearance inspection may be performed by using a substantially rectangular parallelepiped-shaped electronic component (chip-type electronic component) such as a chip capacitor or a chip inductor or an element body thereof as an inspection object.

ここで、チップ型電子部品は、素体に外部電極を焼付けて製造されるが、一般に、素体への外部電極の焼付の前に素体に対してバレル研磨が行われることから、素体の稜部は、面取りされて丸みを帯びた状態となっている。そのため、素体を撮像した撮像画像においては、側面ほど明るく写し出され、稜部に向かうほど暗く写し出される傾向にある(図13参照)。従って、検査対象物がチップ型電子部品やその素体である場合には、図13に示されるように区画を区分することが好適である。   Here, the chip-type electronic component is manufactured by baking the external electrode on the element body. Generally, the element body is subjected to barrel polishing before the external electrode is baked on the element body. The ridge is chamfered and rounded. For this reason, in the captured image obtained by imaging the element body, the side surface tends to appear brighter and the darker the image toward the ridge portion (see FIG. 13). Therefore, when the inspection object is a chip-type electronic component or its element body, it is preferable to divide the sections as shown in FIG.

具体的には、図13においては、素体の側面の中央部分を区画B1とし、図面右側の稜部を区画B2,B3とし、図面左側の稜部を区画B4,B5とし、図面上側の稜部を区画B6,B7とし、図面下側の稜部を区画B8,B9としている。従って、図13の上下方向を見ると、上側稜部、素体の側面の中央部分、下側稜部の順で、画素の輝度値が小、大、小(すなわち、暗、明、暗)となる傾向となっていることから、区画B7,B6,B1,B8,B9は、輝度値の変化が大きい方向に沿って並ぶように設定されているといえる。同じく、図13の左右方向を見ると、右側稜部、素体の側面の中央部分、左側稜部の順で、画素の輝度値が小、大、小(すなわち、暗、明、暗)となる傾向となっていることから、区画B3,B2,B1,B4,B5は、輝度値の変化が大きい方向に沿って並ぶように設定されているといえる。   Specifically, in FIG. 13, the central portion of the side surface of the element body is defined as a section B1, the ridges on the right side of the drawing are defined as sections B2 and B3, and the ridges on the left side of the drawing are defined as sections B4 and B5. The sections are defined as sections B6 and B7, and the ridges on the lower side of the drawing are defined as sections B8 and B9. Therefore, when viewing the vertical direction in FIG. 13, the luminance values of the pixels are small, large, and small (that is, dark, bright, dark) in the order of the upper ridge, the center of the side of the element body, and the lower ridge. Therefore, it can be said that the sections B7, B6, B1, B8, and B9 are set so as to be aligned along the direction in which the change in the luminance value is large. Similarly, when viewing the horizontal direction in FIG. 13, the luminance values of the pixels are small, large, and small (that is, dark, bright, dark) in the order of the right ridge, the center of the side surface of the element body, and the left ridge. Therefore, it can be said that the sections B3, B2, B1, B4, and B5 are set so as to be arranged along the direction in which the change in luminance value is large.

また、ステップ11において、検査対象物画像P1aのエッジを4方向から探索することによって、外形領域A1を決定してもよい。   In step 11, the outer region A1 may be determined by searching for the edge of the inspection object image P1a from four directions.

10…外観検査装置、12…カメラ、14…画像処理部、22…検査対象物、P1,P
13…撮像画像、P1a,P13a…検査対象物画像、Pr…置換画像、P2…マスタ画像、P3,P8…第1補正画像、P4…ソーベル処理画像、P5…第2補正画像、P9…微分処理画像、P10…第3補正画像。
DESCRIPTION OF SYMBOLS 10 ... Appearance inspection apparatus, 12 ... Camera, 14 ... Image processing part, 22 ... Inspection object, P1, P
13 ... Captured image, P1a, P13a ... Inspection object image, Pr ... Replacement image, P2 ... Master image, P3, P8 ... First corrected image, P4 ... Sobel processed image, P5 ... Second corrected image, P9 ... Differential processing Image, P10 ... third corrected image.

Claims (4)

検査対象物の外観検査を行うための外観検査方法であって、
前記検査対象物を撮像して検査対象物画像を含む撮像画像を取得する工程と、
前記撮像画像において外観検査処理を行う対象となる処理領域を決定する工程と、
前記処理領域内に設定されると共に前記処理領域を区分する第1〜第K(Kは2以上の自然数)の区画のうち、前記第k(kは1〜Kの自然数)の区画に含まれる各画素の輝度値の平均値である第kの平均輝度値MBkを算出する工程と、
前記第1〜第Kの平均輝度値のうち最も大きい値を最高値MBmaxとして選択する工程と、
前記第kの区画に含まれる各画素の輝度値を、下記の式(1)
Ik(x,y)×MBmax/MBk・・・(1)
(ただし、Ik(x,y)は、前記第kの区画に含まれる任意座標(x,y)の画素の輝度値を表す。)
によって得られた値でそれぞれ置換して、置換画像を生成する工程と、
前記置換画像の外縁に沿う第1の方向に平行な一連の画素からなる第1の画素列毎に該第1の画素列に含まれる前記一連の画素の輝度値の平均を算出すると共に、前記第1の方向と直交する第2の方向に平行な一連の画素からなる第2の画素列毎に該第2の画素列に含まれる前記一連の画素の輝度値の平均を算出することで、前記第1の方向及び前記第2の方向における前記置換画像の平均輝度分布を算出する工程と、
前記置換画像に対して基準となる基準画像を前記平均輝度分布に基づいて生成する工程と、
前記基準画像を用いて、前記撮像画像をシェーディング補正する工程とを有することを特徴とする外観検査方法。
An appearance inspection method for performing an appearance inspection of an inspection object,
Imaging the inspection object to obtain a captured image including the inspection object image;
Determining a processing region to be subjected to appearance inspection processing in the captured image;
Among the first to Kth (K is a natural number of 2 or more) sections that are set in the processing area and divide the processing area, they are included in the kth (k is a natural number of 1 to K) section. Calculating a k-th average luminance value MBk, which is an average value of the luminance values of each pixel;
Selecting the largest value among the first to Kth average luminance values as the highest value MBmax;
The luminance value of each pixel included in the kth section is expressed by the following equation (1).
Ik (x, y) × MBmax / MBk (1)
(However, Ik (x, y) represents a luminance value of a pixel at an arbitrary coordinate (x, y) included in the kth section.)
Generating a replacement image by replacing each with the value obtained by
Calculating an average of luminance values of the series of pixels included in the first pixel column for each first pixel column including a series of pixels parallel to a first direction along an outer edge of the replacement image; By calculating the average of the luminance values of the series of pixels included in the second pixel column for each second pixel column composed of a series of pixels parallel to the second direction orthogonal to the first direction, Calculating an average luminance distribution of the replacement image in the first direction and the second direction;
Generating a reference image serving as a reference for the replacement image based on the average luminance distribution;
And a step of shading correction of the captured image using the reference image.
前記区画は、前記処理領域内の前記検査対象物画像のうち輝度値の変化が大きい方向に沿って並ぶように設定されていることを特徴とする、請求項1に記載された外観検査方法。   The appearance inspection method according to claim 1, wherein the section is set so as to be arranged along a direction in which a change in luminance value is large in the inspection object image in the processing region. 検査対象物の外観検査を行うための外観検査装置であって、
前記検査対象物を照明する照明手段と、
前記照明手段によって照明された前記検査対象物を撮像して、検査対象物画像を含む撮像画像を取得する撮像手段と、
前記撮像手段によって撮像された前記撮像画像において外観検査処理を行う対象となる処理領域を決定する手段と、
前記処理領域内に設定されると共に前記処理領域を区分する第1〜第K(Kは2以上の自然数)の区画のうち、前記第k(kは1〜Kの自然数)の区画に含まれる各画素の輝度値の平均値である第kの平均輝度値MBkを算出する手段と、
前記第1〜第Kの平均輝度値のうち最も大きい値を最高値MBmaxとして選択する手段と、
前記第kの区画に含まれる各画素の輝度値を、下記の式(2)
Ik(x,y)×MBmax/MBk・・・(2)
(ただし、Ik(x,y)は、前記第kの区画に含まれる任意座標(x,y)の画素の輝度値を表す。)
によって得られた値でそれぞれ置換して、置換画像を生成する手段と、
前記置換画像の外縁に沿う第1の方向に平行な一連の画素からなる第1の画素列毎に該第1の画素列に含まれる前記一連の画素の輝度値の平均を算出すると共に、前記第1の方向と直交する第2の方向に平行な一連の画素からなる第2の画素列毎に該第2の画素列に含まれる前記一連の画素の輝度値の平均を算出することで、前記第1の方向及び前記第2の方向における前記置換画像の平均輝度分布を算出する手段と、
前記置換画像に対して基準となる基準画像を前記平均輝度分布に基づいて生成する手段と、
前記基準画像を用いて、前記撮像画像をシェーディング補正する手段とを備えることを特徴とする外観検査装置。
An appearance inspection apparatus for inspecting the appearance of an inspection object,
Illuminating means for illuminating the inspection object;
An imaging unit that captures an image of the inspection object illuminated by the illumination unit and obtains a captured image including the inspection object image;
Means for determining a processing region to be subjected to appearance inspection processing in the captured image captured by the imaging means;
Among the first to Kth (K is a natural number of 2 or more) sections that are set in the processing area and divide the processing area, they are included in the kth (k is a natural number of 1 to K) section. Means for calculating a k-th average luminance value MBk, which is an average value of luminance values of the respective pixels;
Means for selecting the largest value among the first to K-th average luminance values as the highest value MBmax;
The luminance value of each pixel included in the kth section is expressed by the following equation (2).
Ik (x, y) × MBmax / MBk (2)
(However, Ik (x, y) represents a luminance value of a pixel at an arbitrary coordinate (x, y) included in the kth section.)
Means for generating a replacement image by replacing each of the values obtained by
Calculating an average of luminance values of the series of pixels included in the first pixel column for each first pixel column including a series of pixels parallel to a first direction along an outer edge of the replacement image; By calculating the average of the luminance values of the series of pixels included in the second pixel column for each second pixel column composed of a series of pixels parallel to the second direction orthogonal to the first direction, Means for calculating an average luminance distribution of the replacement image in the first direction and the second direction;
Means for generating a reference image serving as a reference for the replacement image based on the average luminance distribution;
An appearance inspection apparatus comprising: means for shading correction of the captured image using the reference image.
前記区画は、前記処理領域内の前記検査対象物画像のうち輝度値の変化が大きい方向に沿って並ぶように設定されていることを特徴とする、請求項3に記載された外観検査装置。   The appearance inspection apparatus according to claim 3, wherein the section is set so as to be arranged along a direction in which a change in luminance value is large in the inspection object image in the processing region.
JP2009095962A 2009-04-10 2009-04-10 Appearance inspection method and appearance inspection apparatus Active JP5402182B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009095962A JP5402182B2 (en) 2009-04-10 2009-04-10 Appearance inspection method and appearance inspection apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009095962A JP5402182B2 (en) 2009-04-10 2009-04-10 Appearance inspection method and appearance inspection apparatus

Publications (2)

Publication Number Publication Date
JP2010249522A JP2010249522A (en) 2010-11-04
JP5402182B2 true JP5402182B2 (en) 2014-01-29

Family

ID=43312042

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009095962A Active JP5402182B2 (en) 2009-04-10 2009-04-10 Appearance inspection method and appearance inspection apparatus

Country Status (1)

Country Link
JP (1) JP5402182B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102761751A (en) * 2011-12-16 2012-10-31 新奥特(北京)视频技术有限公司 Subarea toning method and system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4100846B2 (en) * 1999-12-24 2008-06-11 Ntn株式会社 Surface texture inspection method and surface texture inspection apparatus
JP3905741B2 (en) * 2001-10-29 2007-04-18 ペンタックス株式会社 Optical member inspection method
JP3917431B2 (en) * 2002-01-25 2007-05-23 ペンタックス株式会社 Optical member inspection method
JP4150390B2 (en) * 2005-09-14 2008-09-17 Tdk株式会社 Appearance inspection method and appearance inspection apparatus
JP5174540B2 (en) * 2008-06-03 2013-04-03 パナソニック株式会社 Wood defect detection device

Also Published As

Publication number Publication date
JP2010249522A (en) 2010-11-04

Similar Documents

Publication Publication Date Title
JP4150390B2 (en) Appearance inspection method and appearance inspection apparatus
CN108445007B (en) Detection method and detection device based on image fusion
JP4707605B2 (en) Image inspection method and image inspection apparatus using the method
US20070047801A1 (en) Defect detecting method and defect detecting device
JP2007285754A (en) Flaw detection method and flaw detector
JP4279833B2 (en) Appearance inspection method and appearance inspection apparatus
JP2006284471A (en) Pattern inspection method, pattern inspection device and pattern inspecting program
JP2005121546A (en) Defect inspection method
JP2009036582A (en) Inspection method, inspection device and inspection program of plane display panel
JP4244046B2 (en) Image processing method and image processing apparatus
JP2005165387A (en) Method and device for detecting stripe defective of picture and display device
JP2004212311A (en) Method and apparatus for detecting unevenness defect
JP6647903B2 (en) Image inspection device, image inspection program, computer-readable recording medium, and recorded device
JP5402182B2 (en) Appearance inspection method and appearance inspection apparatus
JP7003669B2 (en) Surface inspection equipment and surface inspection method
JP2005326323A (en) Image quality inspection device
KR101993654B1 (en) Inspecting apparatus mura of display panel and method thereof
JP2003329428A (en) Device and method for surface inspection
JP2007081513A (en) Blot defect detecting method for solid-state imaging element
JP6114559B2 (en) Automatic unevenness detector for flat panel display
JP2005140655A (en) Method of detecting stain flaw, and stain flaw detector
JP2004226272A (en) Method and apparatus for detecting stain defect
JP2012185030A (en) Color unevenness determination device, color unevenness determination method and display device
KR20210085411A (en) Appratus for automatic detection of repeated mura for the display panel and method for the same
JP2004286708A (en) Defect detection apparatus, method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20111125

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130115

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130129

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131014

R150 Certificate of patent or registration of utility model

Ref document number: 5402182

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150