JP2012059213A - Binarization processing method and image processing apparatus - Google Patents

Binarization processing method and image processing apparatus Download PDF

Info

Publication number
JP2012059213A
JP2012059213A JP2010204643A JP2010204643A JP2012059213A JP 2012059213 A JP2012059213 A JP 2012059213A JP 2010204643 A JP2010204643 A JP 2010204643A JP 2010204643 A JP2010204643 A JP 2010204643A JP 2012059213 A JP2012059213 A JP 2012059213A
Authority
JP
Japan
Prior art keywords
luminance
camera
shutter time
image
work
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
JP2010204643A
Other languages
Japanese (ja)
Other versions
JP5609459B2 (en
Inventor
Takeshi Ito
毅 伊藤
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.)
Toyota Auto Body Co Ltd
Original Assignee
Toyota Auto Body Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Toyota Auto Body Co Ltd filed Critical Toyota Auto Body Co Ltd
Priority to JP2010204643A priority Critical patent/JP5609459B2/en
Publication of JP2012059213A publication Critical patent/JP2012059213A/en
Application granted granted Critical
Publication of JP5609459B2 publication Critical patent/JP5609459B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Studio Devices (AREA)
  • Image Analysis (AREA)
  • Investigating Materials By The Use Of Optical Means Adapted For Particular Applications (AREA)
  • Image Input (AREA)
  • Image Processing (AREA)
  • Transforming Light Signals Into Electric Signals (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a binarization processing method and an image processing apparatus which can obtain an image having a luminance of a background constantly controlled to attain a prescribed luminance even when an illumination environment is changed, and can stably separate the background and a workpiece from each other due to binarization, because the image achieves the background and the workpiece of high contrast.SOLUTION: The binarization processing method includes: S20 of acquiring a current luminance at a background reference measurement point in a background region of a picked-up image which has been imaged in a predetermined shutter time; S30 of calculating the shutter time of main photographing using the current luminance, the target background luminance and a constant at the background reference measurement point; S40 of imaging a workpiece base, a placement table and the workpiece with a camera in the calculated shutter time of the main photographing; and S50 of binarizing the picked-up image acquired by S40 with a binary threshold which has been previously set at a preparation stage.

Description

本発明は、二値化処理方法及び画像処理装置に関する。   The present invention relates to a binarization processing method and an image processing apparatus.

従来から、ワークの外観検査や種類の判定を行う画像処理装置では、ワークが固定されておらず、ワークの位置が移動する場合には、まず始めに撮像画像のどこがワークでどこが背景かを認識する処理を行う。一般的には、ワークと背景の中間の輝度を閾値として二値化を行うことでワーク背景を分離する。   Conventionally, in image processing devices that perform work appearance inspection and type determination, when the work position is not fixed and the position of the work moves, first, it recognizes where the captured image is and what is the background. Perform the process. In general, the work background is separated by performing binarization using a luminance between the work and the background as a threshold value.

二値化を行う場合、閾値の取り方によって二値化後の結果、すなわち二値化画像が変わる。図7に示すようにワーク台100上に載置されたワークWを、モノクロカメラ110で、256階調で撮像した場合、図8(a)に示すように適正露出で撮影された画像を閾値140で二値化すると、図8(b)に示すようにうまくワークと背景を分離できる。図8(b)において、ハッチング領域は、二値化により輝度値が「0」(黒)となった領域を示し、非ハッチング領域は、二値化により輝度値が「255」(白)となった領域を示している。   When binarization is performed, the result after binarization, that is, the binarized image changes depending on how the threshold is set. When the work W placed on the work table 100 as shown in FIG. 7 is imaged with 256 gradations by the monochrome camera 110, an image photographed with appropriate exposure as shown in FIG. When binarized at 140, the work and the background can be well separated as shown in FIG. In FIG. 8B, the hatched area indicates an area where the luminance value becomes “0” (black) by binarization, and the non-hatched area indicates that the luminance value becomes “255” (white) by binarization. It shows the area that became.

一方、露出不足の状態で撮影された画像を同じ閾値140で二値化するとワークと背景を分離できない。図9(a)は露出不足で撮影された撮像画像を示している。図9(b)は図9(a)の撮像画像を閾値140で二値化した結果の画像を示している。なお、説明の便宜上、図9(b)では、背景の領域において、細かいハッチング領域の部分は、全体が、輝度値が「0」(黒)となった領域を示し、荒いハッチング領域の部分は、部分的に輝度値が「0」(黒)となった領域であって、黒点が点在している領域を示している。又、図9(b)において、ワークのハッチング領域は全て輝度値が「0」(黒)となった領域となっており、実際には前記背景の一様に輝度値が「0」(黒)となった領域との境界はなくなっているものと理解されたい。なお、図9(c)では、図9(a)の撮像画像を閾値110で二値化した結果、うまくワークと背景を分離できた画像を示している。   On the other hand, if an image shot in an underexposed state is binarized with the same threshold value 140, the work and the background cannot be separated. FIG. 9A shows a captured image taken with insufficient exposure. FIG. 9B shows an image obtained as a result of binarizing the captured image of FIG. For convenience of explanation, in FIG. 9B, in the background area, the fine hatched area part is an area where the luminance value is “0” (black) as a whole, and the rough hatched area part is , A region where the luminance value is partially “0” (black), and is a region where black dots are scattered. In FIG. 9B, all the hatched areas of the work are areas where the luminance value is “0” (black). Actually, the luminance value of the background is uniformly “0” (black). ) It should be understood that the boundary with the territory is now gone. FIG. 9C shows an image in which the workpiece and the background are successfully separated as a result of binarizing the captured image of FIG.

上記のように背景とワークとをうまく分離できない場合、主な従来の対処法としては次の2つがある。
<対処法1>
対処法1は撮像画像毎に最適な二値化を設定する方法である。撮像画像毎に最適な二値化を設定する方法はいくつか提案されており、例えば、ヒストグラム法がある。ヒストグラム法は、画像の輝度を調べてヒストグラムを図10(a)に示すように作成し、ワークと背景の間の鞍部Kの輝度を閾値とすると、きれいにワークと背景とが分離できるとされている。なお、図10(a)において、横軸は輝度、縦軸は度数を表す。
If the background and the workpiece cannot be separated well as described above, there are the following two main conventional countermeasures.
<Solution 1>
Coping method 1 is a method of setting an optimal binarization for each captured image. Several methods for setting optimal binarization for each captured image have been proposed, for example, a histogram method. In the histogram method, the brightness of an image is examined and a histogram is created as shown in FIG. 10A. If the brightness of the heel K between the work and the background is a threshold value, the work and the background can be separated cleanly. Yes. In FIG. 10A, the horizontal axis represents luminance, and the vertical axis represents frequency.

<対象法2>
対処法2は、外光を遮断する閉空間の中でワークを配置して照明条件を一定にすることにより、常に同じ明るさの画像を得られるようにする方法である。
<Target method 2>
Coping method 2 is a method of always obtaining an image having the same brightness by arranging a work in a closed space that blocks outside light and making the lighting conditions constant.

又、特許文献1では、K−means法(K−平均法)を使用して、画像の輝度データを所定個数のグループに分割するようにしている。そして、各グループの代表値を取得し、輝度レベルが隣り合う前記代表値の差が最大となる最大距離区間の中点を閾値に設定して、該閾値で画像を二値化処理する。   In Patent Document 1, the luminance data of an image is divided into a predetermined number of groups using a K-means method (K-average method). Then, the representative value of each group is acquired, the midpoint of the maximum distance section where the difference between the representative values adjacent to each other in the luminance level is set as a threshold value, and the image is binarized with the threshold value.

特開2002−319021号公報JP 2002-319021 A

ところが、対処法1のヒストグラム法では、図10(b)に示すようにいつも明確な鞍部Kができるとは限らず、画像処理装置が自動で判断するのは困難な場合がある。このように撮像画像に合わせた最適な閾値設定で二値化処理を行う方法は、常に適切に設定できるとは限らず、コンピュータで自動処理するには非常に高度な技術が要求される。   However, in the histogram method of the countermeasure 1, the clear collar K is not always formed as shown in FIG. 10B, and it may be difficult for the image processing apparatus to automatically determine. As described above, the method of performing the binarization process with the optimum threshold setting according to the captured image is not always set appropriately, and a very advanced technique is required for automatic processing by a computer.

