JP2005309914A - Method for processing color image and image processor - Google Patents

Method for processing color image and image processor Download PDF

Info

Publication number
JP2005309914A
JP2005309914A JP2004127912A JP2004127912A JP2005309914A JP 2005309914 A JP2005309914 A JP 2005309914A JP 2004127912 A JP2004127912 A JP 2004127912A JP 2004127912 A JP2004127912 A JP 2004127912A JP 2005309914 A JP2005309914 A JP 2005309914A
Authority
JP
Japan
Prior art keywords
color
image
color image
average
measurement target
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
JP2004127912A
Other languages
Japanese (ja)
Other versions
JP4513394B2 (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 JP2004127912A priority Critical patent/JP4513394B2/en
Publication of JP2005309914A publication Critical patent/JP2005309914A/en
Application granted granted Critical
Publication of JP4513394B2 publication Critical patent/JP4513394B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Images

Landscapes

  • Image Analysis (AREA)
  • Facsimile Image Signal Circuits (AREA)
  • Color Image Communication Systems (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To stabilize an extraction result and a measurement result by eliminating the need of making a user specify a reference color and to perform easy and highly accurate processing even in the case of processing a part having a plurality of kinds of colors. <P>SOLUTION: Pieces of image data about each color component generated by a color camera 2 are stored in image memories 12, 13 and 14 of a main body part 1, respectively. A CPU 10 makes the surface of an object in a color image constituted of the three kinds of image data into a measurement object area and divides the area into a plurality of small areas. Then, color difference of average colors is calculated for every set of adjacent small areas after calculating the average colors for every small areas and frequencies in which the color difference exceeds a threshold are counted. In addition, when pieces of image data constituting a reference color image are registered in reference image memories 15, 16 and 17, a color abnormality part is extracted by calculating the color difference to corresponding pixels of the reference image. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

この発明は、赤、緑、青の各色成分の濃度データから成るカラー画像を用いて、所定の色彩や模様を持つ対象物を抽出したり、その対象物の大きさ、姿勢などを測定したり、色彩に生じた異常を欠陥として検出するなどの処理を行う方法および装置に関する。   The present invention uses a color image composed of density data of red, green, and blue color components to extract an object having a predetermined color or pattern, or to measure the size, posture, etc. of the object. The present invention relates to a method and apparatus for performing processing such as detecting an abnormality occurring in a color as a defect.

従来から行われている代表的なカラー画像処理では、ユーザーに所定の色彩を指定させることによって、各色成分の濃度データの組み合わせによる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号 公報JP-A-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 and the detection result of the defect may be changed due to such fluctuation of the density distribution.

また、異なる色彩が同じ値に変換されると、たとえば変換後の画像とモデルの画像(同様にカラー画像を色差に置きかえた画像)との相関演算処理を実行する場合に、実際の色彩が異なっていても、色差を示す濃度の分布状態が類似していると、類似度が高くなってしまう、という問題がある。   In addition, when different colors are converted to the same value, for example, when performing correlation calculation processing between the converted image and the model image (an image in which the color image is replaced with a color difference), the actual color differs. However, there is a problem that if the distribution state of the density indicating the color difference is similar, the degree of similarity increases.

また、従来の方法は、特定の一色を基準色とするものであるから、各構成文字が異なる色彩で表された文字列、複数の色彩による模様が表された対象物など、計測対象の色彩が複数種ある場合の対応が困難となる。   In addition, since the conventional method uses a specific color as a reference color, the color of the measurement target, such as a character string in which each constituent character is represented in a different color, or an object in which a pattern with multiple colors is represented. It becomes difficult to deal with when there are multiple types.

この発明は上記各問題に着目してなされたもので、周囲と異なる色彩を有する部分を抽出または計測する場合に、ユーザーに基準の色彩を指定させる必要をなくすことによって、抽出結果や計測結果を安定させることを目的とする。   The present invention has been made paying attention to each of the above problems, and when extracting or measuring a portion having a color different from the surroundings, the extraction result or measurement result can be obtained by eliminating the need for the user to specify a reference color. The purpose is to stabilize.

また、この発明は、複数種の色彩を有する部分を抽出または計測する場合の処理を容易にし、かつ精度の高い処理結果を得られるようにすることを第2の目的とする。   A second object of the present invention is to facilitate processing when extracting or measuring a portion having a plurality of kinds of colors and to obtain a highly accurate processing result.

この発明は、赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法に適用される。この発明にかかる第1の方法では、計測対象のカラー画像上に同じ大きさを持つ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 first method according to the present invention, a process of setting two areas having the same size on a color image to be measured, a process of obtaining a color difference between areas based on an average color in each area, and the color difference A process for comparing with a predetermined threshold value is executed for a plurality of cycles while changing the setting position of at least one of the areas, thereby determining whether or not there is a portion in which the color has changed on the image. ing.

上記の方法において、計測対象のカラー画像の各構成画素の色彩は、赤、緑、青の各濃度データの組み合わせにより表される。平均色は、領域内の各画素における濃度値を、色成分毎に平均することにより得ることができる。すなわち、赤色成分の濃度平均値、緑色成分の濃度平均値、青色成分の濃度平均値により示される色彩が平均色であると、考えることができる。   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 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.

上記の方法は、色彩の変化が小さい対象物の画像から、異常な色彩を有する欠陥を抽出するなど、ベースとなる色彩部分とは異なる色彩を有する部分を抽出する場合に実行することができる。たとえば、欠陥を検出する場合に検出すべき欠陥の大きさに応じた大きさの領域を設定すれば、一方の領域内に欠陥があり、他方の領域内には欠陥がない場合の平均色は、領域間で異なるものになると考えることができる。   The above method can be executed when extracting a part having a color different from the base color part, such as extracting a defect having an abnormal color from an image of an object with a small color change. For example, if an area having a size corresponding to the size of the defect to be detected is set when detecting a defect, the average color when there is a defect in one area and no defect in the other area is Can be considered different between regions.

2つの領域間の色差は、たとえば、前記した色空間における平均色間の距離として求めることができる。または、各平均色を明度・彩度・色相による仮想空間の1点に変換し、これらの点間の距離を求めてもよい。また、各平均色を国際照明委員会が規定する色度や輝度に置き換えて色差を算出してもよい。
いずれの場合も、2つの領域間の色差がしきい値を超える値になったとき、これらの領域における色彩は異なるものであると判断することができる。
The color difference between the two regions can be obtained, for example, as the distance between the average colors in the color space described above. Alternatively, each average color may be converted into one point in the virtual space by brightness, saturation, and hue, and the distance between these points may be obtained. Alternatively, the color difference may be calculated by replacing each average color with chromaticity or luminance specified by the International Lighting Commission.
In any case, when the color difference between the two areas exceeds the threshold value, it can be determined that the colors in these areas are different.

さらに上記第1の方法では、2つの領域のうちの少なくとも一方の領域の設定位置を変えながら、前記領域間の色差を求める処理と求めた色差をしきい値と比較する処理とを繰り返し実行する。なお、ここでいう領域の設定は、あらかじめ画像上の計測対象領域を複数の領域に分割し、そのうちの任意の2つの領域を選択する処理を含むものとする。この場合、選択する領域の組み合わせを変更する処理を、領域の設定位置を変更する処理とみなすことができる。   Furthermore, in the first method, while changing the setting position of at least one of the two areas, a process for obtaining a color difference between the areas and a process for comparing the obtained color difference with a threshold value are repeatedly executed. . Here, the setting of the area includes a process of dividing a measurement target area on the image into a plurality of areas in advance and selecting any two of the areas. In this case, the process of changing the combination of areas to be selected can be regarded as the process of changing the set position of the area.

上記第1の方法では、一方の領域の設定位置を固定し、他方の領域を前記固定した領域の上下左右で隣接するように順に設定して、色差を求めることができる。この場合、いずれの色差もしきい値を上回った場合には、固定した領域に周囲と異なる色彩が現れていると判断することができる。また、いずれか1つの色差のみがしきい値を上回った場合には、設定位置が変更された領域側に異なる色彩が含まれていると考えることができる。よって、固定する側の領域の設定位置も種々に変更しながら、設定位置毎に、色差を求める処理と求めた色差をしきい値と比較する処理とを複数サイクル実行することにより、異なる色彩を有する領域を明確に判別することができる。   In the first method, the color difference can be obtained by fixing the setting position of one area and sequentially setting the other area so as to be adjacent to the fixed area in the upper, lower, left, and right directions. In this case, if any color difference exceeds the threshold value, it can be determined that a color different from the surroundings appears in the fixed region. When only one of the color differences exceeds the threshold value, it can be considered that different colors are included in the region where the setting position is changed. Therefore, by changing the setting position of the area to be fixed in various ways, for each setting position, a process for obtaining a color difference and a process for comparing the obtained color difference with a threshold value are executed for a plurality of cycles, so that different colors can be obtained. It is possible to clearly discriminate the area that has it.

ただし、この第1の方法では、必ずしも色彩が異なる部分を特定する必要はなく、色差がしきい値を超えた回数をもって色彩の異なる部分の有無を判別するだけでもよい。   However, in the first method, it is not always necessary to specify a portion having a different color, and it is only necessary to determine the presence / absence of a portion having a different color based on the number of times that the color difference exceeds the threshold value.

また、上記の第1の方法では、隣合わせにした2つの領域を所定方向に沿って移動させながら色差の算出および比較を行うこともできる。この場合、色差がしきい値を超えたときの各領域間の境界を色彩の境界の位置として抽出することができる。この処理によれば、欠陥の位置を検出したり、対象物と背景との境界を切り分けて判別することができる。   In the first method, the color difference can be calculated and compared while moving two adjacent regions along a predetermined direction. In this case, the boundary between the areas when the color difference exceeds the threshold value can be extracted as the position of the color boundary. According to this processing, it is possible to detect the position of the defect or to distinguish the boundary between the object and the background.

この発明にかかる第2の方法では、処理対象のカラー画像を、所定方向に沿って走査しつつ、その走査方向に直交する方向に沿う平均色を求める処理を所定の間隔毎に繰り返し実行する。つぎに、前記した色空間において、前記カラー画像の走査時に求めた複数の平均色に対応する点の位置関係に基づき、これらの点の中から色彩の境界に相当する点を抽出し、その点に対応する平均色を得たときの走査位置を色彩が変化した位置として判別する。   In the second method according to the present invention, while scanning a color image to be processed along a predetermined direction, processing for obtaining an average color along a direction orthogonal to the scanning direction is repeatedly executed at predetermined intervals. Next, in the color space described above, a point corresponding to a color boundary is extracted from these points based on the positional relationship of the points corresponding to the plurality of average colors obtained when scanning the color image, and the points The scanning position when the average color corresponding to is obtained is determined as the position where the color has changed.

この方法は、背景、対象物の双方とも色彩の変化が小さい場合の対象物の輪郭の位置を抽出するなど、画像上の2種類の色彩の境界を抽出する用途に適用することができる。たとえば、走査方向に直交する方向に沿って所定長さのラインを設定し、このライン上の各画素の平均色を求めることができる。この場合のラインの長さは、対象物の大きさに合わせて任意に設定することができる。また、ラインに代えて、走査方向に所定の幅を有する矩形領域を設定し、その領域内の平均色を求めるようにしてもよい。いずれの場合も、平均色の算出は1画素毎に行うことができるが、これに限らず、数画素おきに算出してもよい。また、前記矩形領域を設定する場合には、その領域の幅分だけ走査する毎に平均色を求めてもよい。   This method can be applied to the use of extracting the boundary between two kinds of colors on an image, such as extracting the position of the contour of the object when the color change of both the background and the object is small. For example, a line having a predetermined length can be set along a direction orthogonal to the scanning direction, and an average color of each pixel on the line can be obtained. In this case, the length of the line can be arbitrarily set according to the size of the object. Further, instead of the line, a rectangular area having a predetermined width in the scanning direction may be set, and an average color in the area may be obtained. In either case, the average color can be calculated for each pixel. However, the present invention is not limited to this, and it may be calculated every several pixels. When the rectangular area is set, the average color may be obtained every time scanning is performed by the width of the area.

上記の走査において、色彩に大きな変化が生じていない間に抽出される平均色は、色空間では同種の色彩の範囲に分布する、と考えることができる。一方、所定位置で色彩が大きく変化すると、その位置の平均色は、それまでに求められた各平均色の分布から離れた場所に位置すると考えることができる。したがって、色空間において、各平均色への対応点を走査の順に追跡し、所定のしきい値を超える距離だけ離れて位置する点を見つけたときに、その点を色彩の境界に相当する点として抽出することができる。   In the above scanning, 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点(仮にA,Bとする。)を抽出すると、一方の点Aは、領域が境界の手前の色彩のみを含む場合の平均色に対応し、他方の点Bは、領域が境界より後方の色彩のみを含む場合の平均色に対応すると、考えることができる。またその他の平均色に対応する点は、抽出された順に、点Aから点Bの方向に向けて配列される可能性が高い。よって、点A,B間を線分で結び、他の点から線分ABに下ろした垂線による交点の位置を順に追跡し、垂線と線分ABとの交点が所定の基準位置(たとえば線分ABの中点)を超えたとき、その時点での着目点を、色彩の境界に対応する点として抽出することができる。
なお、ラインを走査する場合でも、画像上の色彩が緩やかに変化する場合には、上記と同様の方法を適用することができる。
Further, when scanning a rectangular area, it can be considered that the ratio of two colors included in the rectangular area gradually changes in accordance with the movement of the area near the boundary between the colors. Therefore, when two points (assumed to be A and B) that are located farthest from the points corresponding to each average color in the color space are extracted, one point A has a region in front of the boundary. It can be considered that it corresponds to the average color when only the color is included, and the other point B corresponds to the average color when the region includes only the color behind the boundary. The points corresponding to the other average colors are likely to be arranged in the order of extraction from point A to point B. Therefore, the points A and B are connected by a line segment, the position of the intersection point by the perpendicular line dropped from the other point to the line segment AB is sequentially tracked, and the intersection point of the perpendicular line and the line segment AB is determined to be a predetermined reference position (for example, a line segment). When the value exceeds the midpoint of AB, the point of interest at that time can be extracted as a point corresponding to the color boundary.
Even when a line is scanned, the same method as described above can be applied if the color on the image changes gradually.

この発明にかかる第3の方法は、計測対象のカラー画像とあらかじめ登録された基準のカラー画像との間で、対応する画素の組毎に色差を求める処理と、前記色差を所定のしきい値と比較する処理とを実行することにより、前記計測対象の画像において、基準のカラー画像とは異なる色彩が現れている部分を抽出する。   According to a third method of the present invention, there is provided a process for obtaining a color difference for each set of corresponding pixels between a color image to be measured and a reference color image registered in advance, and calculating the color difference to a predetermined threshold value. By executing the process of comparing with the reference image, a portion where a color different from the reference color image appears in the measurement target image is extracted.

この方法は、色彩の異なる複数の対象物や、模様などによる複数種の色彩を有する対象物を計測対象とする場合に使用することができる。なお、この方法を実行する場合には、あらかじめ、計測対象のカラー画像と基準のカラー画像との間での位置ずれや回転ずれなどを補正しておくのが望ましい。   This method can be used when measuring a plurality of objects having different colors or an object having a plurality of types of colors such as patterns. When this method is executed, it is desirable to correct in advance a positional deviation or a rotational deviation between the color image to be measured and the reference color image.

上記の方法では、色彩の分布状態が良好な基準のカラー画像に対し、対応する画素毎に色差を求めるので、計測対象のカラー画像に基準のカラー画像とは異なる色彩の分布が生じている場合でも、その差異を精度良く抽出することができる。この場合、ユーザーは、基準のカラー画像を登録する処理を行うだけであるので、計測対象とすべき領域について、色彩の分布が適切な画像を登録することで、安定した処理結果を得ることができる。   In the above method, since a color difference is obtained for each corresponding pixel with respect to a reference color image having a good color distribution state, a color distribution different from that of the reference color image is generated in the color image to be measured. However, the difference can be extracted with high accuracy. In this case, since the user only performs the process of registering the reference color image, it is possible to obtain a stable processing result by registering an image having an appropriate color distribution for the region to be measured. it can.

つぎに、この発明にかかる第4の方法では、計測対象のカラー画像上にあらかじめ登録した基準のカラー画像と同じ大きさの計測対象領域を設け、前記計測対象領域内の画像および基準のカラー画像のそれぞれについて、平均色を求める処理と、前記色空間の各構成画素の色彩に対応する点毎に、前記平均色に対応する点に対する距離および方向を求める処理とを実行する。さらに前記構成画素毎に求めた距離および方向を用いて計測対象領域内の画像と基準のカラー画像との類似度を求め、この類似度が所定のしきい値を上回ったとき、前記計測対象領域が基準のカラー画像に対応していると判別する。   Next, in the fourth method according to the present invention, a measurement target area having the same size as the reference color image registered in advance is provided on the color image to be measured, and the image in the measurement target area and the reference color image are provided. For each of the above, a process for obtaining an average color and a process for obtaining a distance and a direction for the point corresponding to the average color are performed for each point corresponding to the color of each constituent pixel in the color space. Further, the similarity between the image in the measurement target area and the reference color image is obtained using the distance and direction obtained for each of the constituent pixels, and when the similarity exceeds a predetermined threshold, the measurement target area Is determined to correspond to the reference color image.

上記第4の方法も、第3の方法と同様に、異なる色彩を有する複数の対象物や、複数種の色彩が表された単一の対象物を計測対象とする場合に使用することができる。この方法における基準のカラー画像は、計測対象のカラー画像と同じサイズまたは計測対象のカラー画像よりも小さいサイズであり、抽出すべき対象物を含む画像であると考えることができる。   Similarly to the third method, the fourth method can also be used when a plurality of objects having different colors or a single object expressing a plurality of types of colors are to be measured. . The reference color image in this method is the same size as the measurement target color image or smaller than the measurement target color image, and can be considered as an image including the target object to be extracted.

第4の方法では、計測対象領域内の画像、基準のカラー画像のそれぞれについて、前記した色空間に、画像の平均色および構成画素毎の色彩に対応する点を設定する。そして、構成画素に対応する点毎に、平均色に対応する点との距離および方向を求める。なお、この距離および方向は、平均色に対応する点から構成画素の色彩に対応する点に向かうベクトルとして表すことができる。また、基準のカラー画像にかかる距離および方向は、計測処理より前に求め、メモリに登録しておくのが望ましい。   In the fourth method, for each of the image in the measurement target region and the reference color image, points corresponding to the average color of the image and the color of each constituent pixel are set in the color space described above. Then, for each point corresponding to the constituent pixel, the distance and direction from the point corresponding to the average color are obtained. This distance and direction can be expressed as a vector from a point corresponding to the average color to a point corresponding to the color of the constituent pixel. In addition, it is desirable that the distance and direction of the reference color image are obtained before the measurement process and registered in the memory.

上記の距離および方向に基づく類似度は、計測対象領域内の各画素間における距離および方向の関係が、基準のカラー画像の各画素間における距離および方向の関係に近くなるほど大きくなるようにするのが望ましい。たとえば、計測対象領域の画素毎に得た距離DPiと、基準画像の画素毎に得た距離DMiと、各画像の対応する画素間における方向のずれ量θiとを用いた相関演算により、類似度を算出することができる。また、対応する画素の組毎に、前記距離DPi,DMiの差と方向のずれ量θiとの和を求め、画素毎の算出結果の総和を所定の基準値(たとえば100)から差し引く演算により、類似度と求めることができる。いずれの場合にも、計測対象領域内の画像の色彩分布が基準のカラー画像の色彩分布に近づくほど、類似度の値を高くすることができる。   The similarity based on the above distance and direction is set to increase as the relationship between the distance and direction between each pixel in the measurement target region becomes closer to the relationship between the distance and direction between each pixel of the reference color image. Is desirable. For example, the similarity is obtained by a correlation calculation using the distance DPi obtained for each pixel of the measurement target region, the distance DMi obtained for each pixel of the reference image, and the direction shift amount θi between corresponding pixels of each image. Can be calculated. Further, for each corresponding set of pixels, by calculating the sum of the difference between the distances DPi and DMi and the direction shift amount θi, and subtracting the sum of the calculation results for each pixel from a predetermined reference value (for example, 100), Similarity can be obtained. In any case, the similarity value can be increased as the color distribution of the image in the measurement target region approaches the color distribution of the reference color image.

上記方法によれば、計測対象のカラー画像から複数種の色彩が分布している領域を抽出する場合、正しい分布状態が現れたカラー画像を基準のカラー画像として登録しておき、計測対象領域の設定位置を順に変更しながら上記の方法を実行することによって、最も高い類似度(前記所定のしきい値より大きいもの)を得たときの計測対象領域を該当する領域として抽出することができる。   According to the above method, when extracting a region where a plurality of types of colors are distributed from a color image to be measured, a color image in which a correct distribution state appears is registered as a reference color image, and By executing the above method while sequentially changing the setting position, it is possible to extract the measurement target region when the highest similarity (greater than the predetermined threshold value) is obtained as the corresponding region.

また、あらかじめエッジ抽出などの方法により対象物の位置を抽出しておき、その抽出結果に基づき計測対象領域を設定して上記方法を実行すれば、対象物の色彩分布の適否を精度良く判別することができる。   Also, if the position of the object is extracted in advance by a method such as edge extraction, the measurement target region is set based on the extraction result, and the above method is executed, the suitability of the color distribution of the object is accurately determined. be able to.

前記第1の方法を実施するための画像処理装置は、赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、前記画像入力手段が入力したカラー画像上に所定大きさの計測対象領域を設定した後、その計測対象領域を分割して複数の小領域を設定する領域設定手段と、前記小領域毎に平均色を求めた後、隣り合う小領域の組毎に前記平均色に基づき色差を求める演算手段と、前記演算手段により求められた色差を所定のしきい値と比較し、前記色差がしきい値を超えたときに、その色差に対応する2つの小領域間に色彩の差異が生じていると判別する判別手段とを具備する。   An image processing apparatus for carrying out the first method includes an image input unit for inputting a color image composed of density data of red, green, and blue color components, and a predetermined image on the color image input by the image input unit. After setting the measurement target area of the size, the area setting means for dividing the measurement target area and setting a plurality of small areas, and after obtaining the average color for each small area, for each set of adjacent small areas And calculating means for obtaining a color difference based on the average color, and comparing the color difference obtained by the computing means with a predetermined threshold value, and when the color difference exceeds the threshold value, Discriminating means for discriminating that a color difference occurs between the small areas.

前記第2の方法を実施するための画像処理装置は、赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、前記画像入力手段より入力されたカラー画像を、所定方向に沿って走査しつつ、走査方向に直交する方向に沿う平均色を求める平均色算出手段と、前記色空間において、前記平均色算出手段により求められた複数の平均色に対応する点の位置関係に基づき、これらの点の中から色彩の境界に相当する点を抽出する抽出手段と、前記抽出手段により抽出された点に対応する平均色を得たときの走査位置を色彩が変化した位置として判別する判別手段とを具備する。   An image processing apparatus for performing the second method includes an image input unit that inputs a color image composed of density data of each color component of red, green, and blue, and a color image that is input from the image input unit. Average color calculation means for obtaining an average color along a direction orthogonal to the scanning direction while scanning along a predetermined direction, and points corresponding to a plurality of average colors obtained by the average color calculation means in the color space Based on the positional relationship, the color changed the extraction position for extracting the point corresponding to the color boundary from these points, and the scanning position when the average color corresponding to the point extracted by the extraction means was obtained Discriminating means for discriminating the position.

前記第3の方法を実施するための画像処理装置は、赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、基準のカラー画像を登録するためのメモリと、前記画像入力手段より入力されたカラー画像と前記メモリ内の基準のカラー画像との間で、対応する画素の組毎に色差を求める演算手段と、前記演算手段により求められた色差を所定のしきい値と比較し、前記色差がしきい値を超えたときに、その色差が抽出された画素に前記基準のカラー画像とは異なる色彩が現れていると判別する判別手段とを具備する。   An image processing apparatus for carrying out the third method includes an image input means for inputting a color image composed of density data of red, green, and blue color components, a memory for registering a reference color image, A calculation means for obtaining a color difference for each set of corresponding pixels between a color image input from the image input means and a reference color image in the memory, and a color difference obtained by the calculation means are predetermined. And a discriminating means for discriminating that a color different from the reference color image appears in the pixel from which the color difference is extracted when the color difference exceeds a threshold value.

前記第4の方法を実施するための画像処理装置は、赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、基準のカラー画像を登録するためのメモリと、前記画像入力手段より入力されたカラー画像上に前記基準のカラー画像と同じ大きさの計測対象領域を設定する領域設定手段と、前記計測対象領域内の画像および基準のカラー画像のそれぞれについて、その画像における平均色を算出する処理と、前記色空間の各構成画素の色彩に対応する点毎に、前記平均色に対応する点に対する距離および方向を求める処理とを実行した後、求められた構成画素毎の距離および方向を用いて計測対象領域内の画像と基準のカラー画像との間の類似度を求める演算手段と、前記類似度を所定のしきい値と比較し、類似度がしきい値を上回ったとき、前記計測対象領域が基準のカラー画像に対応していると判別する判別手段とを具備する。   An image processing apparatus for carrying out the fourth method includes an image input means for inputting a color image composed of density data of red, green, and blue color components, a memory for registering a reference color image, A region setting unit that sets a measurement target region having the same size as the reference color image on the color image input from the image input unit, and each of the image in the measurement target region and the reference color image After the processing for calculating the average color in the image and the processing for obtaining the distance and direction for the point corresponding to the average color for each point corresponding to the color of each constituent pixel of the color space, the obtained configuration The calculation means for obtaining the similarity between the image in the measurement target area and the reference color image using the distance and direction for each pixel, and the similarity is compared with a predetermined threshold value to determine the similarity. When it exceeded had value, the measurement target region; and a discrimination means for discriminating that corresponds to the reference color image.

上記各構成の装置において、画像入力手段は、カラー画像生成用の撮像手段に対するインターフェース回路とすることができる。また撮像手段がアナログカメラである場合、画像入力手段には、各色成分の濃度データをディジタル変換するA/D変換回路を含めることができる。
また、画像入力手段は、外部の装置からあらかじめ生成されたカラー画像を入力するための通信用のインターフェース回路や、所定の記憶媒体に格納されたカラー画像を読み出すドライブ装置として構成することもできる。
In the apparatus having each configuration described above, the image input means can be an interface circuit for the imaging 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)により構成することもできる。   Each means other than the image input means and the memory is 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).

