[go: up one dir, main page]

JP2018189562A - Image inspection device - Google Patents

Image inspection device Download PDF

Info

Publication number
JP2018189562A
JP2018189562A JP2017093360A JP2017093360A JP2018189562A JP 2018189562 A JP2018189562 A JP 2018189562A JP 2017093360 A JP2017093360 A JP 2017093360A JP 2017093360 A JP2017093360 A JP 2017093360A JP 2018189562 A JP2018189562 A JP 2018189562A
Authority
JP
Japan
Prior art keywords
color
image
unit
foreground
designation
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
JP2017093360A
Other languages
Japanese (ja)
Other versions
JP6893826B2 (en
Inventor
木戸 学
Manabu Kido
学 木戸
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.)
Keyence Corp
Original Assignee
Keyence Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Keyence Corp filed Critical Keyence Corp
Priority to JP2017093360A priority Critical patent/JP6893826B2/en
Publication of JP2018189562A publication Critical patent/JP2018189562A/en
Priority to JP2021091445A priority patent/JP7117420B2/en
Application granted granted Critical
Publication of JP6893826B2 publication Critical patent/JP6893826B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

PROBLEM TO BE SOLVED: To reduce variations in results of image inspection by reducing a burden on a user related to designation of extraction colors.SOLUTION: An image forming apparatus acquires and displays a spectral image, and receives designation of a region including a plurality of pixels. The image forming apparatus clusters the plurality of pixels included in the designated region, determines representative colors of the clusters, and converts the colors of the pixels forming the spectral image into the representative colors to create a false color image. The image forming apparatus receives designation of extraction colors in the false color image, and creates a gray image on the basis of the distances between the extraction colors and the colors of the pixels of the spectral image of an inspection object. The image forming apparatus executes image inspection by using the gray image.SELECTED DRAWING: Figure 14

Description

本発明は画像検査装置に関する。   The present invention relates to an image inspection apparatus.

商品(ワーク)が設計通りに生産されたかどうかを判定するためにワークを撮像して得られた画像を検査する画像検査装置は非常に有用である。このような画像検査ではワークの形状や寸法、色などが検査される。特許文献1によれば印刷物などの検査対象物を撮像して色情報を取得し、高精度に色検査を実行する色検査装置が提案されている。   An image inspection apparatus that inspects an image obtained by imaging a workpiece in order to determine whether or not a product (work) is produced as designed is very useful. In such image inspection, the shape, dimensions, color, etc. of the workpiece are inspected. According to Patent Document 1, a color inspection apparatus that captures color information by imaging an inspection object such as a printed matter and performs color inspection with high accuracy has been proposed.

特開平09−126890号公報JP 09-126890 A

色検査装置などの画像検査装置で、ユーザは、表示装置に表示されたカラー画像において抽出対象となる色をクリックするなどして選択する。ユーザの選択を容易にするために画像検査装置はスポイトツールなどを提供していることもある。画像検査装置は、スポイトツールにより選択された色とカラー画像における各画素の色との距離に応じてカラー画像をグレー画像(濃淡画像)に変換し、グレー画像を用いてワークの画像検査を実行することがある。また、画像検査装置は、ワークの表面のうち画像検査の対象となる特徴を含む前景領域と、このような特徴を含まない背景領域とのユーザによる指定を受け付けてそれぞれ色を抽出してもよい。これらの場合、ユーザが選択した一つの画素の色が抽出色となるため、ユーザが指定した画素に依存してグレー画像が異なってしまい、画像検査の結果にばらつきが生じてしまう。そこで、本発明は、抽出色の指定に関するユーザの負担を軽減することで、画像検査の結果のばらつきを小さくすることを目的とする。   In an image inspection device such as a color inspection device, a user selects a color to be extracted from a color image displayed on a display device by clicking or the like. In order to facilitate user selection, the image inspection apparatus may provide a dropper tool or the like. The image inspection device converts the color image into a gray image (grayscale image) according to the distance between the color selected by the dropper tool and the color of each pixel in the color image, and executes the image inspection of the workpiece using the gray image There are things to do. In addition, the image inspection apparatus may accept the designation by the user of the foreground region including the feature to be image-inspected on the surface of the workpiece and the background region not including such a feature, and extract the colors respectively. . In these cases, since the color of one pixel selected by the user becomes the extracted color, the gray image differs depending on the pixel designated by the user, and the result of the image inspection varies. Accordingly, an object of the present invention is to reduce variations in the results of image inspection by reducing the burden on the user regarding the designation of an extracted color.

本発明の画像検査装置は、たとえば、
検査対象物についての分光画像を取得する取得部と、
前記取得部により取得された分光画像を表示する表示部と、
前記表示部に表示された分光画像において複数の画素を含む領域の指定を受け付ける領域指定部と、
前記領域指定部により指定された各領域に含まれる複数の画素の色空間座標における位置に応じて、前記分光画像を構成する各画素を、複数のクラスタのうちのいずれかのクラスタに所属させるクラスタリング部と、
前記複数のクラスタのそれぞれについて代表色を決定し、前記分光画像を構成する各画素の色を、各画素が属するクラスタの代表色に変換することでフォルスカラー画像を生成するフォルスカラー画像生成部と、
前記表示部に表示されたフォルスカラー画像において抽出対象となる抽出色の指定を受け付ける抽出色指定部と、
前記分光画像の各画素の色と前記抽出色との色空間内での距離に基づいて前記分光画像をグレー画像に変換する変換部と、
前記変換部により生成されたグレー画像を用いて画像検査を実行する検査部と
を有することを特徴とする。
The image inspection apparatus of the present invention is, for example,
An acquisition unit for acquiring a spectral image of the inspection object;
A display unit for displaying the spectral image acquired by the acquisition unit;
An area designating unit that accepts designation of an area including a plurality of pixels in the spectral image displayed on the display unit;
Clustering in which each pixel constituting the spectral image belongs to any one of a plurality of clusters according to positions in color space coordinates of a plurality of pixels included in each region specified by the region specifying unit. And
A false color image generating unit that determines a representative color for each of the plurality of clusters and generates a false color image by converting the color of each pixel constituting the spectral image into a representative color of the cluster to which each pixel belongs; ,
An extraction color designation unit that accepts designation of an extraction color to be extracted in the false color image displayed on the display unit;
A conversion unit that converts the spectral image into a gray image based on a distance in a color space between the color of each pixel of the spectral image and the extracted color;
And an inspection unit that performs an image inspection using the gray image generated by the conversion unit.

本発明によれば、抽出色の指定に関するユーザの負担が軽減され、画像検査の結果のばらつきも小さくなる。   According to the present invention, the burden on the user regarding the designation of the extracted color is reduced, and the variation in the results of the image inspection is also reduced.

画像検査装置を示す図Diagram showing an image inspection device 照明装置を示す図The figure which shows a lighting device 照明装置を構成する部品を示す図The figure which shows the components which comprise an illuminating device 照明装置の電気的な構成を示す図The figure which shows the electrical structure of an illuminating device 画像処理システムの機能を示す図The figure which shows the function of the image processing system マルチスペクトルイメージングにおけるカラー濃淡変換の原理を示す図Diagram showing the principle of color tone conversion in multispectral imaging 自由形状の指定による色抽出手法を示す図Diagram showing color extraction method by specifying free shape クラスタ化領域の設定を補助するUIを示す図The figure which shows UI which assists the setting of the clustering area クラスタ化領域の設定を補助するUIを示す図The figure which shows UI which assists the setting of the clustering area 抽出色の指定を補助するUIを示す図The figure which shows UI which assists specification of an extraction color 抽出色の調整を補助するUIを示す図The figure which shows UI which assists adjustment of an extraction color 抽出色の調整を補助するUIを示す図The figure which shows UI which assists adjustment of an extraction color 抽出色の調整を補助するUIを示す図The figure which shows UI which assists adjustment of an extraction color 色抽出処理を含む画像検査を示すフローチャートFlow chart showing image inspection including color extraction processing 画像処理システムの機能を示す図The figure which shows the function of the image processing system 画像処理システムの機能を示す図The figure which shows the function of the image processing system 画像処理システムの機能を示す図The figure which shows the function of the image processing system

以下に本発明の一実施形態を示す。以下で説明される個別の実施形態は、本発明の上位概念、中位概念および下位概念など種々の概念を理解するために役立つであろう。また、本発明の技術的範囲は、特許請求の範囲によって確定されるのであって、以下の個別の実施形態によって限定されるわけではない。   An embodiment of the present invention is shown below. The individual embodiments described below will help to understand various concepts, such as the superordinate concept, intermediate concept and subordinate concept of the present invention. Further, the technical scope of the present invention is determined by the scope of the claims, and is not limited by the following individual embodiments.

図1は外観検査システム(画像検査装置8)の一例を示す図である。ライン1は検査対象物であるワーク2を搬送する搬送ベルトなどである。照明装置3は互いに異なる波長の検査光(照明光)を発生する複数の発光素子を有し、各波長の照明光を個別に対象物に照射する照明部の一例である。なお、複数の方向から同時または順番に照明光をワーク2に対して照射するために、複数の同一波長の発光素子が設けられてもよい。カメラ4は照明光により照明された検査対象物からの反射光を受光して輝度画像(分光画像)を生成する撮像手段の一例である。画像処理装置5は、各波長について設定された照明強度で発光素子を順番に点灯させることで画像検査の対象となる検査対象物を照明し、撮像部により取得された複数の検査画像を用いて画像検査を実行する検査部を有する。表示部7は検査に関連する制御パラメータを設定するためのユーザインタフェースや検査画像などを表示する表示装置である。入力部6は、コンソール、ポインティングデバイス、キーボードなどであり、制御パラメータを設定するために使用される。   FIG. 1 is a diagram showing an example of an appearance inspection system (image inspection apparatus 8). A line 1 is a conveyance belt that conveys a workpiece 2 that is an inspection object. The illuminating device 3 is an example of an illuminating unit that has a plurality of light emitting elements that generate inspection light (illumination light) having different wavelengths and irradiates an object with illumination light of each wavelength individually. In order to irradiate the workpiece 2 with illumination light simultaneously or sequentially from a plurality of directions, a plurality of light emitting elements having the same wavelength may be provided. The camera 4 is an example of an imaging unit that receives reflected light from an inspection object illuminated by illumination light and generates a luminance image (spectral image). The image processing device 5 illuminates the inspection target that is the subject of the image inspection by sequentially turning on the light emitting elements with the illumination intensity set for each wavelength, and uses the plurality of inspection images acquired by the imaging unit. An inspection unit that performs image inspection is included. The display unit 7 is a display device that displays a user interface for setting control parameters related to the inspection, an inspection image, and the like. The input unit 6 is a console, a pointing device, a keyboard, or the like, and is used for setting control parameters.

<照明装置の構成>
図2(A)は照明装置3の斜視図である。図2(B)は照明装置3の上面図である。図2(C)は照明装置3の底面図である。図2(D)は照明装置3の側面図である。照明装置3の筐体は上ケース21と下ケース22を有している。下ケース22の下部には複数の光源(LEDなどの発光素子)のそれぞれが出力する光を拡散させる光拡散部材23が配置されている。図2(A)や図2(C)が示すように上ケース21や下ケース22と同様に光拡散部材23も円環状を成している。図2(B)や図2(D)が示すように上ケース21の上面にはコネクタ24が設けられている。コネクタ24には照明装置3に格納されている照明制御基板と画像処理装置5とが通信するためのケーブルが接続される。照明制御基板に実装される一部の機能は照明装置3の外部に照明コントローラとして設けられていてもよい。つまり、照明装置3と画像処理装置5との間には照明コントローラが介在してもよい。
<Configuration of lighting device>
FIG. 2A is a perspective view of the lighting device 3. FIG. 2B is a top view of the lighting device 3. FIG. 2C is a bottom view of the lighting device 3. FIG. 2D is a side view of the lighting device 3. The housing of the lighting device 3 has an upper case 21 and a lower case 22. A light diffusion member 23 for diffusing light output from each of a plurality of light sources (light emitting elements such as LEDs) is disposed below the lower case 22. As shown in FIGS. 2A and 2C, the light diffusion member 23 has an annular shape as in the upper case 21 and the lower case 22. As shown in FIGS. 2B and 2D, a connector 24 is provided on the upper surface of the upper case 21. Connected to the connector 24 is a cable for communication between the illumination control board stored in the illumination device 3 and the image processing device 5. Some functions mounted on the lighting control board may be provided outside the lighting device 3 as a lighting controller. That is, an illumination controller may be interposed between the illumination device 3 and the image processing device 5.

図3(A)は照明装置3に格納されている制御基板31とLED基板32とを示す側面図である。制御基板31は点灯制御部が実装された第二基板の一例である。LED基板32は複数の光源が実装された第一基板の一例である。図3(B)はLED基板32の上面図である。図3(C)は照明装置3のうちLED33の付近を拡大した断面図である。図3(D)はLED基板32の底面図である。図3(E)はLED基板32のうちLED33の付近を拡大した側面図である。   FIG. 3A is a side view showing the control board 31 and the LED board 32 stored in the lighting device 3. The control board 31 is an example of a second board on which a lighting control unit is mounted. The LED substrate 32 is an example of a first substrate on which a plurality of light sources are mounted. FIG. 3B is a top view of the LED substrate 32. FIG. 3C is an enlarged cross-sectional view of the vicinity of the LED 33 in the illumination device 3. FIG. 3D is a bottom view of the LED substrate 32. FIG. 3E is an enlarged side view of the vicinity of the LED 33 in the LED substrate 32.

