JP7327866B1 - Learning model generation method - Google Patents

Learning model generation method Download PDF

Info

Publication number
JP7327866B1
JP7327866B1 JP2023093747A JP2023093747A JP7327866B1 JP 7327866 B1 JP7327866 B1 JP 7327866B1 JP 2023093747 A JP2023093747 A JP 2023093747A JP 2023093747 A JP2023093747 A JP 2023093747A JP 7327866 B1 JP7327866 B1 JP 7327866B1
Authority
JP
Japan
Prior art keywords
image
captured image
captured
grayscaled
pixel
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.)
Active
Application number
JP2023093747A
Other languages
Japanese (ja)
Inventor
智樹 大橋
Original Assignee
株式会社シュヴァルベル
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 株式会社シュヴァルベル filed Critical 株式会社シュヴァルベル
Priority to JP2023093747A priority Critical patent/JP7327866B1/en
Application granted granted Critical
Publication of JP7327866B1 publication Critical patent/JP7327866B1/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

【課題】光源装置を複雑にせず、かつ撮像画像の枚数を増やすことなく高速に透明な検査物の欠陥の有無を判定する学習モデル生成方法。【解決手段】本願発明に係る学習モデル生成方法は、光源から投影される明部と暗部とからなる光を透明物に投影し、透明物を撮像した撮像画像を生成するステップと、撮像画像の各画素について輝度値を反転処理した第1の画像、または撮像画像における明部または暗部に相当する領域を撮像画像の端から削除した第1の画像を生成するステップと、第1の画像および撮像画像において対応する位置関係にある画素について輝度値の差分の絶対値に基づいて第2の画像を生成するステップと、第2の画像を教師データとして用いて、第2の画像を入力すると、第2の画像における透明物の欠陥を出力する学習モデルを生成するステップと、を備える。【選択図】図1Kind Code: A1 A learning model generation method for determining the presence or absence of a defect in a transparent test object at high speed without complicating a light source device and increasing the number of captured images. A learning model generation method according to the present invention includes steps of: projecting light composed of a bright portion and a dark portion projected from a light source onto a transparent object to generate a captured image of the transparent object; a step of generating a first image obtained by inverting the luminance value of each pixel, or a first image obtained by removing a region corresponding to a bright portion or a dark portion in the captured image from the edge of the captured image; generating a second image based on absolute values of differences in luminance values for pixels having corresponding positional relationships in the image; and inputting the second image using the second image as teacher data; generating a learning model that outputs transparency defects in the images of 2. [Selection drawing] Fig. 1

Description

本発明は、学習モデル生成方法に関する。 The present invention relates to a learning model generation method.

外観検査において、黒白の周期性パターンを検査物に照射しつつ検査物を撮像し、得られた画像を用いて検査物の欠陥の有無を判定する画像処理方法が知られている(例えば、特許文献1参照。)。 In visual inspection, an image processing method is known in which an image of an inspection object is captured while a black-and-white periodic pattern is irradiated onto the inspection object, and the presence or absence of defects in the inspection object is determined using the obtained image. Reference 1).

引用文献1には、ガラス等の鏡面性または光透過性を有する物体の微小凹凸等の欠点を検査する方法が記載されている。具体的には、ガラス等の被検査物の表面に対し回転機構を備えた光源を用いて光を照射し、その反射光を撮像した撮像画像に基づいて画像処理を行って検査する。この光源の周面は黒白のストライプ模様のフィルムで覆われており、撮像画像は光源による黒白のストライプパターンの位相が徐々にずれた画像となる。これら複数の撮像画像における同じ位置の輝度の差分値を求めることにより、凹凸等の欠点を特定することができる。 Cited Document 1 describes a method for inspecting defects such as minute unevenness of an object having specularity or light transmission properties such as glass. Specifically, the surface of an object to be inspected, such as glass, is irradiated with light using a light source having a rotating mechanism, and the object is inspected by performing image processing based on the captured image of the reflected light. The peripheral surface of the light source is covered with a black and white striped film, and the picked-up image is an image in which the phase of the black and white striped pattern produced by the light source is gradually shifted. Defects such as unevenness can be identified by obtaining the luminance difference value at the same position in the plurality of captured images.

特開2000-018932号公報JP-A-2000-018932

特許文献1に記載の方法では、特許文献1の図1または図7に示すような回転駆動装置を備えた回転光源が必要となり、装置構成が煩雑になる恐れがある。また、位相をずらした複数の画像を用いて欠陥を判別しており、そのような光源を用意できない場合は欠陥を判定できず、あるいは検査物を連続して検査したい場合に逐次光源の位相を変更する必要があるため検査時間がかかってしまうといった課題がある。 The method described in Patent Document 1 requires a rotating light source equipped with a rotary driving device as shown in FIG. 1 or FIG. 7 of Patent Document 1, which may complicate the device configuration. In addition, multiple phase-shifted images are used to discriminate defects, and if such a light source cannot be prepared, defects cannot be discriminated. Since it is necessary to change, there is a problem that inspection time is required.

上記課題を解決するために、本発明に係る学習モデル生成方法は、光源から投影される明部と暗部とからなる光を透明物に投影し、前記透明物を撮像した撮像画像を生成するステップと、前記撮像画像の各画素について輝度値を反転処理した第1の画像、または前記撮像画像における前記明部または前記暗部に相当する領域を前記撮像画像の端から削除した第1の画像を生成するステップと、前記第1の画像および前記撮像画像において対応する位置関係にある画素について輝度値の差分の絶対値に基づいて第2の画像を生成するステップと、前記第2の画像を教師データとして用いて、前記第2の画像を入力すると、前記第2の画像における前記透明物の欠陥を出力する学習モデルを生成するステップと、を備える。 In order to solve the above problems, a learning model generation method according to the present invention includes a step of projecting light consisting of a bright portion and a dark portion projected from a light source onto a transparent object, and generating a captured image of the transparent object. and generating a first image obtained by inverting the luminance value of each pixel of the captured image, or a first image obtained by deleting the area corresponding to the bright part or the dark part in the captured image from the edge of the captured image. generating a second image based on absolute values of differences in luminance values for pixels in a corresponding positional relationship in the first image and the captured image; to generate a learning model that, when input with the second image, outputs the defects of the transparency in the second image.

また、上記課題を解決するために、本発明に係る別の学習モデル生成方法は、光源から投影される明部と暗部とからなる光であって、透明物を透過する前記光とともに前記透明物を撮像した撮像画像を教師データとし、前記教師データを用いて、前記撮像画像を入力すると、前記撮像画像における前記透明物の欠陥を出力する学習モデルを生成する、ことを備える。 Further, in order to solve the above problems, another learning model generation method according to the present invention provides light composed of a bright part and a dark part projected from a light source, and the light passing through a transparent object and the light passing through the transparent object. is used as teacher data, and using the teacher data to generate a learning model that outputs the defect of the transparent object in the captured image when the captured image is input.

本発明は、上記課題に鑑みてなされたものであり、光源装置を複雑にせず、かつ撮像画像の枚数を増やすことなく高速に透明な検査物の欠陥の有無を判定することができる。 SUMMARY OF THE INVENTION The present invention has been made in view of the above-described problems, and can determine whether or not a transparent inspection object has defects at high speed without complicating the light source device and increasing the number of captured images.