上記の画像処理装置は、対象物の位置を抽出する用途のほか、色彩の異常として現れる欠陥を抽出したり、模様のパターンの適否を判別するなどの検査のために使用することができる。いずれの装置にも、抽出処理結果や良/不良の判別結果などを表示したり、外部に出力するための手段を設けることができる。   The image processing apparatus described above can be used not only for the purpose of extracting the position of an object, but also for inspections such as extracting defects that appear as color abnormalities and determining the suitability of pattern patterns. Any device can be provided with a means for displaying an extraction processing result, a good / bad determination result, and the like, and outputting the result to the outside.

また、第3、第4の画像処理装置には、基準のカラー画像の入力または指定を受け付けて、その画像をメモリに登録するための手段が設けられるのが望ましい。さらに、第4の画像処理装置には、基準のカラー画像について前記演算手段により求めらた距離および方向を、前記メモリに登録する手段を設けるのが望ましい。   The third and fourth image processing apparatuses are preferably provided with means for receiving input or designation of a reference color image and registering the image in a memory. Further, it is desirable that the fourth image processing apparatus is provided with means for registering the distance and direction obtained by the calculation means for the reference color image in the memory.

この発明によれば、周囲と異なる色彩を有する部分を抽出または計測する場合に、基準の色彩を指定する必要をなくしたので、安定した抽出結果や計測結果を得ることができる。また、対象物のベースの色彩が変化しても、容易に対応することができる。   According to the present invention, when extracting or measuring a portion having a color different from the surroundings, it is not necessary to specify a reference color, so that a stable extraction result or measurement result can be obtained. Moreover, even if the base color of the object changes, it can be easily handled.