制御基板31には照明制御基板やコネクタ24が配置されている。光源群を構成するLEDなどの発光素子はLED基板32に搭載されている。図3(B)が示すように、本実施例では四方向から照明光を照射するために四つのLED基板32が設けられている。つまり、一つのLED基板32が一つの照明ブロックを形成している。四方向から照明光を照射可能とすることでフォトメトリックステレオ用の画像を取得できるようになる。つまり、照明装置3はマルチスペクトルイメージング(MSI)だけでなく、フォトメトリックステレオのために利用されてもよい。一つのLED基板32には四つのLED33が配置されている場合、光源群は16個の発光素子により構成される。ただし、より多数の発光素子が設けられてもよい。たとえば、一つのLED基板32には8つのLED33が配置されており、8つのLED33が発光する光の波長はいずれも異なっていてもよい。図3(C)、図3(D)および図3(E)が示すように、複数のLED33のうち隣り合った二つのLED33の間には遮光部材35が配置されている。多数のLED33を密接に配置すると、隣り合った二つのLED33からそれぞれ照射される照明光が光拡散部材23の同一の領域を通過することがある。この場合、点灯パターンに応じて一方のLED33を非点灯とし、かつ、他方のLED33を点灯した場合と、他方のLED33を非点灯とし、かつ、一方のLED33を点灯した場合とで、ワーク2の表面には同一の照明方向から同一の光量で照明光が照射されてしまう。これでは高い精度で検査画像を生成することが難しくなる。そこで、隣り合った二つのLED33の間に遮光部材35を配置することで、隣り合った二つのLED33について光量の均一性と光源の独立性とのバランスを取っている。図3(C)が示すようにLED33の光の射出方向A1と、主な照明方向A2とは一致していない。そこで、反射鏡34を配置することでLED33から射出される光を光拡散部材23の方向へ偏向している。これによりLED33が発光した光を効率よくワーク2へ照射できるようになろう。この例では射出方向A1と反射鏡34の反射方向とが概ね直交しているが、これは光拡散部材23の断面形状が円弧を成しており(図3(C))、円弧に関する角度(中心角)が約90度になっているからである。このように中心角を大きくすることで、照明装置3をワーク2に対して遠ざけたり、近づけたりしてもワーク2の表面に対してほぼ均一な平行光を照射しやすくなる。以上の図面によれば、複数のLED33が、ある円周上に並べられているが、半径の異なる別の円周上にも複数のLED33が配置されていてもよい。これにより、波長ごとのLED33の数が増えるため、照明光量を増加させることが可能となる。また、第一の円周上にはマルチスペクトルイメージング用のLED33が配置され、第二の円周上には白色LEDが配置されていてもよい。第一の円周の半径と第二の円周の半径とは異なっている。   An illumination control board and a connector 24 are disposed on the control board 31. Light emitting elements such as LEDs constituting the light source group are mounted on the LED substrate 32. As shown in FIG. 3B, in this embodiment, four LED substrates 32 are provided to irradiate illumination light from four directions. That is, one LED substrate 32 forms one illumination block. By enabling illumination light from four directions, an image for photometric stereo can be acquired. That is, the illumination device 3 may be used not only for multispectral imaging (MSI) but also for photometric stereo. When four LEDs 33 are arranged on one LED substrate 32, the light source group is composed of 16 light emitting elements. However, a larger number of light emitting elements may be provided. For example, eight LEDs 33 are arranged on one LED substrate 32, and the wavelengths of light emitted by the eight LEDs 33 may be different from each other. As shown in FIGS. 3C, 3 </ b> D, and 3 </ b> E, a light shielding member 35 is disposed between two adjacent LEDs 33 among the plurality of LEDs 33. When a large number of LEDs 33 are arranged closely, illumination light emitted from two adjacent LEDs 33 may pass through the same region of the light diffusion member 23 in some cases. In this case, depending on the lighting pattern, one LED 33 is not lit and the other LED 33 is lit, and the other LED 33 is not lit and one LED 33 is lit. The surface is irradiated with illumination light with the same amount of light from the same illumination direction. This makes it difficult to generate an inspection image with high accuracy. Therefore, by arranging the light shielding member 35 between the two adjacent LEDs 33, a balance between the uniformity of the light amount and the independence of the light source is obtained for the two adjacent LEDs 33. As shown in FIG. 3C, the light emission direction A1 of the LED 33 does not coincide with the main illumination direction A2. Therefore, by arranging the reflecting mirror 34, the light emitted from the LED 33 is deflected in the direction of the light diffusion member 23. Thereby, the light emitted from the LED 33 can be efficiently irradiated onto the workpiece 2. In this example, the emission direction A1 and the reflection direction of the reflecting mirror 34 are substantially perpendicular to each other, but this is because the cross-sectional shape of the light diffusing member 23 forms an arc (FIG. 3C), and the angle ( This is because the central angle is about 90 degrees. By increasing the central angle in this way, it becomes easy to irradiate the surface of the work 2 with substantially uniform parallel light even if the illumination device 3 is moved away from or closer to the work 2. According to the above drawings, the plurality of LEDs 33 are arranged on a certain circumference, but the plurality of LEDs 33 may be arranged on another circumference having different radii. Thereby, since the number of LED33 for every wavelength increases, it becomes possible to increase illumination light quantity. Further, an LED 33 for multispectral imaging may be arranged on the first circumference, and a white LED may be arranged on the second circumference. The radius of the first circumference is different from the radius of the second circumference.

<照明装置の回路構成>
図4は照明装置3の回路構成の一例を示している。この例では光源群を構成する四つの照明ブロックのうち一つの照明ブロックを示している。四つのLED33a〜LED33dは直列に接続されている。電圧が可変の可変電源41は照明制御基板40によって指定される電圧値(例:2V〜20V)の電圧を生成して出力する。可変定電流源42は、照明制御基板40によって指定される電流値(例:0A〜1A)となるように照明ブロックに流れる電流を調整する。このような電流制御方式を採用することでリニアリティの高い調光を実現しやすくなる。また、可変定電流源42は、可変定電流源42に印加されている電圧の値を検出して照明制御基板40にフィードバックし、過電圧から可変定電流源42を保護している。LED33a〜LED33dのそれぞれには並列にスイッチ43a〜スイッチ43dが接続されている。照明制御基板40の点灯制御部45はこれらのスイッチ43a〜スイッチ43dを個別に開閉させることで、LED33a〜LED33dのそれぞれを個別に点灯と非点灯とを切り替えることができる。このように、LED33a〜LED33dのそれぞれに並列にスイッチ43a〜スイッチ43dを接続することで、LED33a〜LED33dのいずれか一つを点灯させたり、すべてを点灯させたりするといった個別点灯が可能となる。これは様々な点灯パターンを実現するのに役立っている。なお、点灯制御部45は可変定電流源42とグランドとの間に挿入されたメインスイッチ43eのオン/オフを切り替えることで一つの照明ブロック単位での点灯制御を実行する。通信部44は点灯パターンを指示する制御信号や点灯の開始を指示するトリガー信号を画像処理装置5の照明制御部から受信し、点灯制御部45に渡す。点灯制御部45は、制御信号に対応する点灯パターンデータ47を記憶部46から読み出し、点灯パターンデータ47に従ってスイッチ43a〜スイッチ43dを制御する。なお、一つの照明ブロックが8つのLED33により構成される場合、8個のスイッチ43が設けられ、8個のスイッチ43は点灯制御部45によって制御される。8つのLED33は、たとえば、UVからIR2までの8つの波長に対応している。UVは紫外線波長の照明光により取得された分光画像を示している。Bは青波長の照明光により取得された分光画像を示している。Gは緑波長の照明光により取得された分光画像を示している。AMはアンバー波長の照明光により取得された分光画像を示している。ORはオレンジ波長の照明光により取得された分光画像を示している。Rは赤波長の照明光により取得された分光画像を示している。IR1、IR2はそれぞれ赤外波長の照明光により取得された分光画像を示している。ただし、IR1の波長はIR2の波長よりも短い。
<Circuit configuration of lighting device>
FIG. 4 shows an example of the circuit configuration of the illumination device 3. In this example, one illumination block is shown among the four illumination blocks constituting the light source group. The four LEDs 33a to 33d are connected in series. The variable power supply 41 having a variable voltage generates and outputs a voltage having a voltage value (for example, 2V to 20V) designated by the illumination control board 40. The variable constant current source 42 adjusts the current flowing through the illumination block so that the current value (for example, 0A to 1A) specified by the illumination control board 40 is obtained. By adopting such a current control method, it becomes easy to realize dimming with high linearity. The variable constant current source 42 detects the value of the voltage applied to the variable constant current source 42 and feeds it back to the illumination control board 40 to protect the variable constant current source 42 from overvoltage. A switch 43a to a switch 43d are connected in parallel to each of the LEDs 33a to 33d. The lighting control unit 45 of the illumination control board 40 can individually switch between lighting and non-lighting of the LEDs 33a to 33d by individually opening and closing these switches 43a to 43d. As described above, by connecting the switches 43a to 43d in parallel to the LEDs 33a to 33d, individual lighting such as lighting any one of the LEDs 33a to 33d or lighting all of them can be performed. This is useful for realizing various lighting patterns. The lighting control unit 45 performs lighting control in units of one lighting block by switching on / off a main switch 43e inserted between the variable constant current source 42 and the ground. The communication unit 44 receives a control signal for instructing a lighting pattern and a trigger signal for instructing start of lighting from the illumination control unit of the image processing device 5, and passes them to the lighting control unit 45. The lighting control unit 45 reads the lighting pattern data 47 corresponding to the control signal from the storage unit 46, and controls the switches 43 a to 43 d according to the lighting pattern data 47. In addition, when one illumination block is configured by eight LEDs 33, eight switches 43 are provided, and the eight switches 43 are controlled by the lighting control unit 45. The eight LEDs 33 correspond to, for example, eight wavelengths from UV to IR2. UV indicates a spectral image acquired by illumination light having an ultraviolet wavelength. B shows a spectral image acquired by the blue wavelength illumination light. G indicates a spectral image acquired by illumination light having a green wavelength. AM indicates a spectral image acquired by illumination light having an amber wavelength. OR indicates a spectral image obtained by illumination light having an orange wavelength. R indicates a spectral image acquired by the illumination light having a red wavelength. IR1 and IR2 represent spectral images acquired by illumination light having infrared wavelengths. However, the wavelength of IR1 is shorter than the wavelength of IR2.

<機能ブロック>
図5は検査装置のブロック図である。この例では照明装置3、カメラ4および画像処理装置5がそれぞれ個別の筐体に収容されているが、これは一例に過ぎず、適宜に一体化されてもよい。照明装置3は、マルチスペクトルイメージングを実現する照明装置であるが、フォトメトリックステレオ法に従って検査対象物を照明する照明手段として利用されてもよい。照明装置3は光源群501とこれを制御する照明制御基板40を備えている。すでに図3に示したように、複数の発光素子で一つの照明ブロックが構成され、さらに複数の照明ブロックによって光源群501が構成されていてもよい。照明ブロックの数は一般的には四つであるが、三つ以上であればよい。これは3方向以上の照明方向からワーク2に照明光を照射できれば、フォトメトリックステレオ法により検査画像を生成できるからである。各照明ブロックにはそれぞれ波長が異なる照明光を出力する複数の発光素子(LED33)が設けられている。複数の発光素子には白色LEDが含まれていてもよい。白色LEDはマルチスペクトルイメージングには使用されず、他の検査画像を作成したり、ワーク2の移動補正用の画像を作成するために使用されたりする。図1や図3に示したように照明装置3の外形はリング状をしていてもよい。また、照明装置3は、それぞれ分離した複数の照明ユニットにより構成されていてもよい。照明制御基板40は、画像処理装置5から受信した制御コマンドに応じて光源群501の点灯タイミングや照明パターン(点灯パターン)を制御する。マルチスペクトルイメージングで分光画像を取得するには択一的に選択された波長の照明光をワーク2に照射するが、マルチスペクトルイメージング以外の手法が採用される場合は、複数の波長の照明光が同時に照射されてもよい。照明制御基板40は照明装置3に内蔵されているものとして説明するが、カメラ4に内蔵されていてもよいし、画像処理装置5に内蔵されていてもよいし、これらからは独立した筐体に収容されていてもよい。
<Functional block>
FIG. 5 is a block diagram of the inspection apparatus. In this example, the illumination device 3, the camera 4, and the image processing device 5 are each housed in separate housings, but this is only an example and may be appropriately integrated. The illuminating device 3 is an illuminating device that realizes multispectral imaging. However, the illuminating device 3 may be used as an illuminating unit that illuminates an inspection object according to a photometric stereo method. The illumination apparatus 3 includes a light source group 501 and an illumination control board 40 that controls the light source group 501. As shown in FIG. 3, one illumination block may be configured by a plurality of light emitting elements, and the light source group 501 may be configured by a plurality of illumination blocks. The number of lighting blocks is generally four, but may be three or more. This is because if the work 2 can be irradiated with illumination light from three or more illumination directions, an inspection image can be generated by the photometric stereo method. Each illumination block is provided with a plurality of light emitting elements (LEDs 33) that output illumination light having different wavelengths. The plurality of light emitting elements may include white LEDs. The white LED is not used for multispectral imaging, and is used to create another inspection image or an image for correcting the movement of the work 2. As shown in FIGS. 1 and 3, the outer shape of the illumination device 3 may be ring-shaped. Moreover, the illuminating device 3 may be comprised by the some illumination unit each isolate | separated. The illumination control board 40 controls the lighting timing and illumination pattern (lighting pattern) of the light source group 501 according to the control command received from the image processing device 5. In order to obtain a spectral image by multispectral imaging, the illumination light with an alternatively selected wavelength is irradiated onto the work 2, but when a technique other than multispectral imaging is adopted, illumination light with a plurality of wavelengths is emitted. It may be irradiated at the same time. Although the illumination control board 40 will be described as being built in the lighting device 3, it may be built in the camera 4, or may be built in the image processing device 5, or a housing independent from these. It may be accommodated in.

照明装置3には記憶装置502が内蔵されており、ユーザにより設定された光源群501の点灯タイミングや照明パターンが記憶されている。照明制御基板40は、画像処理装置5からトリガー信号を受け取り、記憶装置502に記憶されている内容に応じて、光源群501を制御することができる。このような構成により、画像処理装置5は、トリガー信号を送信するだけで照明装置3を制御することができるので、画像処理装置5と照明装置3を接続する信号線の数を少なくすることができ、ケーブルの取り回しがよくなる。   The lighting device 3 has a built-in storage device 502, which stores the lighting timing and lighting pattern of the light source group 501 set by the user. The illumination control board 40 can receive the trigger signal from the image processing device 5 and control the light source group 501 in accordance with the contents stored in the storage device 502. With such a configuration, the image processing device 5 can control the illumination device 3 only by transmitting a trigger signal, and therefore the number of signal lines connecting the image processing device 5 and the illumination device 3 can be reduced. And better cable handling.

カメラ4は照明装置3により照明された検査対象物からの反射光を受光して輝度画像を生成する撮像手段の一例であり、画像処理装置5からの制御コマンドに応じて撮像処理を実行する。カメラ4はワーク2の輝度画像を作成して画像処理装置5に転送してもよいし、カメラ4の撮像素子から得られる輝度信号を画像処理装置5に転送し、画像処理装置5が輝度画像を生成してもよい。輝度信号は輝度画像の元になる信号であるため、広義には輝度信号も輝度画像である。また、カメラ4は、照明装置3が出力する各波長の照明光ごとに対象物からの反射光を受光して対象物の画像(分光画像)を生成する撮像部として機能する。   The camera 4 is an example of an imaging unit that receives reflected light from an inspection object illuminated by the illumination device 3 and generates a luminance image, and executes an imaging process in accordance with a control command from the image processing device 5. The camera 4 may create a luminance image of the work 2 and transfer it to the image processing device 5, or transfer a luminance signal obtained from the image sensor of the camera 4 to the image processing device 5. May be generated. Since the luminance signal is a signal from which the luminance image is based, the luminance signal is also a luminance image in a broad sense. The camera 4 functions as an imaging unit that receives reflected light from the object for each illumination light of each wavelength output from the illumination device 3 and generates an image (spectral image) of the object.

画像処理装置5は、コンピュータの一種であり、CPUやASICなどのプロセッサ510と、RAM、ROM、可搬記憶媒体などの記憶装置520と、ASICなどの画像処理部530と、ネットワークインタフェースなどの通信部550とを有している。プロセッサ510は検査ツールの設定や、制御パラメータの調整、検査画像の生成などを担当する。とりわけ、MSI処理部511は、マルチスペクトルイメージング(MSI)に従って、カメラ4により取得された複数の輝度画像(分光画像)からワーク2のグレー画像を作成したり、グレー画像から検査画像を作成したりする。グレー画像自体が検査画像であってもよい。MSI処理部511は、複数の分光画像から一つのカラー画像を作成してもよい。照明制御部512は、照明制御基板40に対して制御コマンドを送信することで点灯パターンや照明切り替えタイミング、照明強度などを制御する。撮像制御部513は、撮影条件(露光時間、ゲインなど)に従ってカメラ4を制御する。   The image processing device 5 is a kind of computer, and a processor 510 such as a CPU or ASIC, a storage device 520 such as a RAM, a ROM, or a portable storage medium, an image processing unit 530 such as an ASIC, and a communication such as a network interface. Part 550. The processor 510 is in charge of setting an inspection tool, adjusting control parameters, generating an inspection image, and the like. In particular, the MSI processing unit 511 creates a gray image of the work 2 from a plurality of luminance images (spectral images) acquired by the camera 4 according to multispectral imaging (MSI), or creates an inspection image from the gray image. To do. The gray image itself may be an inspection image. The MSI processing unit 511 may create one color image from a plurality of spectral images. The illumination control unit 512 controls a lighting pattern, illumination switching timing, illumination intensity, and the like by transmitting a control command to the illumination control board 40. The imaging control unit 513 controls the camera 4 according to imaging conditions (exposure time, gain, etc.).

UI管理部514は、検査ツールを設定するためのユーザインタフェース(UI)や検査画像を生成するために必要となるパラメータを設定するためのUIなどを表示部7に表示し、入力部6から入力された情報に従って検査ツールやパラメータを設定する。検査ツールには、ワーク2が備える特定の特徴(例:ピン)の長さを計測するツールや特徴の面積を計測するツールや、ある特徴から別の特徴までの距離(例:ピン間隔)を計測するツールや、特定の特徴の数を計測するツールや、特定の特徴に傷が有るか無いかを検査するツールなどが含まれてもよい。とりわけ、UI管理部514は色抽出に関する制御パラメータを設定するためのUIを表示部7に表示する。画像選択部515はUIを通じてユーザにより選択された画像の画像データを記憶装置520から読み出してUI内の画像表示領域に表示する。たとえば、画像選択部515はUIを通じて色抽出の対象となるカラー画像のデータを記憶装置520から取得する。領域指定部516は表示された画像に対して検査ツールの検査領域IWなどの指定をユーザから受け付ける。また、領域指定部516は表示されたカラー画像のうち色クラスタリングが施される複数の画素を含むクラスタ化領域の指定を受け付ける。抽出色指定部517は、表示部7に表示されたフォルスカラー画像において抽出対象となる抽出色の指定を受け付ける。抽出色指定部517は、フォルスカラー画像において前景領域の色である前景色と背景領域の色である背景色とのうち少なくとも一方の指定を受け付ける前景背景指定部を有していてもよい。なお、領域指定部516は、表示された画像に対して前景領域や背景領域の指定をユーザから受け付けてもよい。前景領域とは、ワーク2の表面領域のうち、色抽出の対象となる特徴を含む領域である。背景領域とは、前景領域の周囲に存在する領域であり、色抽出の対象となる特徴を含まない領域である。なお、前景領域は、色抽出の対象となる特徴を含むため、検査領域IWの少なくとも一部になることが多い。検査領域、前景領域、背景領域などの領域はユーザにより指定されることが多いため、指定領域と呼ばれてもよい。また、領域指定部516は、これらの指定領域の形状(例:矩形、円、楕円、任意形状)の選択を受け付けて指定領域を示す枠線の形状をUIに反映させてもよい。抽出色指定部517は、表示部7に表示されたフォルスカラー画像において複数のクラスタのうちいずれかのクラスタの代表色を注目色とするための指定を受け付ける抽出色指定部を有していてもよい。クラスタは複数の画素からなる画素群であり、グループと呼ばれてもよい。フォルスカラー画像は分光画像から作成される画像であり、ユーザによる抽出色の指定を補助するための画像である。クラスタ数指定部518は複数のクラスタの数の指定を受け付ける。クラスタ化領域に属する各画素の色は、指定された数のクラスタのいずれかに所属する。調整部519は、表示部7に表示された、二次元または三次元の色空間に投影された注目色の分布を囲む楕円の長軸、短軸および分布の中心座標のうち少なくとも一つの調整をユーザの指示に従って受け付ける。   The UI management unit 514 displays a user interface (UI) for setting an inspection tool, a UI for setting parameters necessary for generating an inspection image, and the like on the display unit 7 and inputs from the input unit 6. Inspection tools and parameters are set according to the information provided. The inspection tool includes a tool for measuring the length of a specific feature (eg pin) of the workpiece 2, a tool for measuring the area of the feature, and a distance from one feature to another feature (eg pin spacing). A tool for measuring, a tool for measuring the number of specific features, a tool for inspecting whether a specific feature is flawed, or the like may be included. In particular, the UI management unit 514 displays a UI for setting control parameters relating to color extraction on the display unit 7. The image selection unit 515 reads the image data of the image selected by the user through the UI from the storage device 520 and displays it in the image display area in the UI. For example, the image selection unit 515 acquires color image data that is a target of color extraction from the storage device 520 through the UI. The area designating unit 516 accepts designation of an inspection tool inspection area IW and the like from the user for the displayed image. In addition, the area designation unit 516 receives designation of a clustered area including a plurality of pixels on which color clustering is performed in the displayed color image. The extraction color designation unit 517 receives designation of an extraction color to be extracted in the false color image displayed on the display unit 7. The extracted color designation unit 517 may include a foreground / background designation unit that accepts designation of at least one of the foreground color that is the color of the foreground area and the background color that is the color of the background area in the false color image. Note that the area designating unit 516 may accept designation of the foreground area and the background area from the user for the displayed image. The foreground area is an area including a feature to be subjected to color extraction in the surface area of the work 2. The background area is an area that exists around the foreground area and does not include a feature to be subjected to color extraction. Note that the foreground area often includes at least a part of the inspection area IW because it includes a feature to be subjected to color extraction. Since areas such as the inspection area, foreground area, and background area are often designated by the user, they may be referred to as designated areas. Further, the area designating unit 516 may accept selection of the shape of these designated areas (eg, rectangle, circle, ellipse, arbitrary shape) and reflect the shape of the frame line indicating the designated area on the UI. The extracted color specifying unit 517 may include an extracted color specifying unit that receives a specification for setting a representative color of any one of a plurality of clusters in the false color image displayed on the display unit 7 as a target color. Good. A cluster is a pixel group composed of a plurality of pixels, and may be called a group. The false color image is an image created from the spectral image and is an image for assisting the user in specifying the extraction color. The cluster number designation unit 518 accepts designation of the number of clusters. The color of each pixel belonging to the clustered area belongs to one of the designated number of clusters. The adjustment unit 519 adjusts at least one of the major axis, the minor axis, and the central coordinates of the distribution surrounding the distribution of the target color projected on the two-dimensional or three-dimensional color space displayed on the display unit 7. Accept according to user instructions.

検査画像生成部560は、検査対象物(ライン1を搬送されるワーク2など)の分光画像から画像検査用の検査画像を生成する。検査画像はグレー画像であってもよいし、グレー画像に対してさらに画像処理(例:二値化など)を適用された画像であってもよい。検査画像生成部560は様々な機能を備えている。取得部561は、画像選択部515を通じてユーザにより指定された画像を記憶装置520やカメラ4から取得する。つまり、画像選択部515は取得部561を通じて画像データを取得する。クラスタリング部562は領域指定部516により指定された各領域に含まれる複数の画素の色空間座標における位置に応じて、分光画像を構成する各画素を、複数のクラスタのうちのいずれかのクラスタに所属させる。たとえば、クラスタリング部562は、色クラスタリングなどの手法を用いて各画素をいずれかのクラスタに所属させる。また、クラスタリング部562は、クラスタ数指定部518により指定された数のクラスタに、分光画像を構成する各画素を所属させてもよい。フォルスカラー画像生成部563は、複数のクラスタのそれぞれについて代表色を決定し、分光画像を構成する各画素の色を、各画素が属するクラスタの代表色に変換することでフォルスカラー画像を生成する。変換部564は、検査対象物の分光画像の各画素の色と抽出色との色空間内での距離に基づいて分光画像の各画素の色情報を一次元の色情報に変換することで検査画像を生成する。たとえば、変換部564は、カラーグレー変換を実行することで検査画像または検査画像の元になるグレー画像を生成してもよい。なお、クラスタリングの対象となる分光画像は、一般に複数の分光画像(例:UV画像、R画像、G画像、B画像、IR画像など)から構成される分光画像群である。   The inspection image generation unit 560 generates an inspection image for image inspection from the spectral image of the inspection object (such as the workpiece 2 conveyed on the line 1). The inspection image may be a gray image or an image obtained by further applying image processing (eg, binarization) to the gray image. The inspection image generation unit 560 has various functions. The acquisition unit 561 acquires an image designated by the user through the image selection unit 515 from the storage device 520 or the camera 4. That is, the image selection unit 515 acquires image data through the acquisition unit 561. The clustering unit 562 converts each pixel constituting the spectral image into one of the plurality of clusters according to the position in the color space coordinates of the plurality of pixels included in each region specified by the region specifying unit 516. Make them belong. For example, the clustering unit 562 causes each pixel to belong to one of the clusters using a method such as color clustering. Further, the clustering unit 562 may cause each pixel constituting the spectral image to belong to the number of clusters designated by the cluster number designation unit 518. The false color image generation unit 563 determines a representative color for each of the plurality of clusters, and generates a false color image by converting the color of each pixel constituting the spectral image into the representative color of the cluster to which each pixel belongs. . The conversion unit 564 converts the color information of each pixel of the spectral image into one-dimensional color information based on the distance in the color space between the color of each pixel of the spectral image of the inspection object and the extracted color. Generate an image. For example, the conversion unit 564 may generate an inspection image or a gray image that is the basis of the inspection image by performing color gray conversion. Note that the spectral image to be clustered is generally a spectral image group composed of a plurality of spectral images (eg, UV image, R image, G image, B image, IR image, etc.).

UI管理部514はユーザにより設定されたこれらの制御パラメータを設定情報523に保存する。UI管理部514は照明条件や撮像条件を設定する設定部として機能したり、検査ツールを設定する設定部として機能したりしてもよい。   The UI management unit 514 stores these control parameters set by the user in the setting information 523. The UI management unit 514 may function as a setting unit that sets illumination conditions and imaging conditions, or may function as a setting unit that sets inspection tools.

画像処理部530は検査画像に対して検査ツールを適用して各種の計測を実行する検査部531などを有している。サーチ部532は画像検査の前に設定された特徴または画像検査中に動的に設定された特徴を、検査画像に配置されたサーチ領域SW内でサーチし、見つかった特徴の位置を求める。検査部531は、見つかった特徴の位置に応じて検査領域(計測領域)の位置を補正する。画像処理部530の機能はプロセッサ510に実装されてもよい。あるいは、プロセッサ510の機能が画像処理部530に実装されてもよい。また、プロセッサ510とプロセッサ510とが協働して単一または複数の機能を実現してもよい。   The image processing unit 530 includes an inspection unit 531 that performs various measurements by applying an inspection tool to the inspection image. The search unit 532 searches a feature set before the image inspection or a feature dynamically set during the image inspection in the search area SW arranged in the inspection image, and obtains the position of the found feature. The inspection unit 531 corrects the position of the inspection area (measurement area) according to the position of the found feature. The function of the image processing unit 530 may be implemented in the processor 510. Alternatively, the function of the processor 510 may be implemented in the image processing unit 530. Further, the processor 510 and the processor 510 may cooperate to realize a single function or a plurality of functions.

判定部540は検査画像を用いてワーク2の良否を判定する判定手段として機能する。たとえば、判定部540は画像処理部530において検査画像を用いて実行された検査の結果を受け取って検査結果が良品条件(公差など)を満たしているかどうかを判定する。   The determination unit 540 functions as a determination unit that determines the quality of the workpiece 2 using the inspection image. For example, the determination unit 540 receives the result of the inspection performed using the inspection image in the image processing unit 530 and determines whether the inspection result satisfies a non-defective product condition (tolerance or the like).

記憶装置520は、カメラ4によって取得された分光画像のデータである分光画像データ521、フォルスカラー画像生成部563により生成されたフォルスカラー画像のデータであるフォルスカラー画像データ522、検査画像の画像データである検査画像データ524や各種の制御パラメータを保持する設定情報523を記憶する。また、記憶装置520は各種の設定データやユーザインタフェースを生成するためのプログラムコードなども記憶している。記憶装置520はグレー画像から生成された検査画像なども記憶して保持していてもよい。   The storage device 520 includes spectral image data 521 that is spectral image data acquired by the camera 4, false color image data 522 that is false color image data generated by the false color image generation unit 563, and image data of an inspection image. The inspection image data 524 and setting information 523 for holding various control parameters are stored. The storage device 520 also stores various setting data, a program code for generating a user interface, and the like. The storage device 520 may also store and hold an inspection image generated from a gray image.

図15ないし図17は、本発明の画像処理装置に係る他の構成例を示す図である。図15は照明装置3とカメラ4が一体化され、カメラ4に照明装置3を制御するための照明制御基板40が設けられている例を示す図である。この構成では照明装置3とカメラ4が一体に設けられているため、照明装置3とカメラ4を設置する際に、位置合わせをする必要がない。また、照明装置3側には光源群501を制御するための照明制御基板40や記憶装置502は不要となり、これらを有さない汎用的な照明装置3も利用することができる。ユーザはカメラ4に接続されている照明装置3を取り外し、別の種類の照明装置に交換することができる。例えば、本発明におけるマルチスペクトルイメージングに用いる照明装置3に変えて、白色光のみを照射するリング照明など他の種類の照明装置を適宜に選択できる。カメラ4は接続された照明装置3の種類を認識し、設定ユーザインタフェースに反映することが好ましい。これにより、ユーザは接続されている照明装置3に設定が可能な項目に対応したユーザインタフェース上で、照明の設定を行うことができる。認識の方法としては、照明装置3が照明種別情報を記憶しており、カメラ4がその情報を参照する方法などが考えられる。また、画像処理装置5が有する照明制御部512と撮像制御部513を、カメラ4の内部に設ける構成とし、撮像・照明系の制御を画像処理装置5とは独立して実行させる構成としてもよい。   15 to 17 are diagrams showing other configuration examples according to the image processing apparatus of the present invention. FIG. 15 is a diagram illustrating an example in which the illumination device 3 and the camera 4 are integrated, and the camera 4 is provided with an illumination control board 40 for controlling the illumination device 3. In this configuration, since the illumination device 3 and the camera 4 are provided integrally, it is not necessary to align the positions when installing the illumination device 3 and the camera 4. Further, the illumination control board 40 and the storage device 502 for controlling the light source group 501 are not necessary on the illumination device 3 side, and a general-purpose illumination device 3 that does not have these can also be used. The user can remove the lighting device 3 connected to the camera 4 and replace it with another type of lighting device. For example, instead of the illumination device 3 used for multispectral imaging in the present invention, other types of illumination devices such as ring illumination that irradiates only white light can be appropriately selected. It is preferable that the camera 4 recognizes the type of the connected lighting device 3 and reflects it in the setting user interface. Thereby, the user can set illumination on the user interface corresponding to the items that can be set in the connected lighting device 3. As a recognition method, a method in which the illumination device 3 stores illumination type information and the camera 4 refers to the information can be considered. Further, the illumination control unit 512 and the imaging control unit 513 included in the image processing device 5 may be provided inside the camera 4, and the imaging / illumination system may be controlled independently of the image processing device 5. .

図16は画像処理装置5の一部の機能を、カメラ4側に設けた構成例を示している。カメラ4は分光画像データ521、フォルスカラー画像データ522、検査画像データ524、設定情報523を記憶する記憶装置520を備え、カメラ4の内部で分光画像データ521からフォルスカラー画像データ522を生成する処理をMSI処理部511や検査画像生成部560などが実行する。また、カメラ4に設けられた検査画像生成部560が検査画像データ524を作成する。照明装置3はカメラ4の照明制御部512が制御する。検査設定時に、カメラ4は画像処理装置4に各波長で撮像された分光画像データ521と、MSI処理部511により生成されたフォルスカラー画像データ522と、検査画像生成部560が作成した検査画像データ524を画像処理装置5に送信する。設定時には、各波長の照明強度や、各波長の分光画像データ521が検査に必要か否かをユーザが確認するために、画像処理装置5はカメラ4から分光画像データ521を取得し、表示部7に表示する。一方、検査運用時には、カメラ4から画像処理装置5への分光画像データ521の送信を行わず、検査対象である検査画像データ524のみを画像処理装置5に送信するようにしてもよい。このように、カメラ4に画像処理装置5の一部の機能を負担させることにより、カメラ4と画像処理装置5間の通信負荷が低減され、分散処理により処理が高速化する。   FIG. 16 shows a configuration example in which some functions of the image processing apparatus 5 are provided on the camera 4 side. The camera 4 includes a storage device 520 for storing spectral image data 521, false color image data 522, inspection image data 524, and setting information 523, and processing for generating false color image data 522 from the spectral image data 521 inside the camera 4. Are executed by the MSI processing unit 511, the inspection image generation unit 560, and the like. Also, the inspection image generation unit 560 provided in the camera 4 creates inspection image data 524. The illumination device 3 is controlled by the illumination control unit 512 of the camera 4. At the time of inspection setting, the camera 4 uses the spectral image data 521 captured by the image processing device 4 at each wavelength, false color image data 522 generated by the MSI processing unit 511, and inspection image data created by the inspection image generation unit 560. 524 is transmitted to the image processing apparatus 5. At the time of setting, the image processing apparatus 5 acquires the spectral image data 521 from the camera 4 in order for the user to confirm whether the illumination intensity of each wavelength and the spectral image data 521 of each wavelength are necessary for the inspection, and the display unit 7 is displayed. On the other hand, during the inspection operation, the spectral image data 521 may not be transmitted from the camera 4 to the image processing device 5, and only the inspection image data 524 that is the inspection target may be transmitted to the image processing device 5. In this way, by causing the camera 4 to bear a part of the functions of the image processing device 5, the communication load between the camera 4 and the image processing device 5 is reduced, and the processing speed is increased by distributed processing.

図17は画像処理装置5の全ての機能をカメラ4に内蔵した構成例である。ユーザはカメラ4と照明装置3のみを設置するだけで良いため、設置時の手間がかからない。たとえば、カメラ4の大型化が許容され、高度な画像演算処理が不要な場合に、この構成は有利であろう。   FIG. 17 shows a configuration example in which all functions of the image processing apparatus 5 are built in the camera 4. Since the user only needs to install the camera 4 and the lighting device 3, it does not take time for installation. For example, this configuration may be advantageous when an increase in the size of the camera 4 is allowed and advanced image calculation processing is not required.

<マルチスペクトルイメージング>
マルチスペクトルイメージングでは点灯色(波長)の異なる照明光が一つずつ順番にワーク2に照射され、各波長ごとの画像(分光画像)が取得される。たとえば、8種類の波長の照明光が照射される場合、8個の画像(分光画像)が取得される。なお、四つの照明ブロックが存在する場合、四つの照明ブロックは同時に点灯する。つまり、同一の波長の四つのLED33が同時に点灯するため、四つの方向から同一波長の照明光がワーク2に照射される。8種類の波長は、たとえば、紫外波長から近赤外波長までの8種類の狭帯域波長である。狭帯域波長とは、白色LEDが発光する光の波長(広帯域波長)の幅と比較して狭い波長をいう。たとえば、青色LEDが発光する光の波長の幅は、白色LEDが発光する光の波長幅よりもずっと狭いため、青色LEDが発光する光の波長は狭帯域波長である。なお、画像検査の中には8個の分光画像のすべてを必要としない画像検査もありうる。この場合、必要な波長の照明光だけがワーク2に照射される。一般に、8個の画像がそのまま画像検査に利用されることは少なく、8個の画像から一個のグレー画像が作成され(カラー濃淡変換)、このグレー画像(カラー濃淡画像)が画像検査に利用される。カラー濃淡変換はカラーグレー変換と呼ばれることもある。たとえば、カラー濃淡画像に対して二値化処理が実行されたり、エッジ検出処理が実行されたり、ブロブ処理が実行されたりして、ワーク2における特徴(例:ピン)の位置や寸法(長さや面積)、色がそれぞれ公差の範囲内に収まっているかが検査される。
<Multispectral imaging>
In multispectral imaging, illumination light having different lighting colors (wavelengths) is irradiated onto the workpiece 2 one by one in order, and an image (spectral image) for each wavelength is acquired. For example, when illumination light with eight types of wavelengths is irradiated, eight images (spectral images) are acquired. Note that when there are four illumination blocks, the four illumination blocks are lit simultaneously. That is, since the four LEDs 33 having the same wavelength are turned on simultaneously, the illumination light having the same wavelength is irradiated onto the work 2 from the four directions. The eight types of wavelengths are, for example, eight types of narrow band wavelengths from the ultraviolet wavelength to the near infrared wavelength. The narrow band wavelength means a wavelength narrower than the width of the wavelength of light emitted from the white LED (broadband wavelength). For example, the wavelength of the light emitted by the blue LED is much narrower than the wavelength of the light emitted by the white LED, so the wavelength of the light emitted by the blue LED is a narrow band wavelength. It should be noted that some image inspections do not require all eight spectral images. In this case, only the illumination light having a necessary wavelength is irradiated onto the workpiece 2. In general, eight images are rarely used for image inspection as they are, and one gray image is created from the eight images (color shading conversion), and this gray image (color shading image) is used for image inspection. The The color shading conversion is sometimes called color gray conversion. For example, a binarization process, an edge detection process, or a blob process is performed on a color grayscale image, and the position and dimensions (length, Area) and color are checked to see if they are within tolerance.

図6を用いてカラー濃淡変換の一例を説明する。検査対象物であるワーク2のグレー画像を作成するには、良品(モデル)の登録色が必要となる。グレー画像は、登録色の色情報を基準に8個の分光画像を変換することで作成されるからである。   An example of color shading conversion will be described with reference to FIG. In order to create a gray image of the work 2 that is the inspection object, a registered color of a good product (model) is required. This is because a gray image is created by converting eight spectral images based on color information of registered colors.

まず、設定モードにおいて、良品から取得された8個の分光画像においてユーザが指定した画像領域(指定領域)から登録色の色情報が抽出される。たとえば、良品がインスタント食品(例:ラーメン)であり、ある具材(例:海老)の数を画像検査により計数する場合、ユーザは、良品の画像を表示し、良品の画像おいて当該具材が含まれる矩形の指定領域を指定し、指定領域に含まれる画素から登録色の色情報が抽出される。登録色の色情報は、平均画素行列、分散共分散行列および指定領域に含まれる画素の数を含む。なお、色情報は、いわゆるスポイトツールにより抽出されてもよい。スポイトツールのUIは領域指定部516に実装されてもよい。   First, in the setting mode, color information of registered colors is extracted from image regions (designated regions) designated by the user in eight spectral images acquired from non-defective products. For example, when the non-defective product is an instant food (eg, ramen) and the number of certain ingredients (eg, shrimp) is counted by image inspection, the user displays an image of the non-defective product, and the relevant material is displayed in the non-defective image. Is specified, and color information of the registered color is extracted from the pixels included in the specified area. The color information of the registered color includes an average pixel matrix, a variance covariance matrix, and the number of pixels included in the designated area. Note that the color information may be extracted by a so-called dropper tool. The UI of the eyedropper tool may be mounted on the area specifying unit 516.

次に、検査モードにおいて、検査対象物であるワーク2について8個の分光画像が取得される。各分光画像に含まれるすべての画素について登録色に対する距離d(x)が求められる(xは8枚の分光画像の各画素値を要素とした8次元ベクトルである)。さらに、距離d(x)に予め定められたゲインgを乗算して積を求め、必要に応じてオフセットaを加え、各画素がとりうる最大階調Gmaxから積を減算することで得られる差Gが注目画素xのグレー階調となる。これは、G = Gmax − (g・d(x) + a)と表記される。   Next, in the inspection mode, eight spectral images are acquired for the workpiece 2 that is the inspection object. The distance d (x) with respect to the registered color is obtained for all the pixels included in each spectral image (x is an 8-dimensional vector whose elements are the pixel values of the eight spectral images). Further, the product is obtained by multiplying the distance d (x) by a predetermined gain g, adding the offset a as necessary, and subtracting the product from the maximum gradation Gmax that each pixel can take. G is the gray gradation of the target pixel x. This is expressed as G = Gmax− (g · d (x) + a).

なお、複数の登録色が存在する場合は、各登録色を基準として複数のグレー画像が作成されてもよいし、単一のグレー画像が作成されてもよい。   When there are a plurality of registered colors, a plurality of gray images may be created based on each registered color, or a single gray image may be created.

また、RGB画像などのカラー画像をグレー画像に変換する際にも上述したカラーグレー変換は採用可能である。この場合にもある登録色(ユーザにより指定された色)を基準として各画素の色情報が濃淡情報に変換されてグレー画像が生成される。また、分散共分散行列は明度を示す行列と色度を示す行列とに分解されてもよい。また、明度行列を調整するための明度スケール(係数Sy)が明度行列に乗算されてもよい。同様に色度行列を調整するための色度スケール(係数Sz)が色度行列に乗算されてもよい。これらのスケールは抽出色の分布を調整することで変更されてもよい。   The above-described color gray conversion can also be employed when converting a color image such as an RGB image into a gray image. Also in this case, the color information of each pixel is converted into light / dark information based on a certain registered color (color designated by the user), and a gray image is generated. The variance-covariance matrix may be decomposed into a matrix indicating brightness and a matrix indicating chromaticity. In addition, the brightness matrix may be multiplied by a brightness scale (coefficient Sy) for adjusting the brightness matrix. Similarly, the chromaticity matrix may be multiplied by a chromaticity scale (coefficient Sz) for adjusting the chromaticity matrix. These scales may be changed by adjusting the distribution of the extracted colors.

<抽出色の指定>
図7(A)はワーク2の表面にある特徴fを含むカラー画像(例:RGB画像)を示している。ユーザが特徴fを画像検査するためには、まず、特徴fの色抽出を行う必要がある。人間の目には特徴fの色はいずれの位置でも同じ色に見えるかもしれないが、特徴fの画像を構成している複数の画素は必ずしも厳密に同じ色を有しているわけではない。
<Specify extraction color>
FIG. 7A shows a color image (example: RGB image) including the feature f on the surface of the work 2. In order for the user to inspect the image of the feature f, first, it is necessary to extract the color of the feature f. Although the color of the feature f may appear to be the same color at any position to the human eye, the pixels constituting the image of the feature f do not necessarily have the exact same color.

たとえば、画素p1の色と画素p2の色とは異なっている。画素p1をポインタ706で選択して画素p1の色を抽出しても、画素p1は特徴fを構成している多数の画素のうちの一つの画素でしかない。そのため、画素p1の色に基づきワーク2のカラー画像を、グレー画像などの検査画像に変換しても、検査画像は特徴fの色や形状を正確に表していないことがある。   For example, the color of the pixel p1 and the color of the pixel p2 are different. Even if the pixel p1 is selected with the pointer 706 and the color of the pixel p1 is extracted, the pixel p1 is only one of the many pixels constituting the feature f. For this reason, even if the color image of the workpiece 2 is converted into an inspection image such as a gray image based on the color of the pixel p1, the inspection image may not accurately represent the color or shape of the feature f.

図7(B)は特徴fのほぼ全体を囲むようにポインタ706により自由形状の領域を描画することを示している。画像検査装置8は自由形状の領域内の画素値の平均値を求め、この平均値に基づいてカラー画像を検査画像に変換する。これにより、検査画像のばらつきが小さくなる。しかし、特徴fの形状が複雑になればなるほど、ユーザが自由形状を描く負担が増加する。   FIG. 7B shows that a free-form area is drawn by the pointer 706 so as to surround almost the entire feature f. The image inspection apparatus 8 obtains an average value of pixel values in a free-form area, and converts a color image into an inspection image based on the average value. Thereby, the dispersion | variation in a test | inspection image becomes small. However, as the shape of the feature f becomes more complicated, the burden on the user to draw a free shape increases.

そこで、本実施形態では、色クラスタリングによる色抽出を採用することでユーザの負担を軽減し、かつ、検査画像のばらつきを小さくする。   Therefore, in the present embodiment, by adopting color extraction by color clustering, the burden on the user is reduced and the variation in the inspection image is reduced.

●色抽出を補助するユーザインタフェース
図8はユーザによる色抽出を補助するためにUI管理部514が表示部7に表示するUI800を示している。UI800は、画像表示領域801と各種の設定を行うための設定タブを有している。図8においては、色クラスタリング(色面分割)に関するパラメータを設定するためのクラスタ化タブ810が選択されている。抽出タブ820はクラスタリング結果を利用したユーザによる色抽出を補助するタブである。調整タブ830は抽出色を調整するためのタブである。
User Interface for Aiding Color Extraction FIG. 8 shows a UI 800 that the UI management unit 514 displays on the display unit 7 to assist color extraction by the user. The UI 800 has an image display area 801 and setting tabs for performing various settings. In FIG. 8, a clustering tab 810 for setting parameters relating to color clustering (color plane division) is selected. The extraction tab 820 is a tab for assisting color extraction by the user using the clustering result. The adjustment tab 830 is a tab for adjusting the extracted color.

画像表示領域801は、プルダウンメニュー811により選択された画像を表示する領域である。プルダウンメニュー811は、記憶装置520に記憶されている複数の分光画像やカメラ4により取得された複数の分光画像などを指定するためのUIである。ここでは、複数の分光画像のうちの一つの分光画像や複数の分光画像を合成することで生成されたカラー画像やグレー画像が選択されてもよい。   The image display area 801 is an area for displaying the image selected by the pull-down menu 811. The pull-down menu 811 is a UI for designating a plurality of spectral images stored in the storage device 520, a plurality of spectral images acquired by the camera 4, and the like. Here, a color image or a gray image generated by combining one spectral image or a plurality of spectral images among the plurality of spectral images may be selected.

プルダウンメニュー811に登録されていない画像はプルダウンメニュー811内の"参照"を選択することにより、指定可能となっている。画像選択部515はプルダウンメニュー811により選択された画像を画像表示領域801に表示する。クラスタ化領域802は、色クラスタリング(分類)が実行される矩形や円形、楕円形などの規定形状の領域である。クラスタ化領域802の形状は、ユーザが領域形状を選択するためのプルダウンメニュー812を操作することにより選択される。編集ボタン813はクラスタ化領域802のサイズ(例:縦、横、半径など)と位置を編集するためのボタンである。編集ボタン813が操作されると、UI管理部514の領域指定部516は、ポインタ706によるクラスタ化領域802のサイズの変更を受け付ける。テキストボックス814は、クラスタ数の入力を受け付ける。クラスタ数指定部518は、テキストボックス814に入力された数値をクラスタ数として受け付ける。クラスタ数とは、クラスタ化領域802内の色をいくつの色(クラスタ)に分割するかを示す。クラスタ化ボタン815は、クラスタ化領域802により囲まれた画像について色クラスタリングの実行を指示するボタンである。確定ボタン816は、色抽出結果の確定を指示するボタンである。キャンセルボタン817は、色抽出結果を破棄するボタンである。   An image that is not registered in the pull-down menu 811 can be specified by selecting “Reference” in the pull-down menu 811. The image selection unit 515 displays the image selected by the pull-down menu 811 in the image display area 801. The clustering region 802 is a region having a predetermined shape such as a rectangle, a circle, or an ellipse on which color clustering (classification) is performed. The shape of the clustered region 802 is selected by operating a pull-down menu 812 for the user to select a region shape. An edit button 813 is a button for editing the size (eg, vertical, horizontal, radius, etc.) and position of the clustered area 802. When the edit button 813 is operated, the area specifying unit 516 of the UI management unit 514 receives a change in the size of the clustered area 802 by the pointer 706. A text box 814 receives an input of the number of clusters. The cluster number designating unit 518 receives the numerical value input in the text box 814 as the cluster number. The number of clusters indicates how many colors (clusters) the color in the clustered area 802 is divided into. The clustering button 815 is a button for instructing execution of color clustering for an image surrounded by the clustering region 802. The confirmation button 816 is a button for instructing confirmation of the color extraction result. A cancel button 817 is a button for discarding the color extraction result.

図9は色クラスタリングが実行された後のUI800を示している。プロセッサ510(クラスタリング部562)は、ポインタ706によるクラスタ化ボタン815の押し下げを検知すると、クラスタ化領域802により囲まれた各画素を解析し、ユーザにより指定されたN個のクラスタのうちのいずれかのクラスタに各画素を所属させる。Nはクラスタ数である。さらに、プロセッサ510(フォルスカラー画像生成部563)は、元の分光画像におけるクラスタ化領域802内の各画素の色を、各画素が所属しているクラスタの代表色に置換することでフォルスカラー画像を生成する。   FIG. 9 shows the UI 800 after color clustering has been performed. When the processor 510 (clustering unit 562) detects that the clustering button 815 is pressed by the pointer 706, the processor 510 (clustering unit 562) analyzes each pixel surrounded by the clustering region 802 and selects one of N clusters designated by the user. Each pixel belongs to the cluster. N is the number of clusters. Further, the processor 510 (the false color image generation unit 563) replaces the color of each pixel in the clustered region 802 in the original spectral image with the representative color of the cluster to which each pixel belongs, and thereby the false color image. Is generated.

さらに、プロセッサ510(フォルスカラー画像生成部563)は、クラスタ化領域802内に表示されている画像をフォルスカラー画像に更新する。フォルスカラー画像とは、色クラスタリングが適用された画像である。クラスタ数が2であれば、クラスタ化領域802内の各画素の色は、第一クラスタの代表色と第二クラスタの代表色とのうち、いずれかの色となる。第一クラスタに分類されたすべての画素の色は第一クラスタの代表色に置換される。第二クラスタに分類されたすべての画素の色は第二クラスタの代表色に置換される。これにより、クラスタ化領域802内の画像は二色に分割されることになる。このようにクラスタ化領域802内が複数の領域(面)に分割されるため、クラスタリングは色面分割と呼ばれてもよい。   Further, the processor 510 (false color image generation unit 563) updates the image displayed in the clustered area 802 to a false color image. A false color image is an image to which color clustering is applied. If the number of clusters is 2, the color of each pixel in the clustered region 802 is one of the representative color of the first cluster and the representative color of the second cluster. The colors of all the pixels classified into the first cluster are replaced with the representative colors of the first cluster. The colors of all the pixels classified into the second cluster are replaced with the representative colors of the second cluster. As a result, the image in the clustered area 802 is divided into two colors. Since the clustered area 802 is thus divided into a plurality of areas (planes), clustering may be referred to as color plane division.

図9に示したクラスタ化領域802に表示されたフォルスカラー画像では、特徴fが第一クラスタの代表色により表現されており、特徴fの周囲は第二クラスタの代表色により表現されている。各クラスタの代表色はそのクラスタに所属する複数の画素の色の平均色、強調平均色、インデックス色などである。フォルスカラー画像は、分割化画像やクラスタ化画像、インデックス画像と呼ばれてもよい。   In the false color image displayed in the clustered area 802 shown in FIG. 9, the feature f is represented by the representative color of the first cluster, and the periphery of the feature f is represented by the representative color of the second cluster. The representative color of each cluster is an average color, an emphasized average color, an index color, or the like of a plurality of pixels belonging to the cluster. The false color image may be called a divided image, a clustered image, or an index image.

図10は抽出タブ820を示す図である。なお、クラスタ化タブ810と抽出タブ820とは一つにタブに集約化されてもよいが、説明の便宜上、これらを二つのタブとして説明する。UI管理部514は、ポインタ706による抽出タブ820の選択を検知すると、UI800に抽出タブ820の内容を表示する。プルダウンメニュー1011は、色抽出手法の選択を補助するUIである。ここでは色抽出手法の一例として前景背景抽出が選択されている。前景背景抽出とは、前景領域の色(前景色)と背景領域の色(背景色)とを抽出することを示している。前景色や背景色などの抽出色は登録色とよばれてもよい。ラジオボタン1012は複数の前景色が存在するときにどの前景色を登録するかを指定するためのボタンである。この例では、前景色用のラジオボタン1012が二つ存在するため、最大で二つの前景色が登録可能となっている。なお、前景領域の数を一つに制限する場合、ラジオボタン1012は不要である。抽出色指定部517はポインタ706により指定された画素の色を前景色に決定し、前景色を前景色表示領域1013に表示する。ラジオボタン1014は複数の背景色が存在するときにどの背景色を登録するかを指定するためのボタンである。抽出色指定部517はポインタ706により指定された画素の色を背景色に決定し、背景色を背景色表示領域1015に表示する。

チェックボックス1016は近傍色(比較色)の自動選択を有効にするためのチェックボックスである。プロセッサ510(抽出色指定部517)は、チェックボックス1016にチェックが付与されると、色空間内で前景色に近い背景色を選択する。なお、プロセッサ510(抽出色指定部517)は、ユーザによって背景色が指定された場合には、色空間内でこの背景色に近い前景色を選択する。このように複数の背景色のうち一つの背景色がユーザによって指定されると、抽出色指定部517は複数の前景色から一つの前景色を指定(選択)する。また、複数の前景色のうち一つの前景色(指定色)がユーザによって指定されると、抽出色指定部517は複数の背景色のうち指定色に最も近い一つの背景色(近傍色)を指定(選択)する。このように近傍色が選択されるのは、色空間上で近傍にある注目色(前景色/背景色)と比較色(背景色/前景色)とを分離することが調整の目的だからである。
FIG. 10 shows the extraction tab 820. Note that the clustering tab 810 and the extraction tab 820 may be integrated into one tab, but for convenience of explanation, these are described as two tabs. When the UI management unit 514 detects selection of the extraction tab 820 with the pointer 706, the UI management unit 514 displays the content of the extraction tab 820 on the UI 800. A pull-down menu 1011 is a UI for assisting selection of a color extraction method. Here, foreground / background extraction is selected as an example of the color extraction method. Foreground / background extraction refers to extracting the color of the foreground area (foreground color) and the color of the background area (background color). Extracted colors such as the foreground color and background color may be referred to as registered colors. The radio button 1012 is a button for designating which foreground color is registered when there are a plurality of foreground colors. In this example, since there are two foreground radio buttons 1012, a maximum of two foreground colors can be registered. If the number of foreground areas is limited to one, the radio button 1012 is not necessary. The extracted color designation unit 517 determines the color of the pixel designated by the pointer 706 as the foreground color and displays the foreground color in the foreground color display area 1013. The radio button 1014 is a button for designating which background color is registered when there are a plurality of background colors. The extracted color designation unit 517 determines the color of the pixel designated by the pointer 706 as the background color, and displays the background color in the background color display area 1015.

A check box 1016 is a check box for enabling automatic selection of neighboring colors (comparison colors). When the check box 1016 is checked, the processor 510 (extracted color specifying unit 517) selects a background color close to the foreground color in the color space. Note that, when a background color is designated by the user, the processor 510 (extracted color designation unit 517) selects a foreground color close to this background color in the color space. When one background color is designated by the user as described above, the extracted color designation unit 517 designates (selects) one foreground color from the plurality of foreground colors. When one foreground color (specified color) is specified by the user from among a plurality of foreground colors, the extracted color specifying unit 517 selects one background color (neighboring color) closest to the specified color among the plurality of background colors. Specify (select). The neighborhood color is selected in this way because the purpose of adjustment is to separate the target color (foreground color / background color) and the comparison color (background color / foreground color) that are nearby in the color space. .

抽出色指定部517は指定色(前景色/背景色)に対する近傍色(背景色/前景色)の計算を実行する近傍色決定部を有していてもよい。これによりユーザによる近傍色の指定負担が軽減される。プロセッサ510(変換部564)は、抽出タブ820に設けられた確定ボタン816の押し下げを検知すると、抽出色に従って検査画像を作成する。検査部531は、ワーク2の特徴fについての画像検査を実行する。   The extracted color designation unit 517 may include a neighborhood color determination unit that calculates a neighborhood color (background color / foreground color) for the designated color (foreground color / background color). As a result, the user's burden of specifying neighboring colors is reduced. When the processor 510 (the conversion unit 564) detects that the confirmation button 816 provided on the extraction tab 820 is pressed, the processor 510 (the conversion unit 564) creates an inspection image according to the extracted color. The inspection unit 531 performs an image inspection on the feature f of the workpiece 2.

図11、図12は調整タブ830を示す図である。UI管理部514は、ポインタ706により調整タブ830が選択されると、UI800において調整タブ830の内容を表示するとともに、画像表示領域801に二つの画像を表示する。左側の画像は色クラスタリングが施されたカラー画像(フォルスカラー画像)である。右側の画像は、カラー画像の色空間における注目色の分布と比較色の分布との間の分離の程度を示す分布画像である。   11 and 12 are diagrams showing the adjustment tab 830. When the adjustment tab 830 is selected by the pointer 706, the UI management unit 514 displays the contents of the adjustment tab 830 on the UI 800 and displays two images in the image display area 801. The left image is a color image (false color image) that has been subjected to color clustering. The image on the right side is a distribution image indicating the degree of separation between the distribution of the target color and the distribution of the comparative color in the color space of the color image.

注目色とは、前景色や背景色のうちラジオボタン1012、1014により選択された色である。抽出色指定部517は複数ある前景色や複数ある背景色のうちラジオボタン1012、1014により選択された色を注目色に決定する。比較色は、ユーザがポインタ706を操作することでフォルスカラー画像から選択した色である。近傍色(比較色)の自動選択が有効化されている場合、抽出色指定部517が比較色を自動的に選択する。   The attention color is a color selected by the radio buttons 1012 and 1014 among the foreground color and the background color. The extracted color designation unit 517 determines a color selected by the radio buttons 1012, 1014 from among a plurality of foreground colors and a plurality of background colors as a target color. The comparison color is a color selected from the false color image by the user operating the pointer 706. When automatic selection of neighboring colors (comparison colors) is enabled, the extraction color designation unit 517 automatically selects a comparison color.

このように抽出色指定部517は比較色の指定を受け付けてもよい。一般に、ユーザは注目色に対して分離したい色を比較色として選択する。たとえば、クラスタ化領域802が5個のクラスタに分割されるケースでは、注目色を含むクラスタに対して色空間内でのユークリッド距離が最も近いクラスタが選択される。なお、プロセッサ510(抽出色指定部517)は、注目色を含むクラスタの代表色と、複数の他のクラスタの代表色との間の距離を求め、求めた距離のうちで最小の距離となった他のクラスタの代表色を比較色(近傍色)に選択してもよい。距離は、たとえば、各クラスタの中心位置(重心位置)間の距離である。   As described above, the extraction color designation unit 517 may accept designation of a comparison color. In general, the user selects a color to be separated from the target color as a comparison color. For example, in the case where the clustered region 802 is divided into five clusters, the cluster having the closest Euclidean distance in the color space to the cluster including the target color is selected. The processor 510 (extracted color designation unit 517) obtains the distance between the representative color of the cluster including the target color and the representative colors of a plurality of other clusters, and becomes the minimum distance among the obtained distances. Alternatively, a representative color of another cluster may be selected as a comparison color (neighboring color). The distance is, for example, the distance between the center positions (center of gravity positions) of each cluster.

プロセッサ510(調整部519または検査画像生成部560)は、注目色の分布と比較色の分布とを二次元の色空間に投影することで分布画像を作成する。なお、プロセッサ510(調整部519または検査画像生成部560)は、注目色の分布と比較色の分布とを三次元の色空間に投影することで分布画像を作成してもよい。1111は注目色の分布を示している。調整部519は、注目色の分布1111を取り囲むように楕円形の枠1112を配置する。枠1112はポインタ706により長径と短径を変更可能な枠である。長径は長軸(明度軸)に相当し、短径は短軸(色度軸)に相当する。なお、一般には、複数ある軸のうち最長軸が主軸と呼ばれ、最長軸以外の軸が副軸と呼ばれる。   The processor 510 (the adjustment unit 519 or the inspection image generation unit 560) creates a distribution image by projecting the distribution of the target color and the distribution of the comparison color into a two-dimensional color space. Note that the processor 510 (the adjustment unit 519 or the inspection image generation unit 560) may create a distribution image by projecting the distribution of the target color and the distribution of the comparison color into a three-dimensional color space. Reference numeral 1111 indicates the distribution of the target color. The adjustment unit 519 arranges an elliptical frame 1112 so as to surround the distribution 1111 of the target color. A frame 1112 is a frame whose major axis and minor axis can be changed by a pointer 706. The major axis corresponds to the major axis (brightness axis), and the minor axis corresponds to the minor axis (chromaticity axis). In general, the longest axis among a plurality of axes is called a main axis, and the axis other than the longest axis is called a sub-axis.

調整部519は、ユーザによる枠1112のサイズの変更に応じて、注目色の分布を左右する明度のスケールと色度のスケールとを変更する。   The adjustment unit 519 changes the lightness scale and the chromaticity scale that affect the distribution of the target color in accordance with the change in the size of the frame 1112 by the user.

1113は比較色の分布を示している。調整部519は、比較色の分布1113を取り囲むように楕円形の枠1114を配置する。楕円形の枠1114はポインタ706により長径と短径を変更可能な枠であってもよい。枠1114のサイズを変更することで比較色の分布を左右する明度のスケールと色度のスケールとが変更される。あるいは、比較色の分布1113は変更できずに固定であってもよい。   Reference numeral 1113 indicates a distribution of comparative colors. The adjustment unit 519 arranges an elliptical frame 1114 so as to surround the comparison color distribution 1113. The oval frame 1114 may be a frame whose major axis and minor axis can be changed by the pointer 706. By changing the size of the frame 1114, the lightness scale and the chromaticity scale that affect the distribution of the comparison colors are changed. Alternatively, the comparison color distribution 1113 may not be changed and may be fixed.

調整タブ830には、注目色を示す表示領域1121と比較色を示す表示領域1122とが設けられている。UI管理部514(比較色指定部)は、画像表示領域801に表示されているフォルスカラー画像の任意の位置で右クリックされたことを検知すると、その位置の色(登録色)を比較色として指定してもよい。あるいはUI管理部514(比較色指定部)はラジオボタンにより選択された登録色を比較色として選択してもよい。上述したように、UI管理部514(比較色指定部)は、色空間において注目色の近傍に位置する色を比較色に登録してもよい。   The adjustment tab 830 is provided with a display area 1121 indicating the target color and a display area 1122 indicating the comparative color. When the UI management unit 514 (comparison color designation unit) detects that a right-click has been made at an arbitrary position in the false color image displayed in the image display area 801, the color (registered color) at that position is used as a comparison color. May be specified. Alternatively, the UI management unit 514 (comparison color designation unit) may select the registered color selected by the radio button as the comparison color. As described above, the UI management unit 514 (comparison color designation unit) may register a color located near the target color in the color space as the comparison color.

テキストボックス1123は注目色の明度に乗算されるスケールを示している。調整部519は、楕円形の枠1112の調整に応じて注目色の明度のスケールを変更する。テキストボックス1124は注目色の色度に乗算されるスケールを示している。調整部519は、楕円形の枠1112の調整に応じて注目色の色度のスケールを変更する。これらのスケールは上述した分散共分散行列を分解することで得られる明度行列のスケールと色度行列のスケールと連動してもよい。テキストボックス1125は、注目色の色分布の中心座標を示す。ユーザは注目色の色分布の中心付近をポインタ706によりドラックすることで注目色の色分布の中心座標を調整してもよい。調整部519は、ポインタ706のドラック量に応じて注目色の色分布の中心座標を更新し、テキストボックス1125に反映する。   A text box 1123 indicates a scale by which the brightness of the target color is multiplied. The adjustment unit 519 changes the brightness scale of the target color according to the adjustment of the elliptical frame 1112. A text box 1124 indicates a scale by which the chromaticity of the target color is multiplied. The adjustment unit 519 changes the chromaticity scale of the target color in accordance with the adjustment of the elliptical frame 1112. These scales may be linked with the scale of the brightness matrix and the scale of the chromaticity matrix obtained by decomposing the above-described variance-covariance matrix. A text box 1125 indicates the center coordinates of the color distribution of the target color. The user may adjust the center coordinates of the color distribution of the target color by dragging the vicinity of the center of the color distribution of the target color with the pointer 706. The adjustment unit 519 updates the center coordinate of the color distribution of the target color according to the drag amount of the pointer 706 and reflects it in the text box 1125.

図11に示した事例では注目色と比較色とが十分に分離されていることが分かる。注目色が前景色であり、比較色が背景色であれば、前景色と背景色との距離(分離の程度)を十分に確保することで、特徴fがその周囲から十分に分離された検査画像が作成される。一方で、図12が示す事例では注目色(前景色)と比較色(背景色)とが十分に分離されていない。したがって、図13の点線が示すように、注目色の分布に連動する枠1112のサイズを調整することにより明度が変更されると、注目色の色分布が変更され、注目色と比較色の分離の程度が拡大する。この例では注目色の明度が変更されている。   In the example shown in FIG. 11, it can be seen that the target color and the comparative color are sufficiently separated. If the target color is the foreground color and the comparative color is the background color, the feature f is sufficiently separated from the surrounding area by ensuring a sufficient distance (degree of separation) between the foreground color and the background color. An image is created. On the other hand, in the example shown in FIG. 12, the target color (foreground color) and the comparative color (background color) are not sufficiently separated. Therefore, as shown by the dotted line in FIG. 13, when the brightness is changed by adjusting the size of the frame 1112 linked to the distribution of the target color, the color distribution of the target color is changed, and the target color and the comparison color are separated. The extent of In this example, the brightness of the attention color is changed.

●フローチャート
図14は色抽出処理を含む画像検査を示すフローチャートである。S1401からS1407までの処理は設定モードにおいて実行され、S1408からS1410までの処理は運転モード(検査モード)において実行されうる。
Flowchart FIG. 14 is a flowchart showing image inspection including color extraction processing. The processing from S1401 to S1407 can be executed in the setting mode, and the processing from S1408 to S1410 can be executed in the operation mode (inspection mode).

S1401でプロセッサ510(取得部561)は設定対象物のカラー画像を取得する。取得部561は照明制御部512を通じて照明制御基板40に照明条件(点灯すべき発光素子や照明強度など)を設定し、光源群501を点灯させ、照明光を設定対象物に照射する。取得部561は撮像制御部513を通じてカメラ4に撮像条件(露光時間や絞りなど)を設定して撮像を指示する。カメラ4は設定対象物のカラー画像の画像データを記憶装置520に格納する。プロセッサ510は記憶装置520からカラー画像の画像データを読み出す。なお、取得部561は、ユーザにより指定されたカラー画像を記憶装置520から取得してもよい。   In S1401, the processor 510 (acquisition unit 561) acquires a color image of the setting object. The acquisition unit 561 sets illumination conditions (light emitting elements to be turned on, illumination intensity, etc.) on the illumination control board 40 through the illumination control unit 512, turns on the light source group 501, and irradiates the setting object with illumination light. The acquisition unit 561 sets an imaging condition (exposure time, aperture, etc.) to the camera 4 through the imaging control unit 513 and instructs imaging. The camera 4 stores the image data of the color image of the setting object in the storage device 520. The processor 510 reads out image data of a color image from the storage device 520. The acquisition unit 561 may acquire a color image designated by the user from the storage device 520.

S1402でプロセッサ510(領域指定部516)はユーザからクラスタ化領域802の指定を受け付ける。UI管理部514はUI800を表示部7に表示し、クラスタ化領域802の指定を受け付ける。画像表示領域801には記憶装置520から取得されたカラー画像が表示される。   In S1402, the processor 510 (area specifying unit 516) receives the specification of the clustered area 802 from the user. The UI management unit 514 displays the UI 800 on the display unit 7 and accepts designation of the clustered area 802. A color image acquired from the storage device 520 is displayed in the image display area 801.

S1403でプロセッサ510(クラスタ数指定部518)はユーザからクラスタ数Nの指定を受け付ける。クラスタ数Nはテキストボックス814に入力された数値である。テキストボックスはプルダウンメニューなどの他の形式のコントロールオブジェクトであってもよい。   In S1403, the processor 510 (cluster number designating unit 518) accepts designation of the cluster number N from the user. The cluster number N is a numerical value input in the text box 814. The text box may be another type of control object such as a pull-down menu.

S1404でプロセッサ510(クラスタリング部562)はカラー画像に設定されたクラスタ化領域内の各画素をN個のクラスタに分類する。ここでは、K−meansやGMM(ガウシアン・ミクスチャ・モデル)などの既知の色クラスタリングアルゴリズムが採用可能である。   In S1404, the processor 510 (clustering unit 562) classifies each pixel in the clustered region set in the color image into N clusters. Here, a known color clustering algorithm such as K-means or GMM (Gaussian mixture model) can be employed.

S1405でプロセッサ510(クラスタリング部562またはフォルスカラー画像生成部563に設けられる代表色決定部)は各クラスタの代表色を決定する。代表色は、各クラスタ内に属している画素の色についての平均色、強調平均色またはインデックス色などである。   In step S1405, the processor 510 (a representative color determination unit provided in the clustering unit 562 or the false color image generation unit 563) determines a representative color of each cluster. The representative color is an average color, an emphasized average color, an index color, or the like for the colors of the pixels belonging to each cluster.

S1406でプロセッサ510(フォルスカラー画像生成部563)は各クラスタの代表色に基づきカラー画像をフォルスカラー画像に変換することでフォルスカラー画像を作成する。たとえば、プロセッサ510はあるクラスタに属している各画素の色をそのクラスタの代表色に置換する。この置換処理はすべてのクラスタで実行される。   In S1406, the processor 510 (false color image generation unit 563) creates a false color image by converting the color image into a false color image based on the representative color of each cluster. For example, the processor 510 replaces the color of each pixel belonging to a certain cluster with the representative color of that cluster. This replacement process is executed in all clusters.

S1407でプロセッサ510(抽出色指定部517)は登録色の指定を受け付ける。図10などに示しようにUI管理部514は画像表示領域801にフォルスカラー画像を表示し、ポインタ706により指定された画素の色(代表色)を登録色に設定する。登録色は一つ以上の前景色や一つ以上の背景色などである。なお、色クラスタリングにより抽出された色がユーザの意図とは異なることもあろう。この場合、ユーザは、図11ないし図13に示したような調整タブ830を開いて抽出色の色分布を微調整してもよい。   In step S1407, the processor 510 (extraction color designation unit 517) accepts designation of a registered color. As shown in FIG. 10 and the like, the UI management unit 514 displays a false color image in the image display area 801, and sets the pixel color (representative color) designated by the pointer 706 as a registered color. Registered colors include one or more foreground colors and one or more background colors. Note that the color extracted by color clustering may be different from the user's intention. In this case, the user may finely adjust the color distribution of the extracted color by opening an adjustment tab 830 as shown in FIGS.

S1408でプロセッサ510(取得部561)は検査対象物のカラー画像を取得する。プロセッサ510の照明制御部512は照明制御基板40に照明条件(点灯すべき発光素子や照明強度など)を設定し、光源群501を点灯させ、照明光を検査対象物に照射する。プロセッサ510の撮像制御部513はカメラ4に撮像条件(露光時間や絞りなど)を設定して撮像を指示する。カメラ4は検査対象物のカラー画像の画像データを記憶装置520に格納する。プロセッサ510は記憶装置520からカラー画像の画像データを読み出す。   In S1408, the processor 510 (acquisition unit 561) acquires a color image of the inspection object. The illumination control unit 512 of the processor 510 sets illumination conditions (such as a light emitting element to be turned on and illumination intensity) on the illumination control board 40, turns on the light source group 501, and irradiates the inspection object with illumination light. The imaging control unit 513 of the processor 510 sets imaging conditions (such as exposure time and aperture) in the camera 4 and instructs imaging. The camera 4 stores the image data of the color image of the inspection object in the storage device 520. The processor 510 reads out image data of a color image from the storage device 520.

S1409でプロセッサ510(変換部564)は登録色と検査対象物のカラー画像とに基づき検査画像を作成する。検査画像は検査ツールごとに異なってもよい。たとえば、変換部564は色空間における前景領域の登録色(前景色)とカラー画像の各画素の色とのマハラノビス距離に応じてカラー画像をグレー画像(前景画像)に変換してもよい。また、変換部564は色空間における背景領域の登録色(背景色)とカラー画像の各画素の色とのマハラノビス距離に応じてカラー画像をグレー画像(背景画像)に変換してもよい。これらの画像はさらに二値化などのさらなる画像処理が施されてもよい。また、プロセッサ510(変換部564)は、前景画像と背景画像との差分画像を検査画像として作成してもよい。   In S1409, the processor 510 (conversion unit 564) creates an inspection image based on the registered color and the color image of the inspection object. The inspection image may be different for each inspection tool. For example, the conversion unit 564 may convert the color image into a gray image (foreground image) according to the Mahalanobis distance between the registered color (foreground color) of the foreground region in the color space and the color of each pixel of the color image. The conversion unit 564 may convert the color image into a gray image (background image) according to the Mahalanobis distance between the registered color (background color) of the background region in the color space and the color of each pixel of the color image. These images may be further subjected to further image processing such as binarization. In addition, the processor 510 (the conversion unit 564) may create a difference image between the foreground image and the background image as an inspection image.

S1410でプロセッサ510(検査部531)は検査画像に対して検査ツールを適用して画像検査を実行する。一例として、検査対象物が樹脂板に設けられた金属端子であり、検査部531が備えるエリア検査ツールにより金属端子の面積と、その周囲の面積を求めることを考える。前景色は金属端子の代表色であり、背景色は樹脂板の代表色である。検査部531は、前景画像を二値化することで樹脂板の色を白に変換し、金属端子の色を黒に変換し、黒の画素の数をカウントすることで金属端子の面積を算出する。同様に、検査部531は、背景画像を二値化することで樹脂板の色を黒に変換し、金属端子の色を白に変換し、黒の画素の数をカウントすることで金属端子の周囲の樹脂板の面積を算出する。判定部540は金属端子の面積を公差などの閾値と比較して合否を判定する。また、判定部540は金属端子の周囲の面積を公差などの閾値と比較して合否を判定する。   In step S1410, the processor 510 (inspection unit 531) executes an image inspection by applying an inspection tool to the inspection image. As an example, it is assumed that the inspection object is a metal terminal provided on a resin plate, and the area of the metal terminal and the surrounding area are obtained by an area inspection tool provided in the inspection unit 531. The foreground color is the representative color of the metal terminal, and the background color is the representative color of the resin plate. The inspection unit 531 converts the color of the resin plate to white by binarizing the foreground image, converts the color of the metal terminal to black, and calculates the area of the metal terminal by counting the number of black pixels. To do. Similarly, the inspection unit 531 converts the color of the resin plate to black by binarizing the background image, converts the color of the metal terminal to white, and counts the number of black pixels to count the metal terminals. Calculate the area of the surrounding resin plate. The determination unit 540 determines pass / fail by comparing the area of the metal terminal with a threshold value such as tolerance. The determination unit 540 determines pass / fail by comparing the area around the metal terminal with a threshold such as tolerance.

<まとめ>
以上で説明したように取得部561や画像選択部515は各画素が多次元の色情報を有するカラー画像を取得する取得部の一例である。また、に取得部561や画像選択部515は検査対象物についての分光画像を取得する取得部の一例である。カラー画像は、たとえば、検査対象物(ライン1を搬送されるワーク2)や設定対象物(ワーク2の良品やリファレンス品)の画像であり、複数の分光画像のうちの一つの分光画像(例:UV画像)や、複数の分光画像から合成されて生成されたトゥルーカラー画像やグレー画像であってもよい。UI管理部514や表示部7は取得部561などにより取得された分光画像などを表示する表示部の一例である。領域指定部516は表示部7に表示された分光画像において複数の画素を含む領域の指定を受け付ける。クラスタリング部562は領域指定部516により指定された各領域に含まれる複数の画素の色空間座標における位置に応じて、分光画像を構成する各画素を、複数のクラスタのうちのいずれかのクラスタに所属させる。図8ではクラスタ化領域802が一つだけ指定されているが、複数のクラスタ化領域802が指定されてもよい。この場合に、クラスタリング部562は複数のクラスタ化領域802のそれぞれについてクラスタリングを実行する。フォルスカラー画像生成部563は複数のクラスタのそれぞれについて代表色を決定し、分光画像を構成する各画素の色を、各画素が属するクラスタの代表色に変換することでフォルスカラー画像を生成する。代表色は、平均色など、そのクラスタを構成する複数の画素の色を代表する色であればよい。抽出色指定部517は表示部7に表示されたフォルスカラー画像において抽出対象となる抽出色の指定を受け付ける。元のカラー画像におけるクラスタ内の各画素の色は一様でないことが多い。そのため、ユーザがどの画素をスポイトで選択するかに依存して抽出色がばらつく。一方で、フォルスカラー画像においてクラスタに属する各画素の色はいずれも同じ色であるため、抽出力のばらつきが生じない。変換部564は検査対象物の分光画像の各画素の色と抽出色との、色空間内での距離に基づいて分光画像の各画素の色情報を一次元の色情報に変換することでグレー画像(検査画像)を生成する。たとえば、RGB色空間の色情報がグレー(濃淡)のみの色空間の色情報に変換される。検査ツールに依存してさらに二値化処理やエッジ抽出処理などの画像処理が追加で実行されてもよい。検査部531は変換部564により生成された検査画像を用いて画像検査を実行する。このような本実施形態によればフォルスカラー画像を用いることで、抽出色の指定に関するユーザの負担が軽減される。また、色抽出のばらつきが小さくなるため、画像検査の結果のばらつきも小さくなる。
<Summary>
As described above, the acquisition unit 561 and the image selection unit 515 are examples of an acquisition unit that acquires a color image in which each pixel has multidimensional color information. Further, the acquisition unit 561 and the image selection unit 515 are an example of an acquisition unit that acquires a spectral image of an inspection target. The color image is, for example, an image of an inspection object (work 2 conveyed on the line 1) or a setting object (non-defective product or reference product of the work 2), and one spectral image (eg, a plurality of spectral images) : A UV image), or a true color image or a gray image generated by combining a plurality of spectral images. The UI management unit 514 and the display unit 7 are examples of a display unit that displays a spectral image acquired by the acquisition unit 561 and the like. The region designation unit 516 receives designation of a region including a plurality of pixels in the spectral image displayed on the display unit 7. The clustering unit 562 converts each pixel constituting the spectral image into one of the plurality of clusters according to the position in the color space coordinates of the plurality of pixels included in each region specified by the region specifying unit 516. Make them belong. Although only one clustered area 802 is designated in FIG. 8, a plurality of clustered areas 802 may be designated. In this case, the clustering unit 562 performs clustering for each of the plurality of clustered regions 802. The false color image generation unit 563 determines a representative color for each of the plurality of clusters, and generates a false color image by converting the color of each pixel constituting the spectral image into the representative color of the cluster to which each pixel belongs. The representative color may be a color that represents the color of a plurality of pixels constituting the cluster, such as an average color. The extraction color designation unit 517 receives designation of an extraction color to be extracted in the false color image displayed on the display unit 7. The color of each pixel in the cluster in the original color image is often not uniform. For this reason, the extracted color varies depending on which pixel the user selects with the dropper. On the other hand, since the colors of the pixels belonging to the cluster in the false color image are the same, there is no variation in extraction power. The conversion unit 564 converts the color information of each pixel of the spectral image into one-dimensional color information based on the distance in the color space between the color of each pixel of the spectral image of the inspection object and the extracted color. An image (inspection image) is generated. For example, the color information in the RGB color space is converted into color information in a color space of only gray (shading). Depending on the inspection tool, image processing such as binarization processing and edge extraction processing may be additionally executed. The inspection unit 531 performs image inspection using the inspection image generated by the conversion unit 564. According to the present embodiment, by using a false color image, the burden on the user regarding the designation of the extracted color is reduced. In addition, since variation in color extraction is reduced, variation in image inspection results is also reduced.