又、一般に産業用カメラは、露出計や自動露出制御機構を持たないため、照明の明るさの変動や外乱光の影響で、ワークと背景を分離する二値化処理に失敗することがある。
又、対処法2では、ワークを撮像する場合、閉空間が必要であるため、閉空間の設置場所などの制約が発生し、又、照度を一定にするための照明条件を維持するために、一定期間毎に照明ランプ等の光源を交換しなければならない等、照明に係るコストも大きくなる問題がある。
In general, an industrial camera does not have an exposure meter or an automatic exposure control mechanism, and therefore, the binarization process for separating the workpiece and the background may fail due to the fluctuation of the brightness of the illumination or the influence of ambient light.
Further, in the countermeasure 2, when a workpiece is imaged, a closed space is necessary, so that a restriction such as an installation location of the closed space occurs, and in order to maintain lighting conditions for making the illuminance constant, There is a problem that the cost of illumination increases, for example, the light source such as an illumination lamp must be replaced every certain period.

又、特許文献1のK−means法では、最初のグループ(すなわち、クラスタ)を設定するときの初期値によって、結果が依存することが知られており、異なる初期値設定により異なる結果の二値化画像となってしまう問題がある。又、前記初期値の設定には、確実な方法がない。   Further, in the K-means method of Patent Document 1, it is known that the result depends on the initial value when the first group (that is, cluster) is set. There is a problem that it becomes a converted image. There is no reliable method for setting the initial value.

本発明の目的は、上記課題を解決することができるとともに、照明環境が変動しても、背景の輝度が常に規定の輝度に制御された画像を得ることができるとともに、前記画像は背景とワークとのコントラストが高い状態とすることができるので、二値化により背景とワークを安定的に分離できる二値化処理方法及び画像処理装置を提供することにある。   The object of the present invention is to solve the above-mentioned problems and to obtain an image in which the brightness of the background is always controlled to a specified brightness even when the lighting environment changes. Therefore, it is an object of the present invention to provide a binarization processing method and an image processing apparatus capable of stably separating a background and a workpiece by binarization.

上記問題点を解決するために、請求項1の発明は、所定シャッタ時間で撮影されたカメラの撮像画像における輝度をpとし、任意のシャッタ時間Tvのときの輝度をVとしたとき、下記式(イ)、式(ロ)が成立することを利用して、
V=A・Tv+I ……(イ)、A=m・p+n ……(ロ)
(なお、Iは、カメラの撮像画像における暗電流時の輝度、Aは係数であり、m,nは前記所定シャッタ時間において定まる定数である。)
前記所定シャッタ時間で得た撮像画像を基に得られた輝度I、定数m,nをカメラ固有値として第1記憶手段に記憶する第1段階と、前記カメラのシャッタ速度を変えて第1撮影対象物と第2撮影対象物とを同時に複数回撮影した複数の撮像画像に基づき、第1撮影対象物に設けられた基準部位の特定画素領域の目標背景輝度と、第2撮影対象物の輝度との中間値を二値化閾値として第2記憶手段に記憶する第2段階と、前記所定シャッタ時間で、前記カメラにより第1撮影対象物と第2撮影対象物とを同時に撮影して得られた撮像画像における基準部位の特定画素領域のプレ撮影輝度を取得する第3段階と、前記プレ撮影輝度を前記pとし、前記目標背景輝度を前記Vとし、かつ、輝度I、定数m,nを使用して、式(イ)、式(ロ)に基づいてシャッタ時間Tvを算出する第4段階と、第4段階で算出したシャッタ時間Tvで前記カメラで第1撮影対象物と第2撮影対象物とを撮像する第5段階と、第5段階で取得した撮像画像を前記二値化閾値で二値化する第6段階を含む二値化処理方法を要旨としている。
In order to solve the above-described problems, the invention of claim 1 is such that the luminance in a captured image of a camera photographed at a predetermined shutter time is p, and the luminance at an arbitrary shutter time Tv is V. (A) Utilizing the fact that formula (b) holds,
V = A · Tv + I 0 (b), A = m · p + n (b)
(I 0 is the luminance at the time of dark current in the captured image of the camera, A is a coefficient, and m and n are constants determined in the predetermined shutter time.)
A first stage in which the luminance I 0 and constants m and n obtained based on the captured image obtained at the predetermined shutter time are stored in the first storage means as camera intrinsic values, and the first photographing is performed by changing the shutter speed of the camera. Based on a plurality of captured images obtained by simultaneously capturing the object and the second object to be imaged a plurality of times, the target background luminance of the specific pixel region of the reference portion provided on the first object to be imaged and the luminance of the second object to be imaged Obtained by simultaneously photographing the first photographing object and the second photographing object with the camera during the second stage in which the intermediate value is stored in the second storage means as the binarization threshold value and the predetermined shutter time. A third stage of acquiring a pre-photographed luminance of a specific pixel region of a reference part in the captured image, the pre-photographed luminance as p, the target background luminance as V, and a luminance I 0 , constants m, n Using the expression (A), expression (B ) Based on (4), a fifth stage in which the camera captures the first and second shooting objects with the shutter time Tv calculated in the fourth stage, and a fifth stage. The gist of the present invention is a binarization processing method including a sixth step of binarizing the captured image acquired in the step with the binarization threshold.

請求項2の発明は、請求項1において、前記第1撮影対象物は、ワークを載置するワーク台であり、前記第2撮影対象物は前記ワークであることを特徴とする。
請求項3の発明は、所定シャッタ時間で撮影されたカメラの撮像画像における輝度をpとし、任意のシャッタ時間Tvのときの輝度をVとしたとき、下記式(イ)、式(ロ)が成立することを利用して、
V=A・Tv+I ……(イ)、A=m・p+n ……(ロ)
(なお、Iは、カメラの撮像画像における暗電流時の輝度、Aは係数であり、m,nは前記所定シャッタ時間において定まる定数である。)
前記所定シャッタ時間で得た撮像画像を基に得られた輝度I、定数m,nをカメラ固有値として記憶する第1記憶手段と、前記カメラのシャッタ速度が変えられて前記第1撮影対象物と第2撮影対象物とを同時に複数回撮影された複数の撮像画像に基づいて得られた基準部位の特定画素領域の目標背景輝度と、第2撮影対象物の輝度との中間値を二値化閾値として記憶する第2記憶手段と、前記所定シャッタ時間で、前記カメラにより前記第1撮影対象物と第2撮影対象物とを同時に撮影して得られた撮像画像における前記基準部位の特定画素領域のプレ撮影輝度を取得する第1取得手段と、前記プレ撮影輝度を前記pとし、前記目標背景輝度を前記Vとして、式(イ)、式(ロ)に基づいてシャッタ時間Tvを算出する算出手段と、前記シャッタ時間Tvで前記カメラを撮像させて第1撮影対象物と第2撮影対象物との撮像画像を取得する第2取得手段と、前記第2取得手段が取得した撮像画像を前記二値化閾値で二値化する二値化手段を含む画像処理装置を要旨としている。
According to a second aspect of the present invention, in the first aspect, the first photographing object is a work table on which a work is placed, and the second photographing object is the work.
According to the third aspect of the present invention, the following formulas (A) and (B) are obtained when the luminance in the captured image of the camera photographed at the predetermined shutter time is p and the luminance at an arbitrary shutter time Tv is V. Utilizing the establishment,
V = A · Tv + I 0 (b), A = m · p + n (b)
(I 0 is the luminance at the time of dark current in the captured image of the camera, A is a coefficient, and m and n are constants determined in the predetermined shutter time.)
First storage means for storing the brightness I 0 and constants m and n obtained based on the captured image obtained at the predetermined shutter time as camera intrinsic values, and the shutter speed of the camera being changed to change the first photographing object. And the binary value of the intermediate value between the target background luminance of the specific pixel region of the reference region obtained based on a plurality of captured images obtained by imaging the second imaging object and the second imaging object at the same time and the luminance of the second imaging object. Specific pixels of the reference region in the captured image obtained by simultaneously capturing the first and second imaging objects with the second shutter and the predetermined shutter time and the camera with the predetermined shutter time The shutter time Tv is calculated based on the equations (A) and (B), with the first acquisition means for acquiring the pre-photographing luminance of the region, the pre-photographing luminance as the p, and the target background luminance as the V. Calculation means and previous A second acquisition unit configured to acquire the captured image of the first imaging target and the second imaging target by imaging the camera with a shutter time Tv; and the binarization threshold value obtained by the second acquisition unit. The gist of the image processing apparatus includes binarization means for binarizing the image.

請求項4の発明は、請求項3において、前記第1撮影対象物は、ワークを載置するワーク台であり、前記第2撮影対象物は前記ワークであることを特徴とする。   According to a fourth aspect of the present invention, in the third aspect, the first photographing object is a work table on which a work is placed, and the second photographing object is the work.

