JP2011112810A - Image processing method and apparatus - Google Patents

Image processing method and apparatus Download PDF

Info

Publication number
JP2011112810A
JP2011112810A JP2009268138A JP2009268138A JP2011112810A JP 2011112810 A JP2011112810 A JP 2011112810A JP 2009268138 A JP2009268138 A JP 2009268138A JP 2009268138 A JP2009268138 A JP 2009268138A JP 2011112810 A JP2011112810 A JP 2011112810A
Authority
JP
Japan
Prior art keywords
image
image processing
focus
density
target display
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
JP2009268138A
Other languages
Japanese (ja)
Other versions
JP5331661B2 (en
Inventor
Munetoshi Imada
宗利 今田
Hironori Yamataka
大乗 山高
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.)
Sharp Corp
Original Assignee
Sharp 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 Sharp Corp filed Critical Sharp Corp
Priority to JP2009268138A priority Critical patent/JP5331661B2/en
Publication of JP2011112810A publication Critical patent/JP2011112810A/en
Application granted granted Critical
Publication of JP5331661B2 publication Critical patent/JP5331661B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide an image processing method and apparatus, capable of determining the degree of focusing in consideration of varying the degree of focusing with the brightness of a lighting device or the like. <P>SOLUTION: The method includes: a second derivative image forming step in which a second derivative image is formed by differentiating twice the respective pixels in the region of objects of decision including a display of object of reading and its environmental background; an absolute mean value calculation process in which an absolute mean value is derived by arithmetically averaging the absolute values of the second derivative value of the respective pixels in the second derivative image: a density histogram forming process in which a density histogram of the region of objects of decision is formed; a density distribution width calculation process in which a threshold for classifying the density histogram into a high luminance side and a low luminance side is derived, and the density distribution width is calculated by the difference of the respective mean densities of the two classes classified by the threshold; a parameter calculation process in which the focusing degree is calculated by dividing the absolute mean value by density distribution width; and a parameter decision process in which the derived focusing degree and a predetermined threshold are compared. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、画像処理方法および画像処理装置に関し、特に、読取対象表示を読取る光学系の合焦度または読取対象表示の鮮明度を判定するための画像処理方法および画像処理装置に関する。   The present invention relates to an image processing method and an image processing apparatus, and more particularly to an image processing method and an image processing apparatus for determining the degree of focus of an optical system that reads a reading target display or the sharpness of the reading target display.

近年、FA(Factory Automation)の普及に伴って、工場の生産ラインでは、ベルトコンベヤなどによって搬送されている工業製品をカメラなどの撮像装置を用いて撮像し、撮像された画像を画像処理することにより、その工業製品からバーコードシンボルおよび二次元コードシンボルなどのコードシンボル、ならびに文字などの読取対象表示を自動的に読み取ることが行われている。このように、移動する被写体に付された読取対象表示を、所定位置に固定して設けられたカメラによって撮像された画像を基に読み取る場合、シャッタチャンスは一度しかないため、撮像すべき被写体ごとに最適な焦点距離を求めるオートフォーカス方式によって撮像が行われるのではなく、撮像装置に備えられるレンズの焦点(フォーカス)および絞り、撮像装置のシャッタ速度、ならびに、撮像すべき被写体を照射するための照明装置の照射光量などの撮像条件を、予め調整しておいて撮像が行われる(たとえば、特許文献1参照)。   In recent years, with the widespread use of FA (Factory Automation), in a factory production line, an industrial product conveyed by a belt conveyor or the like is imaged using an imaging device such as a camera, and the captured image is processed. Thus, a code symbol such as a bar code symbol and a two-dimensional code symbol, and a reading target display such as a character are automatically read from the industrial product. As described above, when the reading target display attached to the moving subject is read based on the image picked up by the camera fixed at a predetermined position, since there is only one photo opportunity, each subject to be picked up The image is not captured by the autofocus method for obtaining the optimum focal length for the lens, but the focus (focal point) and aperture of the lens provided in the imaging device, the shutter speed of the imaging device, and the object to be imaged are irradiated. Imaging is performed by adjusting in advance imaging conditions such as the amount of irradiation light of the illumination device (see, for example, Patent Document 1).

画像処理によって読取対象表示の読取りを行う場合には、読取対象表示に対応する表示領域と該表示領域の周辺の背景領域とのコントラスト、およびピントのボケ具合が、読取精度に大きな影響を与えることは一般に知られている。したがって、前述するように撮像条件を予め調整する際には、生産ラインを試験的に稼動させて、テスト用の物体を撮像することにより、コントラストやピントが適正であるか否かを判定することが行われている。従来から、コントラストやピントを判定するための判定項目として、合焦の程度を表す合焦度を用いた評価が行われている。   When reading a target display by image processing, the contrast between the display area corresponding to the target display and the background area around the display area, and the degree of out-of-focus, greatly affect the reading accuracy. Is generally known. Therefore, when adjusting the imaging conditions in advance as described above, it is determined whether the contrast and focus are appropriate by operating the production line on a trial basis and imaging a test object. Has been done. Conventionally, as a determination item for determining contrast and focus, evaluation using a degree of focus representing the degree of focus has been performed.

たとえば非特許文献1では、合焦判定するための8種類の手法(具体的には、「フーリエ変換を用いる手法」、「グラディエントを用いる手法」、「高周波量に基づいた手法」、「高輝度量に基づいた手法」、「エントロピーを用いる手法」、「頻度の傾きを用いる手法」、「分散を用いる手法」および「SMD(Sum-Modulus-Difference)を用いる手法」)を、走査型電子顕微鏡(SEM:Scanning Electron Microscope)像に対して用い、各手法について評価が行われている。非特許文献1における評価によれば、8種類の手法のうち、「高周波量に基づいた手法」および「分散を用いる手法」が優れている(合焦画像の検出率が100%である)ことが示されている。また特許文献2には、画像中の合焦度を含む矩形領域を抽出するための画像処理方式が開示されている。   For example, in Non-Patent Document 1, eight types of methods for determining focus (specifically, “method using Fourier transform”, “method using gradient”, “method based on high frequency amount”, “high luminance”) "Method based on quantity", "Method using entropy", "Method using frequency slope", "Method using dispersion" and "Method using SMD (Sum-Modulus-Difference)") Each method is evaluated using (SEM: Scanning Electron Microscope) images. According to the evaluation in Non-Patent Document 1, among the eight types of methods, the “method based on the amount of high frequency” and the “method using dispersion” are excellent (the detection rate of the focused image is 100%). It is shown. Patent Document 2 discloses an image processing method for extracting a rectangular region including a degree of focus in an image.

特許第4080897号Patent No. 4080897 特開2001−331806号公報JP 2001-331806 A

ViEW2003 ビジョン技術の実利用ワークショップ講演論文集 pp.12−17ViEW2003 Vision Technology Practical Workshop Lecture Collection pp. 12-17

被写体に付されたコードシンボルや文字などの読取対象表示のピントやコントラストの適正度(合焦度)は、撮像装置および照明装置といった光学系の調整工程と、被写体に付された読取対象表示を検査するための工程において用いられる。非特許文献1に記載されるように、撮像された画像の各画素を二次微分し、その二次微分値のみに基づいて合焦度を算出する方法では、照明などの明るさの変動に伴って合焦度が変動してしまう。したがって、合焦度を判定するための条件としては、満足できるものではなかった。   The focus and contrast appropriateness (focusing degree) of the reading target display such as code symbols and characters attached to the subject is determined by the adjustment process of the optical system such as the imaging device and the illumination device and the reading target display attached to the subject. Used in the inspection process. As described in Non-Patent Document 1, in the method of secondarily differentiating each pixel of a captured image and calculating the degree of focus based only on the second derivative value, brightness variation such as illumination is affected. Along with this, the degree of focus changes. Therefore, the condition for determining the degree of focus is not satisfactory.

本発明の目的は、照明などの明るさによって合焦度が変動することを考慮して合焦度判定を行うことができる画像処理方法および画像処理装置を提供することである。   An object of the present invention is to provide an image processing method and an image processing apparatus capable of performing a focus degree determination in consideration of a change in a focus degree depending on brightness such as illumination.

本発明は、所定の読取対象表示を含む撮像対象領域を撮像することによって、読取対象表示を読取る光学系の合焦度または読取対象表示の鮮明度を判定するための画像処理方法であって、
読取対象表示および該読取対象表示の周辺の背景を含む判定対象領域内の各画素を二次微分することにより二次微分画像を生成する二次微分画像生成工程と、
前記二次微分画像における各画素の二次微分値の絶対値を相加平均することによって、絶対平均値を算出する絶対平均値算出工程と、
前記判定対象領域の濃度ヒストグラムを生成する濃度ヒストグラム生成工程と、
前記濃度ヒストグラムを高輝度側のクラスと低輝度側のクラスとに分けるための閾値を算出し、該閾値によって分けられた2つのクラスの各平均濃度の差分によって、濃度分布幅を算出する濃度分布幅算出工程と、
前記絶対平均値を前記濃度分布幅で除することによって、合焦度または鮮明度を算出するパラメータ算出工程と、
算出された合焦度または鮮明度と、予め定める閾値とを比較するパラメータ判定工程とを含むことを特徴とする画像処理方法である。
The present invention is an image processing method for determining the degree of focus of an optical system that reads a reading target display or the sharpness of the reading target display by imaging an imaging target region including a predetermined reading target display.
A secondary differential image generating step of generating a secondary differential image by performing secondary differentiation on each pixel in a determination target region including a reading target display and a background around the reading target display;
An absolute average value calculating step of calculating an absolute average value by arithmetically averaging the absolute value of the second derivative value of each pixel in the second derivative image;
A density histogram generating step for generating a density histogram of the determination target region;
A density distribution that calculates a threshold value for dividing the density histogram into a high-luminance class and a low-luminance class, and calculates a density distribution width based on the difference between the average densities of the two classes divided by the threshold value Width calculation step;
A parameter calculating step for calculating a focus degree or a sharpness by dividing the absolute average value by the density distribution width;
An image processing method comprising: a parameter determination step for comparing the calculated degree of focus or definition with a predetermined threshold value.

また本発明は、前記二次微分画像生成工程において生成された二次微分画像の各画素から、ゼロクロスに寄与する画素だけを抽出するゼロクロス画素抽出工程をさらに含むことを特徴とする。   The present invention further includes a zero-cross pixel extracting step of extracting only pixels contributing to zero-cross from each pixel of the secondary differential image generated in the second-order differential image generating step.