画像検査装置8は複数のクラスタの数の指定を受け付けるクラスタ数指定部518をさらに有していてもよい。クラスタリング部562は、クラスタ数指定部518により指定された数のクラスタのうちのいずれかに、分光画像を構成する各画素を所属させる。これによりクラスタ数についてユーザの意思を反映させることが可能となる。   The image inspection apparatus 8 may further include a cluster number designation unit 518 that accepts designation of the number of clusters. The clustering unit 562 causes each pixel constituting the spectral image to belong to one of the number of clusters designated by the cluster number designation unit 518. Thereby, it becomes possible to reflect a user's intention about the number of clusters.

図10などに関連して説明したように、抽出色指定部517は、フォルスカラー画像において前景領域の色である前景色と背景領域の色である背景色とのうち少なくとも一方の指定を受け付ける前景背景指定部を有していてもよい。変換部564は前景色に基づいて分光画像を、検査画像の一つである前景画像に変換してもよい。変換部564は背景色に基づいて分光画像を、検査画像の一つである背景画像に変換してもよい。検査部531は前景画像と背景画像とを用いて検査対象物の合否を判定するように構成されてもよい。検査ツールによってはワーク2の画像を前景画像と背景画像とに分割し、前景画像と背景画像との差分画像などを求めて画像検査を実行することがある。この場合に抽出色指定部517は前景領域の指定を受け付けて前景領域から前景色を抽出したり、または、表示されている画像に対して前景色の指定を受け付けたりしてもよい。背景色に関しても同様である。たとえば、図10に示したように、前景背景指定部は、前景色の指定と背景色の指定とを個別に受け付けてもよい。また、前景背景指定部は、複数のクラスタの代表色のうち色空間において前景色に近い代表色を背景色に設定してもよい。一般に、背景色は前景色から分離される色であることが多く、背景色は前景色の近傍色であることも多い。つまり、色空間において前景色のクラスタの近傍に位置するクラスタの代表色が背景色となることが多い。よって、前景背景指定部は、色空間内でのクラスタ間のユークリッド距離を求めて比較することで、前景色の近傍色を自動的に背景色に決定してもよい。なお、図10に示したように、前景背景指定部は、複数の前景色の指定を受け付けてもよい。たとえば、ワーク2に含まれている複数のエビの色は個体ごとに微妙に異なっていることがある。この場合に、複数のエビの色を複数の前景色として指定することで様々なエビの個体を画像検査により抽出することが可能となる。同様に複数の背景色が指定されてもよい。図10に示したように、前景背景指定部は、複数の背景色の指定を受け付けてもよい。   As described with reference to FIG. 10 and the like, the extracted color designation unit 517 accepts designation of at least one of the foreground color that is the color of the foreground area and the background color that is the color of the background area in the false color image. You may have a background designation | designated part. The conversion unit 564 may convert the spectral image based on the foreground color into a foreground image that is one of the inspection images. The conversion unit 564 may convert the spectral image into a background image that is one of the inspection images based on the background color. The inspection unit 531 may be configured to determine pass / fail of the inspection object using the foreground image and the background image. Depending on the inspection tool, the image of the workpiece 2 may be divided into a foreground image and a background image, and a difference image between the foreground image and the background image may be obtained to perform image inspection. In this case, the extraction color designation unit 517 may accept designation of the foreground area and extract the foreground color from the foreground area, or may accept designation of the foreground color for the displayed image. The same applies to the background color. For example, as shown in FIG. 10, the foreground / background designation unit may individually accept foreground designation and background color designation. The foreground / background designation unit may set a representative color close to the foreground color in the color space among the representative colors of the plurality of clusters as the background color. In general, the background color is often a color separated from the foreground color, and the background color is often a color near the foreground color. That is, the representative color of the cluster located in the vicinity of the foreground cluster in the color space is often the background color. Therefore, the foreground / background designation unit may automatically determine the background color of the foreground color by obtaining and comparing the Euclidean distance between the clusters in the color space. As shown in FIG. 10, the foreground / background designation unit may accept designation of a plurality of foreground colors. For example, a plurality of shrimp colors included in the work 2 may be slightly different for each individual. In this case, by specifying a plurality of shrimp colors as a plurality of foreground colors, various shrimp individuals can be extracted by image inspection. Similarly, a plurality of background colors may be designated. As illustrated in FIG. 10, the foreground / background designation unit may accept designation of a plurality of background colors.