請求項1の発明によれば、照明環境が変動しても、背景の輝度が常に規定の輝度に制御された画像を得ることができるとともに、前記画像は背景とワークとのコントラストが高い状態とすることができるので、二値化により背景とワークを安定的に分離できる二値化処理方法を提供できる。   According to the first aspect of the present invention, it is possible to obtain an image in which the brightness of the background is always controlled to the specified brightness even when the illumination environment changes, and the image has a high contrast between the background and the workpiece. Therefore, it is possible to provide a binarization processing method that can stably separate the background and the workpiece by binarization.

請求項2の発明によれば、ワークとワーク台との撮像画像を安定的に分離できる二値化処理方法となる。
請求項3の発明によれば、照明環境が変動しても、背景の輝度が常に規定の輝度に制御された画像を得ることができるとともに、前記画像は背景とワークとのコントラストが高い状態とすることができるので、二値化により背景とワークを安定的に分離できる画像処理装置を提供できる。
According to invention of Claim 2, it becomes a binarization processing method which can isolate | separate stably the picked-up image of a workpiece | work and a workpiece base.
According to the invention of claim 3, even when the lighting environment fluctuates, it is possible to obtain an image in which the background brightness is always controlled to the specified brightness, and the image has a high contrast between the background and the workpiece. Therefore, it is possible to provide an image processing apparatus that can stably separate the background and the workpiece by binarization.

請求項4の発明によれば、ワークとワーク台との撮像画像を安定的に分離できる画像処理装置を提供できる。   According to invention of Claim 4, the image processing apparatus which can isolate | separate stably the picked-up image of a workpiece | work and a workpiece base can be provided.

本実施形態の画像処理装置の全体概略図。1 is an overall schematic diagram of an image processing apparatus according to an embodiment. 二値化処理のフローチャート。The flowchart of a binarization process. 画像処理装置のブロック図。1 is a block diagram of an image processing apparatus. カメラのシャッタ時間と輝度とが一次式で表されることを示す特性図。The characteristic view which shows that the shutter time and the brightness | luminance of a camera are represented by a primary type | formula. 特定シャッタ時間において、前記一次式の傾きと輝度の関係を示す特性図。The characteristic view which shows the relationship between the inclination of the said linear expression, and a brightness | luminance in specific shutter time. 二値化閾値の設定の説明図。Explanatory drawing of the setting of a binarization threshold value. カメラとワーク、ワーク台Camera and work, work table (a)は適正露出で撮影された画像の説明図、(b)は(a)を二値化した画像の説明図。(A) is explanatory drawing of the image image | photographed with appropriate exposure, (b) is explanatory drawing of the image which binarized (a). (a)は適正露出で撮影されなかった画像の説明図、(b)は(a)を不適正な閾値により二値化した画像の説明図、(c)は適正な閾値により二値化した画像の説明図。(A) is an explanatory diagram of an image that was not photographed with proper exposure, (b) is an explanatory diagram of an image obtained by binarizing (a) with an inappropriate threshold, and (c) is binarized with an appropriate threshold. Explanatory drawing of an image. (a)、(b)は、ヒストグラム法により得られたヒストグラム。(A) and (b) are histograms obtained by the histogram method.

以下、本発明を具体化した二値化処理方法及び画像処理装置の一実施形態を図1〜図6を参照して説明する。図1は、本実施形態の画像処理装置10を示している。
本実施形態の画像処理装置10は、ワーク台60上に載置されたワークWをカメラ30で撮像した撮像画像に対して画像処理を行う。
An embodiment of a binarization processing method and an image processing apparatus embodying the present invention will be described below with reference to FIGS. FIG. 1 shows an image processing apparatus 10 of the present embodiment.
The image processing apparatus 10 according to the present embodiment performs image processing on a captured image obtained by capturing the work W placed on the work table 60 with the camera 30.

カメラ30は、CCD、CMOS等の固体撮像デバイスを有するモノクロビデオカメラからなり、カメラ30から出力された画像信号に基づき所定のフレームレート(例えば、1秒間に30フレーム)での動画像の撮像が可能である。カメラ30はカラーカメラ或いはモノクロカメラのいずれでもよい。本実施形態のカメラ30は、256階調で撮像が可能であるが、256階調に限定するものではなく、他の数値の階調であってもよい。又、カメラ30は、図示しない支持手段により支持されてワーク台60上方に配置されている。本実施形態では、ワーク台60上に、ワークWの置く範囲を規定する載置板62が置かれ、載置板62上にワークWが載置される。ワーク台60及び載置板62は、第1撮影対象物に相当する。なお、載置板62は、ワーク台60と同色とする。ワークWは第2撮影対象物に相当する。   The camera 30 is a monochrome video camera having a solid-state imaging device such as a CCD or a CMOS, and can capture a moving image at a predetermined frame rate (for example, 30 frames per second) based on an image signal output from the camera 30. Is possible. The camera 30 may be a color camera or a monochrome camera. The camera 30 of the present embodiment can capture images with 256 gradations, but is not limited to 256 gradations, and may be other numerical gradations. The camera 30 is supported by a support means (not shown) and is disposed above the work table 60. In the present embodiment, a placement plate 62 that defines a range in which the workpiece W is placed is placed on the workpiece base 60, and the workpiece W is placed on the placement plate 62. The work table 60 and the mounting plate 62 correspond to a first object to be photographed. The mounting plate 62 has the same color as the work table 60. The workpiece W corresponds to a second object to be photographed.

画像処理装置10は、カメラ30から出力された画像信号に基づいて、撮像範囲内(撮像して画像取り込みが行われる撮像対象となる範囲)の画像に応じた画像データを生成する。すなわち、前記ビデオカメラより得られた画像信号は、画像処理装置10によりコンピュータでの処理が可能なRGBのカラー画像(或いはモノクロ画像)からなるフレーム画像(M×Nの画素からなる)に変換される。なお、撮像画像の解像度は、例えば水平方向画素数をM=640画素、垂直方向画素数をN=480画素としている。尚、フレームレート、変換される画像及び解像度は、上記の例に限定するものではない。   Based on the image signal output from the camera 30, the image processing apparatus 10 generates image data corresponding to an image within an imaging range (a range to be imaged that is captured and an image is captured). That is, the image signal obtained from the video camera is converted into a frame image (consisting of M × N pixels) composed of RGB color images (or monochrome images) that can be processed by a computer by the image processing apparatus 10. The Note that the resolution of the captured image is, for example, M = 640 pixels in the horizontal direction and N = 480 pixels in the vertical direction. Note that the frame rate, the image to be converted, and the resolution are not limited to the above example.

画像処理装置10は、コンピュータからなり、CPU11、ROM12、RAM13、画像メモリ15、カメラインターフェイス14、モニタインターフェイス16、及び入力インターフェイス17を備えている。CPU11と前記各部はバス18を介して入力出力が可能である。   The image processing apparatus 10 includes a computer, and includes a CPU 11, a ROM 12, a RAM 13, an image memory 15, a camera interface 14, a monitor interface 16, and an input interface 17. The CPU 11 and each unit can be input / output via the bus 18.

CPU11は、第1取得手段、第2取得手段、及び二値化手段、及び算出手段に相当する。又、RAM13は、第1記憶手段及び第2記憶手段に相当する。
ROM12は、CPU11が画像処理プログラムを含む各種処理プログラムが格納されている。
The CPU 11 corresponds to a first acquisition unit, a second acquisition unit, a binarization unit, and a calculation unit. The RAM 13 corresponds to first storage means and second storage means.
The ROM 12 stores various processing programs including an image processing program by the CPU 11.

RAM13は、CPU11の処理により各種データを格納するワークエリアである。カメラインターフェイス14は、カメラ30から出力された画像信号を入力するとともに、CPU11から出されたシャッタ時間をコントロールする制御指令を出力し、カメラ30のシャッタ時間の制御が可能である。画像メモリ15は、CPU11が、前記画像信号に基づいて処理して生成された各フレーム画像(画像データ)を格納する。画像処理装置10は、液晶表示装置等からなるディスプレイ20がモニタインターフェイス16を介して接続されている。ディスプレイ20は、モニタインターフェイス16を介して、CPU11による各種処理における所定の表示を行うとともに、画像メモリ15に格納された撮像画像(画像データ)を表示する。又、入力インターフェイス17は、CPU11による各種処理に必要な各種データの入力を行う入力装置21との接続を行う。   The RAM 13 is a work area for storing various data by the processing of the CPU 11. The camera interface 14 inputs the image signal output from the camera 30 and outputs a control command for controlling the shutter time output from the CPU 11, so that the shutter time of the camera 30 can be controlled. The image memory 15 stores each frame image (image data) generated by the CPU 11 based on the image signal. The image processing apparatus 10 is connected to a display 20 made up of a liquid crystal display device or the like via a monitor interface 16. The display 20 displays a captured image (image data) stored in the image memory 15 while performing predetermined display in various processes by the CPU 11 via the monitor interface 16. The input interface 17 is connected to an input device 21 for inputting various data necessary for various processes by the CPU 11.