また本発明は、所定の読取対象表示を含む撮像対象領域を撮像することによって、読取対象表示を読取る光学系の合焦度または読取対象表示の鮮明度を判定するための画像処理装置であって、
読取対象表示および該読取対象表示の周辺の背景を含む判定対象領域内の各画素を二次微分することにより二次微分画像を生成する二次微分画像生成部と、
前記二次微分画像における各画素の二次微分値の絶対値を相加平均することによって、絶対平均値を算出する絶対平均値算出部と、
前記判定対象領域の濃度ヒストグラムを生成する濃度ヒストグラム生成部と、
前記濃度ヒストグラムを高輝度側のクラスと低輝度側のクラスとに分けるための閾値を算出し、該閾値によって分けられた2つのクラスの各平均濃度の差分によって、濃度分布幅を算出する濃度分布幅算出部と、
前記絶対平均値を前記濃度分布幅で除することによって、合焦度または鮮明度を算出するパラメータ算出部と、
算出された合焦度または鮮明度と、予め定める閾値とを比較するパラメータ判定部とを含むことを特徴とする画像処理装置である。
The present invention is also an image processing apparatus for determining an in-focus level of an optical system that reads a reading target display or a sharpness of the reading target display by imaging an imaging target region including a predetermined reading target display. ,
A secondary differential image generation unit that generates a secondary differential image by performing secondary differentiation on each pixel in a determination target region including a reading target display and a background around the reading target display;
An absolute average value calculating unit that calculates an absolute average value by arithmetically averaging the absolute values of the second derivative values of each pixel in the second derivative image;
A density histogram generator for generating a density histogram of the determination target region;
A density distribution that calculates a threshold value for dividing the density histogram into a high-luminance class and a low-luminance class, and calculates a density distribution width based on the difference between the average densities of the two classes divided by the threshold value A width calculator;
A parameter calculation unit for calculating a focus degree or a sharpness by dividing the absolute average value by the density distribution width;
The image processing apparatus includes a parameter determination unit that compares the calculated degree of focus or definition with a predetermined threshold value.

本発明によれば、光学系の環境設定の適否を判定する際に、判定対象領域の二次微分画像のみから算出される値を用いて判定するのではなく、判定対象領域の二次微分画像の絶対平均値を、判定対象領域の濃度分布幅で除して得られる合焦度を用いて判定するので、すなわち正規化された合焦度を用いて判定するので、照明などの明るさによって合焦度が変動することを考慮して合焦度判定を行うことができ、精度良く読取対象表示を読取ることができるように光学系の環境設定を行うことができる。また、光学系の環境設定を行うユーザが異なるような場合があったとしても、読取精度のばらつきを低減することができる。   According to the present invention, when determining the suitability of the environment setting of the optical system, it is not determined using a value calculated only from the secondary differential image of the determination target region, but the secondary differential image of the determination target region. Is determined by using the degree of focus obtained by dividing the absolute average value by the density distribution width of the determination target region, that is, by using the normalized degree of focus. The degree of focus can be determined in consideration of the change in focus, and the environment of the optical system can be set so that the reading target display can be read with high accuracy. Further, even if the user who sets the environment of the optical system may be different, variations in reading accuracy can be reduced.

また被写体に付された文字などの読取対象表示を検査する際に、判定対象候補領域の二次微分画像のみから算出される値を用いて判定するのではなく、判定対象領域の二次微分画像の絶対平均値を、判定対象領域の濃度分布幅で除して得られる鮮明度を用いて判定するので、すなわち正規化された鮮明度を用いて判定するので、照明などの明るさによって鮮明度が変動することを考慮して鮮明度判定を行うことができ、印刷された文字などの読取対象表示に対する異常を精度良く検出することができる。また、光学系の環境設定を行うユーザが異なるような場合があったとしても、検出精度のばらつきを低減することができる。   In addition, when inspecting a reading target display such as characters attached to a subject, it is not determined using a value calculated only from the secondary differential image of the determination target candidate area, but the secondary differential image of the determination target area Is determined using the sharpness obtained by dividing the absolute average value by the density distribution width of the determination target area, that is, it is determined using the normalized sharpness. Therefore, it is possible to determine the sharpness in consideration of fluctuations in the image quality, and to accurately detect an abnormality with respect to the reading target display such as printed characters. Moreover, even if the user who sets the environment of the optical system may be different, variation in detection accuracy can be reduced.

本発明の一実施形態に係る画像処理装置20を備える画像処理システム1の構成を簡略化して示すブロック図である。1 is a block diagram showing a simplified configuration of an image processing system 1 including an image processing device 20 according to an embodiment of the present invention. 撮像装置10および照明装置30に対して予め行われる光学系の環境設定のフローチャートである。4 is a flowchart of optical system environment setting performed in advance for the imaging device 10 and the illumination device 30. 図2のステップs3における合焦度に基づく調整結果の判定工程のフローチャートである。It is a flowchart of the determination process of the adjustment result based on the focus degree in step s3 of FIG. 本実施形態に係る画像処理装置20の機能的な構成を示すブロック図である。It is a block diagram which shows the functional structure of the image processing apparatus 20 which concerns on this embodiment. 二次微分フィルタである3×3画素のラプラシアンフィルタを示す図である。It is a figure which shows the Laplacian filter of 3x3 pixel which is a secondary differential filter. 濃度ヒストグラムの一例を示す図である。It is a figure which shows an example of a density histogram. 本発明の他の実施形態に係る画像処理装置20aの機能的な構成を示すブロック図である。It is a block diagram which shows the functional structure of the image processing apparatus 20a which concerns on other embodiment of this invention. 被写体2に付された文字を検査するための検査工程のフローチャートである。6 is a flowchart of an inspection process for inspecting characters attached to a subject 2. 図8のステップa3における濃度分布幅を算出する工程のフローチャートである。It is a flowchart of the process of calculating the density distribution width in step a3 of FIG. 図8のステップa4における絶対平均値の算出工程のフローチャートである。It is a flowchart of the calculation process of the absolute average value in step a4 of FIG.

図1は、本発明の一実施形態に係る画像処理装置20を備える画像処理システム1の構成を簡略化して示すブロック図である。画像処理システム1は、被写体2に付されたバーコードシンボルおよび二次元コードシンボルなどのコードシンボル、ならびに文字(記号を含む)などを含む撮像対象領域を撮像し、デジタル画像データとして出力する撮像装置10と、撮像装置10から出力されたデジタル画像データに対して所定の画像処理を行う画像処理装置20と、撮像装置10によって撮像対象領域を撮像する際に、被写体2を照射する照明装置30と、表示画面を有し、撮像装置10によって撮像された撮像対象領域の画像などを表示する表示装置40と、撮像装置10および照明装置30に対して行われる光学系の環境設定(撮像条件の設定)のために、設定値などを入力するための入力装置50とを含んで構成される。   FIG. 1 is a block diagram showing a simplified configuration of an image processing system 1 including an image processing apparatus 20 according to an embodiment of the present invention. The image processing system 1 captures an imaging target region including code symbols such as barcode symbols and two-dimensional code symbols attached to a subject 2 and characters (including symbols), and outputs the imaging target region as digital image data. 10, an image processing device 20 that performs predetermined image processing on digital image data output from the imaging device 10, and an illumination device 30 that irradiates the subject 2 when the imaging device 10 captures an imaging target region A display device 40 that has a display screen and displays an image of an imaging target region imaged by the imaging device 10, and optical system environment settings (imaging condition setting) performed for the imaging device 10 and the illumination device 30 For example, an input device 50 for inputting a set value or the like is included.

このような構成を有する画像処理システム1は、たとえば工場の生産ラインに隣接して設けられ、被写体2である工業製品に付されたコードシンボルおよび文字などを自動的に読取るために、または工業製品に付されたコードシンボルおよび文字が適正に表示されているかを検査するために、好適に用いることができる。以下では、被写体2に付されたコードシンボルおよび文字などのように、画像処理システム1を用いて読取られるべき表示および画像処理システム1を用いて検査されるべき表示を総称して読取対象表示と記す場合がある。   The image processing system 1 having such a configuration is provided adjacent to a production line of a factory, for example, for automatically reading a code symbol and characters attached to an industrial product that is a subject 2, or an industrial product. In order to check whether the code symbols and characters attached to are properly displayed, they can be suitably used. Hereinafter, a display to be read using the image processing system 1 and a display to be inspected using the image processing system 1 such as code symbols and characters attached to the subject 2 are collectively referred to as a reading target display. It may be noted.

以下、画像処理システム1を構成する各装置について詳細に説明する。
撮像装置10は、光学レンズおよび該光学レンズによって結像された光の受光量をアナログ画像信号として出力する電荷結合素子(CCD:Charge Coupled Device)を備えるCCDカメラ11と、CCDカメラ11から出力されたアナログ画像信号をデジタルデータに変換し、デジタル画像データとして出力するA/D(Analog/Digital)変換器12と、デジタル画像データを1フレームごとに格納可能なフレームメモリ13と、デジタル画像データを1フレームごとにフレームメモリ13に格納するとともに、表示装置40に画像を表示させるためにデジタル画像データをD/A(Digital/Analog)変換器15に出力するカメラコントローラ14と、カメラコントローラ14から出力されたデジタル画像データを表示装置40に応じたアナログ画像信号に変換して表示装置40に出力するD/A変換器15とを含んで構成される。
Hereinafter, each device constituting the image processing system 1 will be described in detail.
The imaging device 10 is output from a CCD camera 11 including an optical lens and a charge coupled device (CCD) that outputs an amount of light received by the optical lens as an analog image signal. A / D (Analog / Digital) converter 12 that converts the analog image signal into digital data and outputs it as digital image data, a frame memory 13 that can store digital image data for each frame, and digital image data Each frame is stored in the frame memory 13, and the digital image data is output to a D / A (Digital / Analog) converter 15 for displaying an image on the display device 40, and output from the camera controller 14. The converted digital image data is converted into an analog image signal corresponding to the display device 40. And a D / A converter 15 that outputs to the display device 40.

