JP2015210652A - Image processor, and image processing method - Google Patents

Image processor, and image processing method Download PDF

Info

Publication number
JP2015210652A
JP2015210652A JP2014091580A JP2014091580A JP2015210652A JP 2015210652 A JP2015210652 A JP 2015210652A JP 2014091580 A JP2014091580 A JP 2014091580A JP 2014091580 A JP2014091580 A JP 2014091580A JP 2015210652 A JP2015210652 A JP 2015210652A
Authority
JP
Japan
Prior art keywords
pixel
label value
image data
value
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.)
Pending
Application number
JP2014091580A
Other languages
Japanese (ja)
Inventor
悠也 三宅
Yuya Miyake
悠也 三宅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2014091580A priority Critical patent/JP2015210652A/en
Publication of JP2015210652A publication Critical patent/JP2015210652A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To enable the simplification and the high efficiency achievement of image processing for recognizing divided defects to be the same defect in the case that a defect of an object to be inspected is divided into both ends of image data after polar coordinate conversion due to a starting position of polar coordinate conversion processing.SOLUTION: An image processor includes a storage part which can store image data acquired by imaging the object to be inspected, and a control part for executing polar coordinate conversion processing, binarization processing, and labeling processing. The control part gives the same label value because both pixels are connected in the case that a pixel with a label value to be given thereto respectively exists in one end 120d corresponding to the starting position in a circumferential direction of polar coordinate conversion processing of image data 120 subjected to binarization processing in labeling processing, and in the other end 120e corresponding to the ending position in the circumferential direction.

Description

本発明は、取得した画像データにラベリング処理を実行する画像処理装置、及び画像処理方法に関する。   The present invention relates to an image processing apparatus and an image processing method for executing a labeling process on acquired image data.

従来、例えば、レンズなどの光学部材(以下、「被検査物」という)を、画像処理を用いて欠陥(ゴミや傷など)の有無を検査し、良品不良品の判定(以下、「不良判定」という)を行う検査装置が知られている。このような検査装置では、光源から光を照射された被検査物をカメラで撮影し、撮像された画像データに所定の画像処理を施すことにより、欠陥を抽出し、不良判定を行う検査を実行している。所定の画像処理として、検査装置は、例えば、画像データ中に写っている物体の面積や長さなどの特徴量を取得するためにラベリング処理を実行する。ここで、ラベリング処理とは、画素が有する値(以下、「画素値」という)を予め定められた閾値を境にして2値化する2値化処理が実行された画像データに対し、閾値以上の画素値を有する画素が連結している領域に同一のラベル値を付与する処理である。   Conventionally, for example, an optical member such as a lens (hereinafter referred to as “inspected object”) is inspected for the presence of defects (dust, scratches, etc.) using image processing to determine whether the product is defective or not (hereinafter referred to as “defect determination”). Is known). In such an inspection apparatus, an inspection object irradiated with light from a light source is photographed with a camera, and a predetermined image processing is performed on the captured image data, thereby extracting defects and performing an inspection for determining a defect. doing. As the predetermined image processing, for example, the inspection apparatus executes a labeling process in order to acquire a feature amount such as an area or length of an object shown in the image data. Here, the labeling process is a threshold value or higher for image data on which a binarization process for binarizing a value of a pixel (hereinafter referred to as “pixel value”) with a predetermined threshold as a boundary is executed. This is a process of assigning the same label value to a region where pixels having a pixel value of are connected.

上述した検査装置においては、ラベリング処理を実行した画像データに対し、画像データ中にある欠陥の面積や長さなどの特徴量を抽出する特徴量解析処理を実行する。特徴量解析処理において、検査装置は、ラベリング処理を実行した画像データを参照し、ラベリング処理によって同一のラベル値を付与された欠陥の特徴量を抽出する。そして、検査装置は、不良判定において、特徴量解析処理によって抽出された欠陥の特徴量が一定以上の値である場合に、被検査物には欠陥が存在し不良である、との判定をする。   In the inspection apparatus described above, feature amount analysis processing for extracting feature amounts such as the area and length of defects in the image data is performed on the image data on which the labeling processing has been performed. In the feature amount analysis process, the inspection apparatus refers to the image data that has been subjected to the labeling process, and extracts the feature amount of the defect that has been given the same label value by the labeling process. Then, in the defect determination, the inspection apparatus determines that the defect exists in the inspection object and is defective when the feature amount of the defect extracted by the feature amount analysis process is a certain value or more. .

ここで、被検査物が紙コップや、鉄パイプ、レンズなどの、点対称の形状のものである場合には、必要になる特徴量として、回転方向の長さ、中心からの距離などの特徴量が必要になる場合がある。これらの特徴量は、直交座標系の画像からの特徴量解析では算出しにくいため、極座標展開処理を行い極座標系の画像に対してラベリング処理を行うことが多い。しかしながら、被検査物を撮像し取得した画像データに対して極座標変換処理を実行する場合に、極座標変換処理の開始座標、及び終了座標にまたがって欠陥が位置していた場合には、1つの欠陥が極座標変換した画像データの両端に分割されてしまう。このような場合に、ラベリング処理を実行すると、画像データの両端に分割された1つの欠陥にそれぞれ別個のラベル値を付与してしまう。そのため、検査装置は、特徴量解析処理において、画像データの両端に分割され、それぞれに別個のラベル値を付与された1つの欠陥が、別々の欠陥であるものとして特徴量解析処理を実行してしまう。その結果、検査装置は、分割された各欠陥から、1つの欠陥の特徴量よりも小さな特徴量をそれぞれ抽出してしまい、上述した不良判定において、正確に不良判定を実行できない、という問題が生じることがある。   Here, if the object to be inspected has a point-symmetric shape, such as a paper cup, iron pipe, or lens, the required features include features such as the length in the rotational direction and the distance from the center. An amount may be required. Since these feature amounts are difficult to calculate by feature amount analysis from an orthogonal coordinate system image, polar coordinate expansion processing is often performed and labeling processing is performed on the polar coordinate system image. However, when the polar coordinate conversion process is executed on the image data obtained by imaging the inspection object, if the defect is located across the start coordinate and the end coordinate of the polar coordinate conversion process, one defect is detected. Will be divided at both ends of the polar coordinate transformed image data. In such a case, when the labeling process is executed, separate label values are given to one defect divided at both ends of the image data. Therefore, the inspection apparatus executes the feature amount analysis process in the feature amount analysis process on the assumption that one defect that is divided at both ends of the image data and is given a separate label value is a separate defect. End up. As a result, the inspection apparatus extracts a feature amount smaller than the feature amount of one defect from each of the divided defects, and there arises a problem that the defect determination cannot be performed accurately in the above-described defect determination. Sometimes.

極座標変換処理を実行した画像データを用いて不良判定を実行する場合に、極座標変換処理の開始座標に起因して欠陥の不良判定に問題が生じることを解消する方法としては、特許文献1,2に記載された方法が提案されている。   Patent Documents 1 and 2 are methods for solving the problem of defect defect determination caused by the starting coordinates of polar coordinate conversion processing when performing defect determination using image data subjected to polar coordinate conversion processing. Has been proposed.

例えば、特許文献1に記載された方法では、極座標変換処理を実行した画像データの一端に欠陥が見つかった場合に、該見つかった欠陥を含む一端の一部を左右反転してコピーする。そして、左右反転してコピーした一端の一部を、他端に繋げてから不良判定を実行することで、欠陥の不良判定に問題が生じることを防止している。   For example, in the method described in Patent Document 1, when a defect is found at one end of image data subjected to polar coordinate conversion processing, a part of one end including the found defect is reversed and copied. Then, a defect determination is executed after connecting a part of one end that has been reversed left and right to the other end, thereby preventing a defect from being problematic.

また、特許文献2に記載された方法では、極座標変換処理において、360°以上にわたって極座標変換処理を実行することにより、欠陥が分割されることを防ぎ、欠陥の不良判定に問題が生じることを防止している。   Moreover, in the method described in Patent Document 2, by performing the polar coordinate conversion process over 360 ° or more in the polar coordinate conversion process, it is possible to prevent the defect from being divided and to prevent a problem from being caused in the defect defect determination. doing.

特開2003−240727号公報JP 2003-240727 A 特開2005−265488号公報JP 2005-265488 A

しかしながら、特許文献1に記載された発明においては、欠陥を一度抽出した後に、欠陥を含む画像データの一端の一部をコピーし、画像データの他端に接続した後に、再度欠陥を抽出している。そのため、特許文献1に記載された発明においては、欠陥を複数回抽出してから不良判定を実行しており、画像処理が煩雑で検査結果を出すまでに時間がかかってしまうという問題があった。   However, in the invention described in Patent Document 1, after extracting the defect once, a part of one end of the image data including the defect is copied, connected to the other end of the image data, and then extracted again. Yes. Therefore, in the invention described in Patent Document 1, the defect determination is executed after extracting the defect a plurality of times, and there is a problem that it takes time until the inspection result is output due to complicated image processing. .

また、特許文献2に記載された発明においては、360°以上にわたって極座標変換処理を実行することで、本来必要な360°にわたって極座標変換処理を実行した場合に取得できる画像データよりも、データ容量が大きくなってしまう。そのため、特許文献2に記載された発明においては、画像データを記憶するメモリ領域が多く必要になってしまい、また、画像処理を実行する画像データが大きいことで、特徴量解析処理などの各画像処理に時間がかかってしまうという問題があった。   Further, in the invention described in Patent Document 2, by performing the polar coordinate conversion process over 360 ° or more, the data capacity is larger than the image data that can be acquired when the polar coordinate conversion process is performed over the originally necessary 360 °. It gets bigger. For this reason, in the invention described in Patent Document 2, a large memory area for storing image data is required, and since the image data for executing image processing is large, each image such as feature amount analysis processing is used. There was a problem that processing took time.

そこで、本発明は、画像処理の簡素化、及び高効率化を図ることが可能な画像処理装置、及び画像処理方法を提供することを目的とするものである。   Accordingly, an object of the present invention is to provide an image processing apparatus and an image processing method capable of simplifying image processing and improving efficiency.

本発明に係る画像処理装置は、被検査物を撮像して取得した画像データを記憶可能な記憶部と、前記記憶部に記憶された画像データにおける測定対象の領域の回転の中心点を起点とする周方向の開始位置から前記開始位置に接続される周方向の終了位置まで極座標変換処理を実行し、前記極座標変換処理を実行した画像データを構成する画素を予め定められた閾値を境にした第1の画素値、及び第2の画素値に2値化する2値化処理を実行し、前記2値化処理によって前記第1の画素値、又は前記第2の画素値のいずれか一方の画素値に変換した画素が連結している場合に、該連結している画素のそれぞれに同一のラベル値を付与するラベリング処理を実行する制御部と、を備え、前記制御部が、前記ラベリング処理において、前記2値化処理を実行した画像データの前記開始位置に対応する一端、及び前記終了位置に対応する他端のそれぞれに、前記ラベル値を付与する画素が存在する場合に、前記一端、及び前記他端に存在する両画素が連結しているものとして同一の前記ラベル値を付与する、ことを特徴とする。   An image processing apparatus according to the present invention includes a storage unit capable of storing image data acquired by imaging an object to be inspected, and a rotation center point of a region to be measured in the image data stored in the storage unit as a starting point. The polar coordinate conversion process is executed from the circumferential start position to the circumferential end position connected to the start position, and pixels constituting the image data on which the polar coordinate conversion process has been executed are set with a predetermined threshold as a boundary. A binarization process for binarizing the first pixel value and the second pixel value is executed, and either the first pixel value or the second pixel value is obtained by the binarization process. A control unit that executes a labeling process that assigns the same label value to each of the connected pixels when pixels converted into pixel values are connected, and the control unit includes the labeling process In the above binarization processing When there is a pixel to which the label value is added at one end corresponding to the start position and the other end corresponding to the end position of the image data that has been executed, the image data exists at the one end and the other end. It is characterized in that the same label value is given as if both pixels are connected.