(実施形態の作用)
上記のように構成された画像処理装置10の作用及び二値化処理を説明する。
<1.第1事前準備作業>
第1事前準備作業は、カメラ30で被写体(ワークW、載置板62及びワーク台60)を撮影するときの、露出と被写体の色と撮像画像上での被写体領域の輝度の関係を調べ、画像処理装置10に登録する作業である。
(Operation of the embodiment)
The operation and binarization processing of the image processing apparatus 10 configured as described above will be described.
<1. First preparation work>
In the first preparatory work, the relationship between the exposure, the color of the subject, and the luminance of the subject area on the captured image when photographing the subject (work W, mounting plate 62, and work base 60) with the camera 30, This is an operation for registration in the image processing apparatus 10.

一般的な産業用カメラは、絞りが手動式であり、絞りは固定して使用する。本実施形態のカメラ30も一般的な産業用カメラであり、ここでは、CPU11からの制御指令でシャッタ時間を変更することで、露出を変え、絞りは、実際の装置で使用したい値に固定されているとする。   A general industrial camera has a manual aperture, and the aperture is fixed. The camera 30 of the present embodiment is also a general industrial camera. Here, the exposure is changed by changing the shutter time in accordance with a control command from the CPU 11, and the aperture is fixed to a value desired to be used in an actual apparatus. Suppose that

露出(本実施形態では、シャッタ時間Tv)を変えた時の被写体の輝度Vの変化は線形性があり、輝度Vは、
V=A・Tv+I ……(イ)
の形で表現できる。
The change in the luminance V of the subject when the exposure (shutter time Tv in this embodiment) is changed is linear, and the luminance V is
V = A · Tv + I 0 ...... (I)
It can be expressed in the form of

Aは係数であり、被写体の色に依存し、カメラによって異なる。輝度Iは、露出ゼロ(すなわち、シャッタ時間Tvが0)の時の輝度(平均輝度)であり、カメラの撮像素子の暗電流によって発生し、カメラにより異なるカメラ固有値である。以下では、Iを暗電流輝度とする。 A is a coefficient, which depends on the color of the subject and varies depending on the camera. The luminance I 0 is the luminance (average luminance) when exposure is zero (that is, the shutter time Tv is 0), is generated by the dark current of the image sensor of the camera, and is a camera-specific value that varies depending on the camera. Hereinafter, I 0 is dark current luminance.

本実施形態では、図4に示すように、異なる4種類の色をそれぞれ有する物体(被写体)を、異なるシャッタ時間でカメラ30で撮影し、そのときの、シャッタ時間とCPU11が取得した撮像画像の輝度との関係を示す。被写体の色は限定するものではないが、反射率が大きく異なる4色を選択した方が好ましい。又、4種類ではなく、4種類未満の複数の色、或いは5種類以上の色の被写体に対しそれぞれカメラ30で撮影してもよい。   In the present embodiment, as shown in FIG. 4, an object (subject) having four different colors is photographed by the camera 30 with different shutter times, and the shutter time and the captured image acquired by the CPU 11 at that time are captured. The relationship with luminance is shown. The color of the subject is not limited, but it is preferable to select four colors with greatly different reflectances. Further, instead of four types, a plurality of colors of less than four types or subjects of five or more types of colors may be photographed by the camera 30.

図4の例では、反射率0%(黒)、25%、50%、75%の4色のグレーの被写体を異なるシャッタ時間で撮影し、そのときの輝度をオペレータはプロットとして各色の線形近似式を求めた。以下、反射率0%(黒)、25%、50%、75%のそれぞれを色1〜4とする。なお、ここでの輝度は、フレーム画像の平均輝度である。   In the example shown in FIG. 4, four gray objects with reflectances of 0% (black), 25%, 50%, and 75% are photographed at different shutter times, and the brightness at that time is plotted by the operator as a linear approximation of each color. The formula was determined. Hereinafter, the reflectances of 0% (black), 25%, 50%, and 75% are referred to as colors 1 to 4, respectively. The luminance here is the average luminance of the frame image.

この例では、4色の一次式の係数(傾き)Aは、色1:4.62、色2:3.04、色3:1.56、色4:0.47であり、Iが16であることが求められた。
この暗電流輝度Iを、オペレータは入力装置21により入力し、RAM13に記憶する。
In this example, the coefficients (gradients) A of the primary equations of the four colors are color 1: 4.62, color 2: 3.04, color 3: 1.56, color 4: 0.47, and I 0 is 16 was required.
The dark current luminance I 0 is input by the operator through the input device 21 and stored in the RAM 13.

次に、図4においてある特定条件(すなわち、所定シャッタ時間)における、各色別の輝度を図5に示すような輝度pと係数(傾き)Aの関係のグラフにプロットする。
図5は一例を示している。この例では、図4におけるシャッタ時間Tv=20(ms)の時の各色の輝度pを、それぞれ係数Aを横軸にしてプロットしたものである。
Next, the luminance for each color under a specific condition (that is, a predetermined shutter time) in FIG. 4 is plotted on a graph of the relationship between the luminance p and the coefficient (slope) A as shown in FIG.
FIG. 5 shows an example. In this example, the luminance p of each color when the shutter time Tv = 20 (ms) in FIG. 4 is plotted with the coefficient A as the horizontal axis.

具体的には、係数Aが4.62である色1のTv=20(ms)における輝度が108.4であるから、図5では、横軸108.4、縦軸4.62の位置にプロットする。このようにしてプロットして得られるグラフも線形性があり下記式(ロ)の一次式が成立する。   Specifically, since the luminance at Tv = 20 (ms) of the color 1 having the coefficient A of 4.62 is 108.4, the horizontal axis is 108.4 and the vertical axis is 4.62 in FIG. Plot. The graph obtained by plotting in this way is also linear, and the following linear expression (b) is established.

A=m・p+n ……(ロ)
m,nは、所定シャッタ時間において、定まる定数である。
図5では、所定シャッタ時間である20ms時の場合、m=0.05、n=−0.83となる。なお、本実施形態では、所定シャッタ時間を20msとしているが、所定シャッタ時間は20msに限定するものではなく、他の異なる数値であってもよい。
A = m · p + n (b)
m and n are constants determined in a predetermined shutter time.
In FIG. 5, when the predetermined shutter time is 20 ms, m = 0.05 and n = −0.83. In the present embodiment, the predetermined shutter time is 20 ms, but the predetermined shutter time is not limited to 20 ms, and may be other different numerical values.

ここで、式(イ)に式(ロ)を代入すると、
V=(m・p+n)・Tv+I ……(ハ)
となる。ここで、上記のように求められた暗電流輝度I,定数m,nを式(ハ)に代入すると、
V=(0.05・p−0.83)・Tv+16 ……(ニ)
となる。これは、所定シャッタ時間20msで撮影すると、輝度pとなる色はシャッタ時間をTvにして撮影すると、輝度がVとなることを表している。
Here, substituting equation (b) into equation (b),
V = (m · p + n) · Tv + I 0 (c)
It becomes. Here, when the dark current luminance I 0 and the constants m and n obtained as described above are substituted into the formula (C),
V = (0.05 · p−0.83) · Tv + 16 (D)
It becomes. This indicates that when shooting is performed with a predetermined shutter time of 20 ms, the color having the luminance p becomes V when shooting with the shutter time being Tv.

上記のようにして得られた定数m,n(上記の例では、m=0.05,n=−0.83)を、オペレータは入力装置21により入力し、RAM13に記憶する。
ここで、定数m,nは、カメラのアンプのゲイン等により決まるカメラ固有値である。第1事前準備作業は、請求項1の第1段階に相当する。
The constants m and n obtained as described above (in the above example, m = 0.05, n = −0.83) are input by the operator through the input device 21 and stored in the RAM 13.
Here, the constants m and n are camera specific values determined by the gain of the camera amplifier. The first preparatory work corresponds to the first stage of claim 1.