CCDカメラ11は、図示しないが、光学レンズの焦点(フォーカス)を調整するためのフォーカス機構、絞りを調整するための絞り機構、および、CCDが光学レンズを通した光に露出する露光時間、すなわちシャッタ速度を調整するためのシャッタ機構をさらに備えている。これらの各機構は、入力装置50から入力された指令や設定値に基づき、後述するCPU21からの制御信号によって自動的に駆動するように構成されるとともに、調整用のつまみを備え、該つまみを手動で変位させることによって駆動するように構成されている。   Although not shown, the CCD camera 11 has a focus mechanism for adjusting the focus of the optical lens, an aperture mechanism for adjusting the aperture, and an exposure time during which the CCD is exposed to light passing through the optical lens, that is, A shutter mechanism for adjusting the shutter speed is further provided. Each of these mechanisms is configured to be automatically driven by a control signal from the CPU 21, which will be described later, based on a command or set value input from the input device 50, and includes an adjustment knob. It is configured to be driven by being manually displaced.

表示装置40は、LCD(Liquid Crystal Display)やCRT(Cathode Ray Tube)ディスプレイなどによって実現され、D/A変換器15から出力されたアナログ画像信号に基づき、画像を表示画面に表示する。   The display device 40 is realized by an LCD (Liquid Crystal Display), a CRT (Cathode Ray Tube) display, or the like, and displays an image on a display screen based on an analog image signal output from the D / A converter 15.

入力装置50は、マウスなどのポインティングデバイスやキーボードによって実現され、指令や設定値を入力するために、ユーザによって操作される。   The input device 50 is realized by a pointing device such as a mouse or a keyboard, and is operated by a user to input commands and setting values.

画像処理装置20は、ハードウエアとして、CPU(Central Processing Unit)21と、RAM(Random Access Memory)22と、ROM(Read Only Memory)23と、I/O(Input/Output)コントローラ24とを含んで構成される。CPU21は、ROM23に記憶されている画像処理プログラムに基づいて、撮像装置10から出力されたデジタル画像データに対して、後述する合焦度判定または鮮明度判定を行うための所定の画像処理を実行するとともに、ROM23に記憶されている制御プログラムに基づいて、画像処理システム1全体の動作を制御する。処理中の画像データや演算中のデータなどは一時的にRAM22に記憶される。I/Oコントローラ24は、入力装置50および照明装置30の電源32などが接続され、これらの入出力データの制御を行う。   The image processing apparatus 20 includes a CPU (Central Processing Unit) 21, a RAM (Random Access Memory) 22, a ROM (Read Only Memory) 23, and an I / O (Input / Output) controller 24 as hardware. Consists of. Based on the image processing program stored in the ROM 23, the CPU 21 executes predetermined image processing for performing focus degree determination or sharpness determination described later on the digital image data output from the imaging device 10. At the same time, the overall operation of the image processing system 1 is controlled based on a control program stored in the ROM 23. The image data being processed and the data being calculated are temporarily stored in the RAM 22. The I / O controller 24 is connected to the input device 50 and the power supply 32 of the lighting device 30 and controls these input / output data.

照明装置30は、被写体2を照射するための光源31と、光源31に対して電力供給を行う電源32とを含んで構成される。電源32は、光源31に対して供給する電力量を調整可能に構成され、入力装置50から入力された指令や設定値に基づき、CPU21からの制御信号によって自動的に調整されるように構成されるとともに、調整用のつまみを備え、該つまみを手動で変位させることによって調整されるように構成されている。また、光源31には、たとえば発光ダイオード(LED:Light Emitting Diode)やタングステンランプなどが好適に用いられ、電源32から供給される電力量に応じた照射光量で光を出射する。   The illumination device 30 includes a light source 31 for irradiating the subject 2 and a power source 32 that supplies power to the light source 31. The power source 32 is configured to be capable of adjusting the amount of power supplied to the light source 31 and is configured to be automatically adjusted by a control signal from the CPU 21 based on a command or setting value input from the input device 50. In addition, an adjustment knob is provided, and the knob is adjusted by manually displacing the knob. In addition, for example, a light emitting diode (LED) or a tungsten lamp is preferably used as the light source 31, and emits light with an irradiation light amount corresponding to the amount of power supplied from the power supply 32.

画像処理装置20を備える画像処理システム1は、前述するように、工場の生産ラインにおいてベルトコンベヤなどの搬送手段によって移送されている各被写体(工業製品)2に付された読取対象表示を順次読取る、または読取対象表示を検査するためのシステムである。したがって、被写体2ごとに最適な焦点距離を自動的に設定するオートフォーカス方式を利用して撮像するようには構成されておらず、光学系の環境設定、すなわちCCDカメラ11におけるフォーカス調整、絞り調整およびシャッタ速度調整ならびに照明装置30における照射光量調整を予め行った上で、被写体2ごとに読取対象表示を含む撮像対象領域を撮像するように構成されている。なお、画像処理システム1は、所定位置に停止させた工業製品に付された読取対象表示を読取るため、または検査するために用いられてもよい。   As described above, the image processing system 1 including the image processing apparatus 20 sequentially reads the reading target display attached to each subject (industrial product) 2 being transferred by a conveying unit such as a belt conveyor in a production line of a factory. Or a system for inspecting a reading target display. Therefore, it is not configured to take an image using an autofocus method that automatically sets an optimum focal length for each subject 2, but is configured to set the optical system environment, that is, focus adjustment and aperture adjustment in the CCD camera 11. After the shutter speed adjustment and the irradiation light amount adjustment in the illumination device 30 are performed in advance, an imaging target region including a reading target display is imaged for each subject 2. The image processing system 1 may be used to read or inspect a reading target display attached to an industrial product stopped at a predetermined position.

以下、図2〜図4を参照して、本実施形態に係る画像処理装置20を用いた光学系の環境設定について説明する。   Hereinafter, with reference to FIG. 2 to FIG. 4, environment setting of the optical system using the image processing apparatus 20 according to the present embodiment will be described.

図2は、撮像装置10および照明装置30に対して予め行われる光学系の環境設定のフローチャートである。ステップs0で、光学系の環境設定をするための準備が終了すると、ステップs1に進む。ステップs1では、CCDカメラ11のシャッタ速度が、たとえば次のような方法で設定される。先ずユーザは、撮像されるべき被写体2が静止状態で撮像されるのか、または移動状態で撮像されるのかを、入力装置50を介して入力する。そして、静止状態で撮像される場合には、シャッタ速度をさらに入力することにより、シャッタ機構が駆動されてシャッタ速度が設定される。静止状態の被写体を撮像するときのシャッタ速度としては、たとえば、1/60秒または1/100秒が好適に用いられる。   FIG. 2 is a flowchart of the optical system environment setting performed in advance for the imaging device 10 and the illumination device 30. When the preparation for setting the environment of the optical system is completed in step s0, the process proceeds to step s1. In step s1, the shutter speed of the CCD camera 11 is set by the following method, for example. First, the user inputs via the input device 50 whether the subject 2 to be imaged is captured in a stationary state or in a moving state. When the image is captured in a stationary state, the shutter speed is further input to set the shutter speed by driving the shutter mechanism. For example, 1/60 second or 1/100 second is preferably used as the shutter speed when capturing an image of a still object.

また、移動状態で撮像される場合には、被写体2の移動速度をさらに入力することにより、該移動速度に基づいてシャッタ速度が演算され、演算された値に基づいてシャッタ機構が駆動されてシャッタ速度が設定される。具体的には、RAM22に予め記憶されている画像処理システム1の仕様から、分解能と、撮像装置10の撮像画面領域に相当する移動許容量とを読出し、次式(1)によって、シャッタ速度が演算される。
シャッタ速度=移動速度/(分解能×移動許容量) …(1)
In the case of imaging in a moving state, by further inputting the moving speed of the subject 2, the shutter speed is calculated based on the moving speed, and the shutter mechanism is driven based on the calculated value, thereby releasing the shutter. Speed is set. Specifically, the resolution and the allowable movement amount corresponding to the imaging screen area of the imaging device 10 are read from the specifications of the image processing system 1 stored in advance in the RAM 22, and the shutter speed is determined by the following equation (1). Calculated.
Shutter speed = movement speed / (resolution × allowable movement) (1)

シャッタ速度が設定されると、ステップs2に進む。
ステップs2では、読取対象表示が付されたテスト用の被写体2を撮像して得られたデジタル画像データを画像処理したときの処理結果、および表示画面に表示された読取対象表示を含む撮像対象領域の画像の目視などに基づいて、CCDカメラ11におけるフォーカス機構および絞り機構を駆動することによりフォーカス調整および絞り調整を行うとともに、光源31に供給する電力量を調整することにより照射光量の調整を行う。調整によってフォーカス、絞りおよび照射光量が所望の設定値に設定され、これらの設定が終了すると、ステップs3に進む。
When the shutter speed is set, the process proceeds to step s2.
In step s2, an imaging target area including a processing result when image processing is performed on digital image data obtained by imaging the test subject 2 with the reading target display, and a reading target display displayed on the display screen. On the basis of visual observation of the image, the focus mechanism and the diaphragm mechanism are driven by driving the focus mechanism and the diaphragm mechanism in the CCD camera 11, and the amount of power supplied to the light source 31 is adjusted, and the amount of irradiation light is adjusted. . The focus, aperture, and irradiation light quantity are set to desired setting values by adjustment, and when these settings are completed, the process proceeds to step s3.

ステップs3では、ステップs2において調整されたフォーカス、絞りおよび照射光量の調整結果について、合焦の程度を表すパラメータである合焦度に基づいて、その適否を判定する。合焦度判定についての詳細は後述するが、調整結果が適当であると判定されるとステップs4に進み、調整結果が不適当であると判定されると、調整結果が適当であると判定されるまで、フォーカス、絞りおよび照射光量の調整が繰り返し行われる。ステップs4で、光学系の環境設定を終了する。   In step s3, the suitability of the adjustment result of the focus, stop, and irradiation light amount adjusted in step s2 is determined based on the degree of focus that is a parameter indicating the degree of focus. Details of the focus degree determination will be described later. If it is determined that the adjustment result is appropriate, the process proceeds to step s4. If it is determined that the adjustment result is inappropriate, it is determined that the adjustment result is appropriate. The focus, aperture, and irradiation light amount are adjusted repeatedly until In step s4, the environment setting of the optical system is completed.

図3は、図2のステップs3における合焦度に基づく調整結果の判定工程のフローチャートである。また図4は、本実施形態に係る画像処理装置20の機能的な構成を示すブロック図である。   FIG. 3 is a flowchart of the adjustment result determination process based on the degree of focus in step s3 of FIG. FIG. 4 is a block diagram showing a functional configuration of the image processing apparatus 20 according to the present embodiment.

