JP2010218560A - Method for processing color image and image processing apparatus - Google Patents

Method for processing color image and image processing apparatus Download PDF

Info

Publication number
JP2010218560A
JP2010218560A JP2010086753A JP2010086753A JP2010218560A JP 2010218560 A JP2010218560 A JP 2010218560A JP 2010086753 A JP2010086753 A JP 2010086753A JP 2010086753 A JP2010086753 A JP 2010086753A JP 2010218560 A JP2010218560 A JP 2010218560A
Authority
JP
Japan
Prior art keywords
color
image
scanning
average
point
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.)
Granted
Application number
JP2010086753A
Other languages
Japanese (ja)
Other versions
JP4670993B2 (en
Inventor
Toshihiko Matsumoto
俊彦 松本
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.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
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 Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP2010086753A priority Critical patent/JP4670993B2/en
Publication of JP2010218560A publication Critical patent/JP2010218560A/en
Application granted granted Critical
Publication of JP4670993B2 publication Critical patent/JP4670993B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

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

Abstract

<P>PROBLEM TO BE SOLVED: To stably detect the position of a contour of an object. <P>SOLUTION: A CPU 10 sets a rectangular measurement object area elongated in the direction along x-axis and y-axis of a processing object image on the premise that a processing object image including image data of R, G, B generated by imaging with a color camera 2 and stored in image memories 12, 13, 14 are distinguished by using two kinds of colors. A narrow rectangular small area is set within a measurement object area with a shorter side thereof aligned with the scanning direction, and while scanning is performed at predetermined intervals within the measurement object area by the small area, an average color within the small area at each scanning position is obtained. Further, in the color space taking the respective color components of R, G, B as axes, the average colors obtained at each scanning position are traced in order to extract a point where a distance from a starting point of tracing first exceeds a predetermined threshold, and the position of a small area when the average color corresponding to the point is discriminated as a boundary position of two kinds of colors. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

この発明は、赤、緑、青の各色成分の濃度データから成るカラー画像を処理することにより、対象物の輪郭線の位置を検出する画像処理方法および画像処理装置に関する。   The present invention relates to an image processing method and an image processing apparatus for detecting the position of a contour line of an object by processing a color image composed of density data of red, green, and blue color components.

従来から行われている代表的なカラー画像処理では、ユーザーに所定の色彩を指定させることによって、各色成分の濃度データの組み合わせによる3次元の画像データを、前記指定された色彩に対する色差という一次元のデータに変換し、その色差データの大きさを用いた処理を実行するようにしている(特許文献1参照)。   In typical color image processing performed conventionally, by allowing a user to specify a predetermined color, three-dimensional image data obtained by combining density data of each color component is converted into a one-dimensional color difference with respect to the specified color. And processing using the size of the color difference data is performed (see Patent Document 1).

また、色彩の異常が生じた部分を欠陥として抽出する場合、あらかじめ正常な色彩を基準色として登録しておき、計測対象の画像を構成する画素毎に前記基準色との色差を求めることも提案されている(特許文献2参照。)。   In addition, when extracting a portion where a color abnormality has occurred as a defect, it is also proposed to register a normal color as a reference color in advance and obtain a color difference from the reference color for each pixel constituting the measurement target image. (See Patent Document 2).

特開平7−203476号公報JP-A-7-203476 特開平11−108759号公報Japanese Patent Laid-Open No. 11-108759

図9は、カラー画像上の各画素を1次元の色差データに置き換える処理の概要を、各色成分に対応する3軸による仮想空間(以下、「色空間」という。)における関係にして示したものである。ユーザーにより指定された色彩は、この色空間内の特定の点Qに対応するものとなる。ここで、この色空間における点Qからの距離により色差を表すと、前記点Qを中心とする球体の面上の点に対応する色彩は、すべて同じ値で表されることになる。図9では、点Qの値を255として、150,100,50の各濃度値に変換される範囲を、球体の断面の輪郭に模式化して示す。   FIG. 9 shows an outline of processing for replacing each pixel on a color image with one-dimensional color difference data in a relationship in a virtual space (hereinafter referred to as “color space”) with three axes corresponding to each color component. It is. The color designated by the user corresponds to a specific point Q in this color space. Here, when the color difference is expressed by the distance from the point Q in this color space, the colors corresponding to the points on the surface of the sphere centered on the point Q are all expressed by the same value. In FIG. 9, the value converted to each density value of 150, 100, and 50 with the value of the point Q being 255 is schematically shown in the outline of the cross section of the sphere.

ユーザーに色彩を指定させる場合、ユーザーによって、また同じユーザーでも時によって、指定する色彩が変動する可能性がある。指定色が変動すると、上記点Qの位置も変わることになるから、各画素における色差の値も異なるものとなる。すなわち、特許文献1,2のように、画像上の所定位置の色彩を基準色とした場合、その基準色の選択によって、色差として変換された画像上の濃度分布が変動することになる。さらに、このような濃度分布の変動により、対象物の測定結果までが変わってしまうおそれがある。   When the user designates a color, the color to be designated may vary depending on the user or the same user. When the designated color changes, the position of the point Q also changes, so that the color difference value in each pixel also differs. That is, as in Patent Documents 1 and 2, when the color at a predetermined position on the image is set as a reference color, the density distribution on the image converted as a color difference varies depending on the selection of the reference color. Furthermore, there is a possibility that even the measurement result of the object may be changed due to the fluctuation of the concentration distribution.

この発明は上記の問題に着目してなされたもので、背景、対象物とも無地のカラー画像を処理する場合に、ユーザーに基準の色彩を指定させる必要をなくすことによって、背景と対象物との境界位置(すなわち対象物の輪郭線の位置)を安定して検出することができるようにすることを目的とする。   The present invention has been made paying attention to the above problem, and when processing a solid color image for both the background and the object, by eliminating the need for the user to specify a reference color, the background and the object It is an object of the present invention to make it possible to stably detect a boundary position (that is, the position of the contour line of an object).

この発明は、赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法に適用される。この発明にかかる画像処理方法では、2種類の色彩に色分けされたカラー画像を処理対象画像として、この処理対象画像の直交する2辺のうちの少なくとも一辺に沿う方向を走査方向に設定して、走査方向に沿って所定幅の走査対象範囲を設定する処理と、この走査対象範囲において、幅狭の矩形状の小領域を短い方の辺を走査方向に合わせて所定の間隔で走査しつつ、各走査位置における小領域内の平均色を求める処理とを、走査方向毎に実行する。つぎに、前記した色空間において、前記小領域の走査時に求めた複数の平均色に対応する各点を走査に対応する順序で追跡し、追跡処理の起点からの距離が所定のしきい値を超える点が初めて見つかったとき、その点に対応する平均色を得たときの前記小領域の位置を2種類の色彩の境界位置として判別する。   The present invention is applied to a method of processing a color image composed of density data of red, green, and blue color components. In the image processing method according to the present invention, a color image divided into two kinds of colors is set as a processing target image, and a direction along at least one of two orthogonal sides of the processing target image is set as a scanning direction. A process for setting a scanning target range having a predetermined width along the scanning direction, and in this scanning target range, scanning a narrow rectangular small region with a shorter side aligned with the scanning direction at a predetermined interval, The process of obtaining the average color in the small area at each scanning position is executed for each scanning direction. Next, in the color space described above, each point corresponding to the plurality of average colors obtained at the time of scanning the small area is tracked in the order corresponding to the scan, and the distance from the starting point of the tracking process has a predetermined threshold value. When the exceeding point is found for the first time, the position of the small area when the average color corresponding to the point is obtained is determined as the boundary position between the two types of colors.

上記の方法において、計測対象のカラー画像の各構成画素の色彩は、赤、緑、青の各濃度データの組み合わせにより表される。平均色は、小領域内の各画素における濃度値を、色成分毎に平均することにより得ることができる。すなわち、赤色成分の濃度平均値、緑色成分の濃度平均値、青色成分の濃度平均値により示される色彩が平均色であると、考えることができる。   In the above method, the color of each constituent pixel of the color image to be measured is represented by a combination of red, green, and blue density data. The average color can be obtained by averaging the density value of each pixel in the small area for each color component. That is, it can be considered that the color indicated by the average density value of the red component, the average density value of the green component, and the average density value of the blue component is an average color.

上記の方法の走査において、色彩に大きな変化が生じていない間に抽出される平均色は、色空間では同種の色彩の範囲に分布する、と考えることができる。一方、所定位置で色彩が大きく変化すると、その位置の平均色は、それまでに求められた各平均色の分布から離れた場所に位置すると考えることができる。したがって、色空間において、各平均色への対応点を走査の順に追跡し、所定のしきい値を超える距離だけ離れて位置する点を見つけたときに、その点を色彩の境界に相当する点として抽出することができる。   In the scanning of the above method, it can be considered that the average color extracted while the color does not change greatly is distributed in the same kind of color range in the color space. On the other hand, when the color changes greatly at a predetermined position, it can be considered that the average color at that position is located at a place away from the distribution of each average color obtained so far. Therefore, in the color space, the points corresponding to each average color are tracked in the order of scanning, and when a point located at a distance exceeding a predetermined threshold is found, that point corresponds to the boundary of the color Can be extracted as

上記の方法を実施するための画像処理装置は、赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、前記画像入力手段が2種類の色彩に色分けされたカラー画像を処理対象画像として入力したことに応じて、この処理対象画像の直交する2辺のうちの少なくとも一辺に沿う方向を走査方向に設定して、走査方向に沿って所定幅の走査対象範囲を設定する処理と、この走査対象範囲において、幅狭の矩形状の小領域を短い方の辺を走査方向に合わせて所定の間隔で走査しつつ、各走査位置における小領域内の平均色を求める処理とを、走査方向毎に実行する平均色算出手段と、前記色空間において、前記平均色算出手段により求められた複数の平均色に対応する各点を走査に対応する順序で追跡し、追跡処理の起点からの距離が所定のしきい値を初めて超える点を抽出する抽出手段と、前記抽出手段により抽出された点に対応する平均色を得たときの前記小領域の位置を2種類の色彩の境界位置として判別する判別手段とを具備する。   An image processing apparatus for carrying out the above method includes an image input means for inputting a color image composed of density data of each color component of red, green and blue, and a color in which the image input means is color-coded into two colors In response to the input of the image as the processing target image, a direction along at least one of the two orthogonal sides of the processing target image is set as the scanning direction, and a scanning target range having a predetermined width along the scanning direction is set. In this scanning target range, an average color in the small area at each scanning position is obtained while scanning a narrow rectangular small area at a predetermined interval with the shorter side aligned with the scanning direction. An average color calculating unit that executes the processing for each scanning direction, and in the color space, the points corresponding to the plurality of average colors obtained by the average color calculating unit are tracked in the order corresponding to the scanning, and tracking is performed. Start of processing An extraction means for extracting a point whose distance from the first exceeds a predetermined threshold, and the position of the small area when an average color corresponding to the point extracted by the extraction means is obtained is a boundary between two kinds of colors Discriminating means for discriminating the position.

上記構成の装置において、画像入力手段は、カラー画像生成用の撮像手段に対するインターフェース回路とすることができる。また撮像手段がアナログカメラである場合、画像入力手段には、各色成分の濃度データをディジタル変換するA/D変換回路を含めることができる。
また、画像入力手段は、外部の装置からあらかじめ生成されたカラー画像を入力するための通信用のインターフェース回路や、所定の記憶媒体に格納されたカラー画像を読み出すドライブ装置として構成することもできる。
In the apparatus configured as described above, the image input means may be an interface circuit for the image pickup means for generating a color image. When the imaging means is an analog camera, the image input means can include an A / D conversion circuit that digitally converts density data of each color component.
The image input means can also be configured as a communication interface circuit for inputting a color image generated in advance from an external device or a drive device for reading out a color image stored in a predetermined storage medium.

平均色算出手段、抽出手段、および判別手段は、プログラムが設定されたコンピュータにより構成するのが望ましい。ただし、必ずしもすべての手段をコンピュータにより構成する必要はなく、一部の手段をASIC(特定用途向けIC)により構成することもできる。   The average color calculation means, extraction means, and discrimination means are preferably constituted by a computer in which a program is set. However, it is not always necessary to configure all the means by a computer, and some of the means can be configured by an ASIC (application specific IC).

上記の画像処理方法および画像処理装置によれば、背景、対象物がともに無地となるカラー画像中の対象物と背景との境界位置を、安定して抽出することが可能になる。したがって、たとえば、対象物に対する計測や検査を行うのに先立ち、計測対象領域の設定のために対象物を抽出する目的に使用することができる。   According to the image processing method and the image processing apparatus described above, it is possible to stably extract the boundary position between the object and the background in the color image in which both the background and the object are plain. Therefore, for example, prior to performing measurement or inspection on the target object, it can be used for the purpose of extracting the target object for setting the measurement target region.

この発明によれば、無地の対象物の輪郭線の位置を検出する場合に、基準の色彩を指定する必要がないので、検出される輪郭線の位置が指定色の変動によって変わるおそれがなくなり、安定した検出結果を得ることができる。また、対象物のベースの色彩が変化しても、容易に対応することができる。   According to the present invention, when detecting the position of the contour line of the plain object, there is no need to specify the reference color, so there is no possibility that the position of the detected contour line changes due to the change in the designated color. A stable detection result can be obtained. Moreover, even if the base color of the object changes, it can be easily handled.

この発明にかかる画像処理装置の構成例を示すブロック図である。It is a block diagram which shows the structural example of the image processing apparatus concerning this invention. 欠陥検査1の手順を示すフローチャートである。It is a flowchart which shows the procedure of the defect inspection 1. 計測対象領域の分割例を示す図である。It is a figure which shows the example of a division | segmentation of a measurement object area | region. 欠陥検査2の手順を示すフローチャートである。It is a flowchart which shows the procedure of the defect inspection 2. FIG. 位置計測処理のための計測対象領域およびウィンドウの設定例を示す図である。It is a figure which shows the example of a setting of the measurement object area | region and window for a position measurement process. 位置計測処理の手順を示すフローチャートである。It is a flowchart which shows the procedure of a position measurement process. 図6のST207〜211の処理の具体例を示す図である。It is a figure which shows the specific example of the process of ST207-211 of FIG. 個数検査の手順を示すフローチャートである。It is a flowchart which shows the procedure of number inspection. 色差に基づく変換処理において同じ値が設定される範囲を示す図である。It is a figure which shows the range in which the same value is set in the conversion process based on a color difference.

図1は、この発明が適用された画像処理装置の基本構成を示す。この画像処理装置は、カラー画像生成用のカメラ2と本体部1とから成るもので、カメラ2により生成されたカラー画像を本体部1に取り込んで、色彩異常部位の有無を判別したり、画像中に含まれる対象物を抽出するなどの処理を実行する。本体部1は、CPU10、プログラム等が格納されたメモリ11、処理結果を出力するための出力部18などを有するもので、たとえばパーソナルコンピュータにより構成することができる。   FIG. 1 shows a basic configuration of an image processing apparatus to which the present invention is applied. This image processing apparatus includes a camera 2 for generating a color image and a main body 1. The color image generated by the camera 2 is taken into the main body 1 to determine the presence / absence of a color abnormality part, Processes such as extracting the object contained in it are executed. The main body unit 1 includes a CPU 10, a memory 11 in which programs are stored, an output unit 18 for outputting processing results, and the like, and can be configured by a personal computer, for example.

さらに、この実施例の本体部1には、赤(R)、緑(G)、青(B)の各色成分毎に画像メモリ12,13,14が設けられる。カメラ2から出力された各色成分の画像データは、それぞれ対応する画像メモリ12,13,14に格納される。なお、この図には記載していないが、各画像メモリ12,13,14への入力経路には、インターフェース回路やA/D変換回路などが設けられる。また、出力部18には、外部の装置に処理結果を送信するための通信インターフェース回路や、図示しないモニタに処理結果を表示させるための表示用インターフェース回路などが含められる。   Furthermore, the main body 1 of this embodiment is provided with image memories 12, 13, and 14 for each color component of red (R), green (G), and blue (B). The image data of each color component output from the camera 2 is stored in the corresponding image memories 12, 13, and 14, respectively. Although not shown in this figure, an interface circuit, an A / D conversion circuit, and the like are provided in the input path to each of the image memories 12, 13, and 14. The output unit 18 includes a communication interface circuit for transmitting the processing result to an external device, a display interface circuit for displaying the processing result on a monitor (not shown), and the like.

また、前記本体部1には、対象物のモデルのカラー画像から抽出された基準画像を登録するために、色成分毎の画像メモリ15,16,17(以下、「基準画像メモリ15,16,17」という。)が設けられる。
なお、前記メモリ11は、ROM,RAMのほか、ハードディスクなどの補助記憶装置を含むものとなる。また、基準画像メモリ15,16,17および前記画像メモリ12,13,14は、物理的には同一の記憶装置(前記ハードディスクなど)内に設定することができる。
In addition, in the main body 1, in order to register a reference image extracted from a color image of a model of an object, image memories 15, 16, 17 (hereinafter referred to as “reference image memories 15, 16, 17 ”).
The memory 11 includes an auxiliary storage device such as a hard disk in addition to the ROM and RAM. The reference image memories 15, 16, and 17 and the image memories 12, 13, and 14 can be physically set in the same storage device (the hard disk or the like).

以下、上記の画像処理装置で実施できる処理を4例あげ、各例の詳細な処理内容を説明する。なお、以下でいうところの「画像」は、いずれもR,G,Bの各画像データを組み合わせたものである。   Hereinafter, four examples of processing that can be performed by the above-described image processing apparatus will be described, and detailed processing contents of each example will be described. The “image” referred to below is a combination of R, G, and B image data.

(1)欠陥検査1
この検査は、無地の対象物の表面に、汚れやシミなどの欠陥により、本来とは異なる色彩が生じていないかどうかを検査するものである。図2は、この検査の手順を示す。
(1) Defect inspection 1
This inspection is to inspect whether or not a color different from the original color has occurred on the surface of a plain object due to defects such as dirt and spots. FIG. 2 shows the procedure of this inspection.

この手順は、カメラ2からの画像データが各画像メモリ12,13,14に格納された時点からスタートする。まず、最初のステップ1(以下、ステップを「ST」と略す。)では、画像上の対象物に対して計測対象領域を設定する。なお、図2には詳細に記載していないが、計測領域を設定する際には、たとえば、入力された各色成分の画像データからモノクロ画像を作成し、そのモノクロ画像のエッジを抽出するなどして、対象物の画像を抽出する。そして、その抽出結果に基づき、元のカラー画像において、対象物の検査対象部位を含み、かつ背景部分など他の色彩を有する部位を含まないような計測対象領域を設定する。ただし、対象物が大きく位置ずれしない場合には、計測対象領域の設定位置をあらかじめ登録しておいてもよい。   This procedure starts when the image data from the camera 2 is stored in each of the image memories 12, 13, and 14. First, in the first step 1 (hereinafter, step is abbreviated as “ST”), a measurement target region is set for a target on an image. Although not described in detail in FIG. 2, when setting the measurement region, for example, a monochrome image is created from the input image data of each color component, and an edge of the monochrome image is extracted. Then, an image of the object is extracted. Then, based on the extraction result, a measurement target region is set in the original color image so as to include the inspection target portion of the target object and not to include a portion having another color such as a background portion. However, when the object does not greatly deviate, the setting position of the measurement target area may be registered in advance.

つぎのST2では、前記計測対象領域を複数の小領域に分割する。この小領域の大きさは、抽出すべき欠陥の大きさに応じてあらかじめ設定される。図3はその具体例を示すもので、x,yの各軸毎に計測対象領域20を均等に分割することにより、複数個(図示例では12個)の小領域が設定されている。   In the next ST2, the measurement target area is divided into a plurality of small areas. The size of the small area is set in advance according to the size of the defect to be extracted. FIG. 3 shows a specific example, and a plurality of (12 in the illustrated example) small regions are set by equally dividing the measurement target region 20 for each of the x and y axes.

つぎのST3では、各小領域につき、それぞれその小領域内の各画素における濃度データをR,G,Bの各色成分別に平均化する。この平均化により得られたRの平均値、Gの平均値、Bの平均値により表される色彩が平均色である。   In the next ST3, for each small area, the density data in each pixel in the small area is averaged for each color component of R, G, and B. The color represented by the average value of R, the average value of G, and the average value of B obtained by this averaging is the average color.

つぎにST4において、カウンタnを1に、色差の最大値Dmaxを0に、それぞれ初期設定する。そしてn番目の小領域に着目し、この小領域に上下左右のいずれかの方向で隣接する小領域に対する色差Dnを算出する(ST5,6)。この色差Dnは、色空間におけるユークリッド距離として求めることができる。すなわち、着目中の小領域における平均色を(R0,G0,B0)とし、隣接する小領域の平均色を(R1,G1,B1)とした場合、色差Dnは、つぎの(1)式により算出することができる。   Next, in ST4, the counter n is set to 1 and the maximum color difference value Dmax is set to 0, respectively. Then, paying attention to the n-th small area, the color difference Dn is calculated for the small area adjacent to the small area in any of the vertical and horizontal directions (ST5, ST6). This color difference Dn can be obtained as the Euclidean distance in the color space. That is, when the average color in the small area under consideration is (R0, G0, B0) and the average color in the adjacent small areas is (R1, G1, B1), the color difference Dn is expressed by the following equation (1). Can be calculated.

Figure 2010218560
Figure 2010218560

ST7では、上記(1)式により求めた色差Dnを最大値Dmaxと比較する。前記ST4によりDmaxの初期値を0に設定しているため、1回目のST7の判定は必ず「YES」となる。この場合にはST8に進み、前記Dnの値をもって最大値Dmaxを書き換える。   In ST7, the color difference Dn obtained by the above equation (1) is compared with the maximum value Dmax. Since the initial value of Dmax is set to 0 in ST4, the first determination in ST7 is always “YES”. In this case, the process proceeds to ST8, and the maximum value Dmax is rewritten with the value of Dn.

以下、着目中の小領域に隣接するすべての小領域に対してST6〜8を実行した後、さらにnの値を更新することにより着目対象を変更し、上記の処理を実行する(ST5〜11)。この結果、隣接する小領域の組毎に色差Dnが求められ、その中の最大値がDmaxとして抽出される。ST12では、この最大値Dmaxを所定のしきい値Dthと比較する。なお、このしきい値Dthは、検査に先立ち、欠陥のない対象物の画像から求めた色差(最大の色差とするのが望ましい。)に基づき設定することができる。   Thereafter, after performing ST6 to 8 on all the small regions adjacent to the small region of interest, the value of n is further updated to change the target of interest, and the above processing is performed (ST5 to 11). ). As a result, the color difference Dn is obtained for each set of adjacent small regions, and the maximum value among them is extracted as Dmax. In ST12, the maximum value Dmax is compared with a predetermined threshold value Dth. Note that the threshold value Dth can be set based on a color difference (desirably the maximum color difference) obtained from an image of an object having no defect prior to inspection.