<2.第2事前準備作業>
第2事前準備作業は、目標背景輝度と二値化閾値の設定作業である。なお、ワーク台60には、基準部位としての背景基準計測点Rを有する(図1参照)。背景基準計測点Rは、カメラ30の撮影時にワーク台60及び載置板62により隠れない部位であって、カメラ30の視野に入る位置に位置している。なお、背景基準計測点Rは、ワークWの置き位置を規制した上で、計測点を設けるようにしてもよい。
<2. Second preparation work>
The second preparatory work is a work for setting the target background luminance and the binarization threshold. The work table 60 has a background reference measurement point R as a reference part (see FIG. 1). The background reference measurement point R is a portion that is not hidden by the work table 60 and the mounting plate 62 when the camera 30 is photographed, and is located at a position that enters the field of view of the camera 30. The background reference measurement point R may be provided after the placement position of the workpiece W is regulated.

具体的には、図1に示すようにワークW、ワーク台60、及び載置板62を撮像範囲(視野)内に入るようにした状態で、カメラ30によりワークW、ワーク台60、及び載置板62を、CPU11からの制御指令でシャッタ時間を変えながら撮影する。これにより、CPU11は、シャッタ時間を変えた撮像画像、すなわち、撮像画像の中のワーク領域と背景領域を有する撮像画像(M×Nの画素からなる)を取得する。オペレータは、各シャッタ時間における前記撮像画像において、背景基準計測点Rの領域における背景輝度並びにワーク領域のワーク輝度をそれぞれ求め、図6に示すようにプロットする。図6中、横軸がシャッタ時間、縦軸が輝度である。図6において、□は背景基準計測点Rのプロット、△はワーク領域のプロットである。   Specifically, as shown in FIG. 1, the work W, the work table 60, and the placement are performed by the camera 30 in a state where the work W, the work table 60, and the placement plate 62 are within the imaging range (field of view). The mounting plate 62 is photographed while changing the shutter time in accordance with a control command from the CPU 11. Thereby, the CPU 11 acquires a captured image with a changed shutter time, that is, a captured image (consisting of M × N pixels) having a work area and a background area in the captured image. The operator obtains the background brightness in the area of the background reference measurement point R and the work brightness in the work area in the captured image at each shutter time, and plots them as shown in FIG. In FIG. 6, the horizontal axis represents shutter time and the vertical axis represents luminance. In FIG. 6, □ is a plot of the background reference measurement point R, and Δ is a plot of the work area.

図6において、シャッタ時間が短いと、ワーク色と背景色(ワーク台の色)のコントラストが小さく、シャッタ時間が長いと前記コントラストが大きくなり、二値化による分離が容易になる。なお、過度に長いシャッタ時間は、撮影時間も長くなるため、適切なシャッタ時間になるように、かつ、背景が飽和しないレベルで、かつ、背景とワークが十分なコントラストを持つときの値をオペレータは目標背景輝度Vとして決定し、オペレータは入力装置21を使用してRAM13に登録する。   In FIG. 6, when the shutter time is short, the contrast between the work color and the background color (work table color) is small, and when the shutter time is long, the contrast is large, and separation by binarization is facilitated. Note that an excessively long shutter time also increases the shooting time. Therefore, the operator sets the value when the background is not saturated and the background and the workpiece have sufficient contrast so that the shutter time is appropriate. Is determined as the target background luminance V, and the operator registers it in the RAM 13 using the input device 21.

前記のように目標背景輝度Vが決定されると、その時のシャッタ時間は一義的に決まるため、撮像画像のワーク領域のワーク輝度も決まることになる。二値化閾値は目標背景輝度とワーク輝度の間にとればよいため、オペレータはこのときの目標背景輝度(すなわち、背景色)とワーク色の中間値を二値化閾値として入力装置21を使用してRAM13に登録する。背景輝度とワーク輝度はそれぞれバラツキを有するため、前記中間値を選択することが好ましい。   When the target background brightness V is determined as described above, the shutter time at that time is uniquely determined, and therefore the work brightness of the work area of the captured image is also determined. Since the binarization threshold value may be set between the target background luminance and the work luminance, the operator uses the input device 21 with the intermediate value between the target background luminance (that is, the background color) and the work color at this time as the binarization threshold value. And registered in the RAM 13. Since the background brightness and the work brightness vary, it is preferable to select the intermediate value.

なお、求めたい背景が、画像上ではいくらの輝度で写っていると良いかということであるため、計測中の照明の明るさや、カメラのレンズの絞り等の条件は任意の値で問題ない。第2事前準備作業は第2段階に相当する。   It should be noted that since the background to be obtained should be at what brightness level in the image, conditions such as the brightness of the illumination being measured and the aperture of the camera lens can be any value. The second preparatory work corresponds to the second stage.

<3.運用時の処理>
次に、図2のフローチャートを参照して、画像処理装置10の運用時の処理を説明する。なお、この処理は、ROM12に格納した画像処理プログラムにより実行される。
<3. Processing during operation>
Next, processing during operation of the image processing apparatus 10 will be described with reference to the flowchart of FIG. This process is executed by an image processing program stored in the ROM 12.

S10ではワーク台60、載置板62及びワークWを図1に示す状態で配置した状態で、カメラ30により、カメラ固有値を調べたときの所定シャッタ時間(本実施形態では20ms)でプレ撮影を行い、CPU11は、取得した撮像画像を画像メモリ15に格納する。   In S10, with the work table 60, the mounting plate 62, and the work W arranged in the state shown in FIG. 1, pre-photographing is performed with a predetermined shutter time (20 ms in the present embodiment) when the camera eigenvalue is checked by the camera 30. The CPU 11 stores the acquired captured image in the image memory 15.

S20では、CPU11は、S10で取得した撮像画像から、輝度を一定に制御したい箇所、すなわち、背景領域における背景基準計測点Rの現在の輝度pを計測し、この値をRAM13に登録する。   In S20, the CPU 11 measures the current luminance p of the background reference measurement point R in the background area, that is, the location where the luminance is desired to be controlled from the captured image acquired in S10, and registers this value in the RAM 13.

S20は第3段階に相当する。撮像画像における背景基準計測点Rの領域は基準部位の特定画素領域に相当する。又、背景領域における背景基準計測点Rの現在の輝度pは、撮像画像における基準部位の特定画素領域のプレ撮影輝度に相当する。   S20 corresponds to the third stage. The area of the background reference measurement point R in the captured image corresponds to the specific pixel area of the reference part. Further, the current brightness p of the background reference measurement point R in the background area corresponds to the pre-shooting brightness of the specific pixel area of the reference part in the captured image.

S30では、CPU11は、適正シャッタ時間を算出する。具体的には、CPU11は、式(ハ)を変形した下式(ホ)に、予めRAM13に登録(記憶)したカメラ固有値(暗電流輝度I,定数m,n)、及びS20で登録した背景輝度の現在の輝度p、目標背景輝度Vを代入して適正シャッタ時間Tvを算出する。 In S30, the CPU 11 calculates an appropriate shutter time. Specifically, the CPU 11 registers the camera specific values (dark current luminance I 0 , constants m, n) registered (stored) in the RAM 13 in advance in the following formula (e) obtained by transforming the formula (c) and S20. The appropriate shutter time Tv is calculated by substituting the current luminance p of the background luminance and the target background luminance V.

Tv=(V−I)/(m・p+n) ……(ホ)
なお、この適正シャッタ時間Tvで撮像すると、背景基準計測点Rにおける背景領域の輝度を目標背景輝度Vとすることができることになる。S30は、第4段階に相当する。
Tv = (V−I 0 ) / (m · p + n) (e)
Note that if the image is taken with the appropriate shutter time Tv, the luminance of the background area at the background reference measurement point R can be set to the target background luminance V. S30 corresponds to the fourth stage.

S40では、S30で算出された適正シャッタ時間Tvで、カメラ30を駆動して本撮影を行う。S40は、第5段階に相当する。
S50では、S40でカメラ30から取得した本撮影の撮像画像を、RAM13に登録した二値化閾値で二値化処理し二値化処理した画像を画像メモリ15に格納し、このフローチャートを終了する。S50は、第6段階に相当する。
In S40, the camera 30 is driven and the main photographing is performed with the appropriate shutter time Tv calculated in S30. S40 corresponds to the fifth stage.
In S50, the captured image of the main photographing acquired from the camera 30 in S40 is binarized with the binarization threshold registered in the RAM 13, and the binarized image is stored in the image memory 15, and this flowchart is ended. . S50 corresponds to the sixth stage.