画像処理装置20は、概略位置検出部61と、二次微分画像生成部62と、絶対平均値算出部63と、濃度ヒストグラム生成部64と、濃度分布幅算出部65と、合焦度算出部66と、合焦判定部67とを含んで構成される。これらの各部61〜67は、CPU21がROM23に記憶されている画像処理プログラムを実行することによって実現される。各部61〜67の機能については、合焦度に基づく調整結果の判定工程の説明と併せて説明する。   The image processing apparatus 20 includes an approximate position detection unit 61, a secondary differential image generation unit 62, an absolute average value calculation unit 63, a density histogram generation unit 64, a density distribution width calculation unit 65, and a focus degree calculation unit. 66 and an in-focus determination unit 67. Each of these units 61 to 67 is realized by the CPU 21 executing an image processing program stored in the ROM 23. The functions of the units 61 to 67 will be described together with the description of the adjustment result determination process based on the degree of focus.

ステップs30で、図2のステップs2においてフォーカス、絞りおよび照射光量が所望の設定値に設定されたCCDカメラ11および照明装置30を使用して、テスト用の被写体2を撮像するための準備が終了すると、ステップs31に進む。   In step s30, the preparation for imaging the test subject 2 is completed using the CCD camera 11 and the illumination device 30 in which the focus, aperture, and amount of irradiation light are set to desired setting values in step s2 of FIG. Then, the process proceeds to step s31.

ステップs31では、テスト用の被写体2が撮像装置10によって撮像される。このとき、実際の生産ラインにおいて被写体2が移動状態で撮像される場合には、テスト用の被写体2も同一の移動速度で移動させて撮像され、実際の生産ラインにおいて被写体2が所定の位置に停止させた状態で撮像される場合には、テスト用の被写体2も同一の位置に停止させた状態で撮像される。テスト用の被写体2における読取対象表示を含む撮像対象領域が撮像装置10によって撮像され、撮像装置10からその撮像対象領域に対応するデジタル画像データが出力されると、ステップs32に進む。   In step s <b> 31, the test subject 2 is imaged by the imaging device 10. At this time, when the subject 2 is imaged in a moving state on the actual production line, the test subject 2 is also imaged while moving at the same moving speed, and the subject 2 is placed at a predetermined position on the actual production line. When imaging is performed in a stopped state, the test subject 2 is also imaged in a stopped state at the same position. When the imaging target area including the reading target display in the test subject 2 is captured by the imaging apparatus 10, and the digital image data corresponding to the imaging target area is output from the imaging apparatus 10, the process proceeds to step s32.

ステップs32では、画像処理装置20の概略位置検出部61によって、撮像装置10によって生成されたデジタル画像データに基づき、被写体2に付された読取対象表示の概略位置が検出される。概略位置の検出方法は、周知の方法によって行うことができ、読取対象表示が文字である場合には、たとえばOCR(Optical Character Recognition)法によって実現することができる。また、読取対象表示がコードシンボルである場合には、ラベリング処理法およびエッジ方向ヒストグラム法などによって実現することができる。さらに、撮像対象領域内に複数の文字が含まれている場合には、1文字ごとに概略位置が検出され、撮像対象領域内にコードシンボルと文字とが含まれている場合には、それぞれについて概略位置が検出される。概略位置が検出されると、ステップs33に進む。   In step s32, the approximate position detection unit 61 of the image processing device 20 detects the approximate position of the reading target display attached to the subject 2 based on the digital image data generated by the imaging device 10. The approximate position detection method can be performed by a well-known method, and can be realized by, for example, OCR (Optical Character Recognition) when the reading target display is a character. When the reading target display is a code symbol, it can be realized by a labeling method, an edge direction histogram method, or the like. Further, when a plurality of characters are included in the imaging target area, an approximate position is detected for each character, and when a code symbol and a character are included in the imaging target area, The approximate position is detected. When the approximate position is detected, the process proceeds to step s33.

ステップs33では、画像処理装置20の二次微分画像生成部62によって、撮像対象領域に対応するデジタル画像データから、概略位置検出部61によって概略位置が検出された1つのコードシンボルまたは文字と、そのコードシンボルまたは文字の周辺の背景とを含む判定対象領域の画像データが抽出される。以下では、判定対象領域の画像データが、大きさがm×n(ただし、m,nは正の整数)画素の矩形領域の画像データであるものとして説明する。   In step s33, one code symbol or character whose approximate position is detected by the approximate position detection unit 61 from the digital image data corresponding to the imaging target area by the secondary differential image generation unit 62 of the image processing device 20, and Image data of a determination target area including a code symbol or a background around a character is extracted. In the following description, it is assumed that the image data of the determination target area is image data of a rectangular area having a size of m × n (where m and n are positive integers) pixels.

判定対象領域の画像データが抽出されると、さらに、RAM22に予め記憶されている二次微分フィルタを用いて、判定対象領域内における各画素が二次微分される。図5は、二次微分フィルタである3×3画素のラプラシアンフィルタを示している。図5(a)は、4近傍ラプラシアンフィルタLF1を示し、図5(b)および図5(c)は、それぞれ8近傍ラプラシアンフィルタLF2,LF3を示している。図5に示すようなラプラシアンフィルタを用いて二次微分することにより、二次微分された各画素によって構成される二次微分画像が生成される。二次微分画像が生成されると、ステップs34に進む。   When the image data of the determination target area is extracted, each pixel in the determination target area is second-order differentiated using a second-order differential filter stored in advance in the RAM 22. FIG. 5 shows a 3 × 3 pixel Laplacian filter which is a second order differential filter. FIG. 5A shows a 4-neighbor Laplacian filter LF1, and FIGS. 5B and 5C show 8-neighbor Laplacian filters LF2 and LF3, respectively. By performing the second order differentiation using a Laplacian filter as shown in FIG. 5, a second order differential image composed of each second-order differentiated pixel is generated. When the secondary differential image is generated, the process proceeds to step s34.

ステップs34では、画像処理装置20の絶対平均値算出部63によって、二次微分画像生成部62によって生成されたm×n画素の二次微分画像の各画素について、二次微分値の絶対値が算出され、さらに、各画素の二次微分値の絶対値を相加平均することによって絶対平均値が算出される。具体的には、各画素の二次微分値をUij(ただし、i=1,2,…,m−1,m、および、j=1,2,…,n−1,n)とし、絶対平均値をMとすると、次式(2)によって、絶対平均値Mが算出される。 In step s34, the absolute value of the secondary differential value is calculated for each pixel of the m × n pixel secondary differential image generated by the secondary differential image generation unit 62 by the absolute average value calculation unit 63 of the image processing device 20. Further, an absolute average value is calculated by arithmetically averaging the absolute values of the secondary differential values of each pixel. Specifically, the secondary differential value of each pixel is U ij (where i = 1, 2,..., M−1, m and j = 1, 2,..., N−1, n), When the absolute average value is M, the absolute average value M is calculated by the following equation (2).

Figure 2011112810
Figure 2011112810

絶対平均値Mが算出されると、ステップs35に進む。
ステップs35では、画像処理装置20の濃度ヒストグラム生成部64によって、m×n画素の判定対象領域に関し、濃度頻度をヒストグラムで表した濃度ヒストグラムが生成される。図6は、濃度ヒストグラムの一例を示す図である。本実施形態では、前述するように、判定対象領域が、読取対象表示に対応する表示領域と、背景に対応する背景領域とから成り、したがって、図6に示すような双峰性の濃度ヒストグラムが生成される。濃度ヒストグラムが生成されると、ステップs36に進む。
When the absolute average value M is calculated, the process proceeds to step s35.
In step s35, the density histogram generating unit 64 of the image processing apparatus 20 generates a density histogram representing the density frequency as a histogram for the determination target region of m × n pixels. FIG. 6 is a diagram illustrating an example of a density histogram. In the present embodiment, as described above, the determination target area includes a display area corresponding to the reading target display and a background area corresponding to the background. Therefore, a bimodal density histogram as shown in FIG. Generated. When the density histogram is generated, the process proceeds to step s36.

ステップs36では、画像処理装置20の濃度分布幅算出部65によって、濃度ヒストグラム生成部64によって生成された濃度ヒストグラムに基づいて、m×n画素の判定対象領域についての濃度分布幅が算出される。   In step s36, the density distribution width for the determination target region of m × n pixels is calculated by the density distribution width calculation unit 65 of the image processing apparatus 20 based on the density histogram generated by the density histogram generation unit 64.

具体的には、先ず、判別分析法を用いることにより、ある濃度値kを閾値として濃度ヒストグラムを2つのクラスに分けたときの2つのクラス間の分散が最大となるような濃度値kmaxを決定する。以下では、この濃度値kmaxを、2値化閾値と称することにする。   Specifically, first, by using a discriminant analysis method, the density value kmax is determined such that the variance between the two classes is maximized when the density histogram is divided into two classes using a certain density value k as a threshold value. To do. Hereinafter, this density value kmax will be referred to as a binarization threshold value.

たとえば、濃度範囲が0〜D(たとえば、D=255)であるとき、濃度範囲が0〜kのクラスをC0とし、濃度範囲がk+1〜DのクラスをC1とする。また、その濃度範囲における各濃度値Xに対する度数、すなわち画素数がH(X)であるとする。このとき、クラスC0の度数平均をu0、クラスC0の発生確率をw0、クラスC1の度数平均をu1、クラスC1の発生確率をw1、クラスC0とクラスC1との間の分散をSとすると、分散Sは、次式(3)によって濃度値kの関数として得られる。
=w0×w1×(u1−u0) …(3)
For example, when the density range is 0 to D (for example, D = 255), the class having the density range of 0 to k is C0, and the class having the density range k + 1 to D is C1. Further, it is assumed that the frequency for each density value X in the density range, that is, the number of pixels is H (X). At this time, power averaged u0 class C0, w0 the probability of class C0, power averaged u1 class C1, the probability of class C1 w1, the variance between the classes C0 and class C1 When S 2 The dispersion S 2 is obtained as a function of the density value k by the following equation (3).
S 2 = w0 × w1 × (u1-u0) 2 (3)

ただし、

Figure 2011112810
However,
Figure 2011112810