前記ST12でDmaxがしきい値Dthより大きいと判別された場合には、ST13に進み、不良判定(対象物に欠陥があることを意味する。)を行う。一方、Dmaxがしきい値Dth以下であれば、ST14に進み、良判定(対象物に欠陥がないことを意味する。)を行う。そして、ST15では、ST13またはST14の判定結果を出力部18より出力し、処理を終了する。   If it is determined in ST12 that Dmax is larger than the threshold value Dth, the process proceeds to ST13 and a defect determination (meaning that the object is defective) is performed. On the other hand, if Dmax is equal to or less than the threshold value Dth, the process proceeds to ST14 and a good determination (meaning that the object is free of defects) is performed. In ST15, the determination result of ST13 or ST14 is output from the output unit 18, and the process ends.

上記の処理によれば、無地の対象物について、その対象物の色彩を登録する必要なしに欠陥検査を行うことができる。また、検査の途中で対象物の色彩が変わった場合でも、同じアルゴリズムにより速やかに検査を進めることができる。   According to the above processing, a defect inspection can be performed on a plain object without having to register the color of the object. Moreover, even when the color of the object changes during the inspection, the inspection can be promptly advanced by the same algorithm.

なお、図2の手順では、計測対象領域における色差の最大値Dmaxを求め、そのDmaxの値の大きさによって欠陥の有無を判断しているが、これに代えて、色差Diを求める都度、その値を前記しきい値Dthと比較し、色差Diがしきい値Dthを超えた時点で不良判定を行うようにしてもよい。   In the procedure of FIG. 2, the maximum value Dmax of the color difference in the measurement target region is obtained and the presence or absence of a defect is determined based on the magnitude of the value of Dmax. Instead, each time the color difference Di is obtained, The value may be compared with the threshold value Dth, and the defect determination may be performed when the color difference Di exceeds the threshold value Dth.