<具体例>
S10〜S50の処理において、具体的な数値を入れて説明する。
なお、ワーク台60に設定された背景基準計測点の輝度、すなわち、目標背景輝度を一定値「140」に制御するものとする。又、第2事前準備作業において、目標背景輝度を「140」としたとき、ワーク色の平均輝度は「60」であるとし、二値化閾値である中間値は「100」に設定されたものとする。又、第1事前準備作業、及び第2事前準備作業において、I=16、m=0.05,n=−0.83がRAM13に登録されていたとする。
<Specific example>
In the processing of S10 to S50, description will be made with specific numerical values.
Note that the luminance of the background reference measurement point set on the work table 60, that is, the target background luminance is controlled to a constant value “140”. In the second preparatory work, when the target background luminance is set to “140”, the average luminance of the work color is set to “60”, and the intermediate value as the binarization threshold is set to “100”. And Further, it is assumed that I 0 = 16, m = 0.05, and n = −0.83 are registered in the RAM 13 in the first preparatory work and the second preparatory work.

S10では、所定シャッタ時間(本実施形態では20ms)でプレ撮影を行う。
S20でのプレ撮影では背景基準計測点の現在の輝度pは「80」であったとする。
S30では、式(ホ)に、予め登録済みのI=16、m=0.05,n=−0.83)、S20で登録されたp=80、目標背景輝度V=140を代入すると、
Tv=(140−16)/(0.05*80−0.83)
≒39
となり、シャッタ時間39msが得られる。
In S10, pre-photographing is performed with a predetermined shutter time (20 ms in the present embodiment).
It is assumed that the current brightness p of the background reference measurement point is “80” in the pre-shooting in S20.
In S30, substituting previously registered I 0 = 16, m = 0.05, n = −0.83), p = 80 registered in S20, and target background luminance V = 140 into the formula (e). ,
Tv = (140-16) / (0.05 * 80-0.83)
≒ 39
Thus, a shutter time of 39 ms is obtained.

S40では、このシャッタ時間39msで撮影する。
S50では、本撮影で取得した撮像画像は背景領域の平均輝度が「140」、ワーク色領域の平均輝度が「60」になっているので、二値化閾値としての中間値「100」で二値化すると、ワークと背景(ワーク台60及び載置板62)をうまく分離できる。
In S40, a picture is taken with this shutter time of 39 ms.
In S50, since the average brightness of the background area is “140” and the average brightness of the work color area is “60” in the captured image acquired in the actual shooting, the intermediate value “100” as the binarization threshold value is two. When the value is converted, the work and the background (work table 60 and placement plate 62) can be well separated.

本実施形態では、下記の特徴を有する。
(1) 本実施形態の二値化処理方法は、第1事前準備作業(第1段階)で、所定シャッタ時間で得た撮像画像を基に得られた輝度I、定数m,nをカメラ固有値としてRAM(第1記憶手段)に記憶する。
This embodiment has the following features.
(1) In the binarization processing method of the present embodiment, the brightness I 0 and constants m and n obtained based on the captured image obtained at the predetermined shutter time in the first preparatory work (first stage) are determined by the camera. It memorize | stores in RAM (1st memory | storage means) as an eigenvalue.

又、第2事前準備作業(第2段階)では、カメラ30のシャッタ速度を変えてワーク台60、載置板62(第1撮影対象物)とワークW(第2撮影対象物)とを同時に複数回撮影した複数の撮像画像に基づき、ワーク台60に設けられた背景基準計測点R(基準部位)の領域(特定画素領域)の目標背景輝度Vと、ワークW(第2撮影対象物)の輝度との中間値を二値化閾値としてRAM13(第2記憶手段)に記憶する。又、S20(第3段階)では、所定シャッタ時間で、カメラ30によりワーク台60、載置板62(第1撮影対象物)とワークW(第2撮影対象物)とを同時に撮影して得られた撮像画像における背景領域における背景基準計測点Rの現在の輝度p(プレ撮影輝度)を取得する。又、S30(第4段階)では、背景基準計測点Rの現在の輝度p、目標背景輝度V、輝度I、定数m,nを使用して、式(イ)、式(ロ)から得られる式(ハ)に基づいてシャッタ時間Tvを算出する。そして、S40(第5段階)では、S30で算出したシャッタ時間Tvでカメラ30によりワーク台60、載置板62及びワークWを撮像する。S50(第6段階)でS40で取得した撮像画像を二値化閾値で二値化する。 In the second preparatory work (second stage), the work table 60, the mounting plate 62 (first photographing object) and the work W (second photographing object) are simultaneously changed by changing the shutter speed of the camera 30. Based on a plurality of captured images taken a plurality of times, a target background luminance V of a region (specific pixel region) of a background reference measurement point R (reference region) provided on the work table 60 and a workpiece W (second object to be photographed). Is stored in the RAM 13 (second storage means) as a binarization threshold value. In S20 (third stage), the work table 60, the mounting plate 62 (first photographing object) and the work W (second photographing object) are simultaneously photographed by the camera 30 with a predetermined shutter time. The current luminance p (pre-photographing luminance) of the background reference measurement point R in the background region in the captured image obtained is acquired. In S30 (fourth stage), the current luminance p, the target background luminance V, the luminance I 0 , and the constants m and n of the background reference measurement point R are used to obtain the equations (A) and (B). The shutter time Tv is calculated based on the formula (c) given below. In S40 (fifth stage), the work table 60, the mounting plate 62, and the work W are imaged by the camera 30 with the shutter time Tv calculated in S30. In S50 (sixth stage), the captured image acquired in S40 is binarized with a binarization threshold.

この結果、本実施形態では、照明環境が変動しても、背景の輝度が常に規定の輝度に制御された画像を得ることができるとともに、前記画像は背景とワークとのコントラストが高い状態とすることができるので、二値化により背景とワークを安定的に分離できる。   As a result, in the present embodiment, an image in which the background brightness is always controlled to the specified brightness can be obtained even when the illumination environment changes, and the image has a high contrast between the background and the workpiece. Therefore, the background and the work can be stably separated by binarization.

又、露出計により、画面全体の明るさを制御する方法では、全体の明るさは一定になるものの、ワークや背景の輝度はカメラ視野内のワークの割合に依存して変わってしまう問題がある。それに対して、本実施形態によれば、直接背景の輝度を目標背景輝度として固定化しているため、常に同じ結果の二値化画像が得られる。   In addition, the method of controlling the brightness of the entire screen with an exposure meter has a problem that the brightness of the work and the background changes depending on the ratio of the work in the camera field of view, although the overall brightness is constant. . On the other hand, according to the present embodiment, since the background brightness is directly fixed as the target background brightness, a binarized image having the same result is always obtained.

従来、二値化閾値を最適化する方法もあるが、画像がコントラストの低い状態で撮影されてしまうと、ワークと背景をうまく分離できない虞がある。それに対して、本実施形態では、撮像画像自体を二値化に適した高コントラストな画像に最適化しているため、安定してワークと背景とを分離できる。   Conventionally, there is a method of optimizing the binarization threshold. However, if the image is taken with a low contrast, there is a possibility that the work and the background cannot be separated well. On the other hand, in this embodiment, since the captured image itself is optimized to a high-contrast image suitable for binarization, the work and the background can be stably separated.

又、本実施形態では、撮影時には、閉空間を必要としないため、閉空間の設置場所などの制約がなく、又、照度を一定にするための照明条件を維持する必要もないために、照明に係るコストを低減できる。   In the present embodiment, since no closed space is required at the time of shooting, there is no restriction on the installation location of the closed space, and it is not necessary to maintain the illumination conditions for making the illuminance constant. The cost concerning can be reduced.

(2) 本実施形態の二値化処理方法は、第1撮影対象物として、ワークWを載置するワーク台60及び載置板62とし、第2撮影対象物はワークWとしている。この結果、ワークと、ワーク台60及び載置板62とをきれいに分離できる。   (2) In the binarization processing method of the present embodiment, the work table 60 and the mounting plate 62 on which the work W is placed are used as the first photographing object, and the work W is used as the second photographing object. As a result, it is possible to cleanly separate the workpiece from the workpiece table 60 and the mounting plate 62.