また、本発明に係る画像処理方法は、制御部が、記憶部に記憶された被検査物の画像データにおける測定対象の領域の回転の中心点を起点とする周方向の開始位置から前記開始位置に接続される周方向の終了位置まで極座標変換処理を実行する極座標変換処理工程と、制御部が、前記極座標変換処理工程で前記極座標変換処理を実行した画像データを構成する画素を予め定められた閾値を境にした第1の画素値、及び第2の画素値に2値化する2値化処理を実行する2値化処理工程と、制御部が、前記2値化処理工程で前記2値化処理を実行した画像データにおいて、前記第1の画素値、又は前記第2の画素値のいずれか一方の画素値に変換された画素が連結している場合に、該連結している画素のそれぞれに同一のラベル値を付与するラベリング処理を実行するラベリング処理工程と、を備え、前記制御部が、前記ラベリング処理工程において、前記2値化処理を実行した画像データの前記開始位置に対応する一端、及び前記終了位置に対応する他端のそれぞれに、前記ラベル値を付与する画素が存在する場合に、前記一端、及び前記他端に存在する両画素が連結しているものとして同一の前記ラベル値を付与する端部処理を実行する、ことを特徴とする。   Further, in the image processing method according to the present invention, the control unit has the start position from the circumferential start position starting from the rotation center point of the measurement target region in the image data of the inspection object stored in the storage unit. A polar coordinate conversion processing step for executing the polar coordinate conversion processing up to the end position in the circumferential direction connected to the control unit, and the control unit has predetermined pixels constituting the image data on which the polar coordinate conversion processing has been executed in the polar coordinate conversion processing step A binarization processing step for executing binarization processing for binarization into a first pixel value and a second pixel value with a threshold as a boundary; and a control unit that performs the binarization in the binarization processing step. In the image data that has been subjected to the conversion processing, when pixels converted to either the first pixel value or the second pixel value are connected, the connected pixels Labels that give the same label value to each A labeling process step for executing a labeling process, wherein the control unit corresponds to one end corresponding to the start position and the end position of the image data on which the binarization process has been performed in the labeling process step. When there is a pixel to which the label value is provided at each of the other ends, end processing for giving the same label value as the one end and both pixels existing at the other end are connected It is characterized by executing.

本発明によると、ラベリング処理において、画像データの一端、及び他端に存在する両画素が連結しているものとして同一のラベル値を付与する。これにより、極座標変換処理の開始座標によって1つの欠陥を画像データの両端部に分割してしまった場合であっても、連結している1つの欠陥であるものとして、同一のラベル値を付与することができる。それにより、例えば、1つの欠陥が画像データの両端部に分割されてしまった場合に、煩雑な処理によって画像データを修正する、といった画像処理が不要となり、画像処理の簡素化、及び高効率化を図ることが可能となる。   According to the present invention, in the labeling process, the same label value is given assuming that both pixels existing at one end and the other end of the image data are connected. As a result, even if one defect is divided into both ends of the image data according to the start coordinate of the polar coordinate conversion process, the same label value is given as one connected defect. be able to. As a result, for example, when one defect is divided at both ends of the image data, it is not necessary to perform image processing such as correcting the image data by complicated processing, simplifying image processing, and increasing efficiency. Can be achieved.

検査装置を示す概略図。Schematic which shows an inspection apparatus. 画像処理装置の構成を示すブロック図。1 is a block diagram illustrating a configuration of an image processing apparatus. カメラにより取得した座標変換前の画像データを示す図。The figure which shows the image data before the coordinate transformation acquired with the camera. (a)は、カメラにより取得した画像データに極座標変換処理を実行した後の画像データを示す図。(b)は、極座標変換処理を実行した後の画像データに2値化処理を実行した後の画像データを示す図。(A) is a figure which shows the image data after performing a polar coordinate conversion process to the image data acquired with the camera. (B) is a figure which shows the image data after performing a binarization process to the image data after performing a polar coordinate conversion process. 本実施の形態に係る注目画素に連結している画素のうち調査対象となる画素を示す図であり、(a)は、画像データの開始列、及び終了列のいずれでもない画素が注目画素である場合の調査対象となる画素を示す図。(b)は、画像データの開始列の画素が注目画素である場合の調査対象となる画素を示す図。(c)は、画像データの終了列の画素が注目画素である場合の調査対象となる画素を示す図。It is a figure which shows the pixel used as investigation object among the pixels connected to the attention pixel which concerns on this Embodiment, (a) is a pixel which is neither a start column of an image data, nor an end column, but a attention pixel. The figure which shows the pixel used as the investigation object in a certain case. FIG. 6B is a diagram illustrating a pixel to be investigated when a pixel in the start column of image data is a target pixel. (C) is a figure which shows the pixel used as the investigation object when the pixel of the end row | line of image data is an attention pixel. 本実施の形態に係るラベリング処理を示すフローチャート。The flowchart which shows the labeling process which concerns on this Embodiment. 本実施の形態に係るラベル値付与処理を示すフローチャート。The flowchart which shows the label value provision process which concerns on this Embodiment. 本実施の形態に係るラベル値更新処理を示すフローチャート。The flowchart which shows the label value update process which concerns on this Embodiment. 本実施の形態に係るラベリング処理の具体例を示す概略図であり、(a)は、ラベリング処理開始時の画像データを示す図。(b)乃至(d)は、注目画素がラベル値を有する画素と連結している場合を示す図。(e)は、画像データを構成する全画素にラベル値付与処理を実行した状態を示す図。(f)は、画像データを構成する全画素にラベル値更新処理を実行しラベリング処理が終了した状態を示す図。It is the schematic which shows the specific example of the labeling process which concerns on this Embodiment, (a) is a figure which shows the image data at the time of a labeling process start. (B) thru | or (d) is a figure which shows the case where an attention pixel is connected with the pixel which has a label value. FIG. 6E is a diagram illustrating a state in which label value assignment processing has been performed on all the pixels constituting the image data. FIG. 6F is a diagram illustrating a state in which label value update processing has been performed on all pixels constituting image data and labeling processing has been completed. (a)は、本実施の形態に係るルックアップテーブルを示す図。(b)は、更新後ルックアップテーブルを示す図。(A) is a figure which shows the look-up table which concerns on this Embodiment. (B) is a diagram showing a post-update lookup table.

以下、本発明に係る実施の形態を図1乃至図10に沿って説明する。図1に示した検査装置1は、被検査物11を位置決めする位置決め部材としてのホルダー12と、被検査物11に光を照射する光源13と、被検査物11を撮像して画像データを取得する撮像手段としてのカメラ14と、画像処理装置300と、を備えている。   Hereinafter, embodiments according to the present invention will be described with reference to FIGS. 1 to 10. The inspection apparatus 1 shown in FIG. 1 acquires image data by imaging the inspection object 11, a holder 12 as a positioning member for positioning the inspection object 11, a light source 13 that irradiates the inspection object 11 with light. And an image processing apparatus 300 as an imaging means.

被検査物11は、例えば、レンズ等の光学素子であるが、被検査物11における測定対象の領域が点対称の形状を有する物体であれば、これに限るものではない。なお、被検査物11の形状自体が点対称でなくても、あるいは撮像して得られた画像データに背景が映り込んでいたとしてもよい。すなわち、測定対象の領域が、ある回転中心を起点に概ね点対称であれば、本発明を適用することができる。以下の説明においては、「点対称」という語を用いるが、これは測定対象の領域に回転中心を起点とする回転対称性が、計測に十分な精度で極座標変換できる程度の対称性を示すものであり、厳密な意味での点対称でなくても良い。ホルダー12は、被検査物11における測定対象の領域が概ね点対称となる点11bがカメラ14による撮像の中心となるように、被検査物11を位置決めする。光源13は、被検査物11に向けて光を照射する。光源13から光が照射されると、被検査物11に欠陥11aが存在する場合には、照射された光が欠陥11aにおいて散乱する。カメラ14は、カメラ本体14aと、撮像レンズ14bと、から構成されており、撮像レンズ14bによって集光し、カメラ本体14aに設けられたセンサーにおいて結像することで、画像データを取得する。カメラ14で撮像された画像データは、画像処理装置300に送信自在となっており、言い換えると、画像処理装置300は、被検査物11を含む画像データを取得し得るように構成されている。なお、撮像装置としては、エリアセンサやラインセンサなどを用いてもよい。   The inspection object 11 is, for example, an optical element such as a lens. However, the inspection object 11 is not limited to this as long as the region to be measured in the inspection object 11 has a point-symmetric shape. Note that the shape of the inspection object 11 itself may not be point-symmetric, or the background may be reflected in the image data obtained by imaging. That is, the present invention can be applied if the region to be measured is generally point-symmetric with respect to a certain rotation center. In the following description, the term “point symmetry” is used. This indicates that the rotational symmetry starting from the rotation center in the region to be measured exhibits a degree of symmetry that can be converted into polar coordinates with sufficient accuracy for measurement. It is not necessary to have point symmetry in a strict sense. The holder 12 positions the inspection object 11 so that a point 11b where the measurement target region in the inspection object 11 is substantially point-symmetric is the center of imaging by the camera 14. The light source 13 irradiates light toward the inspection object 11. When light is emitted from the light source 13, when the defect 11a exists in the inspection object 11, the irradiated light is scattered in the defect 11a. The camera 14 includes a camera body 14a and an imaging lens 14b. The camera 14 collects light by the imaging lens 14b and forms an image on a sensor provided in the camera body 14a, thereby acquiring image data. The image data captured by the camera 14 can be transmitted to the image processing apparatus 300. In other words, the image processing apparatus 300 is configured to acquire image data including the inspection object 11. Note that an area sensor, a line sensor, or the like may be used as the imaging device.

検査装置1は、光源13から被検査物11に光を照射し、被検査物11に存在する欠陥11aにおいて散乱した光を撮像レンズ14bによって集光する。そして、検査装置1は、撮像レンズ14bによって集光した欠陥11aにおいて散乱した光を、カメラ本体14aに設けられたセンサーで結像することで、欠陥11aを含む被検査物11の画像データ110を取得し、画像処理装置300に送信する。   The inspection apparatus 1 irradiates the inspection object 11 with light from the light source 13 and condenses the light scattered at the defect 11a existing on the inspection object 11 by the imaging lens 14b. The inspection apparatus 1 forms an image of the light scattered in the defect 11a collected by the imaging lens 14b with a sensor provided in the camera body 14a, thereby obtaining the image data 110 of the inspection object 11 including the defect 11a. Acquired and transmitted to the image processing apparatus 300.