図11などに示したようにUI管理部514や表示部7は、フォルスカラー画像における前景色の分布と、背景色の分布とを二次元または三次元の色空間に投影することで、前景色と背景色との分離の程度を表示してもよい。これによりユーザは前景色と背景色とが十分に分離されているかどうかを確認できる。図13などに示したように調整部519は二次元の色空間における前景色の分布を囲む楕円の長軸と短軸とをユーザ操作に応じて調整してもよい。これにより、前景色と背景色との間の分離の程度を大きくすることが可能となる。たとえば、調整部519は、直軸と短軸の調整量に応じて登録色の色情報の一つである分散共分散行列Σにおける明度スケールと色度スケールを調整する。分散共分散行列Σは明度の行列YYと色度行列ZZとに分解できる。さらに、スケールを導入すると、Σ=sy・YY+sz・ZZと表現できる。したがって、明度スケールである係数syと色度スケールである係数szを個別に調整することで、分散共分散行列Σにおける明度と色度を個別に調整することが可能となる。 As shown in FIG. 11 and the like, the UI management unit 514 and the display unit 7 project the foreground color distribution and the background color distribution in the false color image into a two-dimensional or three-dimensional color space, thereby providing a foreground color. The degree of separation between the color and the background color may be displayed. Thereby, the user can confirm whether the foreground color and the background color are sufficiently separated. As illustrated in FIG. 13 and the like, the adjustment unit 519 may adjust the major axis and the minor axis of the ellipse surrounding the foreground color distribution in the two-dimensional color space according to a user operation. Thereby, the degree of separation between the foreground color and the background color can be increased. For example, the adjustment unit 519 adjusts the lightness scale and chromaticity scale in the variance-covariance matrix Σ, which is one of the color information of registered colors, according to the adjustment amount of the straight axis and the short axis. Variance-covariance matrix Σ can be decomposed into a matrix YY T and the chromaticity matrix ZZ T lightness. Furthermore, if a scale is introduced, it can be expressed as Σ = sy · YY T + sz · ZZ T. Therefore, by individually adjusting the coefficient sy that is the brightness scale and the coefficient sz that is the chromaticity scale, it is possible to individually adjust the brightness and chromaticity in the variance-covariance matrix Σ.