また、しきい値Dthを超える色差が抽出された場合、その色差を得たときの小領域の組について、他の小領域との色差をチェックすることにより、欠陥の位置を特定することもできる。たとえば、前記図2の手順において、最終的に得た最大値Dmaxがしきい値Dthを超えた場合、Dmaxを得たときの2つの小領域について、他の小領域に対する色差をチェックし、隣接するすべての小領域に対し、しきい値Dthを超える色差またはDthに近い値の色差が抽出されている方の小領域を欠陥部位として特定する。   In addition, when a color difference exceeding the threshold value Dth is extracted, the position of the defect can be specified by checking the color difference with the other small areas for the set of small areas when the color difference is obtained. . For example, in the procedure of FIG. 2, when the maximum value Dmax finally obtained exceeds the threshold value Dth, the color difference with respect to the other small areas is checked for two small areas when Dmax is obtained, For all of the small areas, the small area from which the color difference exceeding the threshold value Dth or the color difference close to Dth is extracted is specified as the defective portion.

(2)欠陥検査2
この検査は、無地ではなく、文字、図柄、模様などが複数種の色彩により表された物体を対象として、本来あるべきでない色彩が含まれていないかどうかを検査するものである。この検査を行う際には、まず、色彩の分布が良好な対象物のモデルを撮像し、得られたカラー画像から対象物を含む所定領域内の画像を抽出し、これを前記基準画像メモリ15,16,17に登録する。そして、検査対象の画像と基準画像との間で対応する画素毎に色差を求め、その色差が所定のしきい値dn1を超えるものを欠陥画素として抽出する。
(2) Defect inspection 2
This inspection is to check whether or not a color that should not be originally included is included in an object in which characters, designs, patterns, and the like are represented by a plurality of types of colors, not plain. When performing this inspection, first, a model of an object having a good color distribution is imaged, an image in a predetermined region including the object is extracted from the obtained color image, and this is extracted from the reference image memory 15. , 16 and 17. Then, a color difference is obtained for each corresponding pixel between the image to be inspected and the reference image, and a pixel whose color difference exceeds a predetermined threshold value dn1 is extracted as a defective pixel.