本発明に係る画像処理システムを示す図である。1 is a diagram showing an image processing system according to the present invention; FIG. 本発明に係る背景画像を示す図である。FIG. 4 is a diagram showing a background image according to the present invention; (A)は表面に線キズを有する検査物、(B)は線キズを有する検査物を背景画像とともに撮像した撮像画像をグレースケール化したグレースケール化した撮像画像を示す図である。(A) is an inspection object having a line scratch on the surface, and (B) is a grayscale image obtained by converting a captured image of an inspection object having a line scratch along with a background image into a grayscale. 本発明に係る画像処理方法を示すフロー図である。1 is a flow diagram showing an image processing method according to the present invention; FIG. (A)はグレースケール化した撮像画像であり、(B)は本願発明に係る右ずれ画像、(C)は本願発明に係る左ずれ画像である。(A) is a grayscale captured image, (B) is a right-shifted image according to the present invention, and (C) is a left-shifted image according to the present invention. 本発明に係る反転画像を示す図である。FIG. 4 is a diagram showing an inverted image according to the present invention; (A)は本発明に係る差分画像であり、(B)はノイズあり差分画像である。(A) is a differential image according to the present invention, and (B) is a differential image with noise. (A)は本発明に係るノイズあり差分画像であり、(B)は適応的な閾値処理を説明するための図である。(A) is a differential image with noise according to the present invention, and (B) is a diagram for explaining adaptive threshold processing. 本発明に係る二値画像を示す図である。FIG. 4 is a diagram showing a binary image according to the present invention; 本発明に係る実施例の撮像画像を示す図である。It is a figure which shows the captured image of the Example which concerns on this invention. (A)は本発明に係る実施例の撮像画像であり、(B)~(D)は欠陥を説明するための図である。(A) is a captured image of an embodiment according to the present invention, and (B) to (D) are diagrams for explaining defects. 本発明に係る実施例の差分画像を示す図である。It is a figure which shows the difference image of the Example which concerns on this invention. 本発明に係る実施例の別の差分画像を示す図である。FIG. 11 shows another difference image of an embodiment according to the present invention; (A)は本発明に係る実施例の二値画像であり、(B)はノイズ処理後の二値画像である。(A) is a binary image of an embodiment according to the present invention, and (B) is a binary image after noise processing. (A)は本発明に係る実施例の別の二値画像であり、(B)はノイズ処理後の二値画像である。(A) is another binary image of an embodiment according to the present invention, and (B) is a binary image after noise processing. (A)は本発明に係る別の実施例の欠陥特定画像であり、(B)は別の欠陥特定画像である。(A) is a defect identification image of another embodiment according to the present invention, and (B) is another defect identification image.

以下、図面を参照しつつ本発明の実施形態について詳細に説明する。なお、以下の説明では、同様の構成要素には同一の参照番号を付す。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In the description below, the same reference numerals are given to the same components.

図1は、本発明に係る画像処理システム100を示す図である。画像処理システム100は、透明な検査物WKにキズ等の欠陥があるかどうかを判別するものである。画像処理システム100は、撮像装置10と、画像処理装置20と、光源装置30と、を備える。撮像装置10は、光学素子、プロセッサー、撮像素子等を備え、撮像により画像を取得する。なお、透明な検査物は、光源装置30からの光を所定の光量以上を透過するものであればよい。 FIG. 1 is a diagram showing an image processing system 100 according to the present invention. The image processing system 100 determines whether or not the transparent inspection object WK has defects such as scratches. The image processing system 100 includes an imaging device 10 , an image processing device 20 and a light source device 30 . The imaging device 10 includes an optical element, a processor, an imaging element, etc., and acquires an image by imaging. It should be noted that the transparent inspection object may be any object that transmits a predetermined amount of light or more from the light source device 30 .

画像処理装置20は、CPU(Central Processing Unit:中央演算処理装置)と、メモリと、ハードディスクドライブ、SSD等のストレージと、マウス、キーボード等の入力装置と、ディスプレイ、プリンタ等の出力装置と、通信ネットワークと接続するための通信装置とを備えており、これらがバスを介して接続されている構成とすることができる。 The image processing device 20 includes a CPU (Central Processing Unit), a memory, a storage such as a hard disk drive or SSD, an input device such as a mouse or keyboard, an output device such as a display or printer, and communication. A communication device for connecting to a network may be provided, and these may be connected via a bus.

このような構成を備えることにより、画像処理装置20は、画像処理や各種の情報処理を実行することができる。また、画像処理装置20は撮像装置10に接続されており、撮像装置10により撮像された画像を取得して画像を処理する。なお、撮像装置10が撮像画像を外部記憶素子等に記録し、画像処理装置20に、この外部記憶素子に記憶された撮像画像を読み込ませて画像を処理するようにしてもよい。出力装置に画像処理結果を出力させ、入力装置を介してユーザー設定等を画像処理方法に反映させることも可能である。 With such a configuration, the image processing apparatus 20 can execute image processing and various types of information processing. Further, the image processing device 20 is connected to the imaging device 10, acquires an image captured by the imaging device 10, and processes the image. Note that the imaging device 10 may record the captured image in an external storage device or the like, and the image processing device 20 may read the captured image stored in the external storage device to process the image. It is also possible to cause the output device to output the image processing result, and to reflect user settings and the like in the image processing method via the input device.

光源装置30は、明部と暗部とからなる光を発する装置であり、例えば、画像を表示することができる液晶表示装置等の表示装置であり、図2に示す背景画像200を表示することがきる。検査物WKには、背景画像200と同様の模様が投影される。なお、光源装置30は、液晶表示装置等に限らず、平板の白色光源上に黒白のストライプ模様のフィルムを貼り付けて、背景画像200と同様の暗部と明部とからなる光が検査物WKに投影されるようにしてもよい。 The light source device 30 is a device that emits light composed of a bright portion and a dark portion, and is, for example, a display device such as a liquid crystal display device capable of displaying an image, and is capable of displaying the background image 200 shown in FIG. Wear. A pattern similar to the background image 200 is projected onto the inspection object WK. Note that the light source device 30 is not limited to a liquid crystal display device or the like. may be projected onto

図1に示す検査物WKは、光源装置30の直上に配置される。撮像装置10は、光源装置30が表示する背景画像200とともに検査物WKを撮像する。 The inspection object WK shown in FIG. 1 is arranged directly above the light source device 30 . The imaging device 10 images the inspection object WK together with the background image 200 displayed by the light source device 30 .

図2は、本発明に係る背景画像200を示す図である。背景画像200は、白色画素と黒色画素とから構成される。背景画像200において、白色画素は白帯210のように白色画素群を形成し、黒色画素は黒帯220のように黒色画素群を形成している。これにより、明部と暗部とからなる光が、透明物である透明な検査物WKに投影される。背景画像200は、白帯210及び黒帯220を複数有し、白帯210及び黒帯220はそれぞれ同サイズであり交互に配置される。 FIG. 2 shows a background image 200 according to the invention. Background image 200 is composed of white pixels and black pixels. In background image 200 , white pixels form white pixel groups such as white band 210 , and black pixels form black pixel groups such as black band 220 . As a result, the light composed of the bright portion and the dark portion is projected onto the transparent inspection object WK, which is a transparent object. The background image 200 has a plurality of white bands 210 and black bands 220. The white bands 210 and black bands 220 are of the same size and are alternately arranged.

例えば、図2に示す背景画像200のように、白帯210及び黒帯220はそれぞれ横方向にストライプ状で配置されている。なお、白帯210と黒帯220の幅は、後の画像処理においてノイズの影響を少なくするために同じ幅であることが好ましいが、0.95対1.05または1.05対0.95ほどのずれであれば本発明に係る画像処理方法を実行することができ、例えばノイズ処理も適切に行うことができる。 For example, like the background image 200 shown in FIG. 2, the white belts 210 and the black belts 220 are arranged in stripes in the horizontal direction. It should be noted that the width of the white band 210 and the width of the black band 220 are preferably the same width in order to reduce the influence of noise in subsequent image processing. If the deviation is moderate, the image processing method according to the present invention can be executed, and for example, noise processing can be performed appropriately.