フォルスカラー画像生成部563は、調整部519により調整された楕円の長軸の調整量と短軸の調整量とに応じてグレー画像を再生成する。調整部519は、再生成(更新された)グレー画像を画像表示領域801に表示してもよい。これによりユーザはグレー画像を確認しながら調整量を決定できるようになる。   The false color image generation unit 563 regenerates a gray image according to the adjustment amount of the long axis and the adjustment amount of the short axis of the ellipse adjusted by the adjustment unit 519. The adjustment unit 519 may display the regenerated (updated) gray image in the image display area 801. As a result, the user can determine the adjustment amount while checking the gray image.

図10や図11などに関連して説明したように、ラジオボタン1012、1014やポインタ706などは表示部7に表示されたフォルスカラー画像において複数のクラスタのうちいずれかのクラスタの代表色を注目色として指定する注目色指定部の一例である。たとえば、ラジオボタン1012、1014やポインタ706などは、フォルスカラー画像における前景領域の色である前景色と背景領域の色である背景色を含む複数の登録色から注目色を指定する注目色指定部の一例である。これによりユーザは任意の登録色を注目色や比較色に指定することが可能となる。調整部519は、表示部7に表示された、二次元または三次元の色空間に投影された注目色の分布を囲む楕円の長軸、短軸および分布の中心座標のうち少なくとも一つを調整する。また、表示部7は、注目色の色分布とともに、注目色と比較される比較色の色分布も表示してもよい。注目色指定部は、注目色として前景色が指定されると、比較色として背景色の指定を受け付けるように構成されていてもよい。また、注目色指定部は、注目色として背景色が指定されると、比較色として前景色の指定を受け付けるように構成されていてもよい。上述したように、比較色は注目色に基づいて自動的に選択されてもよい。   As described with reference to FIGS. 10 and 11, the radio buttons 1012, 1014, the pointer 706, and the like pay attention to the representative color of one of a plurality of clusters in the false color image displayed on the display unit 7. It is an example of the attention color designation | designated part designated as a color. For example, a radio button 1012, 1014, a pointer 706, or the like is an attention color designation unit that designates an attention color from a plurality of registered colors including the foreground color that is the color of the foreground area and the background color that is the color of the background area in the false color image. It is an example. As a result, the user can designate any registered color as the target color or comparison color. The adjustment unit 519 adjusts at least one of the major axis, the minor axis, and the center coordinates of the distribution surrounding the distribution of the target color projected on the two-dimensional or three-dimensional color space displayed on the display unit 7. To do. The display unit 7 may also display a color distribution of a comparative color to be compared with the target color along with the color distribution of the target color. The attention color designation unit may be configured to accept the designation of the background color as the comparison color when the foreground color is designated as the attention color. Further, the attention color designation unit may be configured to accept the designation of the foreground color as the comparison color when the background color is designated as the attention color. As described above, the comparison color may be automatically selected based on the target color.