図4は、上記検査の詳細な手順を示す。この手順の最初のステップであるST101では、処理対象のカラー画像をモノクロ画像に変換するなどして対象物のエッジを抽出し、その抽出結果に基づき、前記処理対象のカラー画像に前記基準画像と同じ大きさの計測対象領域を設定する。なお、以下では、設定された計測対象領域に基準画像を重ね合わせたとき、モデルと対象物とが正確に位置合わせされるものとして説明するが、実際には、モデルに対する対象物の位置ずれや微妙な大きさの違いなどを考慮して、しきい値dn1に若干の誤差を含めておくのが望ましい。   FIG. 4 shows the detailed procedure of the inspection. In ST101, which is the first step in this procedure, the edge of the object is extracted by converting the color image to be processed into a monochrome image, and the reference image and the color image to be processed are added to the color image to be processed based on the extraction result. Set the measurement target area of the same size. In the following description, it is assumed that the model and the target object are accurately aligned when the reference image is superimposed on the set measurement target region. In consideration of a subtle difference in size, it is desirable to include a slight error in the threshold value dn1.

計測対象領域が設定されると、ST102では、カウンタiを1に、欠陥画素数dnを0に、それぞれ初期設定する。つぎのST103では、i番目の画素について、基準画像側の対応画素に対する色差Diを算出する。ここで色差Diが所定のしきい値D1を上回る場合には、ST104が「YES」となってST105に進み、前記欠陥画素数dnを1つ大きな値に更新する。
なお、ST103で求める色差Diは、計測対象領域内の一画素と基準画像上の対応画素とについて、色空間における色彩のユークリッド距離として表されるものであり、前記(1)式と同じ方法で求めることができる。
When the measurement target region is set, in ST102, the counter i is initialized to 1, and the number of defective pixels dn is initialized to 0. In the next ST103, the color difference Di with respect to the corresponding pixel on the reference image side is calculated for the i-th pixel. Here, when the color difference Di exceeds the predetermined threshold value D1, ST104 becomes “YES”, the process proceeds to ST105, and the number of defective pixels dn is updated to one larger value.
Note that the color difference Di obtained in ST103 is expressed as the Euclidean distance of the color in the color space for one pixel in the measurement target region and the corresponding pixel on the reference image, and is the same method as the equation (1). Can be sought.

以下、同様に、iの値を更新することにより、計測対象領域内の各画素に順に着目しつつ、その着目画素につき、基準画像上の対応画素との色差Diを算出し、その色差Diがしきい値D1を上回った画素の数を欠陥画素数dnとして計数する(ST103〜107)。すべての画素に対する処理が終了すると、ST108に進み、欠陥画素数dnを所定のしきい値dn1と比較する。ここで欠陥画素数dnが前記しきい値dn1を超える場合には、ST109に進んで不良判定を行う。他方、欠陥画素数dnがしきい値dn1以下であれば、ST110に進んで良判定を行う。最後にST111において、判定結果を出力し、処理を終了する。   Hereinafter, similarly, by updating the value of i, while paying attention to each pixel in the measurement target region in order, the color difference Di with the corresponding pixel on the reference image is calculated for the target pixel, and the color difference Di is calculated. The number of pixels exceeding the threshold value D1 is counted as the defective pixel number dn (ST103 to 107). When the processing for all the pixels is completed, the process proceeds to ST108, and the number of defective pixels dn is compared with a predetermined threshold value dn1. Here, when the number of defective pixels dn exceeds the threshold value dn1, the process proceeds to ST109 to perform defect determination. On the other hand, if the number of defective pixels dn is less than or equal to the threshold value dn1, the process proceeds to ST110 and a good determination is made. Finally, in ST111, the determination result is output and the process is terminated.

上記の欠陥検査によれば、複数種の色彩が混在する対象物について、色彩毎に個別の検査を行わなくとも、簡単に欠陥を抽出することができる。しかも、その抽出は画素単位で行われるから、微小な欠陥まで抽出することができる。
ただし、欠陥画素(前記色差dnがしきい値dn1を超える画素)が所定数以上集まった集合体のみを欠陥として抽出してもよい。また、欠陥画素の座標や集合体の大きさに基づき、欠陥の位置や大きさを抽出して出力するようにしてもよい。
According to the defect inspection described above, a defect can be easily extracted without performing individual inspection for each color of an object in which a plurality of types of colors are mixed. In addition, since the extraction is performed in units of pixels, even minute defects can be extracted.
However, only an aggregate in which a predetermined number or more of defective pixels (pixels having the color difference dn exceeding the threshold value dn1) may be extracted as defects. Further, the position and size of the defect may be extracted and output based on the coordinates of the defective pixel and the size of the aggregate.

(3)位置計測
この計測処理は、背景、対象物とも無地である場合に、背景と対象物との境界(すなわち対象物の輪郭線の位置)を検出するために行われるものである。また、この計測処理は、前記した欠陥検査1において、計測対象領域の設定のために対象物を抽出する際に使用することもできる。
(3) Position Measurement This measurement process is performed in order to detect the boundary between the background and the object (that is, the position of the contour line of the object) when both the background and the object are plain. This measurement process can also be used when extracting an object for setting a measurement target area in the defect inspection 1 described above.