次に、画像処理装置20が実行する画像処理方法について説明する。なお、透明な検査物WKは、図3(A)に示すように表面に線キズ310を有するものとする。この場合、撮像装置10は、図3(B)に示すような撮像画像300を取得する。そして、画像処理装置20は、この撮像画像300をグレースケール化した後に画像処理を行う。 Next, an image processing method executed by the image processing device 20 will be described. It is assumed that the transparent inspection object WK has a line scratch 310 on its surface as shown in FIG. 3(A). In this case, the imaging device 10 acquires a captured image 300 as shown in FIG. 3(B). Then, the image processing device 20 performs image processing after converting the captured image 300 into a gray scale.

撮像画像300は、検査物WKを透過した背景画像200を含んでおり、明部を反映した白色画素と、暗部を反映した黒画素を含んでいる。また、検査物WKが有する線キズ310も、撮像画像300において線キズ350のように、欠陥の影響を受けて灰色の中間色で表される。 The captured image 300 includes the background image 200 transmitted through the inspection object WK, and includes white pixels reflecting bright portions and black pixels reflecting dark portions. In addition, the line flaw 310 on the inspection object WK is also represented in a neutral gray color under the influence of the defect, like the line flaw 350 in the captured image 300 .

画像処理装置20は、撮像装置10から撮像画像300を取得し、図4に示す画像処理方法のフローに従って画像処理を行う。 The image processing device 20 acquires the captured image 300 from the imaging device 10 and performs image processing according to the flow of the image processing method shown in FIG.

まず、S410において、撮像画像300をグレースケース化し、256階調でグレースケール化した撮像画像500に変換する。グレースケース化したことにより、輝度値が「255」を示す画素は白色画素であり、輝度値が「0」を示す画素は黒色画素となる。なお、取得した撮像画像が既にグレースケール化されている場合、当該処理は不要である。また、S410において、必要に応じて傾き補正の処理を行う。傾き補正の処理とは、グレースケール化した撮像画像500に含まれる、背景画像200を取り込んだことによる黒帯501-1~6及び白帯502-1~6の並びの方向が画像の水平方向に対して上向きに傾いている場合に、水平方向になるように補正することである。あるいは、傾き補正は、黒帯501-1~6及び白帯502-1~6の境界の方向が、画像の水平方向に対して垂直となるように補正することである。この補正は、例えば、画素の輝度値の変化に基づいて境界線を特定し、その境界線の角度を求めることによって傾きを何度補正すればよいかを決定することができる。 First, in S410, the captured image 300 is converted into a grayscale captured image 500 with 256 gradations. As a result of the gray-casing, a pixel with a luminance value of "255" is a white pixel, and a pixel with a luminance value of "0" is a black pixel. It should be noted that this processing is not necessary if the acquired captured image has already been converted to grayscale. In addition, in S410, tilt correction processing is performed as necessary. The inclination correction process is performed by correcting the orientation of the black bands 501-1 to 501-6 and the white bands 502-1 to 502-6 by capturing the background image 200 included in the grayscaled captured image 500 in the horizontal direction of the image. is to correct it so that it becomes horizontal when it is tilted upward with respect to Alternatively, the tilt correction is correction so that the direction of the boundary between the black bands 501-1 to 501-6 and the white bands 502-1 to 502-6 is perpendicular to the horizontal direction of the image. For this correction, for example, it is possible to determine how many times the tilt should be corrected by specifying the boundary line based on the change in the luminance value of the pixel and obtaining the angle of the boundary line.

次に、S420において、グレースケール化した撮像画像500に基づいて、ずれ画像または反転画像を生成する。 Next, in S420, a shift image or an inverted image is generated based on the grayscaled captured image 500. FIG.

ずれ画像は、グレースケール化した撮像画像に含まれる黒帯または白帯の横幅に相当する横幅と、グレースケール化した撮像画像の縦幅とからなる領域を、グレースケール化した撮像画像の右端または左端を基準にして削除した画像である。右端を基準にして削除したものは「右ずれ画像」とし、左端を基準にして削除したものは「左ずれ画像」とする。ずれ画像を生成する場合、右ずれ画像または左ずれ画像の少なくとも1つを生成し、または双方とも生成することとなる。 The shift image is an area consisting of the width corresponding to the width of the black band or white band included in the grayscaled captured image and the vertical width of the grayscaled captured image. This image is deleted with the left end as the reference. An image deleted with reference to the right end is referred to as a "right-shifted image", and an image deleted with respect to the left end is referred to as a "left-shifted image". When generating a shifted image, at least one of a right shifted image, a left shifted image, or both will be generated.

図5は、グレースケール化した撮像画像500に基づいて、ずれ画像である右ずれ画像510または左ずれ画像520を生成する方法を説明するための図である。グレースケール化した撮像画像500は、黒帯501-1~6及び白帯502-1~6のように背景画像200を取り込んでいる。また、グレースケール化した撮像画像500は、検査部WKが有するキズとして線キズ503を含んでいる。 FIG. 5 is a diagram for explaining a method of generating a right-shifted image 510 or a left-shifted image 520, which are shifted images, based on a grayscaled captured image 500. FIG. The grayscaled captured image 500 captures the background image 200 as black bands 501-1 to 501-6 and white bands 502-1 to 502-6. In addition, the grayscaled captured image 500 includes a line flaw 503 as a flaw that the inspection unit WK has.

右ずれ画像510は、グレースケール化した撮像画像500から、縦幅と、黒帯501又は白帯502の横幅とからなるサイズの領域を右端から削除するようにして作成される。この領域に相当するのが領域512である。領域512は、縦幅Hと横幅Wとからなる。縦幅Hは、グレースケール化した撮像画像500の縦幅と同一の大きさである。横幅Wは、例えば、グレースケール化した撮像画像の左端から右端までを走査して輝度値の変化に基づいて白帯及び黒帯の本数を特定し、グレースケール化した撮像画像の横幅の画素数を、特定した本数で割ってその画素数を丸めて求めた数を横幅Wとすることができる。縦幅Hは、グレースケール化した撮像画像500の縦幅である。 A right-shifted image 510 is created by deleting, from the right end, a region having a size of the vertical width and the horizontal width of the black band 501 or the white band 502 from the grayscaled captured image 500 . An area 512 corresponds to this area. The region 512 has a vertical width H and a horizontal width W. As shown in FIG. The vertical width H is the same size as the vertical width of the grayscaled captured image 500 . The width W is obtained by, for example, scanning the left end to the right end of the grayscaled captured image, specifying the number of white bands and black bands based on the change in luminance value, and determining the number of pixels in the horizontal width of the grayscaled captured image. is divided by the specified number of lines, and the number of pixels is rounded off. The vertical width H is the vertical width of the captured image 500 converted to grayscale.

横幅Wと縦幅Hとからなる領域512は、グレースケール化した撮像画像500における黒帯501-1と略同一の大きさを有する。よって、グレースケール化した撮像画像500の右端を基準に領域512を削除すると、黒帯501-1を削除することになり、その結果、右ずれ画像510を生成することができる。 A region 512 having a width W and a height H has approximately the same size as the black band 501-1 in the captured image 500 converted to grayscale. Therefore, if the region 512 is deleted with reference to the right end of the grayscaled captured image 500, the black belt 501-1 is deleted, and as a result, the right-shifted image 510 can be generated.

左ずれ画像520は、グレースケール化した撮像画像500から、グレースケール化した撮像画像500の縦幅と、黒帯501又は白帯502の横幅とからなるサイズの領域を左端から削除するようにして作成される。この領域に相当するのが領域521である。領域521は、縦幅Hと横幅Wとからなる。縦幅Hは、グレースケール化した撮像画像500の縦幅と同一の大きさである。横幅Wおよび縦幅Hは、上記の右ずれ画像510の生成に関して説明した内容と同じである。 The left-shifted image 520 is obtained by deleting from the left edge of the grayscaled captured image 500 an area having the size of the vertical width of the grayscaled captured image 500 and the horizontal width of the black band 501 or the white band 502 . created. A region 521 corresponds to this region. The region 521 has a vertical width H and a horizontal width W. As shown in FIG. The vertical width H is the same size as the vertical width of the grayscaled captured image 500 . The horizontal width W and the vertical width H are the same as those described regarding the generation of the right-shifted image 510 above.