(3) 本実施形態の画像処理装置のRAM13は、第1記憶手段として、所定シャッタ時間で得た撮像画像を基に得られた輝度I、定数m,nをカメラ固有値としてに記憶する。画像処理装置のRAM13は、第2記憶手段として、カメラ30のシャッタ速度を変えてワーク台60、載置板62(第1撮影対象物)とワークW(第2撮影対象物)とを同時に複数回撮影した複数の撮像画像に基づき、ワーク台60に設けられた背景基準計測点R(基準部位)の領域(特定画素領域)の目標背景輝度Vと、ワークW(第2撮影対象物)の輝度との中間値を二値化閾値として記憶する。又、画像処理装置のCPU11は、第1取得手段として、所定シャッタ時間で、カメラ30によりワーク台60、載置板62(第1撮影対象物)とワークW(第2撮影対象物)とを同時に撮影して得られた撮像画像における背景領域における背景基準計測点Rの現在の輝度p(プレ撮影輝度)を取得する。画像処理装置のCPU11は、算出手段として、背景基準計測点Rの現在の輝度p、目標背景輝度V、輝度I、定数m,nを使用して、式(イ)、式(ロ)から得られる式(ハ)に基づいてシャッタ時間Tvを算出する。画像処理装置のCPU11は、第2取得手段として、シャッタ時間Tvでカメラ30を撮像させてワーク台60、載置板62(第1撮影対象物)とワークW(第2撮影対象物)との撮像画像を取得するとともに、二値化手段として、取得した撮像画像を中間値(二値化閾値)で二値化する。 (3) The RAM 13 of the image processing apparatus according to the present embodiment stores, as the first storage unit, the luminance I 0 and constants m and n obtained based on the captured image obtained during the predetermined shutter time as camera intrinsic values. The RAM 13 of the image processing apparatus changes the shutter speed of the camera 30 as a second storage unit, and simultaneously uses a plurality of work platforms 60, mounting plates 62 (first imaging objects) and workpieces W (second imaging objects). Based on a plurality of captured images taken twice, the target background luminance V of the region (specific pixel region) of the background reference measurement point R (reference region) provided on the work table 60 and the workpiece W (second object to be photographed). An intermediate value with respect to the luminance is stored as a binarization threshold value. Further, the CPU 11 of the image processing apparatus serves as the first acquisition means by using the camera 30 to move the work table 60, the mounting plate 62 (first photographing object) and the work W (second photographing object) with a predetermined shutter time. The current luminance p (pre-photographing luminance) of the background reference measurement point R in the background region in the captured image obtained by simultaneous imaging is acquired. The CPU 11 of the image processing apparatus uses the current brightness p, the target background brightness V, the brightness I 0 , and the constants m and n of the background reference measurement point R as calculation means, from the formulas (A) and (B). The shutter time Tv is calculated based on the obtained formula (c). As the second acquisition unit, the CPU 11 of the image processing apparatus causes the camera 30 to capture an image with the shutter time Tv, so that the work table 60, the mounting plate 62 (first photographing object), and the work W (second photographing object) are included. A captured image is acquired, and the acquired captured image is binarized with an intermediate value (binarization threshold) as binarization means.

この結果、本実施形態では、上記(1)の作用効果を奏する画像処理装置を提供できる。
(4) 本実施形態の画像処理装置は、第1撮影対象物として、ワークWを載置するワーク台60及び載置板62とし、第2撮影対象物はワークWとしている。この結果、ワークと、ワーク台60及び載置板62とをきれいに分離できる画像処理装置を提供できる。
As a result, in the present embodiment, an image processing apparatus that exhibits the effect (1) can be provided.
(4) The image processing apparatus of the present embodiment uses the work table 60 and the placement plate 62 on which the work W is placed as the first photographing object, and the work W as the second photographing object. As a result, it is possible to provide an image processing apparatus that can cleanly separate the work from the work table 60 and the mounting plate 62.

なお、本発明の実施形態は前記実施形態に限定されるものではなく、下記のように変更しても良い。
・ 前記実施形態では、第1記憶手段及び第2記憶手段は、共通のRAM13としたが、第1記憶手段及び第2記憶手段は異なる記憶手段としてもよい。例えば第1記憶手段をRAM13として、第2記憶手段を図示しないハードディスク等の記憶装置としてもよい。
In addition, embodiment of this invention is not limited to the said embodiment, You may change as follows.
In the embodiment, the first storage unit and the second storage unit are the common RAM 13, but the first storage unit and the second storage unit may be different storage units. For example, the first storage means may be the RAM 13 and the second storage means may be a storage device such as a hard disk (not shown).

・ 前記実施形態では、カメラ30はモノクロビデオカメラとしたが、カラービデオカメラに変更してもよい。
・ 前記実施形態において載置板62を省略し、ワークWを直接ワーク台60上に載置するようにしてもよい。この場合、第1撮影対象物は、ワーク台のみとなる。
In the embodiment, the camera 30 is a monochrome video camera, but may be changed to a color video camera.
In the embodiment, the mounting plate 62 may be omitted, and the work W may be directly mounted on the work table 60. In this case, the first object to be photographed is only the work table.

・ 前記実施形態では、第1撮影対象物として、ワークWを載置するワーク台60及び載置板62とし、第2撮影対象物はワークWとしたが、これに限定するものではない。カメラの撮像範囲内に、複数の撮像対象物がある場合に、その1つを第1撮影対象物とし、残りの1つ又は複数の撮像対象物を第2撮影対象物とするようにしてもよい。この場合、第2撮影対象物は、第1撮影対象物とは異なる色(明度)を有するようにする。例えば、第1撮影対象物が明るい色(明度)を有するものであれば、第2撮影対象物は暗い色(明度)を有するものとする。   In the embodiment described above, the work table 60 and the placement plate 62 on which the work W is placed are used as the first object to be photographed, and the work W is used as the second object to be photographed. However, the present invention is not limited to this. When there are a plurality of imaging objects within the imaging range of the camera, one of them is set as a first imaging object, and the remaining one or a plurality of imaging objects are set as second imaging objects. Good. In this case, the second photographing object has a color (lightness) different from that of the first photographing object. For example, if the first object to be photographed has a bright color (lightness), the second object to be photographed has a dark color (lightness).

10…画像処理装置、
11…CPU(算出手段、第1取得手段、第2取得手段及び二値化手段)、
13…RAM(第1記憶手段、第2記憶手段)、
30…カメラ、60…ワーク台(第1撮影対象物)、
62…載置板(第1撮影対象物)、W…ワーク(第2撮影対象物)。
10 Image processing device,
11 ... CPU (calculation means, first acquisition means, second acquisition means and binarization means),
13 ... RAM (first storage means, second storage means),
30 ... Camera, 60 ... Work table (first object to be photographed),
62... Placement plate (first photographing object), W... Work (second photographing object).

Claims (4)