この計測処理では、対象物の輪郭線の位置がある程度判明していることを前提とするもので、輪郭線に対応する可能性がある範囲に計測対象領域を設定する。図5は、計測対象領域の設定例を示すもので、計測対象の画像30において、対象物31の輪郭線を横切る方向(この例ではx軸方向)に長い矩形状の計測対象領域32を設定している。この実施例では、この計測対象領域32の一端(図示例では左端)に、所定幅wを持つウィンドウ33(y軸方向におけるウィンドウ33の長さは計測対象領域32と同一である。)を設定する。そして、このウィンドウ33を右方向に移動させながら、その幅wに対応する距離だけ移動する毎にウィンドウ33内の平均色を求める。さらに、各位置で求めた平均色を分析することにより、対象物31の輪郭線のx座標を求めるようにしている。
なお、この図5の例は、y軸方向に沿う輪郭線を抽出する場合のものであり、x軸方向に沿う輪郭線を抽出する場合には、その輪郭線に対応する可能性がある範囲に、y軸方向に長い計測対象領域を設定し、輪郭線のy座標を求める。
This measurement process is based on the premise that the position of the contour line of the object is known to some extent, and the measurement target region is set in a range that may correspond to the contour line. FIG. 5 shows an example of setting the measurement target region. In the measurement target image 30, a rectangular measurement target region 32 that is long in the direction crossing the outline of the target object 31 (in this example, the x-axis direction) is set. is doing. In this embodiment, a window 33 having a predetermined width w (the length of the window 33 in the y-axis direction is the same as that of the measurement target area 32) is set at one end (the left end in the illustrated example) of the measurement target area 32. To do. Then, while moving the window 33 in the right direction, the average color in the window 33 is obtained each time the window 33 is moved by a distance corresponding to the width w. Further, by analyzing the average color obtained at each position, the x coordinate of the contour line of the object 31 is obtained.
The example of FIG. 5 is for extracting a contour line along the y-axis direction, and when extracting a contour line along the x-axis direction, a range that may correspond to the contour line. Then, a measurement target region that is long in the y-axis direction is set, and the y-coordinate of the contour line is obtained.

図6は、この計測処理の詳細な手順を示す。なお、この例では、前記図5の例に基づき、対象物のy軸方向に沿う輪郭線の位置を抽出するものとして説明する。
最初のステップであるST201では、前記図5の要領で、前記計測対象領域32を設定する。つぎのST202では、設定した計測対象領域32の左端に前記ウィンドウ33を設定し、ST203において、ウィンドウ33内の平均色を求める。さらに、このウィンドウ33を右に移動させながら、前記幅wに対応する画素数だけ移動する毎に、ウィンドウ33内の平均色を求める(ST203〜205)。なお、平均色の算出は、ウィンドウ33が1画素移動する毎に行っても良い。
FIG. 6 shows the detailed procedure of this measurement process. In this example, it is assumed that the position of the contour line along the y-axis direction of the object is extracted based on the example of FIG.
In ST201, which is the first step, the measurement target area 32 is set in the manner shown in FIG. In the next ST202, the window 33 is set at the left end of the set measurement target region 32. In ST203, an average color in the window 33 is obtained. Further, the average color in the window 33 is obtained each time the window 33 is moved to the right by the number of pixels corresponding to the width w (ST 203 to 205). The average color may be calculated every time the window 33 moves by one pixel.

前記ウィンドウ33の走査により取得した平均色は、取得した順序を示す数字を含むラベル(たとえばP1,P2,P3・・・)に対応づけされて、メモリ11に保存される。また、各平均色を得たときのウィンドウ33の位置は、ウィンドウ33の代表点(左端点など)のx座標として表されるが、このx座標も、平均色と同様の数字を含むラベル(たとえばx1,x2,x3・・・)に対応づけられて、メモリ11に保存される。   The average color acquired by scanning the window 33 is stored in the memory 11 in association with labels (for example, P1, P2, P3...) Including numbers indicating the acquired order. Further, the position of the window 33 when each average color is obtained is expressed as an x coordinate of a representative point (such as the left end point) of the window 33. This x coordinate is also a label (including a number similar to the average color). For example, it is stored in the memory 11 in association with x1, x2, x3.

計測対象領域32の右端までウィンドウ33が移動すると、ST206では、各位置で求めた平均色を2つずつ組み合わせ、組み合わせ毎に色空間における距離を算出する。   When the window 33 moves to the right end of the measurement target region 32, in ST206, two average colors obtained at each position are combined, and the distance in the color space is calculated for each combination.

つぎのST207では、前記の距離の算出結果に基づき、色空間に最大の距離を隔てて位置する2つの色彩を抽出し、これらの色彩を端点とする線分Lを設定する。   In the next ST207, based on the distance calculation result, two colors located at a maximum distance in the color space are extracted, and a line segment L having these colors as endpoints is set.

つぎのST208では、カウンタjを1に初期設定する。このjは、前記ウィンドウの走査により取得した平均色のラベルに対応するものである。初期設定時のj=1は、ウィンドウ33の初期設定位置で取得した平均色に対応する。   In the next ST208, the counter j is initialized to 1. This j corresponds to the average color label obtained by scanning the window. J = 1 at the time of initial setting corresponds to the average color acquired at the initial setting position of the window 33.

ST209では、前記色空間において、j番目に得た平均色に対応する点から前記線分Lへの垂線を設定する。ST210では、前記垂線と線分Lとの交点を抽出する。ST211では、前記交点が直線Lの中点を越えたか否かをチェックする。ここで、中点を越えていないと判断したときは、jをインクリメントすることによって、つぎに取得した平均色に着目し、同様にST209〜211を実行する。   In ST209, a perpendicular line from the point corresponding to the jth average color obtained to the line segment L is set in the color space. In ST210, the intersection of the perpendicular and the line segment L is extracted. In ST211, it is checked whether or not the intersection point exceeds the midpoint of the straight line L. Here, when it is determined that the middle point is not exceeded, j is incremented to focus on the average color obtained next, and ST209 to 211 are similarly executed.

上記の処理において、いずれかの平均色について、その平均色に対応する点からの垂線と線分Lとの交点が線分Lの中点を越えたとき、前記ST209〜212のループを終了してST213に進み、その平均色を得た位置(前記ウィンドウの設定位置のうち、jの値に対応するラベルに対応するもの)を輪郭線の位置であると判別する。そして、ST214で、判別結果として、前記境界線の位置を示す座標を出力し、処理を終了する。   In the above processing, for any one of the average colors, when the intersection of the perpendicular line from the point corresponding to the average color and the line segment L exceeds the midpoint of the line segment L, the loop of ST209 to 212 is ended. Then, the process proceeds to ST213, and the position where the average color is obtained (the one corresponding to the label corresponding to the value of j among the set positions of the window) is determined as the position of the contour line. In ST214, the coordinates indicating the position of the boundary line are output as the determination result, and the process ends.

図7は、色空間における各平均色の分布例を示す。この例では、前記ウィンドウ33が5箇所に設定されたものとして、各平均色に対応する点を抽出の順にP1,P2,P3,P4,P5として示す。また図中のOは前記線分Lの中点である。   FIG. 7 shows an example of the distribution of each average color in the color space. In this example, assuming that the window 33 is set at five locations, the points corresponding to the respective average colors are indicated as P1, P2, P3, P4, and P5 in the order of extraction. In the figure, O is the midpoint of the line segment L.

前記計測対象領域32が対象物の輪郭線を横切るように設定されている場合、最も距離が大きくなる2色の一方は、ウィンドウ33が背景部分に設定されているときの平均色であり、他方はウィンドウ33が対象物上に設定されているときの平均色になると考えることができる。また、ウィンドウ33が背景と対象物との境界を通過する間は、ウィンドウ32に含まれる両者の割合が徐々に変化すると考えられる。このようなことから、図7に示すように、最初の設定位置で取得した平均色P1と最後の設定位置で取得した平均色P5とが前記線分Lの端点になると考えることができる。   When the measurement target region 32 is set so as to cross the outline of the target, one of the two colors having the largest distance is an average color when the window 33 is set as the background portion, and the other Can be considered to be the average color when the window 33 is set on the object. Further, while the window 33 passes the boundary between the background and the object, the ratio of both included in the window 32 is considered to change gradually. For this reason, it can be considered that the average color P1 acquired at the first set position and the average color P5 acquired at the last set position are the end points of the line segment L as shown in FIG.

図7の例において、前記ST207〜212の処理を行う場合、各平均色に対応する点P1,P2,P3,P4,P5に順に着目し、着目中の点から線分Lへの垂線の交点を追跡することになる。ここで、最初の点P1にかかる交点はP1自身となり、以下の交点は、線分Lの他方の端点P5に向かって移動するようになる。図7の例では、点P1から見て最初に中点Oを超えるのは点P4であるから、この点P4に対応する平均色を得た位置を輪郭線の位置として判別することになる。なお、色彩が変化したと判別する点は中点Oに限らず、点P1から任意の距離だけ離れた点としてもよい(ただし、色彩が変化したとみなすのに十分な距離だけ離れた点とする必要がある。)。   In the example of FIG. 7, when performing the processing of ST207 to 212, pay attention to the points P1, P2, P3, P4, and P5 corresponding to each average color in order, and the intersection of the perpendicular line from the point of interest to the line segment L Will be tracking. Here, the intersection point of the first point P1 is P1 itself, and the following intersection point moves toward the other end point P5 of the line segment L. In the example of FIG. 7, since the point P4 first exceeds the middle point O when viewed from the point P1, the position where the average color corresponding to this point P4 is obtained is determined as the position of the contour line. Note that the point for determining that the color has changed is not limited to the middle point O, and may be a point separated from the point P1 by an arbitrary distance (however, a point separated by a sufficient distance to be regarded as a change in color) There is a need to.).