横幅Wと縦幅Hとからなる領域521は、グレースケール化した撮像画像500における白帯502-6と略同一の大きさを有する。よって、グレースケール化した撮像画像500の左端を基準に領域521を削除すると、白帯502-6を削除することになり、その結果、左ずれ画像520を生成することができる。 A region 521 having a width W and a height H has substantially the same size as the white band 502-6 in the captured image 500 converted to grayscale. Therefore, if the area 521 is deleted with reference to the left end of the grayscaled captured image 500, the white band 502-6 is deleted, and as a result, the left-shifted image 520 can be generated.

なお、ずれ画像に関し、黒帯または白帯をグレースケール化した撮像画像500から削除する例を説明しているが、グレースケール化した撮像画像500の右端または左端において黒帯または白帯の一部が起点となっていたとしても、削除されるのは黒帯または白帯と同じ大きさの領域となる。 Regarding the shifted image, an example in which a black band or a white band is deleted from the grayscaled captured image 500 has been described. is the starting point, the area to be deleted is the same size as the black or white band.

一方、反転画像は、グレースケール化した撮像画像500の注目画素の輝度値から255を引いた値の絶対値を、反転画像における注目画素の値とするものである。例えば、グレースケール化した撮像画像500の白画素は輝度値が255であるから、255を引くと0になり、反転画像においては黒画素となる。また、グレースケール化した撮像画像の黒画素は輝度値が0であるから、255を引くと―255になり、その絶対値は255であるから反転画像においては白画素となる。 On the other hand, in the reverse image, the absolute value of the value obtained by subtracting 255 from the luminance value of the pixel of interest in the grayscaled captured image 500 is used as the value of the pixel of interest in the reverse image. For example, since a white pixel in the grayscaled captured image 500 has a luminance value of 255, subtracting 255 results in 0, and in the inverted image, it becomes a black pixel. Also, since the luminance value of black pixels in a grayscaled captured image is 0, subtracting 255 results in -255, and since the absolute value is 255, it becomes a white pixel in an inverted image.

図6に示す反転画像600は、グレースケール化した撮像画像500に基づいて作成されたものである。グレースケール化した撮像画像500と反転画像600を対比すると、グレースケール化した撮像画像500の黒帯501-1~6の位置にある画素は、反転画像600において白画素からなる白帯601-1~6となっている。また、グレースケール化した撮像画像500の白帯502-1~6の位置にある画素は、反転画像600において黒画素からなる黒帯602-1~6となっている。グレースケール化した撮像画像500の線キズ503の画素に関し、その輝度値が中間値近辺にあり、その値を127とすれば、255を引くと-128となり、その絶対値は128であるから反転画像においても同様の輝度値を示す画素となる。従って、反転画像600のように、線キズ603は中間値を示している。 A reverse image 600 shown in FIG. 6 is created based on the captured image 500 converted to grayscale. Comparing the grayscaled captured image 500 and the inverted image 600, the pixels at the positions of the black bands 501-1 to 501-6 in the grayscaled captured image 500 are white pixels in the reversed image 600. ~6. Also, the pixels at the positions of the white bands 502-1 to 502-6 in the grayscaled image 500 are the black bands 602-1 to 602-6 made up of black pixels in the inverted image 600. FIG. Regarding the pixel of the line flaw 503 of the grayscaled captured image 500, the luminance value is near the middle value, and if the value is 127, subtracting 255 gives -128, and the absolute value is 128, so it is inverted. The pixels in the image also exhibit similar luminance values. Therefore, like the reverse image 600, the line blemish 603 shows the intermediate value.

次に、S430において差分画像を生成する。差分画像は、グレースケール化した撮像画像の注目画素の輝度値と、ずれ画像または反転画像の注目画素の輝度値との差分の絶対値に基づいて生成される。 Next, in S430, a difference image is generated. The difference image is generated based on the absolute value of the difference between the luminance value of the pixel of interest in the grayscaled captured image and the luminance value of the pixel of interest in the shifted or inverted image.

まず、反転画像600とグレースケール化した撮像画像500とに基づいて差分画像を作成する処理の例について説明する。なお、反転画像600とグレースケール化した撮像画像500とは同サイズの画像であるため、それぞれの注目画素が同じ位置関係にある。反転画像600における白画素は、グレースケール化した撮像画像500において黒画素となり、反転画像600における黒画素は、グレースケール化した撮像画像500において白画素となる。例えば、反転画像600における白帯601-1の位置には、グレースケール化した撮像画像500では黒帯501-1になっている。このように、それぞれの注目画素が白画素と黒画素との関係にあり、差分の絶対値は「255」となるため、差分画像700において白画素となる。 First, an example of processing for creating a differential image based on the inverted image 600 and the grayscaled captured image 500 will be described. Since the inverted image 600 and the grayscaled captured image 500 are images of the same size, the pixels of interest have the same positional relationship. White pixels in the inverted image 600 become black pixels in the grayscaled captured image 500 , and black pixels in the inverted image 600 become white pixels in the grayscaled captured image 500 . For example, the position of the white band 601-1 in the inverted image 600 is the black band 501-1 in the grayscaled captured image 500. FIG. In this way, each pixel of interest has a relationship between a white pixel and a black pixel, and the absolute value of the difference is "255".

一方、注目画素がキズ603のように中間値を示す輝度値を示す画素である場合、グレースケール化した撮像画像500においてもキズ503のように中間値を示す輝度値を示す画素である。よってこれらの輝度値の差分を求めるとおおよそ「0」に近い値となり、差分画像700においては黒色または黒色に近い灰色となる。 On the other hand, if the pixel of interest is a pixel that indicates a luminance value that indicates an intermediate value, such as the flaw 603 , the pixel that indicates a luminance value that indicates an intermediate value also exists in the grayscaled captured image 500 , like the flaw 503 . Therefore, when the difference between these luminance values is obtained, it becomes a value close to "0", and the difference image 700 is black or gray close to black.

次に、右ずれ画像510とグレースケール化した撮像画像500とに基づいて差分画像を作成する処理について説明する。まず、右ずれ画像510とグレースケール化した撮像画像500との画素の対応関係を設定する。具体的には、右ずれ画像の右上端点513とグレースケール化した撮像画像500の右上端点504とが一致し、右ずれ画像の右下端点514とグレースケール化した撮像画像500の右上端点506とが一致するようにそれぞれの画像の位置関係を設定する。 Next, processing for creating a difference image based on the right-shifted image 510 and the grayscaled captured image 500 will be described. First, the pixel correspondence relationship between the right-shifted image 510 and the grayscaled captured image 500 is set. Specifically, the upper right corner point 513 of the right-shifted image and the upper right corner point 504 of the grayscaled captured image 500 match, and the lower right corner point 514 of the right-shifted image and the upper right corner point 506 of the grayscaled captured image 500 match. Set the positional relationship of each image so that

この位置関係の設定後に、右ずれ画像510とグレースケール化した撮像画像500とで対応関係のある注目画素について輝度値の差分の絶対値を求め、その値を差分画像の画素の輝度値とする。なお、領域512分だけ右ずれ画像510はグレースケール化した撮像画像500よりも小さいため、右ずれ画像510とグレースケール化した撮像画像500とが重なり合わない領域については差分を求めないこととする。この重なり合わない領域はおおよそグレースケール化した撮像画像500の白帯502-6である。よって、差分画像の大きさは、右ずれ画像510と同じ大きさとなる。 After setting this positional relationship, the absolute value of the difference in luminance value is obtained for the pixel of interest that has a corresponding relationship between the right-shifted image 510 and the grayscaled captured image 500, and the obtained value is used as the luminance value of the pixel in the difference image. . Since the right-shifted image 510 is smaller than the grayscaled captured image 500 by the area 512, the difference is not calculated for the region where the right-shifted image 510 and the grayscaled captured image 500 do not overlap. . This non-overlapping region is roughly the white band 502-6 of the grayscaled captured image 500. FIG. Therefore, the difference image has the same size as the right-shifted image 510 .