続いて、画像処理装置300の構造を図2に沿って説明する。画像処理装置300は、制御部として機能するCPU301と、記憶可能な記憶部として機能するROM302、RAM303、HDD(ハードディスクドライブ)304、記録ディスクドライブ305と、各種のインタフェース306乃至308とを備えている。なお、画像処理装置300は、一般的なコンピュータである。   Next, the structure of the image processing apparatus 300 will be described with reference to FIG. The image processing apparatus 300 includes a CPU 301 that functions as a control unit, a ROM 302, a RAM 303, an HDD (hard disk drive) 304, a recording disk drive 305, and various interfaces 306 to 308 that function as storable storage units. . Note that the image processing apparatus 300 is a general computer.

CPU301には、ROM302、RAM303、HDD304、記録ディスクドライブ305、及び各種のインタフェース306乃至308が、バス310を介して接続されている。例えば、HDD304(或いは記録ディスク331や外部記憶装置322等であってもよい)には、CPU301を動作させるための各種プログラムやフィルタのデータが格納されている。この各種プログラムのうち、座標変換プログラム304aは、詳しくは後述するようにCPU301により画像データを座標変換させるためのプログラムである。また、画像処理プログラム304bは、詳しくは後述するようにCPU301によりHPF(ハイパスフィルタ)処理などの各フィルタ処理や、2値化処理による画像データの2値化、ラベリング処理によるラベル値の付与を実行させるためのプログラムである。これらの各プログラムは、記録媒体としての、HDD(ハードディスクドライブ)304、記録ディスクドライブ305、外部記憶装置322などに格納できる。   A ROM 302, a RAM 303, an HDD 304, a recording disk drive 305, and various interfaces 306 to 308 are connected to the CPU 301 via a bus 310. For example, the HDD 304 (or the recording disk 331 or the external storage device 322) stores various programs and filter data for operating the CPU 301. Of these various programs, the coordinate conversion program 304a is a program for causing the CPU 301 to perform coordinate conversion of image data, as will be described in detail later. In addition, as will be described in detail later, the image processing program 304b executes each filter processing such as HPF (high pass filter) processing, binarization of image data by binarization processing, and label value addition by labeling processing, as will be described in detail later. It is a program to make it. Each of these programs can be stored in an HDD (hard disk drive) 304, a recording disk drive 305, an external storage device 322, or the like as a recording medium.

一方、インタフェース306には上記カメラ14(図1参照)が接続され、インタフェース307にはモニタ321が接続され、インタフェース308には外部記憶装置(例えば外付けHDDや不揮発性メモリなど)322が接続されている。上記カメラ14からは、例えばCPU301の指令に基づきインタフェース306、及びバス310を介して図3に示すような点対称の点11bを中心として撮像された画像データ100を取得し、一時的にRAM303等に記憶格納する。モニタ321には、後述する画像処理、及び被検査物11の不良判定が完了した際の結果等の出力データを送信することで、その結果等を示す各種画像が表示される。   On the other hand, the camera 14 (see FIG. 1) is connected to the interface 306, the monitor 321 is connected to the interface 307, and an external storage device (for example, an external HDD or a non-volatile memory) 322 is connected to the interface 308. ing. From the camera 14, for example, based on a command from the CPU 301, the image data 100 imaged around the point symmetry point 11 b as shown in FIG. 3 is acquired via the interface 306 and the bus 310, and temporarily stored in the RAM 303 or the like. Store in memory. By transmitting output data such as results when image processing described later and defect determination of the inspection object 11 are completed, the monitor 321 displays various images indicating the results.

なお、本実施の形態においては、カメラ14で撮像された画像データ100を取得して、後述の座標変換を行うものを説明している。しかしながら、取得する画像データは、あらかじめHHD304に格納されていたり、記録ディスク331に記録されていたり、外部記憶装置322に記録されていたりしているものでもよい。   In the present embodiment, a description is given of obtaining image data 100 captured by the camera 14 and performing coordinate transformation described later. However, the acquired image data may be stored in advance in the HHD 304, recorded in the recording disk 331, or recorded in the external storage device 322.

次に、本実施の形態に係る画像処理について説明する。本実施の形態に係る画像処理方法では、大まかに、まず、元となる直交座標系の画像データに極座標変換処理を実行する極座標変換処理工程を画像処理装置300で実行する。次いで、画像処理方法では、極座標変換処理を実行した画像データを構成する各画素を、予め定められた閾値を境にした第1の画素値、及び第2の画素値に2値化する2値化処理を実行する2値化処理工程を画像処理装置300で実行する。次いで、画像処理方法では、2値化処理が実行された画像データを構成する画素にラベル値を付与するラベリング処理を実行するラベリング処理工程を画像処理装置300で実行する。   Next, image processing according to the present embodiment will be described. In the image processing method according to the present embodiment, first, the image processing apparatus 300 executes a polar coordinate conversion process for executing a polar coordinate conversion process on image data of the original orthogonal coordinate system. Next, in the image processing method, each pixel constituting the image data subjected to polar coordinate conversion processing is binarized into a first pixel value and a second pixel value with a predetermined threshold as a boundary. The image processing apparatus 300 executes a binarization process that executes the conversion process. Next, in the image processing method, the image processing apparatus 300 executes a labeling process for executing a labeling process for assigning a label value to the pixels constituting the image data that has been subjected to the binarization process.

また、画像処理方法では、ラベリング処理工程において、ラベル値を付与する対象となる画素に、既にラベル値を付与されている画素が連結しているか否かを判定する。そして、連結していると判定した場合には、連結している画素に付与されているラベル値のうち最小のラベル値を、ラベル値を付与する対象となる画素に付与するラベル値付与処理を、画像処理装置300で実行する。また、画像処理方法では、ラベリング処理工程において、連結している各画素に付与されているラベル値が異なる場合に、各画素に付与されているラベル値のうち最小のラベル値を、各画素に付与するラベル値更新処理を、画像処理装置300で実行する。また、画像処理方法では、画像データの一端、及び他端のそれぞれに、ラベル値を付与する画素が存在する場合に、両画素が連結しているものとして同一のラベル値を付与する端部処理を画像処理装置300で実行する。なお、画像処理方法では、端部処理において、ラベル値付与処理と、ラベル値更新処理と、を画像処理装置300で実行することで、画像データの一端、及び他端に存在する両画素に同一のラベル値を付与する。   In the image processing method, in the labeling process step, it is determined whether or not a pixel to which a label value has been assigned is connected to a pixel to which a label value is to be assigned. And when it determines with connecting, the label value provision process which assign | provides the minimum label value among the label values provided to the pixel which is connected to the pixel which becomes the object which provides a label value is performed. This is executed by the image processing apparatus 300. In the image processing method, in the labeling process step, when the label value assigned to each connected pixel is different, the minimum label value assigned to each pixel is assigned to each pixel. The label value update process to be applied is executed by the image processing apparatus 300. In addition, in the image processing method, when there is a pixel to which a label value is provided at each of one end and the other end of the image data, end processing that provides the same label value as a combination of both pixels Is executed by the image processing apparatus 300. In the image processing method, in the edge processing, the label value addition process and the label value update process are executed by the image processing apparatus 300, so that the same pixel is present at one end and the other end of the image data. The label value of is assigned.

本実施の形態においては、CPU301が座標変換プログラム304aを実行することによりカメラ14が取得しRAM303に記憶された画像データ100に極座標変換処理を実行する。具体的には、図3に示すように、CPU301は、カメラ14が取得した画像データ100の直交座標(X,Y)を、測定対象の領域の回転の中心点である点11bを起点に、極座標(r,θ)に変換する極座標変換処理を実行する。本実施例の場合、被検査物11自体が回転対称性を備えているため、点11bは被検査物11自体が有する点対称の点11bでもある。本実施の形態において、CPU301は、図3に示すように、被検査物11が有する点対称の点11bを中心とする周方向の開始位置11cから開始位置11cに接続される周方向の終了位置11dまでの360°にわたって極座標変換処理を実行する。   In the present embodiment, the CPU 301 executes the coordinate conversion program 304 a to execute polar coordinate conversion processing on the image data 100 acquired by the camera 14 and stored in the RAM 303. Specifically, as illustrated in FIG. 3, the CPU 301 uses the orthogonal coordinates (X, Y) of the image data 100 acquired by the camera 14 as a starting point from a point 11 b that is the center point of rotation of the measurement target region. Polar coordinate conversion processing for converting to polar coordinates (r, θ) is executed. In the case of the present embodiment, since the inspection object 11 itself has rotational symmetry, the point 11b is also a point symmetry point 11b included in the inspection object 11 itself. In the present embodiment, as shown in FIG. 3, the CPU 301 is connected to the start position 11c from the start position 11c in the circumferential direction around the point symmetry point 11b of the object 11 to be inspected. The polar coordinate conversion process is executed over 360 ° up to 11d.

CPU301によって極座標変換処理が実行された極座標画像データ110を図4(a)に示す。図4(a)に示すように、極座標変換処理によって、点対称の点11bを中心とした被検査物11の画像データ100は、四角形の極座標画像データ110に変換される。ここで、極座標画像データ110の左端は、極座標変換処理の周方向の開始位置11cに対応している。また、極座標画像データ110の右端は、極座標変換処理の周方向の終了位置11dに対応している。   FIG. 4A shows polar coordinate image data 110 that has been subjected to polar coordinate conversion processing by the CPU 301. As shown in FIG. 4A, the image data 100 of the inspection object 11 centered on the point-symmetric point 11b is converted into rectangular polar coordinate image data 110 by the polar coordinate conversion process. Here, the left end of the polar coordinate image data 110 corresponds to the circumferential start position 11c of the polar coordinate conversion process. The right end of the polar coordinate image data 110 corresponds to the circumferential end position 11d of the polar coordinate conversion process.

次に、CPU301が、画像処理プログラム304bを実行することにより、図4(a)に示す極座標画像データ110から照明装置13の写り込み13aなどの背景情報やノイズを除去する処理を行う。ここで、背景除去については、θ方向のHPFを使用することでθ方向に発生している照明の写り込み13aを除去する処理や、マスク処理などで写り込みを除去する処理を行う。また、ノイズ除去についてはLPF(ローパスフィルタ)フィルタ処理やメディアンフィルタ処理などを実行してノイズ除去を行う。   Next, the CPU 301 executes the image processing program 304b to perform processing for removing background information and noise such as the reflection 13a of the lighting device 13 from the polar coordinate image data 110 shown in FIG. Here, with respect to the background removal, a process of removing the reflection 13a of the illumination generated in the θ direction by using the HPF in the θ direction and a process of removing the reflection by a mask process or the like are performed. As for noise removal, noise removal is performed by executing LPF (low-pass filter) filter processing, median filter processing, and the like.