この分散Sを、濃度値kを変化させて、すなわち0〜Dまでの各濃度値kに対して計算することにより、各濃度値kに対する分散Sの値が算出される。このようにして算出された分散Sのうち、分散Sが最大となるときの濃度値kが、2値化閾値kmaxとして決定される。 This dispersion S 2, by changing the density values k, namely by calculating for each density value k to 0 to D, the value of the variance S 2 for each concentration value k is calculated. Thus among the calculated variance S 2 and the concentration value k when the variance S 2 is maximized, it is determined as binarization threshold kmax.

このようにして2値化閾値kmaxが決定されると、この2値化閾値kmaxによって、濃度ヒストグラムが低輝度側(濃度範囲が0〜kmax)のクラスC0’と高輝度側(濃度範囲がkmax+1〜D)のクラスC1’とに分けられる。このとき、クラスC0’の平均濃度をf0、クラスC1’の平均濃度をf1、濃度分布幅をBとするとき、次式(4)によって、濃度分布幅Bが算出される。
B=f1−f0 …(4)
When the binarization threshold value kmax is determined in this manner, the binarization threshold value kmax causes the density histogram to be classified into the class C0 ′ on the low luminance side (density range is 0 to kmax) and the high luminance side (density range is kmax + 1). ˜D) class C1 ′. At this time, when the average density of class C0 ′ is f0, the average density of class C1 ′ is f1, and the density distribution width is B, the density distribution width B is calculated by the following equation (4).
B = f1-f0 (4)

ただし、

Figure 2011112810
However,
Figure 2011112810

濃度分布幅Bが算出されると、ステップs37に進む。
ステップs37では、画像処理装置20の合焦度算出部66によって、絶対平均値算出部63によって算出された絶対平均値Mを、濃度分布幅算出部65によって算出された濃度分布幅Bで除することによって、合焦の程度を表す合焦度Qが算出される。具体的には、次式(5)によって、合焦度Qが算出される。
Q=M÷B×10000 …(5)
When the density distribution width B is calculated, the process proceeds to step s37.
In step s 37, the absolute average value M calculated by the absolute average value calculation unit 63 is divided by the density distribution width B calculated by the density distribution width calculation unit 65 by the focus degree calculation unit 66 of the image processing apparatus 20. Thus, the degree of focus Q representing the degree of focus is calculated. Specifically, the degree of focus Q is calculated by the following equation (5).
Q = M ÷ B × 10000 (5)

合焦度Qが算出されると、ステップs38に進む。
ステップs38では、画像処理装置20の合焦判定部67によって、合焦度算出部66によって算出された合焦度Qに基づいて、合焦度判定が行われる。具体的には、算出された合焦度Qと、予め設定されてRAM22に記憶されている合焦度判定用の閾値Q0とが比較され、Q≧Q0であると判定されると、合焦度Qが適正であるとしてステップs40に進み、Q<Q0であると判定されると、合焦度Qが不適正であるとしてステップs39に進む。合焦度判定用の閾値Q0は、たとえば経験則によって得られた値が予め設定され、ユーザが入力装置50を介してその値を入力することにより、RAM22に記憶される。
When the focus level Q is calculated, the process proceeds to step s38.
In step s38, the focus determination unit 67 of the image processing apparatus 20 performs the focus degree determination based on the focus degree Q calculated by the focus degree calculation unit 66. Specifically, the calculated focus degree Q is compared with a focus degree determination threshold value Q0 that is set in advance and stored in the RAM 22, and when it is determined that Q ≧ Q0, the focus is obtained. If it is determined that the degree Q is appropriate, the process proceeds to step s40. If it is determined that Q <Q0, the degree of focus Q is determined to be inappropriate and the process proceeds to step s39. As the threshold value Q0 for determining the degree of focus, for example, a value obtained by an empirical rule is set in advance, and the value is stored in the RAM 22 when the user inputs the value via the input device 50.

ステップs39では、図2におけるステップs2と同様に、たとえばテスト用の被写体2を撮像して得られたデジタル画像データを画像処理したときの処理結果、および表示画面に表示された読取対象表示を含む撮像対象領域の画像の目視などに基づいて、再度、CCDカメラ11におけるフォーカス機構および絞り機構を駆動することによりフォーカス調整および絞り調整を行うとともに、光源31に供給する電力量を調整することにより照射光量の調整を行う。調整によってフォーカス、絞りおよび照射光量の所望の設定値に設定されると、ステップs31に進む。   In step s39, as in step s2 in FIG. 2, for example, the processing result when the digital image data obtained by imaging the test subject 2 is image-processed, and the reading target display displayed on the display screen are included. Based on visual observation of the image of the imaging target region, the focus mechanism and the diaphragm mechanism in the CCD camera 11 are driven again to perform focus adjustment and diaphragm adjustment, and irradiation is performed by adjusting the amount of power supplied to the light source 31. Adjust the light intensity. When the desired setting values of focus, aperture, and irradiation light quantity are set by adjustment, the process proceeds to step s31.

このように合焦度判定において合焦度Qが適正であると判定されるまで、フォーカス、絞りおよび照射光量の調整が行われ、合焦度Qが適正であると判定されると、ステップs40で合焦度に基づく調整結果の判定工程を終了する。   As described above, the focus, the aperture, and the amount of irradiation light are adjusted until it is determined that the focus degree Q is appropriate in the focus degree determination, and when it is determined that the focus degree Q is appropriate, step s40. Then, the adjustment result determination step based on the degree of focus is completed.

このように、本実施形態によれば、光学系の環境設定の適否を判定する際に、判定対象領域の二次微分画像のみから算出される値を用いて判定するのではなく、判定対象領域の二次微分画像の絶対平均値Mを、判定対象領域の濃度分布幅Bで除して得られる合焦度Qを用いて判定するので、すなわち正規化された合焦度Qを用いて判定するので、照明などの明るさによって合焦度が変動することを考慮して合焦度判定を行うことができ、精度良く読取対象表示を読取ることができるように光学系の環境設定を行うことができる。また、光学系の環境設定を行うユーザが異なるような場合があったとしても、読取精度のばらつきを低減することができる。   As described above, according to the present embodiment, when determining the suitability of the environment setting of the optical system, the determination target region is not determined using a value calculated only from the secondary differential image of the determination target region. Is determined using the focus degree Q obtained by dividing the absolute average value M of the secondary differential image by the density distribution width B of the determination target region, that is, the determination is performed using the normalized focus degree Q. Therefore, it is possible to determine the degree of focus considering that the degree of focus varies depending on the brightness of illumination, etc., and to set the environment of the optical system so that the reading target display can be read accurately. Can do. Further, even if the user who sets the environment of the optical system may be different, variations in reading accuracy can be reduced.

次に、他の実施形態に係る画像処理装置20aを備える画像処理システム1について説明する。画像処理システム1の構成は、図1に示す前述の画像処理システム1と同様の装置構成によって構成されるため、各装置についての重複する説明は省略する。本実施形態に係る画像処理装置20aを備える画像処理システム1は、画像処理プログラムを実行することによって実現される画像処理装置の機能的な構成において、前述する画像処理システム1相違する。なお、以下では、前述する画像処理システム1と同様の構成については、同一の参照符を付して説明する。   Next, an image processing system 1 including an image processing device 20a according to another embodiment will be described. Since the configuration of the image processing system 1 is configured by the same device configuration as that of the above-described image processing system 1 shown in FIG. 1, overlapping description of each device is omitted. The image processing system 1 including the image processing apparatus 20a according to the present embodiment is different from the above-described image processing system 1 in the functional configuration of the image processing apparatus realized by executing the image processing program. In the following, the same components as those of the image processing system 1 described above will be described with the same reference numerals.

図7は、本実施形態に係る画像処理装置20aの機能的な構成を示すブロック図である。画像処理装置20aは、概略位置検出部71と、検査対象マスク画像生成部72と、濃度分布幅検出対象画像生成部73と、濃度ヒストグラム生成部74と、濃度分布幅算出部75と、二次微分画像生成部76と、鮮明度検出候補画像生成部77と、鮮明度検出画像生成部78と、絶対平均値算出部79と、鮮明度算出部80と、鮮明度判定部81とを含んで構成される。これらの各部71〜81は、CPU21がROM23に記憶されている画像処理プログラムを実行することによって実現される。各部71〜81の機能については、後述する読取対象表示の検査工程の説明と併せて説明する。   FIG. 7 is a block diagram showing a functional configuration of the image processing apparatus 20a according to the present embodiment. The image processing apparatus 20a includes an approximate position detection unit 71, an inspection target mask image generation unit 72, a density distribution width detection target image generation unit 73, a density histogram generation unit 74, a density distribution width calculation unit 75, a secondary A differential image generation unit 76, a sharpness detection candidate image generation unit 77, a sharpness detection image generation unit 78, an absolute average value calculation unit 79, a sharpness calculation unit 80, and a sharpness determination unit 81 are included. Composed. Each of these units 71 to 81 is realized by the CPU 21 executing an image processing program stored in the ROM 23. The functions of the units 71 to 81 will be described together with the description of the inspection process of the reading target display described later.

本実施形態に係る画像処理装置20aを備える画像処理システム1は、ベルトコンベヤなどの搬送手段によって移送されてくる被写体(工業製品)2に付された読取対象表示が適正に表示されているかを検査するためのシステムであり、特に、適正に表示されているかを検査するために好適に用いられる。   The image processing system 1 including the image processing apparatus 20a according to the present embodiment inspects whether or not the reading target display attached to the subject (industrial product) 2 transferred by a conveying means such as a belt conveyor is properly displayed. In particular, the system is suitable for inspecting whether the display is properly performed.

以下、図7〜図10を参照して、本実施形態に係る画像処理装置20aを用いた読取対象表示の検査工程について、読取対象表示が文字であるとして説明する。   Hereinafter, the inspection process of the reading target display using the image processing apparatus 20a according to the present embodiment will be described with reference to FIGS. 7 to 10 on the assumption that the reading target display is a character.

図8は、被写体2に付された文字を検査するための検査工程のフローチャートである。ステップa0で、フォーカス、絞りおよび照射光量が所定の設定値に設定されたCCDカメラ11および照明装置30を使用して、検査対象の文字が付された被写体2を撮像するための準備が終了すると、ステップa1に進む。   FIG. 8 is a flowchart of an inspection process for inspecting characters attached to the subject 2. In step a0, when the CCD camera 11 and the illumination device 30 in which the focus, the aperture, and the amount of irradiation light are set to predetermined set values are used, the preparation for imaging the subject 2 with the character to be inspected is completed. The process proceeds to step a1.