輝度値の差分の絶対値を求める際、右ずれ画像510のキズ512と、グレースケール化した撮像画像500のキズ504が重なっている画素がある場合、その重なりあっている画素の輝度値の差分の絶対値はおおよそ0になる。よって、差分画像において、その画素は黒色または黒色に近い灰色となっている。キズ512とキズ504が重なりあわない画素については、キズを示す画素の輝度値と白色又は黒色の輝度値との差分の絶対値となり、その画素はおおよそ中間近辺の灰色を示す輝度値となる。 When obtaining the absolute value of the luminance value difference, if there is a pixel where the flaw 512 of the right-shifted image 510 and the flaw 504 of the grayscaled captured image 500 overlap, the difference in the luminance value of the overlapping pixels. has an absolute value of approximately 0. Therefore, in the difference image, the pixel is black or gray close to black. For pixels where the blemish 512 and blemish 504 do not overlap, the absolute value of the difference between the luminance value of the pixel showing the blemish and the luminance value of white or black is obtained, and the luminance value of the pixel is roughly intermediate gray.

グレースケール化した撮像画像500の黒帯501-1は、右ずれ画像510の白帯512-1と同じ位置にある。従って、その差分の絶対値は255であり、差分画像における黒帯501-1及び白帯512-1の位置にある各画素は白色となる。例えば、図7(A)に示すように、右ずらし画像に基づく差分画像700では、領域701にある、黒帯501-1及び白帯512-1の位置に相当する各画素は白色である。 The black band 501-1 of the grayscaled captured image 500 is at the same position as the white band 512-1 of the right-shifted image 510. FIG. Therefore, the absolute value of the difference is 255, and each pixel at the positions of the black belt 501-1 and the white belt 512-1 in the difference image is white. For example, as shown in FIG. 7A, in a differential image 700 based on the right-shifted image, each pixel corresponding to the positions of the black band 501-1 and the white band 512-1 in the area 701 is white.

左ずれ画像520とグレースケール化した撮像画像500とに基づいて差分画像を作成する処理も上記で説明した、右ずれ画像510とグレースケール化した撮像画像500とに基づいて差分画像を作成する処理と同様である。なお、位置の基準は、左ずれ画像520の左上端点522とグレースケール化した撮像画像500の左上端点505とが一致し、左ずれ画像520の左下端点523とグレースケール化した撮像画像500の左下端点507とが一致するように設定される。 The process of creating a differential image based on the left-shifted image 520 and the grayscaled captured image 500 is also the above-described process of creating a differential image based on the right-shifted image 510 and the grayscaled captured image 500. is similar to Note that the positional reference is that the upper left corner point 522 of the left-shifted image 520 and the upper left corner point 505 of the grayscaled image 500 match, and The end point 507 is set so as to match.

図7(A)に、差分画像700を示す。差分画像700では、グレースケール化した撮像画像500に含まれていた黒帯501-1~6や白帯502-1~6に関し、差分を求めたことにより注目画素が白画素になるため、黒帯を含まない画像となっている。また差分画像は、キズ701が黒色または灰色で示されるため、キズを特定できるような画像となっている。 A difference image 700 is shown in FIG. In the difference image 700, the pixels of interest become white pixels as a result of obtaining the difference with respect to the black bands 501-1 to 501-6 and the white bands 502-1 to 502-6 included in the grayscaled captured image 500. The image does not include a band. Also, since the flaw 701 is shown in black or gray in the differential image, the flaw can be identified.

以上のようにして差分画像を求めるが、差分画像にノイズが発生することがある。例えば、図7(B)に示す差分画像710のように、複数の線711が現われることがある。これは、撮像環境やカメラの性能の影響により、撮像画像において黒帯と白帯の幅が異なる、あるいは白帯と黒帯の境界付近において輝度値がゆるやかに変化していることに起因している。このように、背景画像が映り込んだ撮像画像に基づいて差分画像を生成する場合、黒帯及び白帯の境界の位置に縦線のようなノイズが発生しうる。なお、線711の輝度値は0から、中間値である128付近の値をとりうる。 Although the differential image is obtained as described above, noise may occur in the differential image. For example, multiple lines 711 may appear as in the difference image 710 shown in FIG. 7B. This is because the width of the black band and the white band in the captured image differ, or the luminance value changes gradually near the boundary between the white band and the black band due to the influence of the imaging environment and camera performance. there is Thus, when a differential image is generated based on a captured image in which a background image is reflected, noise such as vertical lines may occur at the position of the boundary between the black band and the white band. Note that the luminance value of the line 711 can take values from 0 to around 128, which is an intermediate value.

差分画像700であってもノイズあり差分画像710であっても、グレースケール化した撮像画像500と対比すると、グレースケール化した撮像画像500に含まれていた黒帯501が消去されているので、人の目で見たときに線キズ701または線キズ712を視認しやすくなり、検査物WKの欠陥の有無を判定しやすくすることができる。 In both the differential image 700 and the differential image 710 with noise, when compared with the grayscaled captured image 500, the black band 501 included in the grayscaled captured image 500 is removed. The line flaw 701 or the line flaw 712 can be easily visually recognized when viewed with the human eye, and the presence or absence of a defect in the inspection object WK can be easily determined.

以上のように差分画像を生成するものであり、グレースケール化した撮像画像において黒帯及び白帯の周期的な配置により人の目により視認しづらかった線キズが、差分画像では黒帯が消去されるので、人の目により線キズを視認しやすくできる。 The difference image is generated as described above, and the line flaws that were difficult to see with the human eye due to the periodic arrangement of black and white bands in the grayscaled image are removed in the difference image. This makes it easier for the human eye to visually recognize the line scratches.

次に、S440において、差分画像に含まれるノイズを除去しつつ、キズ等の欠陥を識別できるような二値画像を生成するための二値化処理を行う。 Next, in S440, binarization processing is performed to generate a binary image capable of identifying defects such as scratches while removing noise contained in the difference image.

図8は、ノイズあり差分画像に対する二値化処理の一例を説明するための図である。二値化処理においては適応的な閾値処理を行う。なお、図8(A)に示すノイズあり差分画像710の領域801における処理を例にして説明する。この適応的な閾値処理(Adaptive Threshold)についてはNiblack法を採用することができるが、これに限定されず、Sauvola法やその他の処理を用いてもよい。 FIG. 8 is a diagram for explaining an example of binarization processing for a noise-containing difference image. Adaptive threshold processing is performed in the binarization processing. Note that the processing in the region 801 of the noise-containing difference image 710 shown in FIG. 8A will be described as an example. The Niblack method can be used for this adaptive threshold processing, but it is not limited to this, and the Sauvola method or other processing may be used.

図8(B)は領域801を拡大した図である。図8(B)に示すように、適応的な閾値処理にあたり、注目画素812を中心とした所定のサイズの枠811が設定される。枠811の大きさは、例えば、横1ピクセル×縦50ピクセルである。ここで、枠811の横幅を1ピクセルとしているが、キズ等の欠陥を示す画素が含まれる場合に縦成分の輝度の変化を的確に判別するために狭い値に設定している。そして、枠811内に含まれる画素の輝度値の平均値や標準偏差に基づいて閾値が定められ、この閾値に基づいて注目画素が「0」または「1」に設定される。なお、縦の大きさは、好ましくは、想定されるキズの大きさの少なくとも2倍程度の画素サイズとすればよい。 FIG. 8B is an enlarged view of the region 801. FIG. As shown in FIG. 8B, in adaptive threshold processing, a frame 811 of a predetermined size centered on a pixel of interest 812 is set. The size of the frame 811 is, for example, 1 horizontal pixel×50 vertical pixels. Here, the horizontal width of the frame 811 is set to 1 pixel, but is set to a narrow value in order to accurately determine the change in luminance of the vertical component when pixels indicating defects such as scratches are included. Then, a threshold value is determined based on the average value and standard deviation of the luminance values of the pixels included in the frame 811, and the pixel of interest is set to "0" or "1" based on this threshold value. It should be noted that the vertical size should preferably be a pixel size that is at least about twice the size of the assumed flaw.