また、CPU301は、画像処理プログラム304bを実行することにより、極座標画像データ110を構成する各画素を、所定の閾値を境にした第1の画素値、及び第2の画素値に2値化する2値化処理を実行する。HPF処理、及び2値化処理が実行されることにより、CPU301は、図4(b)に示す欠陥のみが強調された2値化画像データ120を得ることができる。ここで、2値化画像データ120の左端は、極座標変換処理の周方向の開始位置11cに対応しており、本実施の形態における画像データの一端を構成している。また、2値化画像データ120の右端は、極座標変換処理の周方向の終了位置11dに対応しており本実施の形態における画像データの他端を構成する。また、本実施の形態において、2値化処理によって画素値を第1の画素値に変換された画素は、図4(b)における黒地の画素である。また、本実施の形態において、2値化処理によって画素値を第2の画素値に変換された画素は、図4(b)における白地の画素である。   Further, the CPU 301 executes the image processing program 304b to binarize each pixel constituting the polar coordinate image data 110 into a first pixel value and a second pixel value with a predetermined threshold as a boundary. Execute binarization processing. By executing the HPF process and the binarization process, the CPU 301 can obtain the binarized image data 120 in which only the defect shown in FIG. Here, the left end of the binarized image data 120 corresponds to the start position 11c in the circumferential direction of the polar coordinate conversion process, and constitutes one end of the image data in the present embodiment. The right end of the binarized image data 120 corresponds to the end position 11d in the circumferential direction of the polar coordinate conversion process, and constitutes the other end of the image data in the present embodiment. Further, in the present embodiment, the pixel whose pixel value is converted into the first pixel value by the binarization process is the black background pixel in FIG. In the present embodiment, the pixel whose pixel value is converted into the second pixel value by the binarization process is a white background pixel in FIG.

ここで、例えば、図3に示すように、極座標変換処理の周方向の開始位置11c、及び周方向の終了位置11dにわたって欠陥11aがある場合について説明する。このような場合に、極座標変換処理を実行すると、欠陥11aは、図4(a)に示すように、極座標画像データ110の両端に分割(欠陥110a、110b)されてしまう。欠陥11aが欠陥110aと、欠陥110bと、に分割された状態で2値化処理の実行後に後述するラベリング処理を実行すると、CPU301は、欠陥110aと、欠陥110bと、を別個の欠陥として扱いラベル値を付与してしまう。従って、欠陥110aと、欠陥110bと、が1つの欠陥11aであるものとしてラベル値を付与するためには、特殊な画像処理方法が必要となる。   Here, for example, as shown in FIG. 3, a case where there is a defect 11a over the start position 11c in the circumferential direction and the end position 11d in the circumferential direction of the polar coordinate conversion process will be described. In such a case, when the polar coordinate conversion process is executed, the defect 11a is divided (defects 110a and 110b) at both ends of the polar coordinate image data 110 as shown in FIG. When the labeling process to be described later is performed after the binarization process is performed in a state where the defect 11a is divided into the defect 110a and the defect 110b, the CPU 301 treats the defect 110a and the defect 110b as separate defects and performs labeling. Value. Therefore, a special image processing method is required in order to assign a label value assuming that the defect 110a and the defect 110b are one defect 11a.

そこで、本実施の形態では、ラベリング処理において、右端の欠陥110bにラベル値を付与する場合に、詳しくは後述するラベル値付与処理、及びラベル値更新処理を実行する。これにより、本実施の形態では、欠陥110aと、欠陥110bと、が1つの欠陥11aであるものとして同一のラベル値を付与することができる。以下に、この画像処理の詳細を説明する。   Therefore, in the present embodiment, in the labeling process, when a label value is given to the right edge defect 110b, a label value giving process and a label value updating process, which will be described in detail later, are executed. Thereby, in this Embodiment, the defect 110a and the defect 110b can give the same label value as what is one defect 11a. Details of the image processing will be described below.

本実施の形態において、CPU301は、画像処理プログラム304bを実行することにより、2値化画像データ120の左端から右端に向けて、ラスタスキャン方式によるラベリング処理を実行する。ここで、一般に、ラスタスキャン方式とは、まず、画像データの左端でかつ上端の画素から、横方向右側に1Pixelずつずらしながら各画素にラベリング処理を実行していき、画像データの右端の画素までラベリング処理を実行する。次いで、ラベリング処理の対象となる画素を縦方向下側に1Pixelずらし、再度左端から横方向右側に1Pixelずつずらして各画素にラベリング処理を実行することで、画像データを構成する全画素にラベリング処理を実行する方式である。   In the present embodiment, the CPU 301 executes a labeling process by a raster scan method from the left end to the right end of the binarized image data 120 by executing the image processing program 304b. Here, in general, the raster scanning method is to first perform labeling processing on each pixel while shifting the pixel by 1 Pixel to the right in the horizontal direction from the pixel at the left end and the upper end of the image data to the pixel at the right end of the image data. Execute the labeling process. Next, the target pixel of the labeling process is shifted by 1 pixel in the vertical direction downward, and shifted again by 1 pixel from the left end to the right in the horizontal direction to execute the labeling process for each pixel, thereby labeling all the pixels constituting the image data. It is a method to execute.

なお、本実施の形態において、CPU301は、2値化画像データ120の左端から右端に向けてラベリング処理を実行するように構成されているが、これに限定されない。CPU301は、ラベリング処理を実行する場合に、一方向に向けて実行するように構成されていれば、その方向を限定されない。また、本実施の形態において、CPU301は、1Pixelずつ各画素にラベリング処理を実行するように構成されているが、画像データを構成する全画素に対してラベリング処理を実行できればよい。つまり、各ラベリング処理の対象となる画素数は、特に限定されない。   In the present embodiment, the CPU 301 is configured to execute a labeling process from the left end to the right end of the binarized image data 120, but is not limited thereto. When the CPU 301 is configured to execute the labeling process in one direction, the direction is not limited. In the present embodiment, the CPU 301 is configured to execute a labeling process on each pixel by one pixel. However, it is only necessary that the CPU 301 can execute the labeling process on all pixels constituting the image data. That is, the number of pixels to be subjected to each labeling process is not particularly limited.

CPU301は、ラベリング処理の実行において、ラベリング処理の対象となる画素が、第1の画素値と、第2の画素値と、のいずれを有するかを判定する。そして、CPU301は、画素が第2の画素値を有すると判定した場合に、当該画素をラベル値を付与する画素と判定し、ラベル値を付与していく。なお、以下の記載において、各処理の対象となる画素を、注目画素と記載する。また、本実施の形態においては、注目画素が第2の画素値を有する場合にラベル値を付与するように構成されているが、注目画素が第1の画素値を有する場合にラベル値を付与するように構成してもよい。   In the execution of the labeling process, the CPU 301 determines whether the pixel that is the target of the labeling process has a first pixel value or a second pixel value. When the CPU 301 determines that the pixel has the second pixel value, the CPU 301 determines that the pixel is a pixel to which a label value is applied, and assigns the label value. In the following description, a pixel to be processed is referred to as a target pixel. In this embodiment, the label value is assigned when the pixel of interest has the second pixel value. However, the label value is assigned when the pixel of interest has the first pixel value. You may comprise.

ここで、ラベル値を付与する処理(以下、「ラベル値付与処理」という)においては、第2の画素値を有するか否かの判定の対象となっている注目画素と連結している画素に付与されているラベル値を調査し、注目画素にラベル値を付与していく。注目画素と連結している画素に付与されているラベル値を調査する調査方法としては、一般に、注目画素の1Pixel左の画素と、1Pixel上の画素と、について調査する、いわゆる4近傍と称される調査方法が知られている。また、4近傍に加えて注目画素の1Pixel左、及び上の画素と、1Pixel右、及び上の画素と、について調査する、いわゆる8近傍と称される調査方法も知られている。   Here, in the process of giving the label value (hereinafter referred to as “label value giving process”), the pixel connected to the target pixel that is the target of the determination as to whether or not it has the second pixel value. The assigned label value is investigated, and the label value is assigned to the target pixel. As a survey method for investigating the label value assigned to the pixel connected to the target pixel, it is generally referred to as a so-called four-neighborhood in which the pixel on the left of the pixel of the target pixel and the pixel on the pixel are investigated. Survey methods are known. In addition to the four neighborhoods, a so-called 8-neighbor search method is also known, in which 1 pixel left and top pixels of the pixel of interest and 1 pixel right and top pixels are searched.

図5は、本実施の形態に係るラベリング処理において、CPU301が調査する画素について示した図である。図5(a)は、2値化画像データ120の左端に存在する画素、及び右端に存在する画素のいずれでもない画素が注目画素120aである場合に、CPU301が、注目画素120aに連結している画素について調査する場合を示している。4近傍の調査において、CPU301は、図5(a)に示す注目画素120aの1Pixel左に存在する0番の画素と、注目画素120aの1Pixel上に存在する1番の画素と、について調査する。また、8近傍の調査において、CPU301は、4近傍で調査した画素に加えて、図5(a)に示す注目画素120aの1Pixel左、及び上に存在する2番の画素と、注目画素120aの1Pixel右、及び上に存在する3番の画素と、についても調査する。   FIG. 5 is a diagram illustrating pixels that the CPU 301 investigates in the labeling process according to the present embodiment. FIG. 5A shows a case where the pixel 301 that is not the pixel at the left end or the pixel at the right end of the binarized image data 120 is the target pixel 120a, and the CPU 301 is connected to the target pixel 120a. It shows the case of investigating the pixel. In the investigation of 4 neighborhoods, the CPU 301 investigates the 0th pixel that is 1 pixel to the left of the pixel of interest 120a and the 1st pixel that is on 1 pixel of the pixel of interest 120a shown in FIG. Further, in the investigation of 8 neighborhoods, in addition to the pixels investigated in the 4 neighborhoods, the CPU 301 adds the second pixel existing 1 pixel left and above the pixel of interest 120a shown in FIG. We will also investigate the 3rd pixel that is 1 pixel right and above.

ここで、以下の記載において、後述する図9(a)に示すように、2値化画像データ120の左端、つまり極座標変換処理の周方向の開始位置11cに対応する2値化画像データ120の一端120dのことを、開始列とも記載する。また、以下の記載において、2値化画像データ120の右端、つまり極座標変換処理の周方向の終了位置11dに対応する2値化画像データの他端120eのことを、終了列とも記載する。   Here, in the following description, as shown in FIG. 9A to be described later, the left end of the binarized image data 120, that is, the binarized image data 120 corresponding to the circumferential start position 11c of the polar coordinate conversion processing. The one end 120d is also referred to as a start row. In the following description, the right end of the binarized image data 120, that is, the other end 120e of the binarized image data corresponding to the end position 11d in the circumferential direction of the polar coordinate conversion process is also referred to as an end column.

図5(b)は、2値化画像データ120の開始列に存在する画素が注目画素120aである場合に、CPU301が、注目画素120aに連結している画素について調査する場合を示している。4近傍の調査において、CPU301は、図5(b)に示す注目画素120aの1Pixel上に存在する0番の画素について調査する。また、8近傍の調査において、CPU301は、4近傍で調査した画素に加えて、図5(b)に示す注目画素120aの1Pixel右、及び上に存在する1番の画素についても調査する。   FIG. 5B shows a case where the CPU 301 investigates pixels connected to the target pixel 120a when the pixel existing in the start column of the binarized image data 120 is the target pixel 120a. In the investigation of 4 neighborhoods, the CPU 301 investigates the 0th pixel existing on 1 Pixel of the pixel of interest 120a shown in FIG. Further, in the investigation of the vicinity of 8, the CPU 301 also investigates the first pixel located on the right side of the pixel of interest 120a shown in FIG. 5B and the first pixel in addition to the pixels investigated in the vicinity of 4.