なお、上記の説明は、計測対象領域32が対象物の輪郭線を横切るように設定されていることを前提としているが、計測対象領域32内に対象物の画像が含まれていない場合の誤判別を防止するために、前記線分Lが所定のしきい値より小さい場合には、処理を中止するようにしてもよい。   The above description is based on the premise that the measurement target region 32 is set so as to cross the outline of the target object. However, a misjudgment when the measurement target region 32 does not include an image of the target object. In order to prevent discrimination, when the line segment L is smaller than a predetermined threshold value, the processing may be stopped.

(4)個数検査
この検査は、複数種の色彩が含まれている対象物(たとえばマーク)が複数配列された物体の画像を処理して、前記対象物が定められた数だけ抽出されるかどうかを判別するものである。この判別処理のために、この実施例では、あらかじめ、色彩分布が良好な対象物のモデルを有する物体を撮像し、得られたカラー画像から前記モデルを1個だけ含む画像を切り出し、これを基準画像として登録する。
(4) Number inspection In this inspection, whether a predetermined number of objects are extracted by processing an image of an object in which a plurality of objects (for example, marks) including a plurality of kinds of colors are arranged. It is to determine whether or not. For this discrimination process, in this embodiment, an object having a model of an object having a good color distribution is imaged in advance, and an image including only one of the models is cut out from the obtained color image. Register as an image.

また、この実施例では、前記基準画像について平均色を求めた後、基準画像上の各画素の色彩をそれぞれ色空間中の1点Miとして、前記平均色を示す点Mμから点Miまでの距離、および点Mμから点Miに向かう方向を求める。この距離および方向は、点Mμを始点とし、点Miを終点とするベクトルの長さおよび向きに相当する。また、方向は、基準の平面(たとえばRの軸とGの軸とによる平面)に対する前記ベクトルの角度として表すことができる。   Further, in this embodiment, after obtaining the average color for the reference image, the color of each pixel on the reference image is set to one point Mi in the color space, and the distance from the point Mμ indicating the average color to the point Mi And a direction from the point Mμ toward the point Mi. This distance and direction correspond to the length and direction of a vector starting from the point Mμ and ending at the point Mi. The direction can be expressed as an angle of the vector with respect to a reference plane (for example, a plane formed by the R axis and the G axis).

画素毎に求められた距離および方向は、メモリ11に登録される。検査の際には、検査対象の画像上に前記基準画像と同じ大きさの計測対象領域を走査し、1画素移動する毎に前記メモリ11の登録データを用いて基準画像に対する類似度を求める。そして、類似度が所定のしきい値C1を超えた回数を計数することにより、対象物の数を計測し、その数の適否を判別するようにしている。   The distance and direction obtained for each pixel are registered in the memory 11. At the time of inspection, a measurement target region having the same size as the reference image is scanned on the image to be inspected, and the similarity to the reference image is obtained using registered data in the memory 11 every time one pixel moves. Then, by counting the number of times that the degree of similarity exceeds a predetermined threshold C1, the number of objects is measured, and the suitability of the number is determined.

図8は、検査の詳細な手順を示す。この手順において、(x,y)は、処理対象の画像の各画素の座標であり、axはx軸方向における画素の数を、ayはy軸方向における画素の数を、それぞれ示す。また、Enは、前記対象物の抽出数である。   FIG. 8 shows the detailed procedure of the inspection. In this procedure, (x, y) is the coordinates of each pixel of the image to be processed, ax indicates the number of pixels in the x-axis direction, and ay indicates the number of pixels in the y-axis direction. En is the number of extractions of the object.

最初のステップであるST301では、前記抽出数Enおよびyを初期値の0にセットし、つぎのST302では、xを0にセットする。さらにST303では、前記(x,y)の位置を始点にして計測対象領域を設定する。すなわち、座標(0,0)の位置が左上頂点となるように計測対象領域を設定することになる。   In ST301, which is the first step, the extraction numbers En and y are set to initial values 0, and in the next ST302, x is set to 0. In ST303, the measurement target region is set starting from the position (x, y). That is, the measurement target region is set so that the position of the coordinates (0, 0) is the upper left vertex.

つぎのST304では、前記計測対象領域内の平均色を算出する。この平均色も、R,G,Bの色成分毎の平均値により表されるもので、色空間中の1点Pμとして示すことができる。   In the next ST304, an average color in the measurement target area is calculated. This average color is also represented by an average value for each of the R, G, and B color components, and can be represented as one point Pμ in the color space.

つぎのST305は、計測対象領域内の画素毎に実行されるものである。ここでは、処理対象の画素の色彩を色空間中の1点Piと考えて、前記平均色を示す点Pμからの距離、および点Pμから点Piに向かう方向を求める。なおこの距離および方向は、前記基準画像について求めたものと同様に、点Pμを始点とし、点Piを終点とするベクトルの長さおよび方向に相当するものである。   The next ST305 is executed for each pixel in the measurement target region. Here, the color of the pixel to be processed is considered as one point Pi in the color space, and the distance from the point Pμ indicating the average color and the direction from the point Pμ to the point Pi are obtained. The distance and the direction correspond to the length and direction of the vector having the point Pμ as the start point and the point Pi as the end point, as in the case of the reference image.

ST306では、前記ST305で求めた距離および方向と、メモリ11に登録されている基準画像の距離および方向とを用いて、下記の(2)式に基づき、類似度C(x,y)を求める。なお(2)式において、nは計測対象領域内の全画素数である。またd(Pi,Pμ)は、前記点Piと点Pμとの距離であり、d(Mi,Mμ)は、基準画像側の点MiとMμとの距離である。また、θiは、点Pμ,Piによるベクトルと、点Mμ,Miによるベクトルとのなす角度であり、0度から180度の範囲の数値となる。   In ST306, using the distance and direction obtained in ST305 and the distance and direction of the reference image registered in the memory 11, the similarity C (x, y) is obtained based on the following equation (2). . In Equation (2), n is the total number of pixels in the measurement target area. D (Pi, Pμ) is the distance between the point Pi and the point Pμ, and d (Mi, Mμ) is the distance between the point Mi and Mμ on the reference image side. Further, θi is an angle formed by the vector formed by the points Pμ and Pi and the vector formed by the points Mμ and Mi, and is a numerical value in the range of 0 to 180 degrees.

Figure 2010218560
Figure 2010218560

このようにして類似度C(x,y)を求めると、ST307では、その類似度C(x,y)を所定のしきい値C1と比較する。ここで類似度C(x,y)がしきい値C1を上回ると判断すると、ST308に進み、前記抽出数Enを1つ大きな値に更新する。   When the similarity C (x, y) is obtained in this way, in ST307, the similarity C (x, y) is compared with a predetermined threshold C1. If it is determined that the similarity C (x, y) exceeds the threshold value C1, the process proceeds to ST308, and the extraction number En is updated to one larger value.

以下、x,yの値をそれぞれ1〜ax、1〜ayの範囲で動かすことにより、計測対象領域を1画素ずつ走査しながら、上記と同様の処理により走査毎に相関値C(x,y)を求め、その相関値C(x,y)がしきい値C1を上回った回数を抽出数Enとして計数する(ST302〜312)。走査が完了すると、ST313に進み、前記抽出数Enがあらかじめ登録された基準の数E0と一致するかどうかをチェックする。ここで、En=E0であれば、ST314に進み、検査対象の物体が良品である旨の判定を行う。一方、En≠E0の場合には、ST315に進み、検査対象の物体が不良品である旨の判定を行う。この後は、ST316に進み、前記の判定結果を出力して処理を終了する。   Thereafter, by moving the values of x and y in the ranges of 1 to ax and 1 to ay, respectively, the measurement target region is scanned pixel by pixel, and the correlation value C (x, y is obtained for each scan by the same processing as described above. ) And the number of times that the correlation value C (x, y) exceeds the threshold value C1 is counted as the extraction number En (ST302 to 312). When the scanning is completed, the process proceeds to ST313, and it is checked whether or not the extraction number En matches the reference number E0 registered in advance. If En = E0, the process proceeds to ST314, and it is determined that the object to be inspected is a non-defective product. On the other hand, if En ≠ E0, the process proceeds to ST315, and it is determined that the object to be inspected is a defective product. Thereafter, the process proceeds to ST316, and the determination result is output and the process is terminated.