さらに、この発明によれば、複数種の色彩を含む部分を抽出または計測する場合に、色彩分布が良好な基準のカラー画像を登録することによって、容易に対応することができる。また、画像中に含まれる色彩の数や種類に左右されることなく、色彩の異常部位を抽出する処理や、対象物を抽出する処理を、高い精度で実行することができる。   Furthermore, according to the present invention, when extracting or measuring a portion including a plurality of kinds of colors, it is possible to easily cope with the problem by registering a reference color image having a good color distribution. In addition, it is possible to execute a process of extracting an abnormal portion of a color and a process of extracting an object with high accuracy without being affected by the number and types of colors included in the image.

図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 2005309914
Figure 2005309914

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 equal to or less than the threshold value dn1, the process proceeds to ST110 to perform a good determination. 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 31 (in this example, the x-axis direction) is set. 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 in 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 2005309914
Figure 2005309914

このようにして類似度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 2005309914
Figure 2005309914

(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).

この発明にかかる画像処理装置の構成例を示すブロック図である。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.

符号の説明Explanation of symbols

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 (8)

赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法において、
計測対象のカラー画像上に同じ大きさを持つ2つの領域を設定する処理と、各領域における平均色に基づき領域間の色差を求める処理と、前記色差を所定のしきい値と比較する処理とを、少なくとも一方の領域の設定位置を変えながら複数サイクル実行することにより、前記画像上に色彩が異なる部分があるか否かを判別することを特徴とするカラー画像の処理方法。
In a method of processing a color image composed of density data of red, green and blue color components,
A process of setting two areas having the same size on a color image to be measured, a process of obtaining a color difference between areas based on an average color in each area, and a process of comparing the color difference with a predetermined threshold value The color image processing method is characterized in that it is determined whether or not there is a portion having a different color on the image by executing a plurality of cycles while changing the setting position of at least one region.
赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法において、
前記カラー画像を所定方向に沿って走査しつつ、その走査方向に直交する方向に沿う平均色を求める処理を所定の間隔毎に繰り返し実行し、
前記各色成分に対応する3軸による仮想空間において、前記カラー画像の走査時に求めた複数の平均色に対応する点の位置関係に基づき、これらの点の中から色彩の境界に相当する点を抽出し、その点に対応する平均色を得たときの走査位置を色彩が変化した位置として判別することを特徴とするカラー画像の処理方法。
In a method of processing a color image composed of density data of red, green and blue color components,
While scanning the color image along a predetermined direction, repeatedly performing a process for obtaining an average color along a direction orthogonal to the scanning direction at predetermined intervals,
In the three-axis virtual space corresponding to each color component, a point corresponding to the color boundary is extracted from these points based on the positional relationship of the points corresponding to the plurality of average colors obtained when scanning the color image. And a color image processing method, wherein the scanning position when the average color corresponding to the point is obtained is determined as the position where the color has changed.
赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法において、
計測対象のカラー画像とあらかじめ登録された基準のカラー画像との間で、対応する画素の組毎に色差を求める処理と、前記色差を所定のしきい値と比較する処理とを実行することにより、前記計測対象の画像において、基準のカラー画像とは異なる色彩が現れている部分を抽出することを特徴とするカラー画像の処理方法。
In a method of processing a color image composed of density data of red, green and blue color components,
By executing a process of obtaining a color difference for each set of corresponding pixels between a color image to be measured and a reference color image registered in advance, and a process of comparing the color difference with a predetermined threshold value A method of processing a color image, wherein a portion where a color different from a reference color image appears in the measurement target image is extracted.
赤、緑、青の各色成分の濃度データから成るカラー画像を処理する方法において、
計測対象のカラー画像上に、あらかじめ登録した基準のカラー画像と同じ大きさの計測対象領域を設け、
前記計測対象領域内の画像および基準のカラー画像のそれぞれについて、平均色を求める処理と、前記各色成分に対応する3軸による仮想空間の各構成画素の色彩に対応する点毎に、前記平均色に対応する点に対する距離および方向を求める処理とを実行し、
前記構成画素毎に求めた距離および方向を用いて計測対象領域内の画像と基準のカラー画像との間の類似度を求め、この類似度が所定のしきい値を上回ったとき、前記計測対象領域が基準のカラー画像に対応していると判別することを特徴とするカラー画像の処理方法。
In a method of processing a color image composed of density data of red, green and blue color components,
On the measurement target color image, a measurement target area of the same size as the reference color image registered in advance is provided.
For each of the image in the measurement target area and the reference color image, the average color is calculated for each point corresponding to the color of each component pixel in the virtual space with three axes corresponding to each color component. A process for obtaining a distance and a direction with respect to a point corresponding to
Using the distance and direction obtained for each of the constituent pixels, the similarity between the image in the measurement target region and the reference color image is obtained, and when the similarity exceeds a predetermined threshold, the measurement target A method of processing a color image, characterized in that it is determined that an area corresponds to a reference color image.
赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、
前記画像入力手段が入力したカラー画像上に所定大きさの計測対象領域を設定した後、その計測対象領域を分割して複数の小領域を設定する領域設定手段と、
前記小領域毎に平均色を求めた後、隣り合う小領域の組毎に前記平均色に基づき色差を求める演算手段と、
前記演算手段により求められた色差を所定のしきい値と比較し、前記色差がしきい値を超えたときに、その色差に対応する2つの小領域間に色彩の差異が生じていると判別する判別手段とを具備する画像処理装置。
An image input means for inputting a color image composed of density data of each color component of red, green and blue;
After setting a measurement target area of a predetermined size on the color image input by the image input means, area setting means for dividing the measurement target area and setting a plurality of small areas;
After calculating the average color for each small area, calculating means for determining a color difference based on the average color for each set of adjacent small areas;
The color difference obtained by the calculating means is compared with a predetermined threshold value, and when the color difference exceeds the threshold value, it is determined that a color difference is generated between two small areas corresponding to the color difference. An image processing apparatus comprising: a determination unit that performs the determination.
赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、
前記画像入力手段より入力されたカラー画像を、所定方向に沿って走査しつつ、走査方向に直交する方向に沿う平均色を求める平均色算出手段と、
前記各色成分に対応する3軸による仮想空間において、前記平均色算出手段により求められた複数の平均色に対応する点の位置関係に基づき、これらの点の中から色彩の境界に相当する点を抽出する抽出手段と、
前記抽出手段により抽出された点に対応する平均色を得たときの走査位置を色彩が変化した位置として判別する判別手段とを具備する画像処理装置。
An image input means for inputting a color image composed of density data of each color component of red, green and blue;
Average color calculation means for obtaining an average color along a direction orthogonal to the scanning direction while scanning a color image input from the image input means along a predetermined direction;
Based on the positional relationship of points corresponding to a plurality of average colors obtained by the average color calculation means in a virtual space with three axes corresponding to the color components, points corresponding to color boundaries are selected from these points. Extracting means for extracting;
An image processing apparatus comprising: discrimination means for discriminating a scanning position when an average color corresponding to the point extracted by the extraction means is obtained as a color changed position.
赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、
基準のカラー画像を登録するためのメモリと、
前記画像入力手段より入力されたカラー画像と前記メモリ内の基準のカラー画像との間で、対応する画素の組毎に色差を求める演算手段と、
前記演算手段により求められた色差を所定のしきい値と比較し、前記色差がしきい値を超えたときに、その色差が抽出された画素に前記基準のカラー画像とは異なる色彩が現れていると判別する判別手段とを具備する画像処理装置。
An image input means for inputting a color image composed of density data of each color component of red, green and blue;
A memory for registering a reference color image;
An arithmetic means for obtaining a color difference for each set of corresponding pixels between a color image input from the image input means and a reference color image in the memory;
The color difference obtained by the computing means is compared with a predetermined threshold value, and when the color difference exceeds the threshold value, a color different from the reference color image appears in the pixel from which the color difference is extracted. An image processing apparatus comprising: discrimination means for discriminating that it is present.
赤、緑、青の各色成分の濃度データから成るカラー画像を入力する画像入力手段と、
基準のカラー画像を登録するためのメモリと、
前記画像入力手段より入力されたカラー画像上に前記基準のカラー画像と同じ大きさの計測対象領域を設定する領域設定手段と、
前記計測対象領域内の画像および基準のカラー画像のそれぞれについて、その画像における平均色を算出する処理と、各色成分に対応する3軸による仮想空間の各構成画素の色彩に対応する点毎に、前記平均色に対応する点に対する距離および方向を求める処理とを実行した後、求められた構成画素毎の距離および方向を用いて計測対象領域内の画像と基準のカラー画像との間の類似度を求める演算手段と、
前記類似度を所定のしきい値と比較し、類似度がしきい値を上回ったとき、前記計測対象領域が基準のカラー画像に対応していると判別する判別手段とを具備する画像処理装置。
An image input means for inputting a color image composed of density data of each color component of red, green and blue;
A memory for registering a reference color image;
Area setting means for setting a measurement target area having the same size as the reference color image on the color image input from the image input means;
For each of the image in the measurement target region and the reference color image, a process for calculating an average color in the image, and for each point corresponding to the color of each constituent pixel of the virtual space by three axes corresponding to each color component, The degree of similarity between the image in the measurement target region and the reference color image using the obtained distance and direction for each constituent pixel after executing the processing for obtaining the distance and direction for the point corresponding to the average color Computing means for obtaining
An image processing apparatus comprising: a determination unit that compares the similarity with a predetermined threshold and determines that the measurement target area corresponds to a reference color image when the similarity exceeds the threshold. .
JP2004127912A 2004-04-23 2004-04-23 Color image processing method and image processing apparatus Expired - Lifetime JP4513394B2 (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Related Child Applications (3)

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

Publications (2)

Publication Number Publication Date
JP2005309914A true JP2005309914A (en) 2005-11-04
JP4513394B2 JP4513394B2 (en) 2010-07-28

Family

ID=35438600

Family Applications (1)

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

Country Status (1)

Country Link
JP (1) JP4513394B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013058158A (en) * 2011-09-09 2013-03-28 Fuji Xerox Co Ltd Image processor and image processing program
JP2016029828A (en) * 2015-10-16 2016-03-03 オリンパス株式会社 Imaging device, imaging method, and program
JP2017019108A (en) * 2015-07-07 2017-01-26 株式会社リコー Image quality change detection device, image quality change detection method and program for image quality change detection
JP2017220175A (en) * 2016-06-10 2017-12-14 株式会社パスコ Damaged house detection method

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4670994B2 (en) * 2010-04-05 2011-04-13 オムロン株式会社 Color image processing method and image processing apparatus
JP4670995B2 (en) * 2010-04-05 2011-04-13 オムロン株式会社 Color image processing method and image processing apparatus
JP4670993B2 (en) * 2010-04-05 2011-04-13 オムロン株式会社 Color image processing method and image processing apparatus

Citations (17)

* 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
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
JP2004127912A (en) * 2002-06-03 2004-04-22 Samsung Electronics Co Ltd Liquid crystal display device equipped with noise cutoff means
JP2004185246A (en) * 2002-12-03 2004-07-02 Tokushima Ken Evaluation method of uniformity of color

Patent Citations (17)

* 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
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
JP2004127912A (en) * 2002-06-03 2004-04-22 Samsung Electronics Co Ltd Liquid crystal display device equipped with noise cutoff means
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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013058158A (en) * 2011-09-09 2013-03-28 Fuji Xerox Co Ltd Image processor and image processing program
JP2017019108A (en) * 2015-07-07 2017-01-26 株式会社リコー Image quality change detection device, image quality change detection method and program for image quality change detection
JP2016029828A (en) * 2015-10-16 2016-03-03 オリンパス株式会社 Imaging device, imaging method, and program
JP2017220175A (en) * 2016-06-10 2017-12-14 株式会社パスコ Damaged house detection method

Also Published As

Publication number Publication date
JP4513394B2 (en) 2010-07-28

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
JP5745178B2 (en) Three-dimensional measurement method, apparatus and system, and image processing apparatus
JP3793100B2 (en) Information processing method, apparatus, and recording medium
JP4885584B2 (en) Rangefinder calibration method and apparatus
US20100156896A1 (en) Method of creating three-dimensional model and object recognizing device
US6985626B2 (en) Pattern evaluation method, pattern evaluation system and computer-readable recorded medium
JP6566768B2 (en) Information processing apparatus, information processing method, and program
KR101932214B1 (en) Apparatus for measuring crack using image processing technology and method thereof
JP7188201B2 (en) Image processing device, image processing method, and image processing program
JP2012021919A (en) Image processing system, image processing method and computer program
US6718074B1 (en) Method and apparatus for inspection for under-resolved features in digital images
JP6405124B2 (en) Inspection device, inspection method, and program
JP5469532B2 (en) Image processing apparatus, image processing method, and computer program
JP4670994B2 (en) Color image processing method and image processing apparatus
JP4513394B2 (en) Color image processing method and image processing apparatus
JP2010133744A (en) Defect detection method, and visual inspection device using the same
JP2008152555A (en) Image recognition method and image recognition device
JPWO2005096129A1 (en) Method and apparatus for detecting designated position of imaging apparatus, and program for detecting designated position of imaging apparatus
JP4670993B2 (en) Color image processing method and image processing apparatus
JP4670995B2 (en) Color image processing method and image processing apparatus
JP2002140713A (en) Image processing method and image processor
JP4423347B2 (en) Inspection method and inspection apparatus for compound eye distance measuring apparatus and chart used therefor
JP2008139262A (en) Detect inspection method and inspection apparatus using the same

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20061121

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20091117

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20091124

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100122

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20100216

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20100405

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

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

R150 Certificate of patent or registration of utility model

Ref document number: 4513394

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

Year of fee payment: 3

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

Free format text: PAYMENT UNTIL: 20140521

Year of fee payment: 4

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250