2...ワーク、3...照明装置、4...カメラ、5...画像処理装置、510...プロセッサ、511...MSI処理部、512...照明制御部、513...撮像制御部、531...検査部   2 ... work, 3 ... lighting device, 4 ... camera, 5 ... image processing device, 510 ... processor, 511 ... MSI processing unit, 512 ... lighting control unit, 513 ... Imaging control unit, 531 ... Inspection unit

Claims (13)

検査対象物についての分光画像を取得する取得部と、
前記取得部により取得された分光画像を表示する表示部と、
前記表示部に表示された分光画像において複数の画素を含む領域の指定を受け付ける領域指定部と、
前記領域指定部により指定された各領域に含まれる複数の画素の色空間座標における位置に応じて、前記分光画像を構成する各画素を、複数のクラスタのうちのいずれかのクラスタに所属させるクラスタリング部と、
前記複数のクラスタのそれぞれについて代表色を決定し、前記分光画像を構成する各画素の色を、各画素が属するクラスタの代表色に変換することでフォルスカラー画像を生成するフォルスカラー画像生成部と、
前記表示部に表示されたフォルスカラー画像において抽出対象となる抽出色の指定を受け付ける抽出色指定部と、
前記分光画像の各画素の色と前記抽出色との色空間内での距離に基づいて前記分光画像をグレー画像に変換する変換部と、
前記変換部により生成されたグレー画像を用いて画像検査を実行する検査部と
を有することを特徴とする画像検査装置。
An acquisition unit for acquiring a spectral image of the inspection object;
A display unit for displaying the spectral image acquired by the acquisition unit;
An area designating unit that accepts designation of an area including a plurality of pixels in the spectral image displayed on the display unit;
Clustering in which each pixel constituting the spectral image belongs to any one of a plurality of clusters according to positions in color space coordinates of a plurality of pixels included in each region specified by the region specifying unit. And
A false color image generating unit that determines a representative color for each of the plurality of clusters and generates a false color image by converting the color of each pixel constituting the spectral image into a representative color of the cluster to which each pixel belongs; ,
An extraction color designation unit that accepts designation of an extraction color to be extracted in the false color image displayed on the display unit;
A conversion unit that converts the spectral image into a gray image based on a distance in a color space between the color of each pixel of the spectral image and the extracted color;
An image inspection apparatus comprising: an inspection unit that performs an image inspection using the gray image generated by the conversion unit.
前記複数のクラスタの数の指定を受け付けるクラスタ数指定部をさらに有し、
前記クラスタリング部は、前記クラスタ数指定部により指定された数のクラスタのいずれかに前記分光画像を構成する各画素を所属させることを特徴とする請求項1に記載の画像検査装置。
A cluster number designating unit for accepting designation of the number of the plurality of clusters;
The image inspection apparatus according to claim 1, wherein the clustering unit causes each pixel constituting the spectral image to belong to one of the number of clusters designated by the cluster number designation unit.
前記抽出色指定部は、前記フォルスカラー画像において前景領域の色である前景色と背景領域の色である背景色とのうち少なくとも一方の指定を受け付ける前景背景指定部を有し、
前記変換部は前記前景色に基づいて前記分光画像を前景画像に変換するとともに、前記背景色に基づいて前記分光画像を背景画像に変換するように構成されており、
前記検査部は前記前景画像と前記背景画像とを用いて前記検査対象物の合否を判定するように構成されていることを特徴とする請求項1または2に記載の画像検査装置。
The extracted color designation unit includes a foreground / background designation unit that accepts designation of at least one of a foreground color that is a color of a foreground area and a background color that is a color of a background area in the false color image;
The conversion unit is configured to convert the spectral image to a foreground image based on the foreground color, and to convert the spectral image to a background image based on the background color,
The image inspection apparatus according to claim 1, wherein the inspection unit is configured to determine pass / fail of the inspection object using the foreground image and the background image.
前記前景背景指定部は、前記前景色の指定と前記背景色の指定とを個別に受け付けることを特徴とする請求項3に記載の画像検査装置。   The image inspection apparatus according to claim 3, wherein the foreground / background designation unit individually accepts designation of the foreground color and designation of the background color. 前記前景背景指定部は、前記複数のクラスタの代表色のうち色空間において前記前景色に近い代表色を前記背景色に設定することを特徴とする請求項3に記載の画像検査装置。   The image inspection apparatus according to claim 3, wherein the foreground / background designation unit sets a representative color close to the foreground in a color space among the representative colors of the plurality of clusters as the background color. 前記前景背景指定部は、複数の前景色の指定を受け付けることを特徴とする請求項3ないし5のいずれか一項に記載の画像検査装置。   The image inspection apparatus according to claim 3, wherein the foreground / background designation unit accepts designation of a plurality of foreground colors. 前記前景背景指定部は、複数の背景色の指定を受け付けることを特徴とする請求項3または4に記載の画像検査装置。   The image inspection apparatus according to claim 3 or 4, wherein the foreground / background designation unit accepts designation of a plurality of background colors. 前記表示部は、前記フォルスカラー画像における前記前景色の分布と、前記背景色の分布とを二次元または三次元の色空間に投影することで、前記前景色と前記背景色との分離の程度を表示することを特徴とする請求項3ないし7のいずれか一項に記載の画像検査装置。   The display unit projects the foreground color distribution and the background color distribution in the false color image into a two-dimensional or three-dimensional color space, thereby separating the foreground color from the background color. The image inspection apparatus according to claim 3, wherein: 前記二次元の色空間における前記前景色の分布を囲む楕円の長軸と短軸とを調整する調整部をさらに有することを特徴とする請求項8に記載の画像検査装置。   The image inspection apparatus according to claim 8, further comprising an adjustment unit that adjusts a major axis and a minor axis of an ellipse surrounding the foreground color distribution in the two-dimensional color space. 前記変換部は、前記調整部により調整された前記楕円の長軸の調整量と短軸の調整量とに応じて前記グレー画像を再生成することを特徴とする請求項9に記載の画像検査装置。   The image inspection according to claim 9, wherein the conversion unit regenerates the gray image according to an adjustment amount of a major axis and an adjustment amount of a minor axis of the ellipse adjusted by the adjustment unit. apparatus. 前記フォルスカラー画像における前景領域の色である前景色と背景領域の色である背景色を含む複数の登録色から注目色を指定する注目色指定部と、
前記表示部は、二次元または三次元の色空間に投影された前記注目色の色分布とともに、前記注目色と比較される比較色の色分布を表示することを特徴とする請求項1に記載の画像検査装置。
An attention color designating unit that designates an attention color from a plurality of registered colors including a foreground color that is a color of a foreground area and a background color that is a color of a background area in the false color image;
The display unit displays a color distribution of a comparative color to be compared with the target color together with a color distribution of the target color projected in a two-dimensional or three-dimensional color space. Image inspection equipment.
前記注目色指定部は、前記注目色として前記前景色が指定されると、前記比較色として前記背景色の指定を受け付けるように構成されていることを特徴とする請求項11に記載の画像検査装置。   The image inspection according to claim 11, wherein the attention color designation unit is configured to accept designation of the background color as the comparison color when the foreground color is designated as the attention color. apparatus. 前記注目色指定部は、前記注目色として前記背景色が指定されると、前記比較色として前記前景色の指定を受け付けるように構成されていることを特徴とする請求項11に記載の画像検査装置。   The image inspection according to claim 11, wherein the attention color designation unit is configured to accept designation of the foreground color as the comparison color when the background color is designated as the attention color. apparatus.
JP2017093360A 2017-05-09 2017-05-09 Image inspection equipment Active JP6893826B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2017093360A JP6893826B2 (en) 2017-05-09 2017-05-09 Image inspection equipment
JP2021091445A JP7117420B2 (en) 2017-05-09 2021-05-31 Image inspection device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017093360A JP6893826B2 (en) 2017-05-09 2017-05-09 Image inspection equipment