そして、矢印813で示す方向のように枠811を右方向へスライドさせながら、注目画素について「0」または「1」が設定される。なお枠813が再右端まで移動している場合には注目画素812を一画素分下にずらして最左端から同様にして処理を進める。 Then, while sliding the frame 811 rightward in the direction indicated by an arrow 813, "0" or "1" is set for the pixel of interest. If the frame 813 has moved to the right end, the pixel of interest 812 is shifted downward by one pixel and the processing proceeds in the same manner from the leftmost end.

S440における二値化処理により、図9に示す二値画像900を得る。二値画像900のように、キズ部分が白色画素で表されている。 A binary image 900 shown in FIG. 9 is obtained by the binarization processing in S440. As in the binary image 900, the flawed portion is represented by white pixels.

次に、S450において、二値画像からキズ等の欠陥を特定する。キズの特定は、例えば公知のラベリング処理等を用いて所定の大きさを有する白色画素からなる領域が存在する場合に、これをキズ等の欠陥として扱うことができる。 Next, in S450, defects such as scratches are identified from the binary image. A defect can be identified by, for example, a known labeling process or the like, and when an area of white pixels having a predetermined size exists, it can be treated as a defect such as a scratch.

<変形例1>
上記の発明の実施形態において、S440で二値画像を生成し、S450でこの二値画像に基づいてキズ等の欠陥を特定している。このプロセスとは異なり、学習モデルを利用してキズ等の欠陥を特定するようにしてもよい。
<Modification 1>
In the embodiment of the invention described above, a binary image is generated in S440, and defects such as scratches are specified based on this binary image in S450. Alternatively to this process, a learned model may be used to identify defects such as scratches.

学習モデルは、グレースケール化した撮像画像を教師データとして構築されたものである。この教師データを用い、グレースケール化した撮像画像を入力し、透明物の欠陥を示した撮像画像を出力とする学習モデルを生成する。なお、教師データとして用いるグレースケール化した撮像画像は、キズ等の欠陥を含まない検査物を撮像した撮像画像が好ましい。しかし、キズ等の欠陥を含んだ検査物を撮像した撮像画像であっても、キズ等の欠陥を示さない領域をグレースケール化した撮像画像から抽出し、これを教師データとして用いてもよい。 The learning model is constructed by using grayscaled captured images as teacher data. Using this teacher data, a learning model is generated in which a grayscaled captured image is input and a captured image showing a defect in a transparent object is output. It should be noted that the grayscaled captured image used as training data is preferably a captured image of an inspection object that does not include defects such as scratches. However, even if the captured image is an image of an inspection object that includes defects such as scratches, a region that does not show defects such as scratches may be extracted from the grayscaled captured image and used as teacher data.

<変形例2>
上記の発明の実施形態において、S420でずれ画像を生成する場合、S430でずれ画像とグレースケール化した撮像画像とに基づいて差分画像を生成している。この場合、例えば右ずれ画像であれば、キズが右にずれる分だけ差分画像においてキズが撮像画像よりも大きくなりうる。そこで、S430で右ずれ画像と左ずれ画像の双方を作成し、右ずれ画像とグレースケール化した撮像画像とに基づいて第1の差分画像を生成する。また、左ずれ画像とグレースケール化した撮像画像とに基づいて第2の差分画像を生成する。
<Modification 2>
In the embodiment of the invention described above, when generating a shift image in S420, a difference image is generated based on the shift image and the grayscaled captured image in S430. In this case, for example, in the case of a right-shifted image, the defect in the difference image may be larger than that in the captured image by the amount of the defect shifted to the right. Therefore, in S430, both a right-shifted image and a left-shifted image are created, and a first differential image is generated based on the right-shifted image and the grayscaled captured image. Also, a second difference image is generated based on the left-shifted image and the grayscaled captured image.

次に、S440で、第1の差分画像に基づいた第1の二値画像と、第2の差分画像に基づいた第2の二値画像とを生成する。この第1の二値画像と第2の二値画像との対応する画素について論理積による第3の二値画像を生成し、この第3の二値画像に基づいて、S450においてキズ等の欠陥を特定する。このような処理を行うことにより、ずれ画像を用いた差分画像について、撮像画像と比して大きなキズとならないように抑制できる。なお、第3の二値画像の生成において、第1の二値画像は撮像画像における右端に合わせ、第2の二値画像は左端に合わせるように画素の対応関係を設定する。 Next, at S440, a first binary image based on the first difference image and a second binary image based on the second difference image are generated. A third binary image is generated by logical product of corresponding pixels of the first binary image and the second binary image. identify. By performing such processing, it is possible to prevent the difference image using the shifted image from becoming a large flaw compared to the captured image. In generating the third binary image, the pixel correspondence is set so that the first binary image is aligned with the right end of the captured image, and the second binary image is aligned with the left end.

<変形例3>
上記の発明の実施形態において、撮像画像300に関し、白帯と黒帯が交互に横方向に並ぶようにして撮像されている。このような撮像画像が取得される場合に、背景画像200も白帯と黒帯が交互に横方向に並ぶような画像であれば、これを90°回転させて、白帯と黒帯が交互に縦方向に並ぶような画像を表示させてもよい。
<Modification 3>
In the above-described embodiment of the invention, the captured image 300 is captured so that white bands and black bands are alternately arranged in the horizontal direction. When such a captured image is acquired, if the background image 200 is also an image in which white bands and black bands are alternately arranged in the horizontal direction, this is rotated by 90° so that white bands and black bands are alternately arranged. may be displayed in such a way that the images are arranged in the vertical direction.

これにより、撮像画像は、白帯と黒帯が交互に縦方向に並ぶような画像となる。この場合、S420でずれ画像を生成するときに、グレースケール化した撮像画像の白帯または黒帯に相当する領域を上端から削除した上ずれ画像、または下端から削除した下ずれ画像を生成する。S440で局所的な閾値処理を実行する際には、枠を横50ピクセル×縦1ピクセルのように設定する。これはノイズが横方向に発生するためである。 As a result, the captured image becomes an image in which white stripes and black stripes are alternately arranged in the vertical direction. In this case, when generating the displaced image in S420, an upper displaced image in which the area corresponding to the white band or black band of the grayscaled image is deleted from the upper end or a lower displaced image in which the region corresponding to the gray scaled captured image is deleted from the lower end is generated. When performing local thresholding in S440, the frame is set to 50 pixels wide by 1 pixel high. This is because noise occurs in the horizontal direction.

上記の変形例1~3を複数組み合わせて実施の形態の変形として実施することも可能である。例えば、変形例3で撮像した撮像画像を用いて変形例1を実施し、透明物の欠陥を示した撮像画像を取得するようにしてもよい。 It is also possible to combine a plurality of Modifications 1 to 3 described above and implement them as modifications of the embodiment. For example, modified example 1 may be implemented using the captured image captured in modified example 3 to acquire a captured image showing a defect in a transparent object.