ステップa1では、検査対象の被写体2が撮像装置10によって撮像される。検査対象の被写体2における文字を含む撮像対象領域が撮像装置10によって撮像され、撮像装置10からその撮像対象領域に対応するデジタル画像データが出力されると、ステップa2に進む。   In step a1, the subject 2 to be inspected is imaged by the imaging device 10. When an imaging target area including characters in the subject 2 to be inspected is captured by the imaging apparatus 10 and digital image data corresponding to the imaging target area is output from the imaging apparatus 10, the process proceeds to step a2.

ステップa2では、画像処理装置20aの概略位置検出部71によって、撮像装置10によって生成されたデジタル画像データに基づき、被写体2に付された文字の概略位置が検出される。概略位置の検出方法は、前述するように周知の方法によって行うことができ、たとえばOCR法によって実現することができる。また、撮像対象領域内に複数の文字が含まれている場合には、1文字ごとに概略位置が検出される。概略位置が検出されると、ステップa3に進む。   In step a2, the approximate position of the character attached to the subject 2 is detected by the approximate position detector 71 of the image processing device 20a based on the digital image data generated by the imaging device 10. The approximate position detection method can be performed by a well-known method as described above, and can be realized by, for example, the OCR method. When a plurality of characters are included in the imaging target area, the approximate position is detected for each character. When the approximate position is detected, the process proceeds to step a3.

ステップa3では、濃度分布幅が算出される。図9は、図8のステップa3における濃度分布幅を算出する工程のフローチャートである。ステップa30で、濃度分布幅を算出するための処理が開始されて、ステップa31に進む。   In step a3, the density distribution width is calculated. FIG. 9 is a flowchart of the process of calculating the density distribution width in step a3 of FIG. In step a30, processing for calculating the density distribution width is started, and the process proceeds to step a31.

ステップa31では、画像処理装置20aの検査対象マスク画像生成部72によって、撮像対象領域に対応するデジタル画像データから、概略位置検出部71によって概略位置が検出された1つの文字と、その文字の周辺の背景とを含む判定対象候補領域の画像データが抽出される。以下では、判定対象候補領域の画像データが、大きさがm×n(ただし、m,nは正の整数)画素の矩形領域の画像データであるものとして説明する。   In step a31, one character whose approximate position is detected by the approximate position detection unit 71 from the digital image data corresponding to the imaging target region by the inspection target mask image generation unit 72 of the image processing apparatus 20a, and the surroundings of the character The image data of the determination target candidate area including the background of the image is extracted. In the following description, it is assumed that the image data of the determination target candidate area is image data of a rectangular area having a size of m × n (where m and n are positive integers) pixels.

判定対象候補領域の画像データが抽出されると、さらに、判定対象候補領域内における各画素について2値化処理される。このとき、文字を白、背景を黒とすることによって2値化処理される。   When the image data of the determination target candidate area is extracted, binarization processing is further performed for each pixel in the determination target candidate area. At this time, the binarization process is performed by setting the character to white and the background to black.

2値化処理するための閾値は、ユーザが入力装置50を介して入力することにより、予めRAM22に記憶されている固定の数値によって与えられてもよく、前述する判別分析法を用いることによって算出される2値化閾値kmaxによって与えられてもよい。2値化処理が行われることによって、2値化された各画素によって構成される2値化画像が生成される。2値化画像が生成されると、ステップa32に進む。   The threshold value for the binarization process may be given by a fixed numerical value stored in advance in the RAM 22 when the user inputs it via the input device 50, and is calculated by using the above-described discriminant analysis method. May be given by the binarization threshold kmax. By performing the binarization process, a binarized image composed of binarized pixels is generated. When the binarized image is generated, the process proceeds to step a32.

ステップa32では、検査対象マスク画像生成部72によって、ステップa31において生成された判定対象候補領域の2値化画像に対し、膨張処理が行われる。このとき、膨張処理が行われる回数(膨張回数)N1は、ユーザが入力装置50を介して入力することにより、予めRAM22に記憶される。膨張回数N1は、たとえば2回である。膨張処理が行われることによって、膨張画像が生成されると、ステップa33に進む。   In step a32, the inspection target mask image generation unit 72 performs an expansion process on the binarized image of the determination target candidate area generated in step a31. At this time, the number of times the expansion process is performed (the number of expansions) N1 is stored in advance in the RAM 22 when the user inputs it via the input device 50. The number of expansions N1 is, for example, 2 times. When an expansion image is generated by performing the expansion process, the process proceeds to step a33.

ステップa33では、検査対象マスク画像生成部72によって、ステップa31において生成された判定対象候補領域の2値化画像に対し、収縮処理が行われる。このとき、収縮処理が行われる回数(収縮回数)N2は、ユーザが入力装置50を介して入力することにより、予めRAM22に記憶される。収縮回数N2は、たとえば2回である。収縮処理が行われることによって、収縮画像が生成されると、ステップa34に進む。   In step a33, the inspection target mask image generation unit 72 performs a contraction process on the binarized image of the determination target candidate area generated in step a31. At this time, the number of times the contraction process is performed (the number of contractions) N2 is stored in advance in the RAM 22 when the user inputs it via the input device 50. The number of contractions N2 is, for example, 2 times. When a contraction image is generated by performing the contraction process, the process proceeds to step a34.

ステップa34では、検査対象マスク画像生成部72によって、ステップa32において生成された膨張画像と、ステップa33において生成された収縮画像との差分を計算することによって、検査対象の文字の輪郭領域に対応する輪郭画像が生成される。以下では、この輪郭画像をマスク画像と称する場合がある。具体的には、次式(6)によって、マスク画像が生成される。
マスク画像=膨張画像−収縮画像 …(6)
In step a34, the inspection object mask image generation unit 72 calculates the difference between the expanded image generated in step a32 and the contracted image generated in step a33, thereby corresponding to the contour region of the character to be inspected. A contour image is generated. Hereinafter, this contour image may be referred to as a mask image. Specifically, a mask image is generated by the following equation (6).
Mask image = expanded image-contracted image (6)

マスク画像が生成されると、ステップa35に進む。
ステップa35では、画像処理装置20aの濃度分布幅検出対象画像生成部73によって、ステップa31において抽出された判定対象候補領域の画像と、ステップa34において生成されたマスク画像との論理積演算を行うことによって、濃度分布幅検出対象画像が生成される。この濃度分布幅検出対象画像は、判定対象候補領域の画像から、判定対象領域である検査対象の文字の輪郭領域内における画素を抽出したものに対応する。具体的には、次式(7)によって、濃度分布幅検出対象画像が生成される。
濃度分布幅検出対象画像=候補領域の画像&マスク画像 …(7)
When the mask image is generated, the process proceeds to step a35.
In step a35, the density distribution width detection target image generation unit 73 of the image processing apparatus 20a performs a logical product operation on the determination target candidate region image extracted in step a31 and the mask image generated in step a34. Thus, a density distribution width detection target image is generated. This density distribution width detection target image corresponds to an image obtained by extracting pixels in the contour region of the inspection target character, which is the determination target region, from the determination target candidate region image. Specifically, the density distribution width detection target image is generated by the following equation (7).
Density distribution width detection target image = candidate area image & mask image (7)

濃度分布幅検出対象画像が生成されると、ステップa36に進む。
ステップa36では、画像処理装置20aの濃度ヒストグラム生成部74によって、濃度分布幅検出対象画像について、すなわち判定対象領域に関する濃度ヒストグラムが生成される。濃度ヒストグラムが生成されると、ステップa37に進む。
When the density distribution width detection target image is generated, the process proceeds to step a36.
In step a36, the density histogram generation unit 74 of the image processing apparatus 20a generates a density histogram for the density distribution width detection target image, that is, a determination target region. When the density histogram is generated, the process proceeds to step a37.

ステップa37では、画像処理装置20aの濃度分布幅算出部75によって、濃度ヒストグラム生成部74によって生成された濃度ヒストグラムに基づいて、判定対象領域についての濃度分布幅が算出される。具体的には、先ず、前述と同様に、判別分析法を用いることにより、2値化閾値kmaxを決定する。2値化閾値kmaxが決定され、前述と同様に、2値化閾値kmaxによって、濃度ヒストグラムが低輝度側のクラスC0’と高輝度側のクラスC1’とに分けられると、クラスC0’の平均濃度をf0、クラスC1’の平均濃度をf1、濃度分布幅をBとして、前記の式(4)によって、濃度分布幅Bが算出される。濃度分布幅Bが算出されると、ステップa38に進む。ステップa38で、濃度分布幅Bを算出するための処理が終了する。再び図8に戻って、濃度分布幅Bが算出されると、ステップa4に進む。   In step a37, the density distribution width for the determination target region is calculated by the density distribution width calculation unit 75 of the image processing apparatus 20a based on the density histogram generated by the density histogram generation unit 74. Specifically, first, as described above, the binarization threshold value kmax is determined by using the discriminant analysis method. When the binarization threshold kmax is determined, and the density histogram is divided into the low luminance side class C0 ′ and the high luminance side class C1 ′ by the binarization threshold kmmax, the average of the class C0 ′ is determined. The density distribution width B is calculated by the above equation (4), where the density is f0, the average density of class C1 ′ is f1, and the density distribution width is B. When the density distribution width B is calculated, the process proceeds to step a38. In step a38, the process for calculating the density distribution width B ends. Returning to FIG. 8 again, when the density distribution width B is calculated, the process proceeds to step a4.

ステップa4では、m×n画素の判定対象候補領域内における判定対象領域(文字の輪郭領域)の二次微分画像が生成されて、その二次微分画像について絶対平均値が算出される。図10は、図8のステップa4における絶対平均値の算出工程のフローチャートである。ステップa40で、絶対平均値を算出するための処理が開始されて、ステップa41に進む。   In step a4, a secondary differential image of the determination target region (character contour region) in the determination target candidate region of m × n pixels is generated, and an absolute average value is calculated for the secondary differential image. FIG. 10 is a flowchart of the absolute average value calculation process in step a4 of FIG. In step a40, processing for calculating an absolute average value is started, and the process proceeds to step a41.