図5(c)は、2値化画像データ120の終了列に存在する画素が注目画素120aである場合に、CPU301が、注目画素120aに連結している画素について調査する場合を示している。4近傍の調査において、CPU301は、図5(c)に示す注目画素120aの1Pixel左に存在する0番の画素と、注目画素120aの1Pixel上に存在する1番の画素と、注目画素120aと同じ行の開始列の画素の2番の画素と、について調査する。8近傍の調査において、CPU301は、4近傍で調査した画素に加えて、図5(c)に示す注目画素120aの1Pixel左、及び上に存在する3番の画素と、開始列に存在する2番の画素の1Pixel上に存在する4番の画素と、についても調査する。   FIG. 5C shows a case where the CPU 301 investigates pixels connected to the target pixel 120a when the pixel existing in the end column of the binarized image data 120 is the target pixel 120a. In the investigation of 4 neighborhoods, the CPU 301 determines that the 0th pixel that is 1 pixel to the left of the target pixel 120a, the 1st pixel that is 1 pixel above the target pixel 120a, and the target pixel 120a illustrated in FIG. The second pixel of the pixel in the start column of the same row is investigated. In the investigation of 8 neighborhoods, the CPU 301 adds 2 pixels present in the start column and the 3rd pixel located 1 pixel left and above the pixel of interest 120a shown in FIG. The fourth pixel existing on one pixel of the numbered pixel is also investigated.

ここで、本実施の形態において、CPU301は、4近傍、及び8近傍のいずれの調査方法を用いる場合であっても、調査の対象となる注目画素の近傍に存在する画素を、注目画素に連結している画素として扱う。つまり、本実施の形態において、CPU301は、図5(c)に示すように、終了列に存在する画素にラベリング処理を実行する場合に、終了列、及び開始列に存在する両画素が連結しているものとしてラベリング処理を実行するように構成されている。   Here, in this embodiment, the CPU 301 connects pixels existing in the vicinity of the pixel of interest to be investigated to the pixel of interest regardless of whether the investigation method of 4 neighborhood or 8 neighborhood is used. Is treated as a pixel. That is, in this embodiment, as illustrated in FIG. 5C, when the CPU 301 executes the labeling process on the pixels existing in the end column, the pixels existing in the end column and the start column are connected. It is configured to execute the labeling process.

次に、本実施の形態において、CPU301が画像処理プログラム304bを用いて実行するラベリング処理を、図6乃至図10に沿って説明する。図6は、CPU301が実行するラベリング処理について示したフローチャートである。   Next, labeling processing executed by the CPU 301 using the image processing program 304b in the present embodiment will be described with reference to FIGS. FIG. 6 is a flowchart showing the labeling process executed by the CPU 301.

まず、CPU301は、注目画素120aの有する画素値が第2の画素値であるか否かを判定する(ステップS1)。この処理において、CPU301は、注目画素120aの有する画素値が第1の画素値、又は第2の画素値のいずれであるかを判定し、注目画素120aが後述するラベル値付与処理の対象であるか否かを判定している。   First, the CPU 301 determines whether or not the pixel value of the target pixel 120a is the second pixel value (step S1). In this process, the CPU 301 determines whether the pixel value of the target pixel 120a is the first pixel value or the second pixel value, and the target pixel 120a is a target of a label value adding process described later. It is determined whether or not.

ステップS1の処理において、注目画素120aの有する画素値が第2の画素値であると判定した場合には(YES)、CPU301は、ラベル値付与処理を実行する(ステップS2)。この処理において、CPU301は、図7に示すラベル値付与処理を実行し、注目画素120aに連結している画素に付与されているラベル値を参照して、注目画素120aにラベル値を付与する。   If it is determined in step S1 that the pixel value of the target pixel 120a is the second pixel value (YES), the CPU 301 executes label value addition processing (step S2). In this process, the CPU 301 executes a label value assigning process shown in FIG. 7, and assigns a label value to the target pixel 120a with reference to the label value given to the pixel connected to the target pixel 120a.

ステップS2の処理を実行した後、又はステップS1の処理において、注目画素120aの有する画素値が第1の画素値であると判定した場合には(NO)、CPU301は、ステップS3の処理を実行する。ステップS3の処理において、CPU301は、注目画素120aが図9(a)に示す2値化画像データ120の右端でかつ下端であるラベリング処理終了位置120bに存在しているか否かを判定する。   After executing the process of step S2 or when determining that the pixel value of the target pixel 120a is the first pixel value in the process of step S1 (NO), the CPU 301 executes the process of step S3. To do. In the processing of step S3, the CPU 301 determines whether or not the target pixel 120a is present at the labeling processing end position 120b that is the right end and the lower end of the binarized image data 120 shown in FIG. 9A.

ステップS3の処理において、注目画素120aがラベリング処理終了位置120bに存在していないと判定した場合には(NO)、CPU301は、注目画素移動処理を実行し(ステップS4)、ステップS1の処理に戻る。この処理において、CPU301は、注目画素120aが終了列以外に存在していた場合、注目画素120aを横方向右側に1Pixel移動する。また、この処理において、CPU301は、注目画素120aが終了列に存在していた場合、注目画素120aを縦方向下側に1Pixel移動するとともに、2値化画像データ120の開始列に移動する。   If it is determined in step S3 that the target pixel 120a does not exist at the labeling process end position 120b (NO), the CPU 301 executes the target pixel movement process (step S4), and the process of step S1 is performed. Return. In this process, if the target pixel 120a exists in a position other than the end column, the CPU 301 moves the target pixel 120a by 1 pixel to the right in the horizontal direction. In this process, when the target pixel 120a exists in the end column, the CPU 301 moves the target pixel 120a by 1 pixel downward in the vertical direction and moves to the start column of the binarized image data 120.

一方、ステップS3の処理において、注目画素120aがラベリング処理終了位置120bに存在する画素であると判定した場合には(YES)、CPU301は、注目画素をラベリング処理開始位置に移動する(ステップS5)。この処理において、CPU301は、2値化画像データ120中の第2の画素値を有する画素にラベル値付与処理を実行し終えたので、図9(a)に示す2値化画像データ左端でかつ上端であるラベリング処理開始位置120cに、注目画素120aを移動する。   On the other hand, if it is determined in step S3 that the target pixel 120a is a pixel existing at the labeling process end position 120b (YES), the CPU 301 moves the target pixel to the labeling process start position (step S5). . In this process, since the CPU 301 has finished executing the label value adding process on the pixel having the second pixel value in the binarized image data 120, the left side of the binarized image data shown in FIG. The target pixel 120a is moved to the labeling processing start position 120c which is the upper end.

次に、CPU301は、ラベル値更新処理を実行し(ステップS6)、ラベリング処理を終了する。この処理において、CPU301は、図8に示すラベル値更新処理を実行し、連結しているラベル値を付与されている画素(以下、「ラベル付画素」という)のそれぞれに同一のラベル値を付与する。   Next, the CPU 301 executes a label value update process (step S6), and ends the labeling process. In this process, the CPU 301 executes the label value update process shown in FIG. 8 and assigns the same label value to each of the connected pixel values (hereinafter referred to as “labeled pixels”). To do.

図7は、図6に示したラベリング処理のステップS2において実行されるラベル値付与処理について示したフローチャートである。なお、本実施の形態において、CPU301は、注目画素120aに対して8近傍の調査を行うが、4近傍の調査を行う構成であってもよい。   FIG. 7 is a flowchart showing the label value giving process executed in step S2 of the labeling process shown in FIG. In the present embodiment, the CPU 301 performs a survey of 8 neighborhoods of the pixel of interest 120a, but may be configured to conduct a survey of 4 neighborhoods.

まず、CPU301は、注目画素120aが2値化画像データ120のどの列に存在するかを判定する(ステップS11)。この処理において、CPU301は、注目画素120aが、2値化画像データ120の開始列と、終了列と、それ以外の列と、のいずれに存在しているかを判定し、注目画素120aの位置に応じて実行する処理を決定する。   First, the CPU 301 determines in which column of the binarized image data 120 the pixel of interest 120a is present (step S11). In this process, the CPU 301 determines whether the target pixel 120a exists in the start column, the end column, or any other column of the binarized image data 120, and sets the position of the target pixel 120a. The processing to be executed is determined accordingly.

ステップS11の処理において、注目画素120aが2値化画像データの開始列に存在していると判定した場合には(開始列)、CPU301は、開始列近傍調査処理を実行する(ステップS12)。この処理において、CPU301は、図5(b)に示すように、開始列に存在している注目画素120aに連結している0番、及び1番の位置に存在する画素が、それぞれラベル付画素であるか否かを調査する。   If it is determined in step S11 that the target pixel 120a is present in the start column of the binarized image data (start column), the CPU 301 executes a start column neighborhood inspection process (step S12). In this processing, as shown in FIG. 5B, the CPU 301 determines that the pixels existing in the 0th and 1st positions connected to the target pixel 120a existing in the start column are labeled pixels. It is investigated whether it is.

ステップS11の処理において、注目画素120aが2値化画像データの終了列に存在していると判定した場合には(終了列)、CPU301は、終了列近傍調査処理を実行する(ステップS13)。この処理において、CPU301は、図5(c)に示すように、終了列に存在している注目画素120aに連結している0番、1番、及び3番の位置に存在する画素が、それぞれラベル付画素であるか否かを調査する。また、CPU301は、図5(c)に示すように、開始列に存在している2番、及び4番の位置に存在する画素についても、注目画素120aに連結しているものとして、それぞれラベル付画素であるか否かを調査する。   In the process of step S11, when it is determined that the target pixel 120a is present in the end column of the binarized image data (end column), the CPU 301 executes an end column neighborhood inspection process (step S13). In this processing, as shown in FIG. 5C, the CPU 301 determines that the pixels existing at the 0th, 1st, and 3rd positions connected to the target pixel 120a existing in the end column are respectively Check whether the pixel is a labeled pixel. Further, as shown in FIG. 5C, the CPU 301 also regards the pixels existing in the start row as the second and fourth positions as being connected to the target pixel 120a. It is investigated whether or not the pixel is attached.

ステップS11の処理において、注目画素120aが2値化画像データの開始列、及び終了列のいずれでもない列に存在していると判定した場合には(その他)、CPU301は、通常近傍調査処理を実行する(ステップS14)。この処理において、CPU301は、図5(a)に示すように、注目画素120aに連結している0番乃至3番の位置に存在する画素が、それぞれラベル付画素であるか否かを調査する。   When it is determined in step S11 that the target pixel 120a is present in a column that is neither the start column nor the end column of the binarized image data (others), the CPU 301 performs the normal neighborhood inspection process. Execute (Step S14). In this processing, as shown in FIG. 5A, the CPU 301 investigates whether or not the pixels existing at positions 0 to 3 connected to the target pixel 120a are labeled pixels. .

ステップS12乃至ステップS14のいずれかの処理を実行した後、CPU301は、注目画素120aに何個のラベル付画素が連結していたかを判定する(ステップS15)。この処理において、CPU301は、注目画素120aに連結している画素のうち、何個の画素がラベル付画素であったかを判定し、連結しているラベル付画素の個数及び各ラベル付画素に付与されているラベル値に応じて実行する処理を決定する。   After executing any one of steps S12 to S14, the CPU 301 determines how many labeled pixels are connected to the target pixel 120a (step S15). In this process, the CPU 301 determines how many of the pixels connected to the target pixel 120a are labeled pixels, and gives the number of connected labeled pixels and each labeled pixel. The processing to be executed is determined according to the label value.