Related Child Applications (1)

Application Number Title Priority Date Filing Date
JP2021091445A Division JP7117420B2 (en) 2017-05-09 2021-05-31 Image inspection device

Publications (2)

Publication Number Publication Date
JP2018189562A true JP2018189562A (en) 2018-11-29
JP6893826B2 JP6893826B2 (en) 2021-06-23

Family

ID=64480097

Family Applications (2)

Application Number Title Priority Date Filing Date
JP2017093360A Active JP6893826B2 (en) 2017-05-09 2017-05-09 Image inspection equipment
JP2021091445A Active JP7117420B2 (en) 2017-05-09 2021-05-31 Image inspection device

Family Applications After (1)

Application Number Title Priority Date Filing Date
JP2021091445A Active JP7117420B2 (en) 2017-05-09 2021-05-31 Image inspection device

Country Status (1)

Country Link
JP (2) JP6893826B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018189565A (en) * 2017-05-09 2018-11-29 株式会社キーエンス Image inspection device
JP2018189563A (en) * 2017-05-09 2018-11-29 株式会社キーエンス Image inspection device
JP2022011479A (en) * 2020-06-30 2022-01-17 国立大学法人東北大学 Image processing device, image processing method, and program
WO2025023191A1 (en) * 2023-07-21 2025-01-30 富士フイルム株式会社 Control device, control method, and control program

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7572762B1 (en) * 2024-08-19 2024-10-24 アキュイティー株式会社 Inspection device, inspection method, and program

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002259967A (en) * 2001-02-28 2002-09-13 Dainippon Screen Mfg Co Ltd Area division for color image
JP2003207534A (en) * 2002-01-15 2003-07-25 Hyper Tec:Kk Inspection method of printed circuit board and device used therefor
JP2003315279A (en) * 2002-04-18 2003-11-06 Matsushita Electric Works Ltd Method of inspecting appearance of building board
CN1532541A (en) * 2003-03-21 2004-09-29 中国印钞造币总公司 Detecting method for color printing quality
JP2011075506A (en) * 2009-10-01 2011-04-14 Suzuki Motor Corp Tooth contact face detector
US20160350940A1 (en) * 2014-12-30 2016-12-01 Nanjing Jusha Display Technology Co., Ltd. Automatic Recognition And Calibration Method Of Medical Color And Grayscale Images

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002259967A (en) * 2001-02-28 2002-09-13 Dainippon Screen Mfg Co Ltd Area division for color image
JP2003207534A (en) * 2002-01-15 2003-07-25 Hyper Tec:Kk Inspection method of printed circuit board and device used therefor
JP2003315279A (en) * 2002-04-18 2003-11-06 Matsushita Electric Works Ltd Method of inspecting appearance of building board
CN1532541A (en) * 2003-03-21 2004-09-29 中国印钞造币总公司 Detecting method for color printing quality
JP2011075506A (en) * 2009-10-01 2011-04-14 Suzuki Motor Corp Tooth contact face detector
US20160350940A1 (en) * 2014-12-30 2016-12-01 Nanjing Jusha Display Technology Co., Ltd. Automatic Recognition And Calibration Method Of Medical Color And Grayscale Images

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018189565A (en) * 2017-05-09 2018-11-29 株式会社キーエンス Image inspection device
JP2018189563A (en) * 2017-05-09 2018-11-29 株式会社キーエンス Image inspection device
JP2022011479A (en) * 2020-06-30 2022-01-17 国立大学法人東北大学 Image processing device, image processing method, and program
JP7466862B2 (en) 2020-06-30 2024-04-15 国立大学法人東北大学 Image processing device, image processing method, and program
WO2025023191A1 (en) * 2023-07-21 2025-01-30 富士フイルム株式会社 Control device, control method, and control program