ステップa41では、画像処理装置20aの二次微分画像生成部76によって、検査対象マスク画像生成部72によって抽出された判定対象候補領域の画像データに対し、平滑化フィルタ、すなわち平均値フィルタまたはガウシアンフィルタ(加重平均フィルタ)を用いることによって、平滑化処理が行われノイズが除去される。平滑化処理が行われると、ステップa42に進む。   In step a41, a smoothing filter, that is, an average value filter or a Gaussian filter is applied to the image data of the determination target candidate region extracted by the inspection target mask image generation unit 72 by the secondary differential image generation unit 76 of the image processing apparatus 20a. By using (weighted average filter), smoothing processing is performed and noise is removed. When the smoothing process is performed, the process proceeds to step a42.

ステップa42では、二次微分画像生成部76によって、平滑化処理が行われた判定対象候補領域の画像データの各画素が、前述と同様に、RAM22に予め記憶されているラプラシアンフィルタを用いて二次微分される。二次微分された各画素によって構成される二次微分画像が生成されると、ステップa43に進む。   In step a42, each pixel of the image data of the determination target candidate area that has been subjected to the smoothing process by the second-order differential image generation unit 76 is converted into a pixel value using a Laplacian filter stored in advance in the RAM 22, as described above. Second derivative. When a secondary differential image composed of each pixel subjected to the secondary differentiation is generated, the process proceeds to step a43.

ステップa43では、画像処理装置20aの鮮明度検出候補画像生成部77によって、二次微分画像生成部76によって生成された判定対象候補領域の二次微分画像と、検査対象マスク画像生成部72によって生成された判定対象領域(文字の輪郭領域)に対応するマスク画像との論理積演算を行うことによって、判定対象領域内における各画素が二次微分されている鮮明度検出候補画像が生成される。具体的には、次式(8)によって、鮮明度検出候補画像が生成される。
鮮明度検出候補画像=判定対象候補領域の二次微分画像&マスク画像 …(8)
In step a43, the second differential image of the determination target candidate region generated by the secondary differential image generation unit 76 and the inspection target mask image generation unit 72 are generated by the definition detection candidate image generation unit 77 of the image processing apparatus 20a. A sharpness detection candidate image in which each pixel in the determination target region is second-order differentiated is generated by performing a logical product operation with the mask image corresponding to the determined determination target region (character outline region). Specifically, a sharpness detection candidate image is generated by the following equation (8).
Sharpness detection candidate image = secondary differential image & mask image of determination target candidate region (8)

鮮明度検出候補画像が生成されると、ステップa44に進む。
ステップa44では、画像処理装置20aの鮮明度検出画像生成部78によって、鮮明度検出候補画像生成部77によって生成された鮮明度検出候補画像の各画素のうち、ゼロクロスに寄与する画素を抽出することによって、鮮明度検出画像が生成される。すなわち、本実施形態では、判定対象領域の二次微分画像(鮮明度検出候補画像)の各画素から、さらに不要な画素を取り除くことにより、新たな判定対象領域に対応する二次微分画像(鮮明度検出画像)が生成される。
When the sharpness detection candidate image is generated, the process proceeds to step a44.
In step a44, the sharpness detection image generation unit 78 of the image processing device 20a extracts pixels contributing to zero crossing from among the pixels of the sharpness detection candidate image generated by the sharpness detection candidate image generation unit 77. As a result, a sharpness detection image is generated. That is, in this embodiment, unnecessary pixels are further removed from each pixel of the secondary differential image (definition detection candidate image) in the determination target region, thereby obtaining a secondary differential image (clear) corresponding to the new determination target region. Degree detection image) is generated.

具体的には、鮮明度検出候補画像の各画素について、注目画素の二次微分値と該注目画素に隣接する隣接8近傍の各画素の二次微分値との積をそれぞれ計算し、各積算値(隣接する画素が8つある場合には、8つの積算値)のうち1つでも負の値となる積算値があれば、その注目画素を鮮明度検出画像を構成する画素、すなわちゼロクロスに寄与する画素として判定し、逆に、負の値となる積算値が1つもなければ、その注目画素を鮮明度検出画像を構成する画素でないと判定する。このようにして、鮮明度検出候補画像の各画素から、ゼロクロスに寄与する画素だけを抽出することによって、鮮明度検出画像が生成される。鮮明度検出画像が生成されると、ステップa45に進む。   Specifically, for each pixel of the sharpness detection candidate image, the product of the secondary differential value of the pixel of interest and the secondary differential value of each pixel adjacent to the adjacent 8 adjacent to the pixel of interest is calculated. If at least one of the values (eight integrated values when there are eight adjacent pixels) has a negative integrated value, that pixel of interest becomes the pixel constituting the sharpness detection image, that is, zero cross. On the contrary, if there is no negative integrated value, it is determined that the target pixel is not a pixel constituting the sharpness detection image. In this way, a sharpness detection image is generated by extracting only the pixels that contribute to zero crossing from the pixels of the sharpness detection candidate image. When the sharpness detection image is generated, the process proceeds to step a45.

ステップa45では、画像処理装置20aの絶対平均値算出部79によって、鮮明度検出画像生成部78によって生成された鮮明度検出画像の各画素について、前述と同様に、二次微分値の絶対値が算出され、さらに、その各画素の二次微分値の絶対値を相加平均することによって絶対平均値が算出される。絶対平均値Mが算出されると、ステップa46に進む。ステップa46で、絶対平均値Mを算出するための処理が終了する。再び図8に戻って、絶対平均値Mが算出されると、ステップa5に進む。   In step a45, the absolute value of the secondary differential value is determined for each pixel of the sharpness detection image generated by the sharpness detection image generation unit 78 by the absolute average value calculation unit 79 of the image processing device 20a, as described above. Further, an absolute average value is calculated by arithmetically averaging the absolute values of the secondary differential values of the respective pixels. When the absolute average value M is calculated, the process proceeds to step a46. In step a46, the process for calculating the absolute average value M ends. Returning to FIG. 8 again, when the absolute average value M is calculated, the process proceeds to step a5.

ステップa5では、画像処理装置20aの鮮明度算出部80によって、絶対平均値算出部79によって算出された絶対平均値Mを、濃度分布幅算出部75によって算出された濃度分布幅Bで除することによって、検査対象の文字の鮮明の程度を表す鮮明度Rが算出される。具体的には、次式(9)によって、鮮明度Rが算出される。
R=M÷B×10000 …(9)
In step a5, the absolute value M calculated by the absolute average value calculator 79 is divided by the density distribution width B calculated by the density distribution width calculator 75 by the definition calculator 80 of the image processing apparatus 20a. Thus, the sharpness R representing the degree of sharpness of the character to be inspected is calculated. Specifically, the definition R is calculated by the following equation (9).
R = M ÷ B × 10000 (9)

鮮明度Rが算出されると、ステップa6に進む。
ステップa6では、画像処理装置20aの鮮明度判定部81によって、鮮明度算出部80によって算出された鮮明度Rに基づいて、鮮明度判定が行われる。具体的には、算出された鮮明度Rと、予め設定されてRAM22に記憶されている鮮明度判定用の閾値R0とが比較され、R≧R0であると判定されると、鮮明度Rが適正であるとしてステップa37に進み、R<R0であると判定されると、鮮明度Rが不適正であるとしてステップa38に進む。鮮明度判定用の閾値R0は、たとえば経験則によって得られた値が予め定められ、ユーザが入力装置50を介してその値を入力することにより、RAM22に記憶される。
When the sharpness R is calculated, the process proceeds to step a6.
In step a6, the sharpness determination unit 81 of the image processing apparatus 20a performs the sharpness determination based on the sharpness R calculated by the sharpness calculation unit 80. Specifically, the calculated sharpness R is compared with a sharpness determination threshold value R0 that is set in advance and stored in the RAM 22, and when it is determined that R ≧ R0, the sharpness R is If it is determined that R <R0, it is determined that the sharpness R is inappropriate, and the process proceeds to step a38. For example, a value obtained by an empirical rule is determined in advance as the threshold value R0 for determining the sharpness, and is stored in the RAM 22 when the user inputs the value via the input device 50.

ステップa37では、鮮明度Rが適正である、すなわち印刷された文字に異常なしと判定されたので、検査工程を終了する。また、ステップa38では、鮮明度Rが不適正である、すなわち印刷された文字に異常ありと判定されたので、たとえば表示画面を介して、ユーザに異常があったことを報知して、ステップa39に進む。ステップa39で、検査工程を終了する。   In step a37, since the sharpness R is appropriate, that is, it is determined that there is no abnormality in the printed characters, the inspection process is terminated. Further, in step a38, it is determined that the sharpness R is inappropriate, that is, the printed character is abnormal. Therefore, for example, the user is notified of the abnormality via the display screen, and step a39. Proceed to In step a39, the inspection process is terminated.

このように、本実施形態によれば、被写体2に付された文字などの読取対象表示を検査する際に、判定対象候補領域の二次微分画像のみから算出される値を用いて判定するのではなく、判定対象領域の二次微分画像の絶対平均値Mを、判定対象領域の濃度分布幅Bで除して得られる鮮明度Rを用いて判定するので、すなわち正規化された鮮明度Rを用いて判定するので、照明などの明るさによって鮮明度が変動することを考慮して鮮明度判定を行うことができ、印刷された文字などの読取対象表示に対する異常を精度良く検出することができる。また、光学系の環境設定を行うユーザが異なるような場合があったとしても、検出精度のばらつきを低減することができる。   As described above, according to the present embodiment, when the reading target display such as characters attached to the subject 2 is inspected, the determination is made using the value calculated only from the secondary differential image of the determination target candidate region. Rather, since the determination is made using the sharpness R obtained by dividing the absolute average value M of the secondary differential image of the determination target region by the density distribution width B of the determination target region, that is, the normalized definition R Therefore, the sharpness determination can be performed in consideration of the fluctuation of the sharpness depending on the brightness of illumination or the like, and an abnormality with respect to the reading target display such as a printed character can be accurately detected. it can. Moreover, even if the user who sets the environment of the optical system may be different, variation in detection accuracy can be reduced.