ステップS15の処理において、注目画素120aにラベル付画素が連結していないと判断した場合には(0個)、CPU301は、RAM303に現在所持しているラベル値を、注目画素120aに代入することでラベル値を付与する(ステップS16)。ここで、ラベル値は、画像処理装置300のRAM303内に設けられた所定の領域に所持されており、ラベリング処理開始時における初期値が1である。   If it is determined in step S15 that no labeled pixel is connected to the target pixel 120a (0), the CPU 301 assigns the label value currently held in the RAM 303 to the target pixel 120a. In step S16, a label value is assigned. Here, the label value is held in a predetermined area provided in the RAM 303 of the image processing apparatus 300, and the initial value is 1 at the start of the labeling process.

次に、CPU301は、現在所持しているラベル値をインクリメントし(ステップS17)、ラベル値付与処理を終了する。この処理において、CPU301は、RAM303に所持しているラベル値をインクリメント、つまり1加算する。この処理により、CPU301は、ステップS16の処理においてラベル値を付与した画素に連結していない画素にラベル値を付与する場合に、ステップS16の処理において付与したラベル値とは異なるラベル値を付与することができる。   Next, the CPU 301 increments the label value currently possessed (step S17), and ends the label value assigning process. In this process, the CPU 301 increments the label value possessed in the RAM 303, that is, adds one. With this process, the CPU 301 assigns a label value different from the label value assigned in the process of step S16 when the label value is assigned to the pixel not connected to the pixel to which the label value is assigned in the process of step S16. be able to.

ステップS15の処理において、注目画素120aにラベル付画素が1個連結していると判定した場合及び同一のラベル値が付与された2個以上のラベル付画素が連結していると判定した場合には(1個)、CPU301は、ステップS18の処理を実行する。ステップS18の処理において、CPU301は、連結しているラベル付画素に付与されているラベル値と同一のラベル値を、注目画素120aに付与することで、第2の画素値を有する画素が連結していることを明確にすることができる。ステップS18の処理を実行した後、CPU301は、ラベル値付与処理を終了する。   In the process of step S15, when it is determined that one labeled pixel is connected to the target pixel 120a and when it is determined that two or more labeled pixels to which the same label value is assigned are connected. (1), the CPU 301 executes the process of step S18. In the process of step S18, the CPU 301 assigns the same label value to the target pixel 120a as the label value assigned to the connected labeled pixels, thereby connecting the pixels having the second pixel value. Can be clear. After executing the process of step S18, the CPU 301 ends the label value giving process.

ステップS15の処理において、注目画素120aにそれぞれ異なるラベル値を付与されているラベル付画素が2個以上連結していると判定した場合には(2個以上)、CPU301は、最小ラベル値を注目画素120aに付与する(ステップS19)。この処理において、CPU301は、まず、注目画素120aに連結している各ラベル付画素に付与されているラベル値をそれぞれ比較する。そして、CPU301は、各ラベル付画素に付与されているラベル値の中で、最も値の小さい最小ラベル値を比較した結果から抽出し、抽出した最小ラベル値を注目画素120aに付与する。ステップS19の具体例を、図9(b)に示す。図9に示すように、注目画素120aは、ラベル値「1」が付与されているラベル付画素と、ラベル値「3」が付与されているラベル付画素と、に連結している。この場合、CPU301は、ラベル値「1」が付与されているラベル付画素と、ラベル値「3」が付与されているラベル付画素と、のラベル値を比較することで、最小ラベル値としてラベル値「1」を抽出し、注目画素120aにラベル値「1」を付与する。   In the processing of step S15, when it is determined that two or more labeled pixels each having a different label value are connected to the target pixel 120a (two or more), the CPU 301 pays attention to the minimum label value. This is applied to the pixel 120a (step S19). In this process, the CPU 301 first compares the label values assigned to each labeled pixel connected to the target pixel 120a. Then, the CPU 301 extracts from the result of comparing the smallest label value having the smallest value among the label values assigned to each labeled pixel, and assigns the extracted minimum label value to the target pixel 120a. A specific example of step S19 is shown in FIG. As shown in FIG. 9, the target pixel 120a is connected to a labeled pixel to which a label value “1” is assigned and a labeled pixel to which a label value “3” is assigned. In this case, the CPU 301 compares the label value of the labeled pixel to which the label value “1” is assigned with the labeled value to which the label value “3” is assigned, thereby labeling as the minimum label value. The value “1” is extracted, and the label value “1” is assigned to the target pixel 120a.

ステップS19の処理を実行した後、CPU301は、ルックアップテーブル更新処理を実行し(ステップS20)、ラベル値付与処理を終了する。ここで、ルックアップテーブルとは、RAM303の所定の領域に格納されており、図10(a)に示すように、インデックス番号と、インデックス番号に対応するラベル値と、が格納されている。初期状態において、ルックアップテーブルは、インデックス番号と、ラベル値と、が一致している。なお、本実施の形態において、ルックアップテーブルは、インデックス番号「6」までを有する構成となっているが、これに限定されるものではない。ルックアップテーブルは、ラベル値付与処理において、ラベル値「6」よりも大きいラベル値が付与される場合には、該付与されるラベル値に対応するインデックス番号を有するように構成される。   After executing the process of step S19, the CPU 301 executes a lookup table update process (step S20) and ends the label value providing process. Here, the lookup table is stored in a predetermined area of the RAM 303, and as shown in FIG. 10A, an index number and a label value corresponding to the index number are stored. In the initial state, the lookup table matches the index number with the label value. In the present embodiment, the lookup table is configured to have up to index number “6”, but is not limited to this. The lookup table is configured to have an index number corresponding to the assigned label value when a label value larger than the label value “6” is given in the label value assigning process.

ルックアップテーブル更新処理において、CPU301は、まず、ルックアップテーブルを参照し、ステップS19の処理で最小ラベル値よりも大きいと判定したラベル値と同じ番号のインデックス番号を特定する。次に、CPU301は、ルックアップテーブルに格納されている特定したインデックス番号に対応するラベル値を、最小ラベル値に更新する処理を実行する。   In the look-up table update process, the CPU 301 first refers to the look-up table and specifies an index number having the same number as the label value determined to be larger than the minimum label value in the process of step S19. Next, the CPU 301 executes processing for updating the label value corresponding to the identified index number stored in the lookup table to the minimum label value.

本実施の形態において、CPU301は、例えば、図9(b)に示す位置に注目画素120aが存在している場合に、ステップS20の処理によって、まず、ルックアップテーブルを参照して、ラベル値「3」と同じ番号のインデックス番号「3」を特定する。次に、CPU301は、ルックアップテーブルに格納されているインデックス番号「3」に対応するラベル値「3」を、最小ラベル値であるラベル値「1」に更新する。また、CPU301は、例えば、図9(c)に示す位置に注目画素120aが存在している場合に、上述したラベル値「3」の場合と同様の処理によって、ルックアップテーブルに格納されたラベル値「4」をラベル値「1」に更新する。   In the present embodiment, for example, when the target pixel 120a exists at the position shown in FIG. 9B, the CPU 301 first refers to the lookup table by the process of step S20, and reads the label value “ The index number “3” having the same number as “3” is specified. Next, the CPU 301 updates the label value “3” corresponding to the index number “3” stored in the lookup table to the label value “1” that is the minimum label value. Further, for example, when the target pixel 120a exists at the position illustrated in FIG. 9C, the CPU 301 performs label processing stored in the lookup table by the same processing as in the case of the label value “3” described above. The value “4” is updated to the label value “1”.

また、CPU301は、図9(d)に示す位置に注目画素が存在している場合に、ステップS13の処理によって終了列に存在するラベル付画素のラベル値「5」と、開始列に存在するラベル付画素のラベル値「6」を抽出することができる。そして、ステップS20の処理において、CPU301は、上述したラベル値「3」の場合と同様に、ラベル値「6」をラベル値「5」に更新する。これにより、後述するラベル値更新処理において、CPU301は、終了列に存在しラベル値「5」のラベル付画素と、開始列に存在しラベル値「6」のラベル付画素と、が連結しているものとして、両画素に同一のラベル値を付与することができる。   In addition, when the target pixel exists at the position illustrated in FIG. 9D, the CPU 301 exists in the start column and the label value “5” of the labeled pixel that exists in the end column by the process of step S <b> 13. The label value “6” of the labeled pixel can be extracted. In the process of step S20, the CPU 301 updates the label value “6” to the label value “5” as in the case of the label value “3” described above. Thereby, in the label value update process described later, the CPU 301 connects the labeled pixel having the label value “5” present in the end column and the labeled pixel having the label value “6” present in the start column. As a result, the same label value can be given to both pixels.

第2の画素値を有する画素のうち、2個以上のラベル付画素に連結している画素に対して、ステップS19、及びステップS20の処理を実行することにより、CPU301は、図10(b)に示す更新後ルックアップテーブルを得ることができる。   By executing the processing of step S19 and step S20 on the pixels connected to two or more labeled pixels among the pixels having the second pixel value, the CPU 301 can execute the processing shown in FIG. The updated look-up table shown in FIG.

図7に示すラベル値付与処理を第2の画素値を有する全画素に実行することにより、CPU301は、図9(e)に示す第2の画素値を有する全画素にラベル値が付与されたラベル付与画像データ130を得ることができる。しかしながら、図9(e)に示すように、ラベル付与画像データ130においては、連結しているラベル付画素に、しばしば異なるラベル値が付与されている。特に、ラベル付与画像データ130においては、欠陥110aに対応する画素にラベル値「6」が付与され、欠陥110bに対応する画素にラベル値「5」が付与されている。そこで、連結しているラベル付画素のそれぞれに同一のラベル値を付与するために、CPU301は、ラベル値更新処理を実行する。   By executing the label value giving process shown in FIG. 7 for all the pixels having the second pixel value, the CPU 301 gives the label value to all the pixels having the second pixel value shown in FIG. Labeled image data 130 can be obtained. However, as shown in FIG. 9E, in the label-added image data 130, different label values are often assigned to the connected labeled pixels. In particular, in the label-added image data 130, the label value “6” is assigned to the pixel corresponding to the defect 110a, and the label value “5” is assigned to the pixel corresponding to the defect 110b. Therefore, in order to give the same label value to each of the connected labeled pixels, the CPU 301 executes a label value update process.

図8は、図6に示したラベリング処理のステップS6において実行されるラベル値更新処理について示したフローチャートである。   FIG. 8 is a flowchart showing the label value update process executed in step S6 of the labeling process shown in FIG.

まず、CPU301は、注目画素120aがラベル付画素であるか否かを判定する(ステップS31)。この処理において、注目画素120aがラベル付画素ではないと判定した場合には(NO)、CPU301は、注目画素120aがラベル付画素に連結しているか否かを判定する(ステップS32)。これらの処理において、CPU301は、注目画素120a、及び注目画素120aに連結している画素に、後述するラベル値を更新する処理を実行するか否かを判定している。   First, the CPU 301 determines whether or not the target pixel 120a is a labeled pixel (step S31). In this process, if it is determined that the target pixel 120a is not a labeled pixel (NO), the CPU 301 determines whether or not the target pixel 120a is connected to the labeled pixel (step S32). In these processes, the CPU 301 determines whether or not to execute a process for updating a later-described label value for the target pixel 120a and the pixels connected to the target pixel 120a.