<実施例>
以下、実施例について説明する。光源装置30として、13インチのLCD表示装置を用いた。背景画像200を光源装置30に表示させたときに、黒帯及び白帯の幅は1mmであった。撮像装置10としては、携帯電話機に搭載のカメラ(24mm焦点距離、フルHD)を用いた。
<Example>
Examples are described below. A 13-inch LCD display device was used as the light source device 30 . When the background image 200 was displayed on the light source device 30, the width of the black band and the white band was 1 mm. As the imaging device 10, a camera (24 mm focal length, full HD) mounted on a mobile phone was used.

検査物WKは、材質:ポリプロピレン、6.5mm×9mm、厚さ0.2mmのものを用いた。この検査物WKは3つの欠陥があり、長さ約23mm、約1mm、約0.8mmであり、幅が約0.3mmの線キズである。光源装置30と検査物WKとの距離は12cmであり、検査物WKと撮像装置10までの距離は25cmである。 The material to be inspected WK used was polypropylene, 6.5 mm×9 mm, and 0.2 mm thick. This inspection object WK has three defects, which are line flaws with lengths of about 23 mm, about 1 mm, and about 0.8 mm, and a width of about 0.3 mm. The distance between the light source device 30 and the inspection object WK is 12 cm, and the distance between the inspection object WK and the imaging device 10 is 25 cm.

図10は、撮像画像をグレースケール変換したグレースケール化した撮像画像1000を示す。グレースケール化した撮像画像1000に関し、背景画像とともに検査物WKが有する3つのキズが映り込んでいることが確認できる。具体的には、図11に示すグレースケール化した撮像画像1000上の3つの領域1101、1102、1103において確認できる。図11(B)は領域1101を拡大したものであり、輝度値の中間値を示す画素が横方向に連なっていることが確認できる。図11(C)は、領域1102を拡大したものであり、図11(D)は領域1103を拡大したものである。同様に、輝度値の中間値を示す画素が横方向に連なっていることが確認できる。 FIG. 10 shows a grayscale captured image 1000 obtained by converting the captured image to grayscale. Regarding the captured image 1000 converted to grayscale, it can be confirmed that the three flaws of the inspection object WK are reflected together with the background image. Specifically, it can be confirmed in three areas 1101, 1102, and 1103 on the grayscaled captured image 1000 shown in FIG. FIG. 11B is an enlarged view of the area 1101, and it can be confirmed that the pixels indicating the intermediate luminance value are arranged in the horizontal direction. FIG. 11C is an enlarged view of the area 1102, and FIG. 11D is an enlarged view of the area 1103. FIG. Similarly, it can be confirmed that the pixels indicating the intermediate value of the luminance value are arranged in the horizontal direction.

次に、S420において、ずれ画像または反転画像を生成する。そして、S430で差分画像を生成する。図12に示す差分画像1200は、グレースケール化した撮像画像1000と、グレースケール化した撮像画像1000に基づいて所定の大きさだけ削除した右ずれ画像とに基づいて作成したものである。 Next, at S420, a shifted or inverted image is generated. Then, in S430, a difference image is generated. A difference image 1200 shown in FIG. 12 is created based on a grayscaled captured image 1000 and a right-shifted image obtained by deleting a predetermined size based on the grayscaled captured image 1000 .

図13に示す差分画像1300は、グレースケール化した撮像画像1000と、グレースケール化した撮像画像1000に基づいて作成した反転画像とに基づいて作成したものである。 A differential image 1300 shown in FIG. 13 is created based on the grayscaled captured image 1000 and the inverted image created based on the grayscaled captured image 1000 .

差分画像1200または差分画像1300のいずれにおいても、線キズがグレースケール化した撮像画像1000と比して視認しやすくなっていることがわかる。 It can be seen that in both the difference image 1200 and the difference image 1300, the line scratches are easier to visually recognize than in the captured image 1000 in which the line scratches are grayscaled.

次に、S440において、二値画像を生成する。図14に示す二値画像1400は、差分画像1200に対し、適応的な閾値処理により生成した二値画像である。適応的な閾値処理にあたり、横1ピクセル×縦50ピクセルを枠として設定している。 Next, at S440, a binary image is generated. A binary image 1400 shown in FIG. 14 is a binary image generated by performing adaptive threshold processing on the difference image 1200 . For adaptive threshold processing, a frame of 1 horizontal pixel×50 vertical pixels is set.

次に、二値画像1400から、ノイズ除去及び膨張処理を実施し、二値画像1410を生成する。ノイズ除去においては、白画素の塊について、横1ピクセル以下、縦4ピクセル以下、または面積49ピクセル以下の塊については黒画素に書き換えている。膨張処理については、白画素の塊について縦横それぞれ2ピクセル分膨張させている。 Next, the binary image 1400 is subjected to noise removal and expansion processing to generate a binary image 1410 . In the noise removal, white pixel clusters of 1 pixel or less in width, 4 pixels or less in height, or 49 pixels or less in area are rewritten to black pixels. As for the dilation process, each block of white pixels is dilated by 2 pixels vertically and horizontally.

一方、S440において、差分画像1300に基づいて二値画像を生成したものが図15に示す二値画像1500である。二値画像1500は、差分画像1300に対し、適応的な閾値処理により生成した二値画像である。適応的な閾値処理にあたり、横1ピクセル×縦50ピクセルを枠として設定している。 On the other hand, a binary image 1500 shown in FIG. 15 is generated based on the difference image 1300 in S440. A binary image 1500 is a binary image generated by performing adaptive threshold processing on the difference image 1300 . For adaptive threshold processing, a frame of 1 horizontal pixel×50 vertical pixels is set.

次に、二値画像1500から、ノイズ除去及び膨張処理を実施し、二値画像1510を生成する。ノイズ除去においては、白画素の塊について、横1ピクセル以下、縦4ピクセル以下、または面積49ピクセル以下の塊については黒画素に書き換えている。膨張処理については、白画素の塊について縦横それぞれ2ピクセル分膨張させている。 Next, the binary image 1500 is subjected to noise removal and dilation processing to generate a binary image 1510 . In the noise removal, white pixel clusters of 1 pixel or less in width, 4 pixels or less in height, or 49 pixels or less in area are rewritten to black pixels. As for the dilation process, each block of white pixels is dilated by 2 pixels vertically and horizontally.

次に、S450において、キズを特定する。例えば、図14に示す二値画像1410または図15に示す二値画像1510の白画素群をキズ等の欠陥として特定する。ユーザーに知覚させるために、この白画素群を矩形で囲み、二値画像上に表示させ、あるいは矩形の位置に合わせて撮像画像上に合成して表示させる等の処理も可能である。 Next, in S450, flaws are identified. For example, white pixels in the binary image 1410 shown in FIG. 14 or the binary image 1510 shown in FIG. 15 are identified as defects such as scratches. In order to make the user perceive it, it is also possible to enclose this white pixel group in a rectangle and display it on a binary image, or combine it on the captured image according to the position of the rectangle and display it.

なお、背景画像200のような画像を表示させることなく、透明の検査物WKを撮像画像として撮像し本発明に係る画像処理方法を実施したところ、検査物WKにおいてハレーションの影響があり、キズの検出ができなかった。背景画像200を表示させて撮像したところハレーションの影響はなかったので、背景画像200を表示させることによりハレーションの抑制効果があることも分かった。 When an image such as the background image 200 is not displayed, and the image processing method according to the present invention is performed by imaging the transparent inspection object WK as an imaged image, the inspection object WK is affected by halation and scratches. Could not be detected. When the image was captured with the background image 200 displayed, there was no effect of halation, so it was also found that displaying the background image 200 has the effect of suppressing halation.

次に、上記の変形例1で示した学習モデルを生成し、学習モデルを利用してキズ等の欠陥を特定した例について説明する。図16(A)に示す画像1600は、グレースケール化した撮像画像を教師データとして構築した学習モデルに、キズ等の欠陥を含んだ透明な検査物を撮像したグレースケール化した撮像画像を入力し、検査物の欠陥を示した撮像画像を出力させたものである。 Next, an example will be described in which the learning model shown in Modification 1 above is generated and defects such as scratches are specified using the learning model. An image 1600 shown in FIG. 16A is obtained by inputting a grayscale captured image of a transparent inspection object including defects such as scratches to a learning model constructed by using grayscale captured images as training data. , which outputs a picked-up image showing the defect of the inspection object.