所定シャッタ時間で撮影されたカメラの撮像画像における輝度をpとし、任意のシャッタ時間Tvのときの輝度をVとしたとき、下記式(イ)、式(ロ)が成立することを利用して、
V=A・Tv+I ……(イ)、A=m・p+n ……(ロ)
(なお、Iは、カメラの撮像画像における暗電流時の輝度、Aは係数であり、m,nは前記所定シャッタ時間において定まる定数である。)
前記所定シャッタ時間で得た撮像画像を基に得られた輝度I、定数m,nをカメラ固有値として第1記憶手段に記憶する第1段階と、前記カメラのシャッタ速度を変えて第1撮影対象物と第2撮影対象物とを同時に複数回撮影した複数の撮像画像に基づき、第1撮影対象物に設けられた基準部位の特定画素領域の目標背景輝度と、第2撮影対象物の輝度との中間値を二値化閾値として第2記憶手段に記憶する第2段階と、前記所定シャッタ時間で、前記カメラにより第1撮影対象物と第2撮影対象物とを同時に撮影して得られた撮像画像における基準部位の特定画素領域のプレ撮影輝度を取得する第3段階と、前記プレ撮影輝度を前記pとし、前記目標背景輝度を前記Vとし、かつ、輝度I、定数m,nを使用して、式(イ)、式(ロ)に基づいてシャッタ時間Tvを算出する第4段階と、第4段階で算出したシャッタ時間Tvで前記カメラで第1撮影対象物と第2撮影対象物とを撮像する第5段階と、第5段階で取得した撮像画像を前記二値化閾値で二値化する第6段階を含む二値化処理方法。
Using the fact that the following formulas (A) and (B) are established, where p is the luminance in the captured image of the camera photographed at the predetermined shutter time and V is the luminance at the arbitrary shutter time Tv: ,
V = A · Tv + I 0 (b), A = m · p + n (b)
(I 0 is the luminance at the time of dark current in the captured image of the camera, A is a coefficient, and m and n are constants determined in the predetermined shutter time.)
A first stage in which the luminance I 0 and constants m and n obtained based on the captured image obtained at the predetermined shutter time are stored in the first storage means as camera intrinsic values, and the first photographing is performed by changing the shutter speed of the camera. Based on a plurality of captured images obtained by simultaneously capturing the object and the second object to be imaged a plurality of times, the target background luminance of the specific pixel region of the reference portion provided on the first object to be imaged and the luminance of the second object to be imaged Obtained by simultaneously photographing the first photographing object and the second photographing object with the camera during the second stage in which the intermediate value is stored in the second storage means as the binarization threshold value and the predetermined shutter time. A third stage of acquiring a pre-photographed luminance of a specific pixel region of a reference part in the captured image, the pre-photographed luminance as p, the target background luminance as V, and a luminance I 0 , constants m, n Using the expression (A), expression (B ) Based on (4), a fifth stage in which the camera captures the first and second shooting objects with the shutter time Tv calculated in the fourth stage, and a fifth stage. A binarization processing method including a sixth step of binarizing the captured image acquired in the step with the binarization threshold.
前記第1撮影対象物は、ワークを載置するワーク台であり、前記第2撮影対象物は前記ワークであることを特徴とする請求項1に記載の二値化処理方法。   The binarization processing method according to claim 1, wherein the first object to be photographed is a work table on which a work is placed, and the second object to be photographed is the work. 所定シャッタ時間で撮影されたカメラの撮像画像における輝度をpとし、任意のシャッタ時間Tvのときの輝度をVとしたとき、下記式(イ)、式(ロ)が成立することを利用して、
V=A・Tv+I ……(イ)、A=m・p+n ……(ロ)
(なお、Iは、カメラの撮像画像における暗電流時の輝度、Aは係数であり、m,nは前記所定シャッタ時間において定まる定数である。)
前記所定シャッタ時間で得た撮像画像を基に得られた輝度I、定数m,nをカメラ固有値として記憶する第1記憶手段と、前記カメラのシャッタ速度が変えられて第1撮影対象物と第2撮影対象物とを同時に複数回撮影された複数の撮像画像に基づいて得られた基準部位の特定画素領域の目標背景輝度と、第2撮影対象物の輝度との中間値を二値化閾値として記憶する第2記憶手段と、前記所定シャッタ時間で、前記カメラにより前記第1撮影対象物と第2撮影対象物とを同時に撮影して得られた撮像画像における前記基準部位の特定画素領域のプレ撮影輝度を取得する第1取得手段と、前記プレ撮影輝度を前記pとし、前記目標背景輝度を前記Vとして、式(イ)、式(ロ)に基づいてシャッタ時間Tvを算出する算出手段と、前記シャッタ時間Tvで前記カメラを撮像させて第1撮影対象物と第2撮影対象物との撮像画像を取得する第2取得手段と、前記第2取得手段が取得した撮像画像を前記二値化閾値で二値化する二値化手段を含む画像処理装置。
Using the fact that the following formulas (A) and (B) are established, where p is the luminance in the captured image of the camera photographed at the predetermined shutter time and V is the luminance at the arbitrary shutter time Tv: ,
V = A · Tv + I 0 (b), A = m · p + n (b)
(I 0 is the luminance at the time of dark current in the captured image of the camera, A is a coefficient, and m and n are constants determined in the predetermined shutter time.)
First storage means for storing the luminance I 0 and constants m and n obtained based on the captured image obtained at the predetermined shutter time as camera intrinsic values, and the first photographing object by changing the shutter speed of the camera. Binarizes an intermediate value between the target background luminance of the specific pixel region of the reference region obtained based on a plurality of captured images obtained by photographing the second imaging object at the same time a plurality of times and the luminance of the second imaging object. A second pixel means for storing as a threshold value, and a specific pixel region of the reference part in a captured image obtained by simultaneously photographing the first photographing object and the second photographing object with the camera at the predetermined shutter time. The first acquisition means for acquiring the pre-photographing luminance, and the pre-photographing luminance as p, the target background luminance as V, and the calculation for calculating the shutter time Tv based on the equations (A) and (B) Means, and A second acquisition unit configured to acquire the captured image of the first and second imaging objects by capturing the camera at a time Tv; and the binarized image captured by the second acquisition unit An image processing apparatus including binarization means for binarizing with a threshold value.
前記第1撮影対象物は、ワークを載置するワーク台であり、前記第2撮影対象物は前記ワークであることを特徴とする請求項3に記載の画像処理装置。   The image processing apparatus according to claim 3, wherein the first photographing object is a work table on which a work is placed, and the second photographing object is the work.
JP2010204643A 2010-09-13 2010-09-13 Binarization processing method and image processing apparatus Active JP5609459B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010204643A JP5609459B2 (en) 2010-09-13 2010-09-13 Binarization processing method and image processing apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010204643A JP5609459B2 (en) 2010-09-13 2010-09-13 Binarization processing method and image processing apparatus

Publications (2)

Publication Number Publication Date
JP2012059213A true JP2012059213A (en) 2012-03-22
JP5609459B2 JP5609459B2 (en) 2014-10-22

Family

ID=46056194

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010204643A Active JP5609459B2 (en) 2010-09-13 2010-09-13 Binarization processing method and image processing apparatus

Country Status (1)

Country Link
JP (1) JP5609459B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014006852A (en) * 2012-06-27 2014-01-16 Seiko Epson Corp Recognition processing method, recognition processing device, robot system and recognition processing program
KR20190118817A (en) * 2018-04-11 2019-10-21 한국전자통신연구원 Automatic teaching apparatus and method of machine vision inspection apparatus
CN114529925A (en) * 2022-04-22 2022-05-24 华南理工大学 Method for identifying table structure of whole line table

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6461872A (en) * 1987-09-01 1989-03-08 Omron Tateisi Electronics Co Visual recognizer
JP2003065968A (en) * 2001-08-29 2003-03-05 Matsushita Electric Ind Co Ltd Method for inspecting break and apparatus therefor
JP2003125285A (en) * 2001-10-17 2003-04-25 Matsushita Electric Ind Co Ltd Image feedforward control method for camera and portable terminal with camera employing the method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6461872A (en) * 1987-09-01 1989-03-08 Omron Tateisi Electronics Co Visual recognizer
JP2003065968A (en) * 2001-08-29 2003-03-05 Matsushita Electric Ind Co Ltd Method for inspecting break and apparatus therefor
JP2003125285A (en) * 2001-10-17 2003-04-25 Matsushita Electric Ind Co Ltd Image feedforward control method for camera and portable terminal with camera employing the method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2014006852A (en) * 2012-06-27 2014-01-16 Seiko Epson Corp Recognition processing method, recognition processing device, robot system and recognition processing program
KR20190118817A (en) * 2018-04-11 2019-10-21 한국전자통신연구원 Automatic teaching apparatus and method of machine vision inspection apparatus
KR102177638B1 (en) * 2018-04-11 2020-11-12 한국전자통신연구원 Automatic teaching apparatus and method of machine vision inspection apparatus
CN114529925A (en) * 2022-04-22 2022-05-24 华南理工大学 Method for identifying table structure of whole line table
CN114529925B (en) * 2022-04-22 2022-07-15 华南理工大学 Method for identifying table structure of whole line table

Also Published As

Publication number Publication date
JP5609459B2 (en) 2014-10-22

Similar Documents

Publication Publication Date Title
EP3308537B1 (en) Calibration of defective image sensor elements
JP5445363B2 (en) Image processing apparatus, image processing method, and image processing program
WO2010031252A1 (en) Method for correcting lightness of electrical display screen
KR20150109177A (en) Photographing apparatus, method for controlling the same, and computer-readable recording medium
JP2009177472A (en) Image processing method, image processor and imaging device
JP2003198891A (en) Image display controller, image display control method, and imaging apparatus
US20120127336A1 (en) Imaging apparatus, imaging method and computer program
US8223258B2 (en) Backlight photographing method
US7580076B2 (en) Devices and methods for calculating pixel values representative of a scene
US8243165B2 (en) Video camera with flicker prevention
JP5609459B2 (en) Binarization processing method and image processing apparatus
US20220021800A1 (en) Image capturing apparatus, method of controlling image capturing apparatus, and storage medium
JP2010177917A (en) White balance adjusting device, white balance adjusting method, and white balance adjusting program
JP2018059903A (en) Exterior appearance inspection device, and optical system automatic calibration method of the same
JP2008180602A (en) Inspection apparatus, testing method, inspection program, and computer readable medium
US20100013954A1 (en) Video camera
JP2011101158A (en) Imaging apparatus
KR20010037684A (en) Apparatus for correlating of exposure automatically of a digital still camera and method for performing the same
JP5675391B2 (en) Image processing device
JP2022160498A (en) Projection controller, projector, projection control method, and program
US8154618B2 (en) Imaging apparatus and method for setting the same
JP7442989B2 (en) Imaging device, control method for the imaging device, and program
CN108668124B (en) Photosensitive chip testing method and device based on charge calculation
JP2009141613A (en) In-plane uniformity evaluating apparatus and method
KR101710627B1 (en) Photographing apparatus and photographing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20121217

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20140114

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20140121

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140319

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

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140818

R150 Certificate of patent or registration of utility model

Ref document number: 5609459

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250