注目画素120aがラベル付画素であると判定した場合(ステップS31でYES)、又は注目画素120aがラベル付画素に連結していると判定した場合には(ステップS32でYES)、CPU301は、ステップS33の処理を実行する。ステップS33の処理において、CPU301は、注目画素120a、及び注目画素120aに連結する画素に付与されているラベル値を抽出し、図10(b)に示す更新後ルックアップテーブルからラベル値を取得し、ラベル値を更新する。   When it is determined that the target pixel 120a is a labeled pixel (YES in step S31), or when it is determined that the target pixel 120a is connected to the labeled pixel (YES in step S32), the CPU 301 performs step The process of S33 is executed. In the processing of step S33, the CPU 301 extracts the target pixel 120a and the label value given to the pixel connected to the target pixel 120a, and acquires the label value from the updated lookup table shown in FIG. Update the label value.

ステップS33の詳細について説明すると、まず、CPU301は、ラベル付画素に付与されているラベル値を抽出し、抽出したラベル値と同じ番号のインデックス番号を特定する。次に、CPU301は、図10(b)に示す更新後ルックアップテーブルを参照し、特定したインデックス番号に対応したラベル値を取得し、取得したラベル値をラベル付画素に付与することにより、ラベル付画素のラベル値を更新する。   The details of step S33 will be described. First, the CPU 301 extracts the label value assigned to the labeled pixel, and specifies the index number having the same number as the extracted label value. Next, the CPU 301 refers to the updated look-up table shown in FIG. 10B, acquires a label value corresponding to the specified index number, and assigns the acquired label value to the labeled pixel. The label value of the attached pixel is updated.

例えば、注目画素120aがラベル値「3」を有する場合、まず、CPU301は、ラベル付画素のラベル値「3」を抽出し、インデックス番号「3」を特定する。次に、CPU301は、更新後ルックアップテーブルを参照し、特定したインデックス番号「3」に対応するラベル値「1」を取得し、ラベル付画素にラベル値「1」を付与することで、ラベル付画素のラベル値を更新する。また、注目画素120aに連結している画素がラベル値「1」を有する場合、まず、CPU301は、連結しているラベル付画素のラベル値「1」を抽出し、インデックス番号「1」を特定する。次に、CPU301は、更新後ルックアップテーブルを参照し、特定したインデックス番号「1」に対応するラベル値「1」を取得し、連結しているラベル付画素にラベル値「1」を付与することで、ラベル値を更新する。この処理により、CPU301は、ラベル値「6」をラベル値「5」に更新する。つまり、CPU301は、開始列に存在する欠陥110aに対応する画素と、終了列に存在する欠陥110bに対応する画素と、の両各画素に、同一のラベル値「5」を付与することができる。   For example, when the target pixel 120a has the label value “3”, the CPU 301 first extracts the label value “3” of the labeled pixel and identifies the index number “3”. Next, the CPU 301 refers to the updated look-up table, acquires the label value “1” corresponding to the identified index number “3”, and assigns the label value “1” to the labeled pixel, thereby The label value of the attached pixel is updated. When the pixel connected to the target pixel 120a has the label value “1”, the CPU 301 first extracts the label value “1” of the connected labeled pixel and specifies the index number “1”. To do. Next, the CPU 301 refers to the updated lookup table, acquires the label value “1” corresponding to the identified index number “1”, and assigns the label value “1” to the connected labeled pixels. As a result, the label value is updated. With this process, the CPU 301 updates the label value “6” to the label value “5”. That is, the CPU 301 can assign the same label value “5” to both the pixels corresponding to the defect 110a existing in the start column and the pixel corresponding to the defect 110b existing in the end column. .

ステップS33の処理を実行した後、又はステップS32の処理において、注目画素120aがラベル付画素に連結していないと判定した場合には(NO)、CPU301は、ステップS34の処理を実行する。ステップS34の処理において、CPU301は、注目画素120aがラベリング処理終了位置120bに存在しているか否かを判定する。   After executing the process of step S33 or when determining in step S32 that the target pixel 120a is not connected to the labeled pixel (NO), the CPU 301 executes the process of step S34. In the process of step S34, the CPU 301 determines whether or not the target pixel 120a is present at the labeling process end position 120b.

ステップS34の処理において、注目画素120aがラベリング処理終了位置120bに存在していないと判定した場合には(NO)、CPU301は、注目画素移動処理を実行し(ステップS35)、ステップS31の処理に戻る。この処理において、CPU301は、ラベリング処理(図6参照)のステップS4の処理と同様の処理を実行する。   If it is determined in step S34 that the target pixel 120a does not exist at the labeling process end position 120b (NO), the CPU 301 executes the target pixel movement process (step S35), and the process of step S31 is performed. Return. In this process, the CPU 301 executes a process similar to the process in step S4 of the labeling process (see FIG. 6).

一方、ステップS34の処理において、注目画素120aがラベリング処理終了位置120bに存在する画素であると判定した場合には(YES)、CPU301は、2値化画像データ120のラベル値を更新し終えたと判定し、ラベル値更新処理を終了する。   On the other hand, if it is determined in step S34 that the target pixel 120a is a pixel existing at the labeling processing end position 120b (YES), the CPU 301 has finished updating the label value of the binarized image data 120. The label value update process is terminated.

図8に示すラベル値更新処理を実行することにより、CPU301は、図9(f)に示す連結しているラベル付画素のそれぞれに同一のラベル値が付与された、ラベル値更新後画像データ140を得ることができる。   By executing the label value update process shown in FIG. 8, the CPU 301 updates the label value-updated image data 140 in which the same label value is assigned to each of the connected labeled pixels shown in FIG. Can be obtained.

以上のように、本実施の形態に係る画像処理装置300は、注目画素120aが終了列に存在している場合に、終了列近傍調査処理(図7参照)を実行し、調査結果を用いてラベル値を付与する各処理(図7のステップS16、S18、S19参照)を実行する。また、ラベル値付与処理において、更新された更新後ルックアップテーブル(図10(b)参照)を参照してラベル値更新処理(図8参照)を実行する。これにより、画像処理装置300は、極座標変換処理の開始座標によって1つの欠陥11aを極座標画像データ110の両端部に欠陥110a、及び欠陥110bとして分割した場合であっても、欠陥110a、及び欠陥110bが連結しているものと判定できる。そして、画像処理装置300は、2値化画像データ120の一端120dに存在する欠陥110aと、他端120eに存在する欠陥110bと、が1つの欠陥11aであるものとして、欠陥110a、及び欠陥110bに同一のラベル値を付与することができる。つまり、画像処理装置300は、煩雑な画像処理をすることなく、分割された欠陥110a、及び欠陥110bに同一のラベル値を付与するため、画像処理の簡素化、及び高効率化を図ることが可能となる。   As described above, the image processing apparatus 300 according to the present embodiment executes the end-sequence neighborhood inspection process (see FIG. 7) when the target pixel 120a exists in the end sequence, and uses the survey result. Each process (see steps S16, S18, and S19 in FIG. 7) for assigning a label value is executed. In the label value assigning process, the label value updating process (see FIG. 8) is executed with reference to the updated post-update lookup table (see FIG. 10B). Thereby, even if the image processing apparatus 300 divides one defect 11a as the defect 110a and the defect 110b at both ends of the polar coordinate image data 110 according to the start coordinates of the polar coordinate conversion process, the defect 110a and the defect 110b are divided. Can be determined to be connected. Then, the image processing apparatus 300 assumes that the defect 110a existing at one end 120d of the binarized image data 120 and the defect 110b existing at the other end 120e are one defect 11a, and the defect 110a and the defect 110b. Can be given the same label value. That is, the image processing apparatus 300 assigns the same label value to the divided defect 110a and defect 110b without performing complicated image processing, so that the image processing can be simplified and increased in efficiency. It becomes possible.

そして、検査装置1は、ラベリング処理が実行されたラベル値更新後画像データ140から欠陥11aの特徴量を抽出、解析する。このため、検査装置1は、極座標変換処理によって分割された欠陥110a、及び欠陥110bを同一の欠陥11aであるものとして不良判定を実行することができる。これにより、検査装置1は、被検査物11の不良判定において、極座標変換処理に起因した特徴量解析処理の問題を発生させることなく、正確に不良判定を実行することができる。   Then, the inspection apparatus 1 extracts and analyzes the feature amount of the defect 11a from the updated label value image data 140 on which the labeling process has been performed. For this reason, the inspection apparatus 1 can execute the defect determination assuming that the defect 110a and the defect 110b divided by the polar coordinate conversion process are the same defect 11a. As a result, the inspection apparatus 1 can accurately perform the defect determination in the defect determination of the inspection object 11 without causing the problem of the feature amount analysis process caused by the polar coordinate conversion process.

なお、本実施の形態においては、本画像処理装置300を検査装置1に用いて、被検査物11の欠陥を抽出するものを一例として説明したが、いわゆるマシンビジョンに応用したり、これらに限らず、他分野に応用したりすることができる。例えば、レンズなどの光学素子の生産装置において、生産された物品(製品)の品質を検査する一工程として、本画像処理装置300を用いることもできる。すなわち、物品を製造する製造工程と、物品を撮像する撮像装置と撮像装置が撮像した画像を処理する画像処理装置とを備えた検査装置によって、上述したの画像処理方法を実行し物品を検査する検査工程と、を行う生産方法に用いてもよい。上述した画像処理方法を用いることにより、物品の生産方法においては、効果的に物品の生産を行うことができる。要するに点対称の点を中心とする画像データから欠陥を抽出する画像処理であれば、どのような画像処理にも本技術を適用することができる。   In the present embodiment, the image processing apparatus 300 is used as the inspection apparatus 1 to extract the defect of the inspection object 11 as an example. However, the present embodiment is applied to a so-called machine vision or is not limited thereto. It can be applied to other fields. For example, the image processing apparatus 300 can be used as a process for inspecting the quality of a produced article (product) in a production apparatus for optical elements such as lenses. That is, the above-described image processing method is executed and an article is inspected by an inspection apparatus including a manufacturing process for manufacturing an article, an imaging apparatus that images the article, and an image processing apparatus that processes an image captured by the imaging apparatus. You may use for the production method which performs an inspection process. By using the image processing method described above, an article can be effectively produced in the article production method. In short, the present technology can be applied to any image processing as long as the image processing extracts a defect from image data centered on a point-symmetric point.

1…検査装置:11…被検査物:11a…欠陥:11b…点対称の点:11c…開始位置:11d…終了位置:12…位置決め部材(ホルダー):13…光源:14…撮像装置(カメラ):100…画像データ:110…極座標変換処理を実行した画像データ(極座標画像データ):120…2値化処理を実行した画像データ(2値化画像データ):120d…一端:120e…他端:300…画像処理装置:301…制御部(CPU):303…記憶部(RAM):304…記録媒体(HDD):304b…画像処理プログラム DESCRIPTION OF SYMBOLS 1 ... Inspection apparatus: 11 ... Inspected object: 11a ... Defect: 11b ... Point symmetry point: 11c ... Start position: 11d ... End position: 12 ... Positioning member (holder): 13 ... Light source: 14 ... Imaging apparatus (camera) ): 100: Image data: 110: Image data subjected to polar coordinate conversion processing (polar coordinate image data): 120 ... Image data subjected to binarization processing (binarized image data): 120d: One end: 120e: Other end : 300 ... Image processing apparatus: 301 ... Control unit (CPU): 303 ... Storage unit (RAM): 304 ... Recording medium (HDD): 304b ... Image processing program