上記(2)式によれば、d(Pi,Pμ)とd(Mi,Mμ)との差が小さくなり、かつθiが0に近づくほど、類似度C(x,y)の値は高くなる。したがって、前記しきい値C1の値を十分に高く設定することにより、基準画像の色彩の分布状態に近い画像領域を対象物として抽出することが可能となる。   According to the above equation (2), the difference C (x, y) increases as the difference between d (Pi, Pμ) and d (Mi, Mμ) decreases and θi approaches 0. . Therefore, by setting the threshold value C1 to a sufficiently high value, an image region close to the color distribution state of the reference image can be extracted as an object.

ただし、(2)式では、平均色に対する相対的な色彩変化が同様であれば、類似度C(x,y)も高くなるので、基準画像とは色合いが異なる領域も対象物として抽出されることになる。基準画像と同様の色合いの領域のみを抽出する必要がある場合には、つぎの(3)式により前記類似度C(x,y)を補正するとよい。   However, in equation (2), if the relative color change with respect to the average color is the same, the similarity C (x, y) also increases, so that a region having a different hue from the reference image is also extracted as an object. It will be. When it is necessary to extract only a region having the same hue as that of the reference image, the similarity C (x, y) may be corrected by the following equation (3).

Figure 2010218560
Figure 2010218560

(3)式において、dmaxは、色空間において得ることのできる最大の距離である。たとえば、各色成分の濃度値を8ビットで表す場合には、dmax=(255×3)となる。d(Pμ,Mμ)は、計測対象領域から求めた平均色Pμと基準画像から求めた平均色Mμとの距離である。この(3)式による補正後の類似度C´(x,y)によれば、計測対象領域内の各色彩Piの平均色Pμに対する関係が基準画像における関係に類似していても、平均色Pμが基準の平均色Mμから離れるほど、類似度の値は小さくなる。 In equation (3), dmax is the maximum distance that can be obtained in the color space. For example, when the density value of each color component is represented by 8 bits, dmax = (255 2 × 3). d (Pμ, Mμ) is a distance between the average color Pμ obtained from the measurement target region and the average color Mμ obtained from the reference image. According to the corrected similarity C ′ (x, y) according to the equation (3), even if the relationship of the colors Pi in the measurement target region to the average color Pμ is similar to the relationship in the reference image, the average color The similarity value decreases as Pμ moves away from the reference average color Mμ.

なお、図8の手順では、類似度C(x,y)がしきい値C1を超えた回数をもって、対象物の数を求めているが、これに代えて、類似度C(x,y)がしきい値C1を超えたときの(x,y)の値を、対象物の位置として出力してもよい。また、類似度C(x,y)の値によって、対象物の色彩分布の適否を判別することもできる。   In the procedure of FIG. 8, the number of objects is obtained from the number of times the degree of similarity C (x, y) exceeds the threshold value C1, but instead, the degree of similarity C (x, y) is calculated. The value of (x, y) when the threshold value C1 is exceeded may be output as the position of the object. Also, the suitability of the color distribution of the object can be determined based on the value of the similarity C (x, y).

1 本体部
2 カメラ
10 CPU
11 メモリ
12,13,14 画像メモリ
14,15,17 基準画像メモリ
1 Body 2 Camera 10 CPU
11 Memory 12, 13, 14 Image memory 14, 15, 17 Reference image memory

Claims (2)

赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法において、
2種類の色彩に色分けされたカラー画像を処理対象画像として、この処理対象画像の直交する2辺のうちの少なくとも一辺に沿う方向を走査方向に設定して、走査方向に沿って所定幅の走査対象範囲を設定する処理と、この走査対象範囲において、幅狭の矩形状の小領域を短い方の辺を走査方向に合わせて所定の間隔で走査しつつ、各走査位置における小領域内の平均色を求める処理とを、走査方向毎に実行し、
前記各色成分に対応する3軸による仮想空間において、前記小領域の走査時に求めた複数の平均色に対応する各点を走査に対応する順序で追跡し、追跡処理の起点からの距離が所定のしきい値を超える点が初めて見つかったとき、その点に対応する平均色を得たときの前記小領域の位置を前記2種類の色彩の境界位置として判別する、
ことを特徴とするカラー画像の処理方法。
In a method of processing a color image composed of density data of red, green and blue color components,
A color image that is color-coded in two colors is used as a processing target image, and a direction along at least one of two orthogonal sides of the processing target image is set as a scanning direction, and scanning with a predetermined width is performed along the scanning direction. The process of setting the target range, and in this scan target range, the narrow rectangular small region is scanned at a predetermined interval with the shorter side aligned with the scanning direction, and the average within the small region at each scanning position A process for obtaining a color for each scanning direction,
In a three-axis virtual space corresponding to each color component, each point corresponding to a plurality of average colors obtained at the time of scanning the small area is tracked in the order corresponding to the scan, and the distance from the starting point of the tracking process is predetermined. When a point exceeding the threshold is found for the first time, the position of the small area when the average color corresponding to the point is obtained is determined as a boundary position between the two types of colors.
A method for processing a color image.
赤、緑、青の各色成分の濃淡データから成るカラー画像を処理対象画像として入力する画像入力手段と、
前記画像入力手段が2種類の色彩に色分けされたカラー画像を処理対象画像として入力したことに応じて、この処理対象画像の直交する2辺のうちの少なくとも一辺に沿う方向を走査方向に設定して、走査方向に沿って所定幅の走査対象範囲を設定する処理と、この走査対象範囲において、幅狭の矩形状の小領域を短い方の辺を走査方向に合わせて所定の間隔で走査しつつ、各走査位置における小領域内の平均色を求める処理とを、走査方向毎に実行する平均色算出手段と、
前記各色成分に対応する3軸による仮想空間において、前記平均色算出手段により求められた複数の平均色に対応する各点を走査に対応する順序で追跡し、追跡処理の起点からの距離が所定のしきい値を初めて超える点を抽出する抽出手段と、
前記抽出手段により抽出された点に対応する平均色を得たときの前記小領域の位置を前記2種類の色彩の境界位置として判別する判別手段とを具備する画像処理装置。
An image input means for inputting, as a processing target image, a color image composed of grayscale data of red, green, and blue color components;
In response to the image input means inputting a color image color-coded into two colors as a processing target image, a direction along at least one of the two orthogonal sides of the processing target image is set as a scanning direction. In addition, a process for setting a scanning target range having a predetermined width along the scanning direction, and scanning the narrow rectangular small region in the scanning target range at predetermined intervals with the shorter side aligned with the scanning direction. Meanwhile, the average color calculation means for executing the process for obtaining the average color in the small area at each scanning position for each scanning direction;
In a three-axis virtual space corresponding to each color component, each point corresponding to a plurality of average colors obtained by the average color calculation means is tracked in the order corresponding to scanning, and the distance from the starting point of the tracking process is predetermined. An extraction means for extracting points that exceed the threshold for the first time;
An image processing apparatus comprising: discrimination means for discriminating a position of the small area when an average color corresponding to the point extracted by the extraction means is obtained as a boundary position between the two types of colors.
JP2010086753A 2010-04-05 2010-04-05 Color image processing method and image processing apparatus Expired - Fee Related JP4670993B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010086753A JP4670993B2 (en) 2010-04-05 2010-04-05 Color image processing method and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010086753A JP4670993B2 (en) 2010-04-05 2010-04-05 Color image processing method and image processing apparatus

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2004127912A Division JP4513394B2 (en) 2004-04-23 2004-04-23 Color image processing method and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2010218560A true JP2010218560A (en) 2010-09-30
JP4670993B2 JP4670993B2 (en) 2011-04-13

Family

ID=42977259

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010086753A Expired - Fee Related JP4670993B2 (en) 2010-04-05 2010-04-05 Color image processing method and image processing apparatus