Also Published As

Publication number Publication date
JP6893826B2 (en) 2021-06-23
JP7117420B2 (en) 2022-08-12
JP2021128171A (en) 2021-09-02

Similar Documents

Publication Publication Date Title
US10168216B2 (en) Image inspection device
US10304176B2 (en) Image inspection device
JP7117420B2 (en) Image inspection device
US10416086B2 (en) Image inspection device
US20200043157A1 (en) Inspection Apparatus, Inspection Method, And Program
JP6917762B2 (en) Image inspection equipment
US10157456B2 (en) Information processing apparatus, information processing method, and storage medium utilizing technique for detecting an abnormal state such as a scratch on a target
US20170350827A1 (en) Inspection Apparatus, Inspection Method, And Program
JP6981775B2 (en) Image inspection equipment and image inspection method
JP6917761B2 (en) Image inspection equipment
US10863069B2 (en) Image processing system and setting method
KR20150091216A (en) Inspection apparatus and inspection method
JP6931552B2 (en) Image inspection equipment
EP3846121A1 (en) Inspection system, information processing apparatus, and carrier means
JP2019046134A (en) Image inspection device, and image inspection method
JP2020042053A (en) Image inspection device and image inspection method
JP6825067B2 (en) Inspection equipment and its control method
JP2019045510A (en) Inspection device
US10708561B2 (en) POS terminal, information processing device, white balance adjustment method, and recording medium
JP2019060903A (en) Inspection device
JP2015092141A (en) Printing inspection device
US11812157B2 (en) Image processing device and image processing program
CN118403811A (en) Printed circuit board ink color sorting method, device and sorting system
HK1228085A1 (en) Pos terminal, information processing device, white balance adjustment method, and recording medium

Legal Events

Date Code Title Description
A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20190805

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A821

Effective date: 20190805

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200326

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20210113

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210317

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210602

R150 Certificate of patent or registration of utility model

Ref document number: 6893826

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250