図16(B)に示す画像1610は、ずれ画像に基づいた差分画像を教師データとして構築した学習モデルに、差分画像を入力し、検査物の欠陥を示した撮像画像を出力させたものである。画像1600と画像1610を比較すると、画像1600を作成した学習モデルの方がより検査物の欠陥を抽出できていることが分かった。 An image 1610 shown in FIG. 16B is obtained by inputting a difference image to a learning model constructed by using a difference image based on a shift image as teacher data, and outputting a captured image showing a defect of an inspection object. . Comparing the image 1600 and the image 1610, it was found that the learning model that created the image 1600 was able to extract the defect of the inspection object better.

なお、学習モデルの構築は、MVTec社(ドイツ)製の画像解析ソフトHALCONを用いたが、その他の画像解析ソフトを用いて学習モデルを構築することも可能である。 Although the image analysis software HALCON manufactured by MVTec (Germany) was used to construct the learning model, it is also possible to construct the learning model using other image analysis software.

10 撮像装置
20 画像処理装置
30 光源装置
100 画像処理システム
200 背景画像
300 撮像画像
500 グレースケール化した撮像画像
510 右ずれ画像
520 左ずれ画像
600 反転画像
700 差分画像
710 ノイズあり差分画像
900 二値画像
1000 グレースケール化した撮像画像
1200 差分画像
1300 差分画像
1400 二値画像
1410 二値画像
1500 二値画像
1510 二値画像

REFERENCE SIGNS LIST 10 imaging device 20 image processing device 30 light source device 100 image processing system 200 background image 300 captured image 500 grayscale captured image 510 right-shifted image 520 left-shifted image 600 inverted image 700 differential image 710 differential image with noise 900 binary image 1000 Grayscaled captured image 1200 Difference image 1300 Difference image 1400 Binary image 1410 Binary image 1500 Binary image 1510 Binary image

Claims (2)

光源から投影される明部と暗部とからなる光を透明物に投影し、前記透明物を撮像した撮像画像を生成するステップと、
前記撮像画像の各画素について輝度値を反転処理した第1の画像、または前記撮像画像における前記明部または前記暗部に相当する領域を前記撮像画像の端から削除した第1の画像を生成するステップと、
前記第1の画像および前記撮像画像において対応する位置関係にある画素について輝度値の差分の絶対値に基づいて第2の画像を生成するステップと、
前記第2の画像を教師データとして用いて、前記第2の画像を入力すると、前記第2の画像における前記透明物の欠陥を出力する学習モデルを生成するステップと、
を備える学習モデル生成方法。
a step of projecting light consisting of a bright portion and a dark portion projected from a light source onto a transparent object to generate a captured image of the transparent object;
a step of generating a first image obtained by inverting the luminance value of each pixel of the captured image, or a first image obtained by deleting the area corresponding to the bright portion or the dark portion in the captured image from the edge of the captured image; and,
a step of generating a second image based on the absolute value of the difference in luminance values for pixels in a corresponding positional relationship in the first image and the captured image;
using the second image as teacher data to generate a learning model that outputs the defect of the transparent object in the second image when the second image is input;
A learning model generation method comprising:
前記第2の画像のうちの一部分を抽出した画像を前記教師データとする、
請求項1に記載の学習モデル生成方法。
An image obtained by extracting a part of the second image as the training data;
The learning model generation method according to claim 1.
JP2023093747A 2023-02-07 2023-06-07 Learning model generation method Active JP7327866B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2023093747A JP7327866B1 (en) 2023-02-07 2023-06-07 Learning model generation method

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2023016651A JP7297354B1 (en) 2023-02-07 2023-02-07 Image processing system and image processing method
JP2023093747A JP7327866B1 (en) 2023-02-07 2023-06-07 Learning model generation method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2023016651A Division JP7297354B1 (en) 2023-02-07 2023-02-07 Image processing system and image processing method

Publications (1)

Publication Number Publication Date
JP7327866B1 true JP7327866B1 (en) 2023-08-16

Family

ID=86900467

Family Applications (2)

Application Number Title Priority Date Filing Date
JP2023016651A Active JP7297354B1 (en) 2023-02-07 2023-02-07 Image processing system and image processing method
JP2023093747A Active JP7327866B1 (en) 2023-02-07 2023-06-07 Learning model generation method

Family Applications Before (1)

Application Number Title Priority Date Filing Date
JP2023016651A Active JP7297354B1 (en) 2023-02-07 2023-02-07 Image processing system and image processing method

Country Status (1)

Country Link
JP (2) JP7297354B1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017219478A (en) 2016-06-09 2017-12-14 本田技研工業株式会社 Defect inspection method and device of the same
CN211263236U (en) 2019-11-25 2020-08-14 厦门大学 Glass defect image acquisition equipment
JP2021139769A (en) 2020-03-05 2021-09-16 国立大学法人 筑波大学 Defect detection classification system and defect determination training system
WO2021192376A1 (en) 2020-03-24 2021-09-30 日本電産株式会社 Visual inspection system and computer program

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2017219478A (en) 2016-06-09 2017-12-14 本田技研工業株式会社 Defect inspection method and device of the same
CN211263236U (en) 2019-11-25 2020-08-14 厦门大学 Glass defect image acquisition equipment
JP2021139769A (en) 2020-03-05 2021-09-16 国立大学法人 筑波大学 Defect detection classification system and defect determination training system
WO2021192376A1 (en) 2020-03-24 2021-09-30 日本電産株式会社 Visual inspection system and computer program

Also Published As

Publication number Publication date
JP7297354B1 (en) 2023-06-26

Similar Documents

Publication Publication Date Title
US20070047801A1 (en) Defect detecting method and defect detecting device
JP6250793B2 (en) Method and apparatus for removing character background from color image
CN111474177A (en) Liquid crystal screen backlight foreign matter defect detection method based on computer vision
WO2007132925A1 (en) Surface inspection device
JP2006138814A (en) Liquid level detection method
KR101726532B1 (en) Enhanced analysis for image-based serpentine belt wear evaluation
JP2011076204A (en) Method and apparatus for inspecting printed matter
JP7327866B1 (en) Learning model generation method
JP2005165387A (en) Method and device for detecting stripe defective of picture and display device
JP3695120B2 (en) Defect inspection method
JP4163199B2 (en) Inspection device, inspection method
JP5509465B2 (en) Glass bottle inspection equipment
JP4093426B2 (en) Inspection device, inspection method
JP2710527B2 (en) Inspection equipment for periodic patterns
JP5136277B2 (en) Defect detection method for netted or lined glass
JP2008233107A (en) Visual examination method and visual examination device
CN113570578A (en) Lens ghost phenomenon detection method and device
JP2021064215A (en) Surface property inspection device and surface property inspection method
JP2006133055A (en) Unevenness defect detection method and device, spatial filter, unevenness defect inspection system, and program for unevenness defect detection method
JP6185539B2 (en) Optical connector ferrule end face inspection device and inspection program
JP2004110543A (en) Face image processing unit and program
JP4790031B2 (en) Image processing apparatus, image processing method, program, and recording medium
JPH0979946A (en) Inspection device for display device
JP2021015035A (en) Image inspection method and image inspection device for image display device
JP2006145228A (en) Unevenness defect detecting method and unevenness defect detector

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230614

A871 Explanation of circumstances concerning accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A871

Effective date: 20230614

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230627

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230630

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230714

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230714

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20230727

R150 Certificate of patent or registration of utility model

Ref document number: 7327866

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150