Country Status (1)

Country Link
JP (1) JP4670993B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010182330A (en) * 2010-04-05 2010-08-19 Omron Corp Method for processing color image and image processor
JP2010186485A (en) * 2010-04-05 2010-08-26 Omron Corp Method of processing color image and image processing apparatus

Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04299785A (en) * 1991-03-28 1992-10-22 Sekisui Chem Co Ltd Color unevenness inspecting device
JPH05180781A (en) * 1991-12-27 1993-07-23 Kawasaki Steel Corp Method and apparatus for surface defect inspection
JPH0690150B2 (en) * 1988-05-30 1994-11-14 株式会社キリンテクノシステム Bottle body inspection method and device
JPH07198491A (en) * 1993-12-29 1995-08-01 Kurabo Ind Ltd Color extraction apparatus as well as apparatus and method for inspection of color
JPH07203476A (en) * 1993-12-29 1995-08-04 Kurabo Ind Ltd Color image converter
JPH08266154A (en) * 1995-03-30 1996-10-15 Seibutsukei Tokutei Sangyo Gijutsu Kenkyu Suishin Kiko Device for detecting crop
JPH102800A (en) * 1996-06-17 1998-01-06 Hitachi Ltd Method and system for evaluating image quantity of color display and manufacture of color display
JPH1013699A (en) * 1996-06-24 1998-01-16 Fuji Xerox Co Ltd Image processor
JPH1196369A (en) * 1997-09-19 1999-04-09 Minolta Co Ltd Color characteristic extracting device, color characteristic extracting method and program storage medium
JPH11108759A (en) * 1997-09-30 1999-04-23 Hitachi Ltd Defect inspecting method and device therefor
JPH11211442A (en) * 1998-01-27 1999-08-06 Matsushita Electric Works Ltd Method and device for detecting defect of object surface
JP2001029938A (en) * 1999-07-21 2001-02-06 Kajima Corp Water treatment state monitoring device
JP2001043376A (en) * 1999-07-30 2001-02-16 Canon Inc Image extraction method and device and storage medium
JP2002117400A (en) * 2000-10-12 2002-04-19 Sharp Corp Image correction method and device, and recording medium readable by computer and having image correction program recorded thereon
JP2002303588A (en) * 2001-04-04 2002-10-18 Sony Corp Pattern defect inspection device
JP2003044841A (en) * 2002-06-20 2003-02-14 Sharp Corp Device and method for generating model and recording medium with model generation program recorded thereon
JP2004185246A (en) * 2002-12-03 2004-07-02 Tokushima Ken Evaluation method of uniformity of color
JP4513394B2 (en) * 2004-04-23 2010-07-28 オムロン株式会社 Color image processing method and image processing apparatus
JP2010182330A (en) * 2010-04-05 2010-08-19 Omron Corp Method for processing color image and image processor
JP2010186485A (en) * 2010-04-05 2010-08-26 Omron Corp Method of processing color image and image processing apparatus

Patent Citations (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0690150B2 (en) * 1988-05-30 1994-11-14 株式会社キリンテクノシステム Bottle body inspection method and device
JPH04299785A (en) * 1991-03-28 1992-10-22 Sekisui Chem Co Ltd Color unevenness inspecting device
JPH05180781A (en) * 1991-12-27 1993-07-23 Kawasaki Steel Corp Method and apparatus for surface defect inspection
JPH07198491A (en) * 1993-12-29 1995-08-01 Kurabo Ind Ltd Color extraction apparatus as well as apparatus and method for inspection of color
JPH07203476A (en) * 1993-12-29 1995-08-04 Kurabo Ind Ltd Color image converter
JPH08266154A (en) * 1995-03-30 1996-10-15 Seibutsukei Tokutei Sangyo Gijutsu Kenkyu Suishin Kiko Device for detecting crop
JPH102800A (en) * 1996-06-17 1998-01-06 Hitachi Ltd Method and system for evaluating image quantity of color display and manufacture of color display
JPH1013699A (en) * 1996-06-24 1998-01-16 Fuji Xerox Co Ltd Image processor
JPH1196369A (en) * 1997-09-19 1999-04-09 Minolta Co Ltd Color characteristic extracting device, color characteristic extracting method and program storage medium
JPH11108759A (en) * 1997-09-30 1999-04-23 Hitachi Ltd Defect inspecting method and device therefor
JPH11211442A (en) * 1998-01-27 1999-08-06 Matsushita Electric Works Ltd Method and device for detecting defect of object surface
JP2001029938A (en) * 1999-07-21 2001-02-06 Kajima Corp Water treatment state monitoring device
JP2001043376A (en) * 1999-07-30 2001-02-16 Canon Inc Image extraction method and device and storage medium
JP2002117400A (en) * 2000-10-12 2002-04-19 Sharp Corp Image correction method and device, and recording medium readable by computer and having image correction program recorded thereon
JP2002303588A (en) * 2001-04-04 2002-10-18 Sony Corp Pattern defect inspection device
JP2003044841A (en) * 2002-06-20 2003-02-14 Sharp Corp Device and method for generating model and recording medium with model generation program recorded thereon
JP2004185246A (en) * 2002-12-03 2004-07-02 Tokushima Ken Evaluation method of uniformity of color
JP4513394B2 (en) * 2004-04-23 2010-07-28 オムロン株式会社 Color image processing method and image processing apparatus
JP2010182330A (en) * 2010-04-05 2010-08-19 Omron Corp Method for processing color image and image processor
JP2010186485A (en) * 2010-04-05 2010-08-26 Omron Corp Method of processing color image and image processing apparatus

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010182330A (en) * 2010-04-05 2010-08-19 Omron Corp Method for processing color image and image processor
JP2010186485A (en) * 2010-04-05 2010-08-26 Omron Corp Method of processing color image and image processing apparatus
JP4670995B2 (en) * 2010-04-05 2011-04-13 オムロン株式会社 Color image processing method and image processing apparatus
JP4670994B2 (en) * 2010-04-05 2011-04-13 オムロン株式会社 Color image processing method and image processing apparatus

Also Published As

Publication number Publication date
JP4670993B2 (en) 2011-04-13

Similar Documents

Publication Publication Date Title
JP4687518B2 (en) Image processing method, three-dimensional measurement method using the method, and image processing apparatus
Atcheson et al. Caltag: High precision fiducial markers for camera calibration.
JP4811272B2 (en) Image processing apparatus and image processing method for performing three-dimensional measurement
JP6566768B2 (en) Information processing apparatus, information processing method, and program
JP6468802B2 (en) Three-dimensional measuring apparatus, three-dimensional measuring method and program
US11657644B2 (en) Automatic ruler detection
JP7188201B2 (en) Image processing device, image processing method, and image processing program
US11928805B2 (en) Information processing apparatus, information processing method, and storage medium for defect inspection and detection
US6718074B1 (en) Method and apparatus for inspection for under-resolved features in digital images
US10074551B2 (en) Position detection apparatus, position detection method, information processing program, and storage medium
JP4670994B2 (en) Color image processing method and image processing apparatus
CN113096121A (en) Pavement crack detection method and system based on cross fracture mechanics and image processing
JP2010133744A (en) Defect detection method, and visual inspection device using the same
JP4513394B2 (en) Color image processing method and image processing apparatus
JP2008152555A (en) Image recognition method and image recognition device
JP4670993B2 (en) Color image processing method and image processing apparatus
JP4670995B2 (en) Color image processing method and image processing apparatus
KR20080104963A (en) Drill inspection apparatus, drill inspection method, and redording media recording the program
JP2002140713A (en) Image processing method and image processor
JP2008139262A (en) Detect inspection method and inspection apparatus using the same
JP2008116207A (en) Apparatus and method for image measurement, and program
JP4423347B2 (en) Inspection method and inspection apparatus for compound eye distance measuring apparatus and chart used therefor
JP2007172596A (en) Two-dimensional code, and method and apparatus for detecting the same
US10062155B2 (en) Apparatus and method for detecting defect of image having periodic pattern
JP2004109105A (en) Flaw type classification boundary setting method in surface defect detection, and defect detection method

Legal Events

Date Code Title Description
A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20101005

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20101129

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20110103

R150 Certificate of patent or registration of utility model

Ref document number: 4670993

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20140128

Year of fee payment: 3

LAPS Cancellation because of no payment of annual fees