また、本実施形態では、読取対象表示の輪郭領域に対応するマスク画像によって抽出された鮮明度検出候補画像から、さらに二次微分値の小さな累積誤差の影響を避けるために、ゼロクロスに寄与する画素だけを抽出することにより鮮明度検出画像を生成し、この鮮明度検出画像から絶対平均値を算出しているので、鮮明度判定の精度を向上させることができる。   Further, in the present embodiment, pixels that contribute to zero crossing are avoided from the sharpness detection candidate image extracted by the mask image corresponding to the contour region of the reading target display, in order to avoid the influence of a cumulative error of a small second derivative value. Since the sharpness detection image is generated by extracting only and the absolute average value is calculated from this sharpness detection image, the accuracy of the sharpness determination can be improved.

1 画像処理システム
10 撮像装置
11 CCDカメラ
20 画像処理装置
21 CPU
22 RAM
23 ROM
30 照明装置
31 光源
32 電源
40 表示装置
50 入力装置
61 概略位置検出部
62 二次微分画像生成部
63 絶対平均値算出部
64 濃度ヒストグラム生成部
65 濃度分布幅算出部
66 合焦度算出部
67 合焦判定部
DESCRIPTION OF SYMBOLS 1 Image processing system 10 Imaging device 11 CCD camera 20 Image processing device 21 CPU
22 RAM
23 ROM
DESCRIPTION OF SYMBOLS 30 Illuminating device 31 Light source 32 Power supply 40 Display apparatus 50 Input apparatus 61 Approximate position detection part 62 Secondary differential image generation part 63 Absolute average value calculation part 64 Density histogram generation part 65 Density distribution width calculation part 66 Focus degree calculation part 67 Matching Focus determination unit

Claims (3)

所定の読取対象表示を含む撮像対象領域を撮像することによって、読取対象表示を読取る光学系の合焦度または読取対象表示の鮮明度を判定するための画像処理方法であって、
読取対象表示および該読取対象表示の周辺の背景を含む判定対象領域内の各画素を二次微分することにより二次微分画像を生成する二次微分画像生成工程と、
前記二次微分画像における各画素の二次微分値の絶対値を相加平均することによって、絶対平均値を算出する絶対平均値算出工程と、
前記判定対象領域の濃度ヒストグラムを生成する濃度ヒストグラム生成工程と、
前記濃度ヒストグラムを高輝度側のクラスと低輝度側のクラスとに分けるための閾値を算出し、該閾値によって分けられた2つのクラスの各平均濃度の差分によって、濃度分布幅を算出する濃度分布幅算出工程と、
前記絶対平均値を前記濃度分布幅で除することによって、合焦度または鮮明度を算出するパラメータ算出工程と、
算出された合焦度または鮮明度と、予め定める閾値とを比較するパラメータ判定工程とを含むことを特徴とする画像処理方法。
An image processing method for determining an in-focus level of an optical system for reading a reading target display or a sharpness of a reading target display by imaging an imaging target region including a predetermined reading target display,
A secondary differential image generating step of generating a secondary differential image by performing secondary differentiation on each pixel in a determination target region including a reading target display and a background around the reading target display;
An absolute average value calculating step of calculating an absolute average value by arithmetically averaging the absolute value of the second derivative value of each pixel in the second derivative image;
A density histogram generating step for generating a density histogram of the determination target region;
A density distribution that calculates a threshold value for dividing the density histogram into a high-luminance class and a low-luminance class, and calculates a density distribution width based on the difference between the average densities of the two classes divided by the threshold value Width calculation step;
A parameter calculating step for calculating a focus degree or a sharpness by dividing the absolute average value by the density distribution width;
An image processing method, comprising: a parameter determination step of comparing the calculated degree of focus or definition with a predetermined threshold value.
前記二次微分画像生成工程において生成された二次微分画像の各画素から、ゼロクロスに寄与する画素だけを抽出するゼロクロス画素抽出工程をさらに含むことを特徴とする請求項1に記載の画像処理方法。   2. The image processing method according to claim 1, further comprising a zero-cross pixel extracting step of extracting only pixels contributing to zero-cross from each pixel of the second-order differential image generated in the second-order differential image generating step. . 所定の読取対象表示を含む撮像対象領域を撮像することによって、読取対象表示を読取る光学系の合焦度または読取対象表示の鮮明度を判定するための画像処理装置であって、
読取対象表示および該読取対象表示の周辺の背景を含む判定対象領域内の各画素を二次微分することにより二次微分画像を生成する二次微分画像生成部と、
前記二次微分画像における各画素の二次微分値の絶対値を相加平均することによって、絶対平均値を算出する絶対平均値算出部と、
前記判定対象領域の濃度ヒストグラムを生成する濃度ヒストグラム生成部と、
前記濃度ヒストグラムを高輝度側のクラスと低輝度側のクラスとに分けるための閾値を算出し、該閾値によって分けられた2つのクラスの各平均濃度の差分によって、濃度分布幅を算出する濃度分布幅算出部と、
前記絶対平均値を前記濃度分布幅で除することによって、合焦度または鮮明度を算出するパラメータ算出部と、
算出された合焦度または鮮明度と、予め定める閾値とを比較するパラメータ判定部とを含むことを特徴とする画像処理装置。
An image processing apparatus for determining an in-focus level of an optical system for reading a reading target display or a sharpness of a reading target display by imaging an imaging target region including a predetermined reading target display,
A secondary differential image generation unit that generates a secondary differential image by performing secondary differentiation on each pixel in a determination target region including a reading target display and a background around the reading target display;
An absolute average value calculating unit that calculates an absolute average value by arithmetically averaging the absolute values of the second derivative values of each pixel in the second derivative image;
A density histogram generator for generating a density histogram of the determination target region;
A density distribution that calculates a threshold value for dividing the density histogram into a high-luminance class and a low-luminance class, and calculates a density distribution width based on the difference between the average densities of the two classes divided by the threshold value A width calculator;
A parameter calculation unit for calculating a focus degree or a sharpness by dividing the absolute average value by the density distribution width;
An image processing apparatus comprising: a parameter determination unit that compares the calculated degree of focus or definition with a predetermined threshold value.
JP2009268138A 2009-11-25 2009-11-25 Image processing method and image processing apparatus Expired - Fee Related JP5331661B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009268138A JP5331661B2 (en) 2009-11-25 2009-11-25 Image processing method and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009268138A JP5331661B2 (en) 2009-11-25 2009-11-25 Image processing method and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2011112810A true JP2011112810A (en) 2011-06-09
JP5331661B2 JP5331661B2 (en) 2013-10-30

Family

ID=44235194

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009268138A Expired - Fee Related JP5331661B2 (en) 2009-11-25 2009-11-25 Image processing method and image processing apparatus

Country Status (1)

Country Link
JP (1) JP5331661B2 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015006259A (en) * 2013-06-25 2015-01-15 朝日レントゲン工業株式会社 X-ray machine and x-ray image selection method
JP2016177430A (en) * 2015-03-19 2016-10-06 カシオ計算機株式会社 Image correction device, image correction method, and program
JP2017056364A (en) * 2017-01-06 2017-03-23 朝日レントゲン工業株式会社 X-ray imaging apparatus and X-ray image selection method
US11776093B2 (en) * 2019-07-16 2023-10-03 University Of Florida Research Foundation, Incorporated Automatic sharpness adjustment for imaging modalities

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0519161A (en) * 1991-07-15 1993-01-29 Nikon Corp Automatic focusing controller
JP2003346164A (en) * 2002-05-27 2003-12-05 Ricoh Co Ltd Edge extraction device of image
JP2008276217A (en) * 2007-05-01 2008-11-13 Samsung Electronics Co Ltd Method and apparatus for auto-focusing in image sensor

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0519161A (en) * 1991-07-15 1993-01-29 Nikon Corp Automatic focusing controller
JP2003346164A (en) * 2002-05-27 2003-12-05 Ricoh Co Ltd Edge extraction device of image
JP2008276217A (en) * 2007-05-01 2008-11-13 Samsung Electronics Co Ltd Method and apparatus for auto-focusing in image sensor

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015006259A (en) * 2013-06-25 2015-01-15 朝日レントゲン工業株式会社 X-ray machine and x-ray image selection method
JP2016177430A (en) * 2015-03-19 2016-10-06 カシオ計算機株式会社 Image correction device, image correction method, and program
JP2017056364A (en) * 2017-01-06 2017-03-23 朝日レントゲン工業株式会社 X-ray imaging apparatus and X-ray image selection method
US11776093B2 (en) * 2019-07-16 2023-10-03 University Of Florida Research Foundation, Incorporated Automatic sharpness adjustment for imaging modalities

Also Published As

Publication number Publication date
JP5331661B2 (en) 2013-10-30

Similar Documents

Publication Publication Date Title
US20200364906A1 (en) Image Inspection Apparatus
JP5043755B2 (en) Resin material inspection device and program
JP5546317B2 (en) Visual inspection device, visual inspection discriminator generation device, visual inspection discriminator generation method, and visual inspection discriminator generation computer program
EP1580691A2 (en) Automatic adjustment of acquisition of inspection image
JP4309927B2 (en) Eyelid detection device and program
JP6765791B2 (en) A method for creating a reference image set for pattern matching, a device for creating a reference image set for pattern matching, a work recognition method, a program, and a recording medium.
JP5331661B2 (en) Image processing method and image processing apparatus
JP2021196362A (en) Workpiece inspection including monitoring workpiece image and defect detection system
JP2008170256A (en) Flaw detection method, flaw detection program and inspection device
JP2011174896A (en) Imaging apparatus and method
JP6647903B2 (en) Image inspection device, image inspection program, computer-readable recording medium, and recorded device
JP2012237585A (en) Defect inspection method
JP2021092887A (en) Visual inspection device, visual inspection system, feature quantity estimation device, and visual inspection program
WO2019176614A1 (en) Image processing device, image processing method, and computer program
CN116256366A (en) Chip defect detection method, detection system and storage medium
JP3871963B2 (en) Surface inspection apparatus and surface inspection method
JP7293907B2 (en) Visual inspection management system, visual inspection management device, visual inspection management method and program
JP2008111705A (en) Method and program for detecting defect and inspection apparatus
JP7198360B2 (en) Charged particle beam device
JP2014106141A (en) Defect inspection device and defect inspection method
JP4563183B2 (en) Inspection method and apparatus for streaky unevenness defect
JP7079218B2 (en) Imaging device
JP2009222513A (en) Flaw detector and flaw detection method
JP4563184B2 (en) Method and apparatus for inspecting mura defect
JP2010121955A (en) Height information acquisition device, height information acquisition method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120223

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20121031

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20121113

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20130729

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees