JPH0993443A - Color-monochromatic image conversion method and edge position detection method for object to be inspected - Google Patents

Color-monochromatic image conversion method and edge position detection method for object to be inspected

Info

Publication number
JPH0993443A
JPH0993443A JP8029742A JP2974296A JPH0993443A JP H0993443 A JPH0993443 A JP H0993443A JP 8029742 A JP8029742 A JP 8029742A JP 2974296 A JP2974296 A JP 2974296A JP H0993443 A JPH0993443 A JP H0993443A
Authority
JP
Japan
Prior art keywords
point
color
value
image
inspected
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP8029742A
Other languages
Japanese (ja)
Inventor
Yasuo Okuda
泰生 奥田
Fumio Yasutomi
文夫 安富
Seiji Tamai
精治 玉井
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.)
Sanyo Electric Co Ltd
Original Assignee
Sanyo Electric Co Ltd
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 Sanyo Electric Co Ltd filed Critical Sanyo Electric Co Ltd
Priority to JP8029742A priority Critical patent/JPH0993443A/en
Publication of JPH0993443A publication Critical patent/JPH0993443A/en
Pending legal-status Critical Current

Links

Landscapes

  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)

Abstract

PROBLEM TO BE SOLVED: To enable flexible inspection by converting RGB value at each point into a coordinate at each corresponding point in a uniform color space and calculating contrast of each point of a color image of an object to be inspected through the use of the coordinate at each corresponding point in the uniform color space. SOLUTION: A color image 2 is converted from a value in an RGB color space being a camera output into a value in an L*a*b* uniform color space in matching with a human sense. A clustering of a reference image is conducted in the L*a*b* uniform color space by the K-average method designating in advance a cluster number and the gravity center of each cluster is obtained. Then the L*a*b* value corresponding to the coordinate of each point in the RGB system color space is calculated and the contrast with respect to the L*a*b* value is calculated, based on the L*a*b* value and the cluster gravity center position. Then the contrast with respect to each coordinate of the RGB system is stored in a lookup table LUT 8. In this inspection processing, the LUT 8 is referenced to the photographed color image of the object to be inspected to obtain the contrast image.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】本発明は複数の色で構成される複
雑な背景上に存在する対象物を検査する場合に用いられ
るカラーモノクロ画像変換方法および被検査対象のエッ
ジ位置検出方法に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a color / monochrome image conversion method and an edge position detection method for an object to be inspected, which are used when an object existing on a complicated background composed of a plurality of colors is inspected.

【0002】[0002]

【従来の技術】最近カラー画像撮像装置の低価格化に伴
いカラー画像処理技術が盛んに研究されつつあるが、現
在においてもカラー画像処理はモノクロ濃淡画像処理を
駆逐するには至っておらず、依然としてモノクロ画像処
理が主流である。
2. Description of the Related Art Recently, color image processing technology has been actively researched along with the price reduction of color image pickup devices, but at present color image processing has not succeeded in destroying monochrome grayscale image processing. Monochrome image processing is the mainstream.

【0003】これは実際の使用に際し、カラー画像処理
は情報量が多いということが逆効果になり、処理の煩雑
化、高コスト化等の問題が生じているためである。
This is because, in actual use, the color image processing has the opposite effect that the amount of information is large, which causes problems such as complicated processing and high cost.

【0004】ところでカラー画像の入力装置として使用
されるカメラからのRGB出力は、カメラに適した色空
間上の出力値であるが、検査等の目的に応じた処理がで
きないことが多い。従ってRGB出力値を適当な3次元
の色空間変換を施した後に、その後の処理を行うのが一
般的である。
By the way, the RGB output from a camera used as a color image input device is an output value on a color space suitable for the camera, but in many cases, it cannot be processed according to the purpose such as inspection. Therefore, it is general that the RGB output values are subjected to an appropriate three-dimensional color space conversion and then the subsequent processing is performed.

【0005】斯かる色空間として代表的なものの一つ
は、赤、緑、青等の色合いを表わす色相(H : hue)、
色の鮮やかさの度合いを示す彩度(S : saturation
)、明るい、暗いを示す明度(V : value)によるH
SV色空間があり、これは極座標系をなす。尚、上記の
ように色が互いに独立的にもっている3種の性質を総称
して色の3属性という。
One of the typical ones as such a color space is a hue (H: hue) representing a hue such as red, green, and blue.
Saturation indicating the degree of color vividness (S: saturation
), H by brightness (V: value) indicating bright or dark
There is an SV color space, which forms a polar coordinate system. The three types of properties that colors have independently of each other as described above are collectively referred to as three attributes of color.

【0006】またカメラ出力のRGB色空間では2色間
の距離が人の知覚特性と一致しない。実用の観点からは
3次元のどの方向へも色の変化が感覚的に均等になって
いれば好都合である。そこでCIE(国際照明委員会)
がこれら要求を満たす均等空間を1964年に定めた。
Also, in the RGB color space of the camera output, the distance between the two colors does not match the human perception characteristics. From a practical point of view, it would be convenient if the color changes were perceptually uniform in all three-dimensional directions. So CIE (International Commission on Illumination)
Established a uniform space in 1964 to meet these requirements.

【0007】この空間はその後改良が加えられ、現在で
はCIE1976L* * * とCIE1976L*
* * の2つが定義されている。即ちこれらの色空間も
人の知覚特性に一致した空間である。
This space has since been improved and is now CIE1976L * a * b * and CIE1976L * u.
Two of * v * are defined. That is, these color spaces are also spaces that match human perception characteristics.

【0008】[0008]

【発明が解決しようとする課題】さてカラー画像を用い
た検査には様々なケースがある。例えば瓶の王冠、プリ
ントパターン、シートベルト等である。例えばカラー印
刷上の文字の場合、モノクロカメラで撮影すると、文字
と背景とが分離できないという問題点がある。また斯か
る文字の検査は従来のカラー2値画像変換では困難であ
るという問題点がある。
There are various cases in the inspection using the color image. Examples include bottle caps, print patterns, seat belts, and the like. For example, in the case of characters printed in color, there is a problem that the characters cannot be separated from the background when taken with a monochrome camera. In addition, there is a problem that the inspection of such characters is difficult by the conventional color binary image conversion.

【0009】さらにL* * * 空間の距離のみに着目
した従来の色差によるカラーモノクロ画像変換手法によ
るモノクロ濃淡画像では背景の濃度値に広がりがあるた
めに、文字と背景の濃度値が近接してしまい、やはり文
字と背景が分離できるような画像が得られないという問
題点がある。
Further, since the background density value is wide in a monochrome grayscale image by the conventional color-monochrome image conversion method based on the color difference in which only the distance of the L * a * b * space is focused, the density values of the character and the background are close to each other. However, there is a problem that an image in which the character and the background can be separated cannot be obtained.

【0010】本発明は、複数の色で構成される複雑な背
景上に対象物が存在する被検査対象のカラー画像から、
対象物を高精度で抽出することができるようなモノクロ
画像を生成するカラーモノクロ画像変換方法を提供する
ことを目的とする。
According to the present invention, from a color image of an object to be inspected in which the object is present on a complicated background composed of a plurality of colors,
It is an object of the present invention to provide a color / monochrome image conversion method for generating a monochrome image capable of extracting an object with high accuracy.

【0011】また、本発明は、複数の色で構成される複
雑な背景上に対象物が存在する被検査対象のカラー画像
に基づいて、対象物と背景との境界エッジを高精度で検
出することができる被検査対象のエッジ位置検出方法を
提供することを目的とする。
Further, according to the present invention, the boundary edge between the object and the background is detected with high accuracy based on the color image of the object to be inspected in which the object is present on the complicated background composed of a plurality of colors. It is an object of the present invention to provide a method for detecting an edge position of an object to be inspected.

【0012】[0012]

【課題を解決するための手段】この発明によるカラーモ
ノクロ画像変換方法では、対象物および背景からなる被
検査対象のカラー画像の各点のRGB値が、人の知覚特
性に一致した均等色空間内の各対応点の座標値に変換さ
れる。そして、均等色空間の各対応点の座標値を用い
て、被検査対象のカラー画像の各点の濃淡値が算出され
ることにより、カラー画像がモノクロ濃淡画像に変換さ
れる。
In the color / monochrome image conversion method according to the present invention, the RGB value of each point of the color image of the object to be inspected, which is composed of the object and the background, is within the uniform color space in which the human perceptual characteristics are matched. Is converted into the coordinate value of each corresponding point. Then, the color value is converted into a monochrome grayscale image by calculating the grayscale value of each point of the color image to be inspected using the coordinate value of each corresponding point in the uniform color space.

【0013】被検査対象のカラー画像の各点の濃淡値を
算出する方法には、次の4つの方法がある。
There are the following four methods for calculating the gray value of each point of the color image to be inspected.

【0014】(1)第1方法 被検査対象のカラー画像の各点のRGB値を、XYZ表
色系の座標値(x,y,z)に変換する。得られたXY
Z表色系の座標値(x,y,z)を、均等色空間として
のL* * * 表色系の座標値(L* ,a* ,b* )に
変換する。L** * 表色系における全画素を、対象
物が主として含まれるクラスタと、1または複数の背景
のクラスタとに分類する。
(1) First Method RGB values at each point of a color image to be inspected are converted into coordinate values (x, y, z) in the XYZ color system. XY obtained
The coordinate values (x, y, z) of the Z color system are converted into the coordinate values (L * , a * , b * ) of the L * a * b * color system as a uniform color space. All pixels in the L * a * b * color system are classified into a cluster mainly containing an object and one or more background clusters.

【0015】対象物が主として含まれるクラスタの代表
点をC0 、背景のクラスタの代表点をC1 〜CN 、L*
* * 系の任意の点Aの濃淡値をDA 、C0 とC
n (n=1〜N)とを結ぶ線分C0 n の長さをLn
点Aと各線分C0 n との距離をln 、C0 と点Aとの
距離をLA とした場合に、任意の点Aの濃淡値DA を求
める数式5に基づいて、前記被検査対象のカラー画像の
各点のRGB値に対応する濃淡値を算出する。
The representative point of the cluster mainly containing the object is C 0 , the representative points of the background clusters are C 1 to C N , L *.
The gray value of an arbitrary point A in the a * b * system is D A , C 0 and C
The length of a line segment C 0 C n connecting n (n = 1 to N) is L n ,
The distance between the point A and the line segment C 0 C n the distance between l n, C 0 and the point A in the case of the L A, based on Equation 5 to determine the gray value D A of an arbitrary point A, the The gray value corresponding to the RGB value of each point of the color image to be inspected is calculated.

【0016】[0016]

【数5】 (Equation 5)

【0017】(2)第2方法 被検査対象の基準見本のカラー画像を生成する。基準見
本のカラー画像の各点のRGB値を、XYZ表色系の座
標値(x,y,z)に変換する。得られたXYZ表色系
の座標値(x,y,z)を、均等色空間としてのL*
* * 表色系の座標値(L* ,a* ,b* )に変換す
る。L* * * 表色系における全画素を、対象物が主
として含まれるクラスタと、1または複数の背景のクラ
スタとに分類する。
(2) Second Method A color image of a reference sample to be inspected is generated. The RGB value of each point of the color image of the reference sample is converted into the coordinate value (x, y, z) of the XYZ color system. The coordinate value (x, y, z) of the obtained XYZ color system is used as L * a as a uniform color space.
* b * Convert to coordinate values (L * , a * , b * ) in the color system. All pixels in the L * a * b * color system are classified into a cluster mainly containing an object and one or more background clusters.

【0018】対象物が主として含まれるクラスタの代表
点をC0 、背景のクラスタの代表点をC1 〜CN 、L*
* * 系の任意の点Aの濃淡値をDA 、C0 とC
n (n=1〜N)とを結ぶ線分C0 n の長さをLn
点Aと各線分C0 n との距離をln 、C0 と点Aとの
距離をLA とした場合に、任意の点Aの濃淡値DA を求
める数式6に基づいて、RGB系の各座標点に対する濃
淡値を算出して、RGB値を濃淡値に変換するテーブル
を作成する。作成されたテーブルに基づいて、被検査対
象のカラー画像の各点のRGB値に対応する濃淡値を算
出する。
The representative point of the cluster mainly containing the object is C 0 , the representative points of the background clusters are C 1 to C N , L *.
The gray value of an arbitrary point A in the a * b * system is D A , C 0 and C
The length of a line segment C 0 C n connecting n (n = 1 to N) is L n ,
The distance between the point A and the line segment C 0 C n l n, the distance between C 0 and the point A in the case of the L A, based on Equation 6 for obtaining the gradation value D A of an arbitrary point A, RGB A gray value for each coordinate point of the system is calculated, and a table for converting the RGB value into the gray value is created. Based on the created table, the gray value corresponding to the RGB value of each point of the color image to be inspected is calculated.

【0019】[0019]

【数6】 (Equation 6)

【0020】(3)第3方法 被対象画像のカラー画像の各点のRGB値を、XYZ表
色系の座標値(x,y,z)に変換する。得られたXY
Z表色系の座標値(x,y,z)を、均等色空間として
のL* * * 表色系の座標値(L* ,a* ,b* )に
変換する。L** * 表色系における全画素を、対象
物が主として含まれるクラスタと、1または複数の背景
のクラスタに分類する。
(3) Third Method RGB values at each point of the color image of the target image are converted into coordinate values (x, y, z) of the XYZ color system. XY obtained
The coordinate values (x, y, z) of the Z color system are converted into the coordinate values (L * , a * , b * ) of the L * a * b * color system as a uniform color space. All pixels in the L * a * b * color system are classified into a cluster mainly containing an object and one or more background clusters.

【0021】対象物が主として含まれるクラスタの代表
点をC0 、背景のクラスタの代表点をC1 〜CN 、L*
* * 系の任意の点Aの濃淡値をDA 、C0 とC
n (n=1〜N)とを結ぶ線分C0 n の長さをLn
0 と点Aとを結ぶ線分C0 Aの長さをLA 、点AC0
n のなす角度をθn とした場合に、任意の点Aの濃淡
値DA を求める数式7に基づいて、前記被検査対象のカ
ラー画像の各点のRGB値に対応する濃淡値を算出す
る。
The representative point of the cluster mainly containing the object is C 0 , the representative points of the background clusters are C 1 to C N , L *.
The gray value of an arbitrary point A in the a * b * system is D A , C 0 and C
The length of a line segment C 0 C n connecting n (n = 1 to N) is L n ,
The length of the line segment C 0 A connecting C 0 and the point A is L A , and the point AC 0
When the angle formed by C n is θ n , the gray value corresponding to the RGB value of each point of the color image to be inspected is calculated based on Equation 7 for obtaining the gray value D A of the arbitrary point A. To do.

【0022】この際、各クラスタに所属する全ての画素
をL* * * 表色系の各軸に対して射影し、それぞれ
の軸上での最頻点を各クラスタの代表点C0 〜Cn とす
ることが好ましい。
At this time, all pixels belonging to each cluster are projected onto each axis of the L * a * b * color system, and the most frequent point on each axis is represented by the representative point C 0 of each cluster. it is preferable that the ~C n.

【0023】[0023]

【数7】 (Equation 7)

【0024】(4)第4方法 被検査対象の基準見本のカラー画像を生成する。基準見
本のカラー画像の各点のRGB値を、XYZ表色系の座
標値(x,y,z)に変換する。得られたXYZ表色系
の座標値(x,y,z)を、均等色空間としてのL*
* * 表色系の座標値(L* ,a* ,b* )に変換す
る。L* * * 表色系における全画素を、対象物が主
として含まれるクラスタと、1または複数の背景のクラ
スタに分類する。
(4) Fourth Method A color image of a reference sample to be inspected is generated. The RGB value of each point of the color image of the reference sample is converted into the coordinate value (x, y, z) of the XYZ color system. The coordinate value (x, y, z) of the obtained XYZ color system is used as L * a as a uniform color space.
* b * Convert to coordinate values (L * , a * , b * ) in the color system. All pixels in the L * a * b * color system are classified into a cluster mainly containing an object and one or more background clusters.

【0025】対象物が主として含まれるクラスタの代表
点をC0 、背景のクラスタの代表点をC1 〜CN 、L*
* * 系の任意の点Aの濃淡値をDA 、C0 とC
n (n=1〜N)とを結ぶ線分C0 n の長さをLn
0 と点Aとを結ぶ線分C0 Aの長さをLA 、点AC0
n のなす角度をθn とした場合に、任意の点Aの濃淡
値DA を求める数式8に基づいて、RGB系の各座標点
に対する濃淡値を算出して、RGB値を濃淡値に変換す
るテーブルを作成する。作成されたテーブルに基づい
て、被検査対象のカラー画像の各点のRGB値に対応す
る濃淡値を算出する。
The representative point of the cluster mainly containing the object is C 0 , the representative point of the background cluster is C 1 to C N , L *.
The gray value of an arbitrary point A in the a * b * system is D A , C 0 and C
The length of a line segment C 0 C n connecting n (n = 1 to N) is L n ,
The length of the line segment C 0 A connecting C 0 and the point A is L A , and the point AC 0
When the angle formed by C n is θ n , the gray value for each coordinate point of the RGB system is calculated based on Equation 8 for obtaining the gray value D A of the arbitrary point A, and the RGB value is set as the gray value. Create a table to convert. Based on the created table, the gray value corresponding to the RGB value of each point of the color image to be inspected is calculated.

【0026】この際、各クラスタに所属する全ての画素
をL* * * 表色系の各軸に対して射影し、それぞれ
の軸上での最頻点を各クラスタの代表点C0 〜Cn とす
ることが好ましい。
At this time, all pixels belonging to each cluster are projected onto each axis of the L * a * b * color system, and the most frequent point on each axis is represented by the representative point C 0 of each cluster. it is preferable that the ~C n.

【0027】[0027]

【数8】 (Equation 8)

【0028】この発明による被検査対象のエッジ位置検
出方法では、対象物および背景からなる被検査対象がカ
ラー撮像装置により撮像される。被検査対象のカラー画
像の各点のRGB値が、人の知覚特性に一致した均等色
空間内の各対応点の座標値に変換される。均等色空間の
各対応点の座標値を用いて、被検査対象のカラー画像の
各点の濃淡値が算出されることにより、カラー画像がモ
ノクロ濃淡画像に変換される。そして、得られたモノク
ロ濃淡画像の所定方向に沿った濃淡値の変化特性に基づ
いて、対象物と背景との境界エッジが求められる。
In the method of detecting the edge position of the object to be inspected according to the present invention, the object to be inspected consisting of the object and the background is imaged by the color imaging device. The RGB value of each point of the color image to be inspected is converted into the coordinate value of each corresponding point in the uniform color space that matches the human perception characteristics. The color value is converted into a monochrome grayscale image by calculating the grayscale value of each point of the color image to be inspected using the coordinate value of each corresponding point in the uniform color space. Then, the boundary edge between the object and the background is obtained based on the change characteristic of the gray value along the predetermined direction of the obtained monochrome gray image.

【0029】本発明によるカラーモノクロ画像変換方法
によれば、複数の色で構成される複雑な背景上に対象物
が存在する被検査対象のカラー画像から、対象物を高精
度で抽出することができるようなモノクロ画像を生成す
ることができる。
According to the color / monochrome image conversion method of the present invention, an object can be extracted with high accuracy from a color image of an object to be inspected in which the object exists on a complicated background composed of a plurality of colors. It is possible to generate such a monochrome image.

【0030】本発明による被検査対象のエッジ位置検出
方法は、対象物と背景とからなる被検査対象をカラー撮
像装置により撮像し、被検査対象のカラー画像の各点の
RGB値を人の知覚特性に一致した均等色空間内の各対
応点の座標値に変換し、該均等色空間の各対応点の座標
値を用いて前記カラー画像の各点の濃淡値を算出するこ
とによりカラー画像をモノクロ濃淡画像に変換し、得ら
れたモノクロ濃淡画像の所定方向に沿った濃淡値の変化
特性に基づいて、対象物と背景との境界エッジを求める
ことを特徴とする。
According to the edge position detecting method of the object to be inspected according to the present invention, the object to be inspected consisting of the object and the background is imaged by the color image pickup device, and the RGB value of each point of the color image of the object to be inspected is perceived by a person. A color image is converted by converting the coordinate values of corresponding points in the uniform color space that match the characteristics and calculating the grayscale value of each point of the color image using the coordinate values of the corresponding points in the uniform color space. It is characterized in that it is converted into a monochrome grayscale image, and the boundary edge between the object and the background is obtained based on the change characteristic of the grayscale value along the predetermined direction of the obtained monochrome grayscale image.

【0031】本発明による被検査対象のエッジ位置検出
方法によれば、複数の色で構成される複雑な背景上に対
象物が存在する被検査対象のカラー画像に基づいて、対
象物と背景との境界エッジを高精度で検出することがで
きる。
According to the edge position detecting method of the object to be inspected according to the present invention, the object and the background are detected based on the color image of the object to be inspected in which the object is present on the complicated background composed of a plurality of colors. The boundary edge of can be detected with high accuracy.

【0032】[0032]

【発明の実施の形態】以下、この発明を文字の品質検査
に適用した場合の実施の形態について説明する。
BEST MODE FOR CARRYING OUT THE INVENTION An embodiment in which the present invention is applied to a character quality inspection will be described below.

【0033】〔1〕第1の文字検査処理方法についての
説明
[1] Description of First Character Inspection Processing Method

【0034】図1は、文字検査処理手順を示している。
この文字検査処理は、オフラインで行なわれる設定処理
と、オンラインで行なわれる検査処理とからなる。
FIG. 1 shows a character inspection processing procedure.
The character checking process includes a setting process performed offline and a checking process performed online.

【0035】設定処理では、予め基準となる見本を用い
て、RGB色空間上の各点毎にその点の色に対応する濃
淡値を、クラスタリングにより得られたクラスタ代表点
に基づいて算出し、算出値をルックアップテーブル(L
UT)に格納する。
In the setting process, a gray scale value corresponding to the color of each point on the RGB color space is calculated based on the cluster representative points obtained by clustering, using a reference sample in advance, Lookup table (L
UT).

【0036】検査処理では、対象となる検査品をカラー
カメラで撮像し、カラー入力画像の各画素のRGB値
を、設定処理で予め設定されたLUTを参照することに
より、濃淡値に変換する。得られた濃淡画像は濃淡画像
処理され、検査・認識の判断が行なわれる。
In the inspection process, the target inspection product is imaged by a color camera, and the RGB value of each pixel of the color input image is converted into a gray value by referring to the LUT preset in the setting process. The obtained grayscale image is subjected to grayscale image processing, and the inspection / recognition determination is performed.

【0037】設定処理について詳細に説明する。設定処
理では、まず基準となる見本がカラーCCDカメラ(図
示せず)で撮影されることにより(ステップ1)、基準
見本のカラー画像が得られる(ステップ2)。
The setting process will be described in detail. In the setting process, first, a reference sample is photographed by a color CCD camera (not shown) (step 1) to obtain a color image of the reference sample (step 2).

【0038】得られたカラー画像データは、カメラ出力
のRGB色空間の値から、人間の感覚に合致したL*
* * 均等色空間の値に変換される(ステップ3)。こ
の変換は、具体的には、後述する数式9、10によって
行なわれる。
The obtained color image data is L * a which matches the human sense from the values of the RGB color space of the camera output.
* b * Converted to a value in the uniform color space (step 3). Specifically, this conversion is performed by the following mathematical expressions 9 and 10.

【0039】L* * * 均等色空間上で、クラスタ数
を予め指定可能なK−平均法によって、基準画像のクラ
スタリングが行なわれる(ステップ4)。図2にクラス
タリング結果の一例を示す。そして、クラスタの数、各
クラスタの重心位置(代表点)が求められる(ステップ
5)。
On the L * a * b * uniform color space, clustering of reference images is performed by the K-means method in which the number of clusters can be designated in advance (step 4). FIG. 2 shows an example of the clustering result. Then, the number of clusters and the barycentric position (representative point) of each cluster are obtained (step 5).

【0040】次に、RGB系の色空間上の各点の座標
(0、0、0)〜(255、255、255)に対応す
るL* * * 値が算出され、このL* * * 値と前
記クラスタ重心位置とを基に各L* * * 値に対する
濃淡値が算出される(ステップ6)。この濃淡値の算出
は、具体的には、後述する数式13または14を用いて
行なわれる。そして、RGB系の各座標点に対する濃淡
値がルックアップテーブル(LUT)に格納される(ス
テップ7、8)。
Next, the L * a * b * values corresponding to the coordinates (0,0,0) to (255,255,255) of each point on the RGB color space are calculated, and this L * a is calculated. A gray value for each L * a * b * value is calculated based on the * b * value and the cluster centroid position (step 6). The calculation of the gray value is specifically performed by using the equations 13 or 14 described later. Then, the grayscale value for each coordinate point of the RGB system is stored in the look-up table (LUT) (steps 7 and 8).

【0041】つまり、設定処理においては、不良を含む
基準見本がカメラによって撮像される。そして、得られ
たカラー画像に対して、検査員のティーチングの下でク
ラスタリングが行われ、その結果から得られたクラスタ
リング画像が検査員に表示される。ここでのティーチン
グとは、対象と背景とを検査員が領域もしくはポイント
を判定することではなく、得られた各クラスタが対象か
背景かを検査員が判断することを意味する。クラスタリ
ング結果が良好でない場合は、条件を変更してクラスタ
リングが行なわれる。そしてクラスタの代表点をカラー
モノクロ濃淡画像変換における濃淡値の基準点にして、
濃淡値計算が行われる。求められた濃淡値はLUT(ル
ックアップテーブル)に格納される。
That is, in the setting process, the reference sample including the defect is imaged by the camera. Then, the obtained color image is clustered under the teaching of the inspector, and the clustering image obtained from the result is displayed to the inspector. Teaching here does not mean that the inspector determines the area or the point between the target and the background, but means that the inspector determines whether each obtained cluster is the target or the background. If the clustering result is not good, the condition is changed to perform clustering. Then, using the representative point of the cluster as the reference point of the gray value in the color monochrome gray image conversion,
Gray value calculation is performed. The obtained gray value is stored in the LUT (look-up table).

【0042】検査処理では、検査対象がカラーCCDカ
メラで撮影されることにより(ステップ11)、検査対
象のカラー画像が得られる(ステップ12)。
In the inspection processing, the color image of the inspection object is obtained by photographing the inspection object with the color CCD camera (step 11) (step 12).

【0043】得られたカラー画像のRGB値から、LU
Tを参照して濃淡値が算出され、画像処理が施されるこ
とにより(ステップ13)、濃淡画像が得られる(ステ
ップ14)。
From the RGB values of the obtained color image, LU
A grayscale value is calculated with reference to T, and image processing is performed (step 13) to obtain a grayscale image (step 14).

【0044】そして得られた濃淡画像が、基準画像等の
判定基準と比較されることにより、検査判定が行なわれ
る(ステップ15)。この検査結果は、たとえば、OK
(合格)、かすれ、よごれ、かけ、誤字等の表示ととも
に出力される(ステップ16)。
Then, the grayscale image thus obtained is compared with a determination standard such as a reference image to make an inspection determination (step 15). This inspection result is, for example, OK.
It is output together with the display of (pass), faintness, dirt, call, typographical error, etc. (step 16).

【0045】つまり、検査処理では、先ず撮影した検査
対象のカラー画像に対して、LUTを参照して、カラー
モノクロ画像変換が行われ、濃淡画像が得られる。次に
得られた濃淡画像に対して画像処理が施され、検査員の
ティーチングに基づいた検査判定が下され、検査結果が
出力される。
That is, in the inspection processing, first, a color image is obtained by performing color / monochrome image conversion on the photographed color image to be inspected with reference to the LUT. Next, image processing is performed on the obtained grayscale image, the inspection determination is made based on the teaching of the inspector, and the inspection result is output.

【0046】ステップ3またはステップ6で行なわれ
る、カラー画像のRGB値の、L* * * 均等色空間
の座標系への変換方法について説明する。この変換は、
まず、RGB値を数式9の変換式を用いてXYZ表色系
の座標値X、Y、Zに変換した後、得られたX、Y、Z
値を数式10の変換式を用いてL* * * 表色系の座
標値L* 、a* 、b* に変換することによって行なわれ
る。
Performed in step 3 or step 6
L of the RGB value of the color image*a *b*Uniform color space
A method of converting to the coordinate system will be described. This conversion is
First, the RGB values are converted into the XYZ color system using the conversion formula of Formula 9.
After converting to the coordinate values X, Y, Z of
The value is converted into L using the conversion formula of Formula 10.*a*b*Color system
Standard L*, A*, B*Done by converting to
You.

【0047】[0047]

【数9】 [Equation 9]

【0048】[0048]

【数10】 (Equation 10)

【0049】但し、X0、Y0、Z0は照明光源の三刺激値と
いわれるものであり、照明光源が標準の光Cの場合は、
数式11で表される。
However, X 0 , Y 0 and Z 0 are called tristimulus values of the illumination light source, and when the illumination light source is the standard light C,
It is expressed by Equation 11.

【0050】[0050]

【数11】 [Equation 11]

【0051】照明光源が標準の光D65の場合には、X0
Y0、Z0は数式12で表される。
When the illumination light source is the standard light D 65 , X 0 ,
Y 0 and Z 0 are represented by Expression 12.

【0052】[0052]

【数12】 (Equation 12)

【0053】ところで、印刷物に限らず一般に、複雑な
色彩をもった背景の上に文字が描かれる場合、文字を判
読し易くするために、文字には背景の色彩と感覚的にあ
る程度隔たった色が用いられる。そこで、人の感覚的な
色の隔たりを表す色差(均等色空間における距離)を用
いることにより、文字と背景とを分離することは可能で
あると考えられる。
By the way, when a character is drawn on a background having a complicated color, not limited to a printed matter, the character has a color which is sensuously separated from the background color in order to make the character easy to read. Is used. Therefore, it is considered possible to separate the character from the background by using the color difference (distance in the uniform color space) that represents the human sense of color separation.

【0054】一方、図3に示すような”かすれ”、”に
じみ”、あるいは”汚れ”といった印刷欠陥は、文字の
色と、本来その位置に存在する背景の色との中間の色を
もつものと考えられる。即ち、欠陥のある画素は、色空
間上において文字の点の色と、背景の色の点(文字の
色、背景の色といっても実際には色空間上では一つの点
ではなく空間的な拡がりをもっている)を結ぶ線分上の
いずれかの位置に存在するものと考えられる。
On the other hand, a print defect such as "blurring", "bleeding", or "dirt" as shown in FIG. 3 has an intermediate color between the character color and the background color originally present at that position. it is conceivable that. That is, a defective pixel is a point of a character in the color space and a point of a background color (the character color and the background color are actually not a single point in the color space but a spatial point). It is considered to be present at some position on the line segment connecting the lines.

【0055】この場合、背景の色が複雑であれば、文字
と背景の各色との色差は、背景色ごとに異なってくる。
例えば青と水色の背景の上に黒の文字が書かれているよ
うな場合、黒と水色よりも黒と青の方が明らかに色差が
小さくなる。従って、単純に文字の色からの色差のみを
利用して、欠陥を分離することは困難である。
In this case, when the background color is complicated, the color difference between the character and each background color is different for each background color.
For example, when black characters are written on a blue and light blue background, the color difference between black and blue is obviously smaller than that between black and light blue. Therefore, it is difficult to separate the defects simply by using the color difference from the character color.

【0056】以上のような点を踏まえて、文字と欠陥、
背景と欠陥との分離を容易にすることを前提として次の
ようなカラーモノクロ画像変換手法を用いることにす
る。
Based on the above points, characters and defects,
The following color-monochrome image conversion method is used on the assumption that the background and the defect can be easily separated.

【0057】検査の基準となる欠陥を含まない基準画像
を先ず用意し、予めこの画像を何らかの方法(例えばK
−平均アルゴリズム)の手法によりクラスタリングし、
クラスタ数、各クラスタの代表点(ここではそのクラス
タに属する全ての画素の色空間上での座標値を平均した
値、即ち重心をこれに当てる)を求める。
First, a reference image which does not include a defect serving as an inspection reference is prepared, and this image is prepared in advance by some method (for example, K
-Averaging algorithm)
The number of clusters and a representative point of each cluster (here, a value obtained by averaging the coordinate values on the color space of all pixels belonging to the cluster, that is, the center of gravity is applied to this) are obtained.

【0058】ここではクラスタリング結果が、図2に示
すように、N+1個のクラスタに分離された場合につい
て説明する。同図において文字を構成する画素が主に含
まれるクラスタ0の代表点をC0 、それ以外のクラスタ
1〜Nの代表点をそれぞれC 1 、C2 、・・・ 、CN とす
る。
Here, the clustering result is shown in FIG.
As shown in Fig.
Will be explained. In the figure, the pixels that make up the characters are mainly included.
The representative point of cluster 00, Other clusters
Representative points of 1 to N are C 1, C2, ..., CNToss
You.

【0059】このときL* * * 均等色空間上の点A
の画素の濃淡値DA は、C0 とCn(n=1〜N)とを
結ぶ線分C0 n の長さLn 、点Aと各線分C0 n
の距離ln 及び代表点C0 と点Aとの距離LA を用いて
数式13により求められる。
At this time, a point A on the L * a * b * uniform color space
The gray value D A of the pixel, C 0 and C n (n = 1~N) length of the line segment C 0 C n connecting the L n, the distance between the point A and the line segment C 0 C n l n And the distance L A between the representative point C 0 and the point A are used to obtain the value by Expression 13.

【0060】[0060]

【数13】 (Equation 13)

【0061】ただし、Kは濃淡変化の勾配を与える定数
である。尚、点Aが直線C0 n 上にある場合には数式
13において分母が0になるため、この場合は数式14
が用いられる。
However, K is a constant that gives the gradient of the gradation change. When the point A is on the straight line C 0 C n , the denominator in Expression 13 is 0. In this case, Expression 14
Is used.

【0062】[0062]

【数14】 [Equation 14]

【0063】これらの式により、濃淡値は点C0 におい
て0に、C1 、C2 、・・・ 、CN の各点において等しく
Kになる。そしてC0 を通る任意の直線上の全ての点の
濃淡値は、点C0 からの距離に比例する。また濃淡値の
等しい点を結んだ等濃度面は全周に亙って連続で、尚且
各直線C0 n の近傍において直線に直交する。
From these equations, the gray value becomes 0 at the point C 0 and becomes equal K at the points C 1 , C 2 , ..., C N. Then, the gray value of all points on an arbitrary straight line passing through C 0 is proportional to the distance from the point C 0 . Further, the isodensity surface connecting the points having the same gray value is continuous over the entire circumference, and is orthogonal to the straight lines in the vicinity of each straight line C 0 C n .

【0064】色空間を3次元から2次元に簡略化した本
手法及び従来手法によるカラーモノクロ画像変換のモデ
ルを図4に示す。同図から従来の手法では(b)のよう
に等濃度面が平面状(明度による変換手法)、もしくは
(c)のように同心球状(色差による変換手法)となる
いわば線形な変換であったのに対し、(a)に示す本手
法では等濃度面は凹凸のあるいびつな球面状となる。
FIG. 4 shows a model of color monochrome image conversion by the present method and the conventional method in which the color space is simplified from three-dimensional to two-dimensional. From the figure, the conventional method is a linear conversion in which the iso-concentration surface is flat (conversion method by lightness) as in (b) or concentric spherical (conversion method by color difference) as in (c). On the other hand, in the present method shown in (a), the iso-concentration surface has an irregular spherical surface with irregularities.

【0065】このような非線形な変換を行うことによ
り、背景のうち特に代表的な背景色の影響を重点的に取
り除き欠陥の抽出を容易にすることが期待される。
By performing such a non-linear conversion, it is expected that the influence of a typical background color of the background will be intensively removed to facilitate the extraction of defects.

【0066】例えば図5の(a)のような背景に濃淡が
ある場合の文字の欠陥検出を行う場合、従来手法によれ
ば(c)のように背景に濃淡が現れ文字の分離が難しく
なるのに対し、本手法によれば(b)に示すように背景
の濃度が均一になり、文字の分離が行い易くなる。
For example, in the case of detecting a defect of a character when there is a shade in the background as shown in FIG. 5A, according to the conventional method, the shade appears in the background as shown in FIG. 5C and the character separation becomes difficult. On the other hand, according to the present method, the background density becomes uniform as shown in (b), and the characters can be easily separated.

【0067】尚前記設定処理におけるLUTを設定する
のに要した時間(クラスタリングに要する時間を含まな
い)は、Silicon Graphics Indigo2(CPU:MIPS R4000, 1
00MH Z ) 上で約0.2秒、カラーモノクロ画像変換処理
に要した時間は同じく約0.3秒であった。表1にこの
実験の条件を示す。
The LUT in the setting process is set.
Time taken to
I) is Silicon Graphics Indigo2(CPU: MIPS R4000, 1
00MH Z) About 0.2 seconds above, color monochrome image conversion processing
It also took about 0.3 seconds. This in Table 1
The experimental conditions are shown.

【0068】[0068]

【表1】 [Table 1]

【0069】設定処理を行なわずに、被検査対象のカラ
ー画像をLUTを用いずに逐次濃度値変換して濃淡画像
を得ることも可能であるが、その場合LUTを用いる場
合の倍以上の時間を処理に費やすことを意味する。即ち
LUTを用いれば被検査対象の変換処理は0.3秒でで
きるということである。
It is also possible to obtain a grayscale image by sequentially converting the color image of the object to be inspected without using the LUT without performing the setting process, but in that case, it is more than twice as long as when the LUT is used. Means spending on processing. That is, if the LUT is used, the conversion process of the inspection object can be performed in 0.3 seconds.

【0070】〔2〕第2の文字検査方法についての説明[2] Description of Second Character Inspection Method

【0071】この第2の文字検査方法では、前記第1の
文字検査方法とは異なり、クラスタの代表点として重心
以外の点を用い、且つ点Aの濃淡値DA を対象クラスタ
0から各クラスタ代表点C1 〜Cn までの距離ではな
く、AとC0 とCn とのなす角度θn を用いて算出す
る。尚、その他は第1の文字検査方法と同じである。
In the second character inspection method, unlike the first character inspection method, a point other than the center of gravity is used as the representative point of the cluster, and the gray value D A of the point A is set from the target cluster C 0. The calculation is performed using not the distance from the cluster representative points C 1 to C n but the angle θ n formed by A, C 0 and C n . The rest is the same as the first character inspection method.

【0072】クラスタ代表点の決定に関しては、図6
(a)に示すようにクラスタを構成する画素の分布を見
れば、必ずしもその重心がクラスタ内に存在するわけで
はなく、クラスタの広がりかたによっては画素の分布が
ないクラスタ外に重心が生じるおそれがある。
Regarding the determination of the cluster representative points, FIG.
Looking at the distribution of the pixels forming the cluster as shown in (a), the center of gravity does not always exist in the cluster, and the center of gravity may occur outside the cluster where there is no pixel distribution depending on how the cluster is spread. There is.

【0073】そこであらゆるクラスタにおいて代表点を
適切に決定するために次のような手順で代表点を決定し
た。
Therefore, in order to appropriately determine the representative point in every cluster, the representative point was determined by the following procedure.

【0074】図7に示すように、先ず一つのクラスタに
所属する全ての画素についてL* * * 均等色空間の
各軸へ投影し、各軸上の各点において射影された画素の
累積値を算出し、各軸の最大の累積値を示す座標値(図
ではp、q、r)をそのクラスタの代表点の画素値とし
て設定する。
As shown in FIG. 7, first, one cluster is created.
L for all pixels to which it belongs*a *b*Of uniform color space
Of the projected pixels at each point on each axis
The cumulative value is calculated, and the coordinate value that shows the maximum cumulative value of each axis (Fig.
Let p, q, r) be the pixel value of the representative point of the cluster
To set.

【0075】このようにすることによって図6(b)に
示すように代表点は必ず画素の分布のある領域に設定さ
れることになる。
By doing so, the representative point is always set in a region having a pixel distribution as shown in FIG. 6 (b).

【0076】次に点Aの濃淡値DA の求め方について説
明する。前記第1の文字検査方法では点Aから線分C0
n までの距離ln を用いて、点Aの濃度値が算出され
ている。しかしながら、距離ln を用いて濃度値を算出
した場合には、図8(a)に示すように、線分C0 n
と点A1 との距離および線分C0 n と点A2 との距離
が等しくなり、L* * * 均等色空間の異なる位置に
ありながら同じ濃淡値を示す点A1 およびA2 が存在す
ることになり、対象と背景の分離化がうまく行えないお
それがある。
Next, how to obtain the grayscale value D A of the point A will be described. In the first character inspection method, the line segment C 0 from the point A
The density value at the point A is calculated using the distance l n to C n . However, when the density value is calculated using the distance l n , the line segment C 0 C n as shown in FIG.
And the point A 1 and the line segment C 0 C n and the point A 2 are equal, and the points A 1 and A have the same gray value at different positions in the L * a * b * uniform color space. Since there is 2 , there is a possibility that the target and background will not be separated well.

【0077】そこで、図8(b)に示すようにAC0
n の角度θn を用いると、点A1 の角度θ1 と点A2
角度θ2 が同じにならないので、第1の文字検査方法の
欠点が解消されることになる。
Therefore, as shown in FIG. 8B, AC 0 C
With n of the angle theta n, the angle theta 2 of the angle theta 1 and point A 2 at the point A 1 is not the same, so that the drawbacks of the first character testing method is eliminated.

【0078】図11は、クラスタリング結果の一例を示
している。また、数式15は、AC 0 n の角度θn
用いて濃淡値を算出する演算式を示している。
FIG. 11 shows an example of the clustering result.
doing. Equation 15 is AC 0CnAngle θnTo
An arithmetic expression for calculating the gray value by using is shown.

【0079】[0079]

【数15】 (Equation 15)

【0080】数式15において、Ln はC0 n 間の距
離、LA はC0 A間の距離、θn はAC0 n の角度を
表し、Kは濃淡勾配を与える係数を表している。
In Equation 15, L n is the distance between C 0 C n , L A is the distance between C 0 A, θ n is the angle of AC 0 C n , and K is a coefficient that gives a gradation gradient. There is.

【0081】また、関数f(x)は、図9に示すような
S字状の関数であり、対象と背景との境界の鮮鋭化を行
なう関数である。この関数f(x)によって、均等色空
間において、対象クラスタ及び背景クラスタの近傍での
濃淡変化を緩やかにし、中間付近での濃度変化を急にす
ることが可能となる。したがって、図10に示すよう
に、等濃度面は、背景と対象との境界近傍で密(急)と
なり、そのほかのところでは疎(緩)となる。
Further, the function f (x) is an S-shaped function as shown in FIG. 9, and is a function for sharpening the boundary between the object and the background. With the function f (x), it is possible to make the change in density near the target cluster and the background cluster gradual and make the change in density near the middle abrupt in the uniform color space. Therefore, as shown in FIG. 10, the iso-concentration surface becomes dense (abrupt) near the boundary between the background and the object, and becomes sparse (slow) at other places.

【0082】第2の文字検査方法を用いて、図12に示
す5色の領域からなるサンプルをカラープリンタ出力し
たものを実験サンプルとして用い、これをカラーカメラ
で撮影した画像を基準画像とし、中央のピンクの領域
を対象物、そのほかの領域〜を背景として画像変換
実験を行った。
Using the second character inspection method, a sample consisting of five color areas shown in FIG. 12 was output as a color printer and used as an experimental sample. An image taken by a color camera was used as a reference image, and the center image was used. An image conversion experiment was conducted using the pink area of the object as the target and the other areas as the background.

【0083】LUTの入力にはR、G、Bの各上位5b
itづつを割り当て、出力を8bitの濃淡値とした。
また、K=200とした。
The upper 5b of each of R, G, and B is input to the LUT.
It was assigned to each and the output was set to a gray value of 8 bits.
Further, K = 200.

【0084】この変換結果から、上記第2の文字検査方
法の変換方法は、従来あるいは上記第1の文字検査方法
による変換方法に比して、対象と背景との分離がさらに
明確になり、第1の文字検査方法と同等に背景の濃淡値
が均一になっていることが分かった。
From this conversion result, in the conversion method of the second character inspection method, the separation between the object and the background becomes clearer as compared with the conversion method of the related art or the first character inspection method. It was found that the gray value of the background was uniform as in the case of the character inspection method of 1.

【0085】また、カラー画像を2値ではなく濃淡画像
に変換することによる様々な利点のうち、生産システム
において必要と思われるサブピクセル単位でのエッジ位
置検出の可能性の検証実験を行った。この場合サンプル
を微動ステージに載せ、一方向に平行移動させながら撮
影し、画像の対象と背景の境界付近での1画素の画像変
換後の濃淡値の変化を調べた。
Further, among various advantages of converting a color image into a grayscale image instead of a binary image, a verification experiment was conducted on the possibility of edge position detection in subpixel units which is considered necessary in a production system. In this case, the sample was placed on a fine movement stage, photographed while moving in parallel in one direction, and the change in the gray value after image conversion of one pixel near the boundary between the object and the background of the image was examined.

【0086】画像上の1画素の幅はサンプル上で約32
0μmであり、1回の移動量は40μmとした。この結
果を図13に示す。但し破線は理想の濃淡変化を示す。
この図より、濃淡変化の具合は多少の鈍化が見られるも
のの濃淡値が移動量にほぼ比例しており、画素幅以下の
単位でのエッジ位置検出が十分可能なことが分かる。
The width of one pixel on the image is about 32 on the sample.
It was 0 μm, and the amount of movement per time was 40 μm. FIG. 13 shows the result. However, the broken line shows the ideal grayscale change.
From this figure, it can be seen that although the degree of change in shade is somewhat blunted, the shade value is almost proportional to the amount of movement, and edge position detection is possible in units of pixel width or less.

【0087】〔3〕エッジ位置検出方法についての説明[3] Description of Edge Position Detection Method

【0088】以下、上記第1の文字検査方法または第2
の文字検査方法で得られた濃淡画像から、検査対象のエ
ッジ位置を検出する方法について説明する。
Hereinafter, the first character inspection method or the second character inspection method
A method for detecting the edge position of the inspection target from the grayscale image obtained by the character inspection method will be described.

【0089】説明の便宜上、検査対象が図12に示す5
色の領域からなるサンプルであるとする。そして、この
検査対象に対して、上記第1の文字検査方法または第2
の文字検査方法で得られた濃淡画像が図14に示されて
いるものとする。図14において、は対象物を、〜
は背景を示している。そして、得られた濃淡画像にお
いて、背景〜の濃淡値は高く、対象物の濃淡値は
0付近の低い値であるとする。
For convenience of explanation, the inspection target is 5 shown in FIG.
It is assumed that the sample is a color region. The first character inspection method or the second character inspection method is applied to the inspection target.
It is assumed that the grayscale image obtained by the character inspection method is shown in FIG. In FIG. 14, is an object,
Indicates the background. Then, in the obtained grayscale image, the grayscale values of the background to are high, and the grayscale value of the object is low near 0.

【0090】図15は、たとえば背景と、対象物と
の境界のエッジEの位置を検出する方法を示している。
FIG. 15 shows a method for detecting the position of the edge E at the boundary between the background and the object, for example.

【0091】先ず、変数iに0が設定される(ステップ
21)。背景領域において、画素位置がY=iで、X
方向に隣接する3画素が選択される(ステップ22)。
First, 0 is set to the variable i (step 21). In the background area, the pixel position is Y = i and X is
Three pixels adjacent in the direction are selected (step 22).

【0092】次に、3画素の濃淡値の平均値が算出さ
れ、算出された平均値がY=iでの濃度値とされる(ス
テップ23)。
Next, the average value of the grayscale values of the three pixels is calculated, and the calculated average value is used as the density value at Y = i (step 23).

【0093】次に、ステップ23で得られた濃淡値が所
定値以下でかつ前回算出された濃淡値に対する変化量が
所定値以下あるという条件を満たしたか否かが判別され
る(ステップ24)。
Next, it is judged whether or not the condition that the gradation value obtained in step 23 is less than or equal to a predetermined value and the amount of change with respect to the previously calculated gradation value is less than or equal to a predetermined value is satisfied (step 24).

【0094】上記条件で満たされなかった場合には、変
数iが1だけインクリメント(i←i+1)された後
(ステップ25)、ステップ22に戻る。したがって、
上記条件が満たされるまで、ステップ22〜25の処理
が繰り返される。つまり、ステップ23で得られた濃淡
値が所定値以下でかつ前回算出された濃淡値に対する変
化量が所定値以下であるという条件が満たされるまで、
Y座標が0から1つずつ大きくされ、各Y座標における
濃淡値が算出される。このようにして、算出された濃淡
値の変化特性曲線を図16に示す。
If the above conditions are not satisfied, the variable i is incremented by 1 (i ← i + 1) (step 25) and then the process returns to step 22. Therefore,
The processes of steps 22 to 25 are repeated until the above conditions are satisfied. That is, until the condition that the gray value obtained in step 23 is less than or equal to the predetermined value and the amount of change with respect to the previously calculated gray value is less than or equal to the predetermined value is satisfied,
The Y coordinate is increased by 1 from 0, and the gray value at each Y coordinate is calculated. FIG. 16 shows the change characteristic curve of the gray value calculated in this way.

【0095】ステップ23で得られた濃淡値が所定値以
下でかつ前回算出された濃淡値に対する変化量が所定値
以下であるという条件が満たされると(ステップ24で
YES)、ステップ26に移行し、それまでに得られた
濃淡値の変化特性に基づいて、エッジ位置が算出され
る。たとえば、濃淡値の変化特性曲線の2次微分が求め
られ、そのゼロ交差点により算出された位置(図16に
Pで示す)がエッジ位置とされる。
When the condition that the grayscale value obtained in step 23 is less than or equal to the predetermined value and the amount of change with respect to the previously calculated grayscale value is less than or equal to the predetermined value is satisfied (YES in step 24), the process proceeds to step 26. The edge position is calculated based on the grayscale value change characteristics obtained up to that point. For example, the second derivative of the change characteristic curve of the gray value is obtained, and the position (indicated by P in FIG. 16) calculated by the zero crossing point is set as the edge position.

【0096】なお、上記のエッジ位置検出方法では、ス
テップ23でX方向に隣接する3画素が選択され、選択
された3画素の平均値が算出されているが、ステップ2
3において、1画素のみを選択してもよい。さらに、ス
テップ23において、3以外の複数の画素を選択し、選
択した複数画素の平均をステップ24で算出するように
してもよい。
In the above edge position detecting method, the three pixels adjacent in the X direction are selected in step 23, and the average value of the selected three pixels is calculated.
In step 3, only one pixel may be selected. Further, a plurality of pixels other than 3 may be selected in step 23, and the average of the selected plurality of pixels may be calculated in step 24.

【0097】[0097]

【発明の効果】本発明によるカラーモノクロ画像変換方
法を、印刷文字や工業製品の美観検査等の被検査対象の
検査に用いれば、2値画像や従来の濃淡変換手法を用い
た場合に比べて広く、且つ柔軟な検査に対応でき、また
現場調整も容易になるという効果が期待できる。
When the color / monochrome image conversion method according to the present invention is used to inspect an object to be inspected such as a printed character or an aesthetic inspection of an industrial product, compared to the case where a binary image or a conventional grayscale conversion method is used. A wide and flexible inspection can be supported, and on-site adjustment can be expected to be easy.

【0098】しかも、この場合の被検査対象は2種類以
上の色調からなる複雑な背景から特定の色彩を抽出する
場合でも抽出する色から各背景色までの色度差が考慮さ
れ、背景に影響されにくい対象の分離が可能となる効果
が期待できる。
In addition, in this case, the object to be inspected takes into consideration the chromaticity difference from the extracted color to each background color even when extracting a specific color from a complicated background composed of two or more types of color tones, and influences the background. It can be expected that an object that is difficult to be separated can be separated.

【0099】また代表点を画素の最頻点とし点Aと各ク
ラスタのなす角度を用いて濃淡値を求めるようにすれば
対象の背景との分離がさらに明確化し、且つサブピクセ
ル単位でのエッジ位置検出の実用性が確保される効果が
ある。
If the representative point is the mode of the pixel and the gray value is obtained by using the angle formed by the point A and each cluster, the separation from the target background is further clarified, and the edge in the sub-pixel unit is determined. This has the effect of ensuring the practicality of position detection.

【0100】本発明による被検査対象のエッジ位置検出
方法によれば、背景が複数色で構成されていても、背景
の色調に左右されずに対象物と背景との境界エッジを求
めることができるようになる。
According to the edge position detecting method of the object to be inspected according to the present invention, even if the background is composed of a plurality of colors, the boundary edge between the object and the background can be obtained without being influenced by the color tone of the background. Like

【図面の簡単な説明】[Brief description of drawings]

【図1】カラーモノクロ画像変換方法のアルゴリズムを
示す図である。
FIG. 1 is a diagram showing an algorithm of a color / monochrome image conversion method.

【図2】本発明に用いられる均等色空間のイメージ図で
ある。
FIG. 2 is an image diagram of a uniform color space used in the present invention.

【図3】文字検査におけるにじみ、かすれの例を示す図
である。
FIG. 3 is a diagram showing an example of blurring and blurring in a character inspection.

【図4】本方法(a)と従来手法(b)(c)を比較し
た等濃度面のイメージ図である。
FIG. 4 is an image diagram of an iso-concentration surface comparing the present method (a) with the conventional methods (b) and (c).

【図5】カラー画像(a)を処理した時の本方法(b)
と従来手法(c)とを比較する図である。
FIG. 5: This method (b) when processing a color image (a)
It is a figure which compares with conventional method (c).

【図6】(a)(b)はクラスタ代表点の相異なる設定
の方法を示す図である。
6A and 6B are diagrams showing a method of differently setting cluster representative points.

【図7】クラスタの代表点の画素値を求める方法の概念
図である。
FIG. 7 is a conceptual diagram of a method of obtaining a pixel value of a representative point of a cluster.

【図8】(a)(b)は濃淡値を求めるための相異なる
方法を表す図である。
8A and 8B are diagrams showing different methods for obtaining a gray value.

【図9】関数f(x)の特性図である。FIG. 9 is a characteristic diagram of a function f (x).

【図10】第2実施例による均等色空間状の等濃度面の
様子を示す図である。
FIG. 10 is a diagram showing a state of a uniform density space-like uniform density surface according to the second embodiment.

【図11】均等色空間上のクラスタ配置状況を表す図で
ある。
FIG. 11 is a diagram illustrating a cluster arrangement situation on a uniform color space.

【図12】実験に用いたサンプルを示す図である。FIG. 12 is a diagram showing a sample used in an experiment.

【図13】エッジ検出結果を示す図である。FIG. 13 is a diagram showing an edge detection result.

【図14】第1の被検査対象の検査方法または第2の被
検査対象の検査方法によって得られた濃淡画像の一例を
示す模式図である。
FIG. 14 is a schematic diagram showing an example of a grayscale image obtained by the first inspection target inspection method or the second inspection target inspection method.

【図15】エッジ位置検出方法を示すフローチャートで
ある。
FIG. 15 is a flowchart showing an edge position detecting method.

【図16】エッジ位置検出方法において求められた濃淡
値の変化特性を示すグラフである。
FIG. 16 is a graph showing the change characteristic of the gray value obtained by the edge position detecting method.

Claims (7)

【特許請求の範囲】[Claims] 【請求項1】 対象物および背景からなる被検査対象の
カラー画像の各点のRGB値を、人の知覚特性に一致し
た均等色空間内の各対応点の座標値に変換し、 均等色空間の各対応点の座標値を用いて、被検査対象の
カラー画像の各点の濃淡値を算出することにより、カラ
ー画像をモノクロ濃淡画像に変換するカラーモノクロ画
像変換方法。
1. A uniform color space is obtained by converting RGB values of respective points of a color image of an object to be inspected including an object and a background into coordinate values of corresponding points in the uniform color space that match human perception characteristics. A color-monochrome image conversion method for converting a color image into a monochrome gray-scale image by calculating the gray-scale value of each point of the color image to be inspected using the coordinate value of each corresponding point.
【請求項2】 被検査対象のカラー画像の各点のRGB
値を、XYZ表色系の座標値(x,y,z)に変換し、 得られたXYZ表色系の座標値(x,y,z)を、均等
色空間としてのL* * * 表色系の座標値(L* ,a
* ,b* )に変換し、 L* * * 表色系における全画素を、対象物が主とし
て含まれるクラスタと、1または複数の背景のクラスタ
とに分類し、 対象物が主として含まれるクラスタの代表点をC0 、背
景のクラスタの代表点をC1 〜CN 、L* * * 系の
任意の点Aの濃淡値をDA 、C0 とCn (n=1〜N)
とを結ぶ線分C0 n の長さをLn 、点Aと各線分C0
n との距離をln 、C0 と点Aとの距離をLA とした
場合に、任意の点Aの濃淡値DA を求める数式1に基づ
いて、前記被検査対象のカラー画像の各点のRGB値に
対応する濃淡値を算出する請求項1に記載のカラーモノ
クロ画像変換方法。 【数1】
2. RGB of each point of a color image to be inspected
The values are converted into coordinate values (x, y, z) in the XYZ color system, and the obtained coordinate values (x, y, z) in the XYZ color system are equalized.
L as color space*a *b*Coordinate value of color system (L*, A
*, B*) Is converted to L*a*b*All pixels in the color system are mainly the object
Included clusters and one or more background clusters
And the representative point of the cluster mainly containing the object is C0, Back
The representative point of the scene cluster is C1~ CN, L*a*b*Ancestry
The gray value of arbitrary point A is DA, C0And Cn(N = 1 to N)
Line segment C that connects with0CnL is the length ofn, Point A and each line segment C0
CnDistance fromn, C0And the distance between point A and LAAnd
In this case, the grayscale value D of arbitrary point AABased on Equation 1
The RGB values at each point of the color image to be inspected.
The color object according to claim 1, wherein the corresponding gray value is calculated.
Black image conversion method. [Equation 1]
【請求項3】 被検査対象の基準見本のカラー画像を生
成し、 基準見本のカラー画像の各点のRGB値を、XYZ表色
系の座標値(x,y,z)に変換し、 得られたXYZ表色系の座標値(x,y,z)を、均等
色空間としてのL* * * 表色系の座標値(L* ,a
* ,b* )に変換し、 L* * * 表色系における全画素を、対象物が主とし
て含まれるクラスタと、1または複数の背景のクラスタ
とに分類し、 対象物が主として含まれるクラスタの代表点をC0 、背
景のクラスタの代表点をC1 〜CN 、L* * * 系の
任意の点Aの濃淡値をDA 、C0 とCn (n=1〜N)
とを結ぶ線分C0 n の長さをLn 、点Aと各線分C0
n との距離をln 、C0 と点Aとの距離をLA とした
場合に、任意の点Aの濃淡値DA を求める数式2に基づ
いて、RGB系の各座標点に対する濃淡値を算出して、
RGB値を濃淡値に変換するテーブルを作成し、 作成されたテーブルに基づいて、被検査対象のカラー画
像の各点のRGB値に対応する濃淡値を算出することを
特徴とする請求項1記載の被検査対象の検査方法。 【数2】
3. A color image of a reference sample to be inspected is produced.
The RGB value of each point of the color image of the reference sample.
The coordinate values (x, y, z) of the XYZ color system are converted into uniform coordinate values (x, y, z).
L as color space*a *b*Coordinate value of color system (L*, A
*, B*) Is converted to L*a*b*All pixels in the color system are mainly the object
Included clusters and one or more background clusters
And the representative point of the cluster mainly containing the object is C0, Back
The representative point of the scene cluster is C1~ CN, L*a*b*Ancestry
The gray value of arbitrary point A is DA, C0And Cn(N = 1 to N)
Line segment C that connects with0CnL is the length ofn, Point A and each line segment C0
CnDistance fromn, C0And the distance between point A and LAAnd
In this case, the grayscale value D of arbitrary point AABased on Equation 2
Then, the gray value for each coordinate point of the RGB system is calculated,
Create a table that converts RGB values into gray values, and use the created table to create a color image to be inspected.
It is possible to calculate the gray value corresponding to the RGB value of each point of the image.
The method for inspecting an object to be inspected according to claim 1. [Equation 2]
【請求項4】 被対象画像のカラー画像の各点のRGB
値を、XYZ表色系の座標値(x,y,z)に変換し、 得られたXYZ表色系の座標値(x,y,z)を、均等
色空間としてのL* * * 表色系の座標値(L* ,a
* ,b* )に変換し、 L* * * 表色系における全画素を、対象物が主とし
て含まれるクラスタと、1または複数の背景のクラスタ
に分類し、 対象物が主として含まれるクラスタの代表点をC0 、背
景のクラスタの代表点をC1 〜CN 、L* * * 系の
任意の点Aの濃淡値をDA 、C0 とCn (n=1〜N)
とを結ぶ線分C0 n の長さをLn 、C0 と点Aとを結
ぶ線分C0 Aの長さをLA 、点AC0 n のなす角度を
θn とした場合に、任意の点Aの濃淡値DA を求める数
式3に基づいて、前記被検査対象のカラー画像の各点の
RGB値に対応する濃淡値を算出する請求項1に記載の
カラーモノクロ画像変換方法。 【数3】
4. RGB of each point of a color image of a target image
The values are converted into coordinate values (x, y, z) in the XYZ color system, and the obtained coordinate values (x, y, z) in the XYZ color system are equalized.
L as color space*a *b*Coordinate value of color system (L*, A
*, B*) Is converted to L*a*b*All pixels in the color system are mainly the object
Included clusters and one or more background clusters
And the representative point of the cluster mainly containing the object is C0, Back
The representative point of the scene cluster is C1~ CN, L*a*b*Ancestry
The gray value of arbitrary point A is DA, C0And Cn(N = 1 to N)
Line segment C that connects with0CnL is the length ofn, C0And point A
Line segment C0The length of A is LA, Point AC0CnThe angle that
θn, Then the gray value D of any point AAThe number to find
Based on Equation 3, for each point of the color image to be inspected,
The grayscale value corresponding to the RGB value is calculated.
Color monochrome image conversion method. [Equation 3]
【請求項5】 被検査対象の基準見本のカラー画像を生
成し、 基準見本のカラー画像の各点のRGB値を、XYZ表色
系の座標値(x,y,z)に変換し、 得られたXYZ表色系の座標値(x,y,z)を、均等
色空間としてのL* * * 表色系の座標値(L* ,a
* ,b* )に変換し、 L* * * 表色系における全画素を、対象物が主とし
て含まれるクラスタと、1または複数の背景のクラスタ
に分類し、 対象物が主として含まれるクラスタの代表点をC0 、背
景のクラスタの代表点をC1 〜CN 、L* * * 系の
任意の点Aの濃淡値をDA 、C0 とCn (n=1〜N)
とを結ぶ線分C0 n の長さをLn 、C0 と点Aとを結
ぶ線分C0 Aの長さをLA 、点AC0 n のなす角度を
θn とした場合に、任意の点Aの濃淡値DA を求める数
式4に基づいて、RGB系の各座標点に対する濃淡値を
算出して、RGB値を濃淡値に変換するテーブルを作成
し、 作成されたテーブルに基づいて、被検査対象のカラー画
像の各点のRGB値に対応する濃淡値を算出することを
特徴とする請求項1記載の被検査対象の検査方法。 【数4】
5. A color image of a reference sample to be inspected is produced.
The RGB value of each point of the color image of the reference sample.
The coordinate values (x, y, z) of the XYZ color system are converted into uniform coordinate values (x, y, z).
L as color space*a *b*Coordinate value of color system (L*, A
*, B*) Is converted to L*a*b*All pixels in the color system are mainly the object
Included clusters and one or more background clusters
And the representative point of the cluster mainly containing the object is C0, Back
The representative point of the scene cluster is C1~ CN, L*a*b*Ancestry
The gray value of arbitrary point A is DA, C0And Cn(N = 1 to N)
Line segment C that connects with0CnL is the length ofn, C0And point A
Line segment C0The length of A is LA, Point AC0CnThe angle that
θn, Then the gray value D of any point AAThe number to find
Based on equation 4, the gray value for each coordinate point of the RGB system is calculated.
Create a table that calculates and converts RGB values into gray values
Then, based on the created table, the color image to be inspected
It is possible to calculate the gray value corresponding to the RGB value of each point of the image.
The method for inspecting an object to be inspected according to claim 1. (Equation 4)
【請求項6】 各クラスタに所属する全ての画素をL*
* * 表色系の各軸に対して射影し、それぞれの軸上
での最頻点を各クラスタの代表点C0 〜Cnとすること
を特徴とする上記請求項4および5のいずれかに記載の
記載のカラーモノクロ画像変換方法。
6. All pixels belonging to each cluster are L *.
6. The projection according to each axis of the a * b * color system, and the most frequent points on each axis are set as the representative points C 0 to C n of each cluster. The color monochrome image conversion method described in any one of the above.
【請求項7】 対象物および背景からなる被検査対象を
カラー撮像装置により撮像し、 被検査対象のカラー画像の各点のRGB値を、人の知覚
特性に一致した均等色空間内の各対応点の座標値に変換
し、 均等色空間の各対応点の座標値を用いて、被検査対象の
カラー画像の各点の濃淡値を算出することにより、カラ
ー画像をモノクロ濃淡画像に変換し、 得られたモノクロ濃淡画像の所定方向に沿った濃淡値の
変化特性に基づいて、対象物と背景との境界エッジを求
める被検査対象のエッジ位置検出方法。
7. An object to be inspected composed of an object and a background is imaged by a color image pickup device, and RGB values at respective points of a color image of the object to be inspected are associated with each other in a uniform color space in accordance with human perceptual characteristics. Convert the color image to a monochrome grayscale image by converting the color values to the coordinate values of the points and using the coordinate values of the corresponding points in the uniform color space to calculate the grayscale value of each point of the color image to be inspected. A method for detecting an edge position of an object to be inspected, which obtains a boundary edge between an object and a background based on a change characteristic of a gray value along a predetermined direction of the obtained monochrome gray image.
JP8029742A 1995-05-16 1996-02-16 Color-monochromatic image conversion method and edge position detection method for object to be inspected Pending JPH0993443A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP8029742A JPH0993443A (en) 1995-05-16 1996-02-16 Color-monochromatic image conversion method and edge position detection method for object to be inspected

Applications Claiming Priority (5)

Application Number Priority Date Filing Date Title
JP11702795 1995-05-16
JP17866395 1995-07-14
JP7-117027 1995-07-14
JP7-178663 1995-07-14
JP8029742A JPH0993443A (en) 1995-05-16 1996-02-16 Color-monochromatic image conversion method and edge position detection method for object to be inspected

Publications (1)

Publication Number Publication Date
JPH0993443A true JPH0993443A (en) 1997-04-04

Family

ID=27286705

Family Applications (1)

Application Number Title Priority Date Filing Date
JP8029742A Pending JPH0993443A (en) 1995-05-16 1996-02-16 Color-monochromatic image conversion method and edge position detection method for object to be inspected

Country Status (1)

Country Link
JP (1) JPH0993443A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000175218A (en) * 1998-12-03 2000-06-23 Toshiba Eng Co Ltd Color transformation device
JP2009111979A (en) * 2007-10-30 2009-05-21 Sharp Corp Method and system of estimating background color
JP2009276902A (en) * 2008-05-13 2009-11-26 Toshiba Corp Processor, processing method, and processing program for multi-spectrum image
JP2010016533A (en) * 2008-07-02 2010-01-21 Kyocera Mita Corp Image processor, image processing method and image processing program
US8615129B2 (en) 2007-01-18 2013-12-24 Fujitsu Limited Pattern separating extraction device, and pattern separating extraction method
CN105208398A (en) * 2015-09-22 2015-12-30 西南交通大学 Method for acquiring real-time background image of road
KR20170121048A (en) * 2016-04-22 2017-11-01 가부시키가이샤 도쿄 웰드 Defect detection method and defect detection system
CN107493431A (en) * 2017-08-31 2017-12-19 努比亚技术有限公司 A kind of image taking synthetic method, terminal and computer-readable recording medium

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000175218A (en) * 1998-12-03 2000-06-23 Toshiba Eng Co Ltd Color transformation device
US8615129B2 (en) 2007-01-18 2013-12-24 Fujitsu Limited Pattern separating extraction device, and pattern separating extraction method
JP2009111979A (en) * 2007-10-30 2009-05-21 Sharp Corp Method and system of estimating background color
US8014596B2 (en) 2007-10-30 2011-09-06 Sharp Laboratories Of America, Inc. Methods and systems for background color extrapolation
US8121403B2 (en) 2007-10-30 2012-02-21 Sharp Laboratories Of America, Inc. Methods and systems for glyph-pixel selection
JP2009276902A (en) * 2008-05-13 2009-11-26 Toshiba Corp Processor, processing method, and processing program for multi-spectrum image
JP2010016533A (en) * 2008-07-02 2010-01-21 Kyocera Mita Corp Image processor, image processing method and image processing program
CN105208398A (en) * 2015-09-22 2015-12-30 西南交通大学 Method for acquiring real-time background image of road
CN105208398B (en) * 2015-09-22 2018-06-19 西南交通大学 A kind of method for obtaining the real-time Background of road
KR20170121048A (en) * 2016-04-22 2017-11-01 가부시키가이샤 도쿄 웰드 Defect detection method and defect detection system
CN107493431A (en) * 2017-08-31 2017-12-19 努比亚技术有限公司 A kind of image taking synthetic method, terminal and computer-readable recording medium

Similar Documents

Publication Publication Date Title
JP4160258B2 (en) A new perceptual threshold determination for gradient-based local contour detection
JP4006224B2 (en) Image quality determination method, determination device, and determination program
JP4725298B2 (en) Visual inspection method using images
JP4323097B2 (en) Method and system for detecting errors in sample images
US7386167B2 (en) Segmentation technique of an image
WO2007074844A1 (en) Detecting method and detecting system for positions of face parts
JPH0993443A (en) Color-monochromatic image conversion method and edge position detection method for object to be inspected
US20170359485A1 (en) Image processing apparatus and image processing method
JP2005043174A (en) Color irregularity inspection apparatus
JP2002090308A (en) Evaluation system for degree of surface degradation of steel using image processing
JPH1063859A (en) Method for evaluating picture quality and device therefor
JP4315243B2 (en) Evaluation method of color uniformity
JP2005283197A (en) Detecting method and system for streak defect of screen
JP3587029B2 (en) Image inspection method and image inspection device
KR101585187B1 (en) Image Processing Method and Apparatus for Integrated Multi-scale Retinex Based on CIELAB Color Space for Preserving Color
JPH1096696A (en) Method and apparatus for inspecting irregularity in object
JPH10164281A (en) Picture evaluating method and device
Lee et al. Laplacian of Gaussian Based on Color Constancy Algorithm for Surrounding Image Stitching Application
JP2005061856A (en) System for inspecting color unevenness
JP4391071B2 (en) Color variation monitoring method and apparatus
JPH10269352A (en) Image processor and method
JPH0624014B2 (en) Gray image processing method
WO2023074565A1 (en) Machine learning model, computer program, and method
JP3941403B2 (en) Image density unevenness detection method and inspection apparatus
JP2007200289A (en) Method for detection of location of eye