Claims (7)

被検査物を撮像して取得した画像データを記憶可能な記憶部と、
前記記憶部に記憶された画像データにおける測定対象の領域の回転の中心点を起点とする周方向の開始位置から前記開始位置に接続される周方向の終了位置まで極座標変換処理を実行し、前記極座標変換処理を実行した画像データを構成する画素を予め定められた閾値を境にした第1の画素値、及び第2の画素値に2値化する2値化処理を実行し、前記2値化処理によって前記第1の画素値、又は前記第2の画素値のいずれか一方の画素値に変換した画素が連結している場合に、該連結している画素のそれぞれに同一のラベル値を付与するラベリング処理を実行する制御部と、を備え、
前記制御部が、前記ラベリング処理において、前記2値化処理を実行した画像データの前記開始位置に対応する一端、及び前記終了位置に対応する他端のそれぞれに、前記ラベル値を付与する画素が存在する場合に、前記一端、及び前記他端に存在する両画素が連結しているものとして同一の前記ラベル値を付与する、
ことを特徴とする画像処理装置。
A storage unit capable of storing image data acquired by imaging the inspection object;
Performing a polar coordinate conversion process from a circumferential start position starting from a rotation center point of the measurement target region in the image data stored in the storage unit to a circumferential end position connected to the start position, Performing binarization processing to binarize a pixel constituting image data subjected to polar coordinate conversion processing into a first pixel value and a second pixel value with a predetermined threshold as a boundary; When pixels converted into either one of the first pixel value or the second pixel value are connected by the conversion process, the same label value is assigned to each of the connected pixels. A control unit that executes a labeling process to be provided,
In the labeling process, the controller assigns the label value to each of one end corresponding to the start position and the other end corresponding to the end position of the image data that has been subjected to the binarization process. If present, the same label value is given as if the pixels existing at the one end and the other end are connected,
An image processing apparatus.
前記被検査物を位置決めする位置決め部材と、
前記被検査物を照射する光源と、
前記被検査物を撮像して前記画像データを取得する撮像装置と、
前記請求項1に記載の画像処理装置と、を備え、
前記画像処理装置によって前記ラベル値が付与された画像データを用いて、前記被検査物が欠陥を有するか否かを判定する、
ことを特徴とする検査装置。
A positioning member for positioning the inspection object;
A light source for irradiating the object to be inspected;
An imaging device that images the inspection object and acquires the image data;
An image processing apparatus according to claim 1,
Using the image data to which the label value is given by the image processing device, it is determined whether or not the inspection object has a defect,
Inspection apparatus characterized by that.
制御部が、記憶部に記憶された被検査物の画像データにおける測定対象の領域の回転の中心点を起点とする周方向の開始位置から前記開始位置に接続される周方向の終了位置まで極座標変換処理を実行する極座標変換処理工程と、
制御部が、前記極座標変換処理工程で前記極座標変換処理を実行した画像データを構成する画素を予め定められた閾値を境にした第1の画素値、及び第2の画素値に2値化する2値化処理を実行する2値化処理工程と、
制御部が、前記2値化処理工程で前記2値化処理を実行した画像データにおいて、前記第1の画素値、又は前記第2の画素値のいずれか一方の画素値に変換された画素が連結している場合に、該連結している画素のそれぞれに同一のラベル値を付与するラベリング処理を実行するラベリング処理工程と、を備え、
前記制御部が、前記ラベリング処理工程において、前記2値化処理を実行した画像データの前記開始位置に対応する一端、及び前記終了位置に対応する他端のそれぞれに、前記ラベル値を付与する画素が存在する場合に、前記一端、及び前記他端に存在する両画素が連結しているものとして同一の前記ラベル値を付与する端部処理を実行する、
ことを特徴とする画像処理方法。
Polar coordinates from the start position in the circumferential direction starting from the center point of rotation of the measurement target region in the image data of the inspection object stored in the storage unit to the end position in the circumferential direction connected to the start position A polar coordinate conversion process for executing the conversion process;
The control unit binarizes the pixels constituting the image data that has been subjected to the polar coordinate conversion process in the polar coordinate conversion process step into a first pixel value and a second pixel value with a predetermined threshold as a boundary. A binarization process for executing the binarization process;
In the image data in which the control unit has performed the binarization process in the binarization process step, a pixel converted into one of the first pixel value and the second pixel value is A labeling process that executes a labeling process that gives the same label value to each of the connected pixels when connected, and
Pixels to which the control unit assigns the label value to each of one end corresponding to the start position and the other end corresponding to the end position of the image data subjected to the binarization process in the labeling process step If there is, the end processing to give the same label value as the connection between the one end and both pixels existing at the other end,
An image processing method.
前記制御部が、前記ラベリング処理工程において、前記ラベル値を付与する画素に、前記ラベル値を付与されているラベル付画素が少なくとも1つ連結している場合に、該連結している前記ラベル付画素に付与されている前記ラベル値のうち最小の最小ラベル値を、前記ラベル値を付与する画素に付与するラベル値付与処理と、
前記制御部が、前記ラベリング処理工程において、前記ラベル値を付与する画素に、前記ラベル付画素が少なくとも1つ連結している場合に、該連結している前記ラベル付画素に付与されている前記最小ラベル値とは異なる前記ラベル値を、前記最小ラベル値に更新するラベル値更新処理と、を実行し、
前記制御部が、前記端部処理において、前記2値化処理を実行した画像データの前記一端、及び前記他端のそれぞれに、前記ラベル値を付与する画素が存在する場合に、前記ラベル値付与処理、及び前記ラベル値更新処理を実行し、前記一端、及び前記他端に存在する両画素に同一の前記最小ラベル値を付与する、
ことを特徴とする請求項3に記載の画像処理方法。
In the labeling process, when the control unit connects at least one labeled pixel to which the label value is given to the pixel to which the label value is given, the connected labeling A label value assigning process for assigning the smallest minimum label value among the label values given to the pixels to the pixel to which the label value is given;
In the labeling process, when the control unit is connected to the pixel to which the label value is applied and at least one of the labeled pixels is connected, the control unit is applied to the connected labeled pixels. A label value update process for updating the label value different from the minimum label value to the minimum label value;
In the edge processing, the control unit assigns the label value when there is a pixel to which the label value is applied at each of the one end and the other end of the image data subjected to the binarization processing. Process, and the label value update process, to give the same minimum label value to both pixels existing at the one end and the other end,
The image processing method according to claim 3.
請求項3、又は請求項4に記載の各工程をコンピュータに実行させるための画像処理プログラム。   An image processing program for causing a computer to execute each step according to claim 3 or 4. 請求項5に記載の画像処理プログラムを記録した、コンピュータで読み取り可能な記録媒体。   A computer-readable recording medium on which the image processing program according to claim 5 is recorded. 物品を製造する製造工程と、
前記物品を撮像する撮像装置と前記撮像装置が撮像した画像を処理する画像処理装置とを備えた検査装置によって、請求項4に記載の画像処理方法を実行することで前記物品を検査する検査工程と、を備えた、
ことを特徴とする生産方法。
A manufacturing process for manufacturing the article;
An inspection step of inspecting the article by executing the image processing method according to claim 4 by an inspection apparatus including an imaging device that images the article and an image processing device that processes an image captured by the imaging device. And with,
A production method characterized by that.
JP2014091580A 2014-04-25 2014-04-25 Image processor, and image processing method Pending JP2015210652A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2014091580A JP2015210652A (en) 2014-04-25 2014-04-25 Image processor, and image processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2014091580A JP2015210652A (en) 2014-04-25 2014-04-25 Image processor, and image processing method

Publications (1)

Publication Number Publication Date
JP2015210652A true JP2015210652A (en) 2015-11-24

Family

ID=54612794

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2014091580A Pending JP2015210652A (en) 2014-04-25 2014-04-25 Image processor, and image processing method

Country Status (1)

Country Link
JP (1) JP2015210652A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003240727A (en) * 2002-02-18 2003-08-27 Dainippon Printing Co Ltd Apparatus and method for examining inner surface of round paper cup
JP2010014698A (en) * 2008-06-04 2010-01-21 Kobe Steel Ltd Tire shape inspection method and tire shape inspection device
JP2013200233A (en) * 2012-03-26 2013-10-03 Toppan Printing Co Ltd Port plug inspection device, and port plug inspection method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003240727A (en) * 2002-02-18 2003-08-27 Dainippon Printing Co Ltd Apparatus and method for examining inner surface of round paper cup
JP2010014698A (en) * 2008-06-04 2010-01-21 Kobe Steel Ltd Tire shape inspection method and tire shape inspection device
JP2013200233A (en) * 2012-03-26 2013-10-03 Toppan Printing Co Ltd Port plug inspection device, and port plug inspection method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吉見 隆,外1名: "境界追跡型ラベリングの円筒状画像への拡張", 電子情報通信学会技術研究報告 VOL.102 NO.554, vol. 第102巻, JPN6018016506, 9 January 2003 (2003-01-09), JP, pages 103 - 108 *

Similar Documents

Publication Publication Date Title
JP5152231B2 (en) Image processing method and image processing apparatus
KR102110634B1 (en) Wafer inspection using free-form care areas
WO2016034022A1 (en) Vehicle inspection method and system
JP2007285754A (en) Flaw detection method and flaw detector
JP2009259036A (en) Image processing device, image processing method, image processing program, recording medium, and image processing system
JP2018096908A (en) Inspection device and inspection method
JP6197340B2 (en) Image processing apparatus, image processing method, and program
WO2018207261A1 (en) Image analysis device
JP2021532347A (en) Multi-mode defect classification in semiconductor inspection
JP4279833B2 (en) Appearance inspection method and appearance inspection apparatus
JP6045429B2 (en) Imaging apparatus, image processing apparatus, and image processing method
JP2007298376A (en) Method and device for determining boundary position, program for making computer function as boundary position determination device, and recording medium
JP5772675B2 (en) Gray image edge extraction method, edge extraction device, and gray image edge extraction program
KR20230066002A (en) Systems and methods for quantifying light flare in images
JPWO2016194338A1 (en) Image processing method and image processing apparatus
JP5825226B2 (en) Pipe number counting method, pipe number counting device, and computer program
JP2014126445A (en) Alignment device, defect inspection device, alignment method and control program
CN117252861A (en) Method, device and system for detecting wafer surface defects
JP6647903B2 (en) Image inspection device, image inspection program, computer-readable recording medium, and recorded device
WO2019176614A1 (en) Image processing device, image processing method, and computer program
JP2013205320A (en) Inspection condition determination method, inspection method, and inspection device
JP2015210652A (en) Image processor, and image processing method
JP6326445B2 (en) Image processing method, image processing apparatus, and image processing program
JP2019100937A (en) Defect inspection device and defect inspection method
JP4315349B2 (en) Image processing method, apparatus, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20170421

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20180412

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20180515

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20181225