JP5769559B2 - Image processing apparatus, image processing program, robot apparatus, and image processing method - Google Patents
Image processing apparatus, image processing program, robot apparatus, and image processing method Download PDFInfo
- Publication number
- JP5769559B2 JP5769559B2 JP2011195285A JP2011195285A JP5769559B2 JP 5769559 B2 JP5769559 B2 JP 5769559B2 JP 2011195285 A JP2011195285 A JP 2011195285A JP 2011195285 A JP2011195285 A JP 2011195285A JP 5769559 B2 JP5769559 B2 JP 5769559B2
- Authority
- JP
- Japan
- Prior art keywords
- edge
- image processing
- detection target
- image
- feature
- 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.)
- Expired - Fee Related
Links
Images
Description
本発明は、画像処理によってエッジを検出するための画像処理装置、画像処理プログラム、ロボット装置及び画像処理方法に関するものである。 The present invention relates to an image processing apparatus, an image processing program, a robot apparatus, and an image processing method for detecting an edge by image processing.
画像処理の分野において、画像から物体の端面等を知るための方法としてエッジ抽出がよく知られている。エッジを抽出する方法(画像処理方法)としては、ソーベルフィルタやラプラシアンフィルタ等が一般的に知られている。この手法として、以下のエッジ抽出装置を用いる画像処理方法が知られている。なお、エッジとは、濃淡画像内で輝度(画素値)が急激に変化している部分を意味する。 In the field of image processing, edge extraction is well known as a method for knowing an end face of an object from an image. As a method for extracting an edge (image processing method), a Sobel filter, a Laplacian filter, or the like is generally known. As this technique, an image processing method using the following edge extraction apparatus is known. Note that the edge means a portion where the luminance (pixel value) changes rapidly in the grayscale image.
このエッジ抽出装置(画像処理装置)は、画像からエッジ強度を算出してエッジ検出を行うエッジ検出部と、エッジ検出部が検出したエッジをラベリング処理し、かつエッジの長さを求めるラベリング処理部とを備えている。さらに、エッジ抽出装置は、ラベリング処理部が求めたエッジの長さとエッジ検出部が算出したエッジ強度とを対応付けた値によってエッジの強調処理を行うエッジ強調処理部を備えている。そして、エッジ抽出装置は、エッジ強調処理部によって強調された画像の値に対して、調整可能とされる閾値(しきい値)により2値化処理を施し、所定のエッジを抽出するエッジ抽出部を備えている(特許文献1参照)。 The edge extraction device (image processing device) includes an edge detection unit that calculates edge strength from an image and detects an edge, and a labeling processing unit that performs a labeling process on the edge detected by the edge detection unit and calculates an edge length And. Further, the edge extraction apparatus includes an edge enhancement processing unit that performs edge enhancement processing using a value in which the edge length obtained by the labeling processing unit is associated with the edge strength calculated by the edge detection unit. Then, the edge extraction device performs binarization processing on the value of the image emphasized by the edge enhancement processing unit using a threshold value (threshold value) that can be adjusted, and extracts a predetermined edge. (See Patent Document 1).
即ち、特許文献1に記載のエッジ検出装置では、エッジを検出する際にエッジの強度(濃淡変化の急峻さ)と長さとを基準にして、エッジ強度が弱く且つ短いエッジに関してはノイズエッジと判断することで、細かいノイズエッジを除去する。
That is, in the edge detection device described in
また、エッジ抽出システムを用いた別の画像処理方法が知られている。このエッジ抽出システムは、画像を入力する画像入力手段と、画像入力手段から出力される入力画像から画像のエッジを抽出するエッジ抽出手段と、エッジ抽出手段で抽出されたエッジ抽出画像を取り込むエッジ抽出画像出力手段とを備えている。エッジ抽出手段は、画像入力手段から出力される入力画像の中から切り出した領域のデータを入力データとし該領域の特定画素がエッジか否かを示すデータを教師データとして画像のエッジ抽出処理を学習するエッジ抽出学習部を備えている。さらに、エッジ抽出学習部で学習した学習結果に基づいて、画像入力手段から出力される入力画像から画像のエッジを抽出するエッジ抽出部を備えている(特許文献2参照)。 Another image processing method using an edge extraction system is known. The edge extraction system includes an image input unit that inputs an image, an edge extraction unit that extracts an edge of an image from an input image output from the image input unit, and an edge extraction that captures an edge extraction image extracted by the edge extraction unit Image output means. The edge extraction means learns the edge extraction processing of the image using the data of the area cut out from the input image output from the image input means as the input data and the data indicating whether or not the specific pixel of the area is an edge. An edge extraction learning unit is provided. Furthermore, an edge extraction unit that extracts an edge of an image from an input image output from the image input unit based on a learning result learned by the edge extraction learning unit is provided (see Patent Document 2).
即ち、特許文献2に記載のエッジ抽出システムでは、図15(a)に示すように、入力画像の比較対象となる、ワークの参照画像33から領域を設定する。さらに、検出対象となるエッジを含む検出対象領域34のデータと、検出対象となるエッジを含まない非検出対象の非検出対象領域35のデータとを予め記憶しておく。検出対象領域34には、検出対象が真である(例えば1)と関連付け、非検出対象領域35には、検出対象が否(例えば0)と関連付けることにより、予め検出領域を学習させておく。
That is, in the edge extraction system described in
そして、図15(b)に示すように、参照画像33とは別に撮像したワークの入力画像36に対して領域を走査していき、学習結果より、入力画像36における領域37は非検出領域であり、入力画像36における領域38は検出対象領域であると判断する。つまり、参照画像33の中から切り出した領域データの特定画素がエッジか否かを示すデータを教師データとして、画像のエッジ抽出処理を学習することにより、図15(c)に示すように任意のエッジを検出する。
Then, as shown in FIG. 15B, the area is scanned with respect to the
図16(a)の画像に対し、従来の一般的なエッジ抽出を行った結果を以下に示す。つまり、図16(a)の画像に対して行う一般的なエッジ抽出のみでは、図16(b)に示すように背景や物体の傷、照明の輝度ムラ等が原因でノイズが多く出るため、このことが、エッジを使用した位置計測を行う場合などには誤差の要因になる。 The result of performing conventional general edge extraction on the image of FIG. 16A is shown below. That is, since only the general edge extraction performed on the image of FIG. 16A causes a lot of noise due to background and object scratches, uneven brightness of illumination, and the like as shown in FIG. This causes an error when performing position measurement using edges.
ここで、上記特許文献1記載のエッジ検出装置を用いた画像処理方法によると、図16(b)に示すような細かいノイズエッジを除去することは可能である。しかし、図16(c)に示すような二重円形部分を有する画像に対してエッジ抽出した場合には、図16(d)に示すように、円環部の内径と外径とでエッジが夫々に抽出される。なお、図16(d)における符号31は、検出したい検出対象エッジである内径のエッジを示し、符号32は、検出対象ではない非検出対象エッジである外径のエッジを示す。
Here, according to the image processing method using the edge detection apparatus described in
このような画像の場合、内径にも外径にも同様に、強度が強く且つ長いエッジが取れるため、任意の内径エッジのみを検出することは困難である。非検出対象エッジが検出対象エッジに対して形状の相違を持つのであれば、両者を形状の特徴に基づいて分離することは容易である。しかし、非検出対象エッジと検出対象エッジとが類似の形状を示すような場合は、特に検出対象エッジのみを検出することは困難となる。つまり図16(d)に示すように、検出対象エッジ31及び非検出対象エッジ32の双方がともに円形の一部を示すような形状であるため、形状特徴による分離が難しい。
In the case of such an image, both the inner diameter and the outer diameter are similarly strong and have long edges, so that it is difficult to detect only an arbitrary inner diameter edge. If the non-detection target edge has a shape difference with respect to the detection target edge, it is easy to separate the two based on the shape characteristics. However, when the non-detection target edge and the detection target edge show similar shapes, it is particularly difficult to detect only the detection target edge. That is, as shown in FIG. 16D, since both the
また、上記特許文献2記載のエッジ抽出システムを用いた画像処理方法によると、図16(c)に示すような画像に対しても、予め参照画像に基づいて検出対象のエッジか否かを学習することで、検出対象エッジ31のみを検出することは可能である。しかし、この画像処理方法では、カメラの撮像に用いられる照明装置が劣化するなどで照明条件に変化が生じた場合には、入力画像の輝度変動が大きくなる。そして、予め学習しておいたエッジか否かを示す教師データと入力画像のエッジ領域データとで、輝度変動による差異が生じる。そのため、検出対象エッジ31の検出が不安定になるという不都合を生じる。
Further, according to the image processing method using the edge extraction system described in
本発明は、検出対象エッジに対して類似形状の非検出対象エッジを持つような状況下で照明の変化が起こっても、検出対象エッジのみを安定して検出することが可能な画像処理装置、画像処理プログラム、ロボット装置及び画像処理方法を提供することを目的とする。 The present invention relates to an image processing apparatus capable of stably detecting only a detection target edge even when a change in illumination occurs in a situation where the detection target edge has a non-detection target edge having a similar shape to the detection target edge, An object is to provide an image processing program, a robot apparatus, and an image processing method.
本発明は、予めワークを撮像した参照画像上の複数のエッジのそれぞれについて算出された、エッジに対して一定の位置関係にあるサンプリング領域の輝度値からなる特徴量の大小関係を記憶する記憶部と、取得した入力画像上のワークのエッジを抽出するエッジ抽出部と、前記エッジ抽出部によって抽出された各エッジについて前記特徴量を算出する特徴量算出部と、算出された前記入力画像上の各エッジの特徴量から輝度値及び頻度の度数分布を示すヒストグラムを作成し、このヒストグラムの分布状態に基づいて求められた閾値により区分される特徴量の範囲により、前記エッジ抽出工程にて抽出されたエッジを区分するエッジ区分部と、前記閾値によって区分された特徴量の範囲の大小関係と前記記憶部に記憶された特徴量の大小関係とを比較して、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと前記参照画像上でのエッジとを対応付けるエッジ関係設定部と、を備えたことを特徴とする画像処理装置にある。 The present invention stores a magnitude relationship of feature amounts composed of luminance values of a sampling area having a fixed positional relationship with respect to an edge, calculated for each of a plurality of edges on a reference image obtained by imaging a workpiece in advance. An edge extraction unit that extracts an edge of a workpiece on the acquired input image, a feature amount calculation unit that calculates the feature amount for each edge extracted by the edge extraction unit, and a calculated on the input image A histogram showing the frequency distribution of luminance values and frequencies is created from the feature values of each edge, and extracted by the edge extraction step based on the feature value range divided by the threshold value obtained based on the distribution state of the histogram. An edge classifying unit that classifies the detected edge, a magnitude relationship between the range of the feature quantity segmented by the threshold value, and a magnitude relation of the feature quantity stored in the storage unit And an edge relationship setting unit that associates an edge on the input image within the range of the corresponding feature quantity with an edge on the reference image, and an image processing comprising: In the device.
本発明は、コンピュータを、前記画像処理装置として機能させることを特徴とする画像処理プログラムにある。 The present invention resides in an image processing program that causes a computer to function as the image processing apparatus.
本発明は、ワークを照らす照明装置と、前記照明装置に照らされたワークを撮像するカメラと、前記画像処理装置と、前記カメラが撮像した入力画像に基づいて前記画像処理装置が算出した位置情報に基づいて、ワークに対して所定の処理を施す作動アームと、を備えたことを特徴とするロボット装置にある。 The present invention relates to an illumination device that illuminates a workpiece, a camera that captures a workpiece illuminated by the illumination device, the image processing device, and positional information calculated by the image processing device based on an input image captured by the camera. And a working arm that performs a predetermined process on the workpiece.
本発明は、画像処理装置が、予めワークを撮像した参照画像上の複数のエッジのそれぞれについて算出された、エッジに対して一定の位置関係にあるサンプリング領域の輝度値からなる特徴量の大小関係を記憶する記憶工程と、前記画像処理装置が、取得した入力画像上のワークのエッジを抽出するエッジ抽出工程と、前記画像処理装置が、前記エッジ抽出工程にて抽出された各エッジについて前記特徴量を算出する特徴量算出工程と、前記画像処理装置が、算出された前記入力画像上の各エッジの特徴量から輝度値及び頻度の度数分布を示すヒストグラムを作成し、このヒストグラムの分布状態に基づいて求められた閾値により区分される特徴量の範囲により、前記エッジ抽出部によって抽出されたエッジを区分するエッジ区分工程と、前記画像処理装置が、前記閾値によって区分された特徴量の範囲の大小関係と前記記憶工程にて記憶された特徴量の大小関係とを比較して、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと前記参照画像上でのエッジとを対応付けるエッジ関係設定工程と、を備えたことを特徴とする画像処理方法にある。 According to the present invention, the magnitude relationship of the feature amount including the luminance value of the sampling area having a fixed positional relationship with respect to the edge, which is calculated for each of the plurality of edges on the reference image obtained by capturing an image of the workpiece in advance by the image processing apparatus. A storage step for storing the image, an edge extraction step in which the image processing device extracts an edge of a work on the acquired input image, and the image processing device performs the feature for each edge extracted in the edge extraction step. A feature amount calculating step for calculating the amount, and the image processing apparatus creates a histogram indicating the frequency distribution of the luminance value and the frequency from the calculated feature amount of each edge on the input image. An edge segmentation step for segmenting the edge extracted by the edge extraction unit according to a range of feature quantities segmented by the threshold value obtained based on the threshold value; The image processing apparatus compares the size relationship between the feature amount ranges classified by the threshold and the feature relationship stored in the storing step, and determines whether the feature amount range is in the corresponding feature amount range. An image processing method comprising an edge relationship setting step for associating an edge on an input image with an edge on the reference image.
本発明によれば、閾値によって区分された特徴量の範囲の大小関係と、記憶部に記憶された特徴量の大小関係とを比較して、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと、参照画像上でのエッジとを対応付けることができる。そのため、検出対象エッジに対して類似形状の非検出対象エッジを持つような状況下で照明の変化が起こった場合であっても、検出対象のエッジのみを安定して検出することが可能になる。 According to the present invention, the magnitude relationship between the ranges of the feature quantities classified by the threshold value is compared with the magnitude relation of the feature quantities stored in the storage unit, and the input within the corresponding feature quantity range is compared. An edge on the image can be associated with an edge on the reference image. Therefore, even when a change in illumination occurs in a situation where the detection target edge has a non-detection target edge having a similar shape, it is possible to stably detect only the detection target edge. .
以下、図面に沿って、本発明に係る実施形態について説明する。まず、図1(a),(b)を参照して、本発明に係る画像処理装置及びこの画像処理装置を備えるロボット装置について説明するが、本発明に係る画像処理方法については、画像処理装置及びロボット装置の説明を通して説明されるものとする。なお、図1(a)は画像処理装置を備えるロボット装置100におけるカメラ1及び画像処理部2を用いて載置部4上の検出対象ワーク3からエッジを検出する際の概略構成図であり、図1(b)はロボット装置100の全体を示す斜視図である。
Hereinafter, embodiments according to the present invention will be described with reference to the drawings. First, an image processing apparatus according to the present invention and a robot apparatus including the image processing apparatus will be described with reference to FIGS. 1A and 1B. The image processing method according to the present invention is described below. And the explanation of the robot apparatus. FIG. 1A is a schematic configuration diagram when an edge is detected from the
図1(a),(b)に示すように、ロボット装置100は、検出対象ワーク(ワーク)3を照らす照明装置105と、照明装置105に照らされた検出対象ワーク3を撮像するカメラ1とを備えている。更に、ロボット装置100は、コンピュータ19により構成される画像処理装置と、カメラ1が撮像した入力画像に基づいて画像処理装置が算出した位置情報に基づいて、検出対象ワーク3に対して所定の処理を施す作動アーム102とを備えている。
As shown in FIGS. 1A and 1B, the
即ち、ロボット装置100は、複数の枠部材104によって形成されたブース103と、ブース103の下部中央に配置された架台101とを備えている。さらに、架台101上部に配置された作動アーム102と、作動アーム102に対向する位置に配置された状態で検出対象ワーク3を載置する載置部4とを備えている。架台101内には、画像処理部2等を有するコンピュータ19が配設されている。ブース103における作動アーム102の上方には、撮像手段としてのカメラ1と、このカメラ1の両隣りに配置された照明装置105とが配設されている。作動アーム102は、多関節シリアルリンクロボットから成り、その各関節は、コンピュータ19に基づくモータ駆動によりアーム先端部102aの位置及び姿勢が制御される。
In other words, the
カメラ1は、不図示のレンズにより光像を形成し、不図示の撮像素子により光像を撮像信号に変換し、この撮像信号を、エッジの検出対象である入力画像として画像処理部2に提供する撮像手段を構成している。
The
図1(a)に示すように、アーム先端部102aに取り付けられたハンド部102bは、検出対象ワーク(ワーク)3を把持及び解放し得るように構成されている。ハンド部102bは、把持した検出対象ワーク3の位置・姿勢を修正するのに十分な範囲においての、手首に相当する関節での回転機構や多関節指機構等の制御機構を備えている。このようなハンド部102bを有する作動アーム102の駆動制御は、カメラ1からの撮像データに基づく画像処理部2、及びこの画像処理部2からのデータを用いるコンピュータ19によって実現される。
As shown in FIG. 1A, the
図2に示すように、コンピュータ19のコンピュータ本体19aには、CPU5を主体として機能する画像処理部2等が収納されている。CPU5には、画像処理部2の他に、RAM29及びROM30等がバス7を介して接続されている。RAM29には、CPU5に対する作業領域が確保される。ROM30には、コンピュータ19の基本制御に必要なプログラムが格納されている。画像処理部2は、後述する画像処理機能の他、CPU5からの描画指示に応じて液晶等のディスプレイ40を制御して所定の画像を表示させる機能を備える。コンピュータ19における上記ROM30には、コンピュータ19を画像処理装置として機能させるための画像処理プログラムが格納されている。
As shown in FIG. 2, a computer
CPU5には、バス7に接続された入力インターフェース(インターフェイス)41を介して、入力装置としてのキーボード42及びマウス43が接続されており、エッジ検出等に必要な指定情報、メニュー選択指示、あるいはその他の指示の入力を可能としている。また、CPU5には、バス7に接続された入力インターフェース47を介して、カメラ1が接続されている。そして、バス7には、記録ディスク読取装置44が接続されており、種々の情報を記録した記録媒体45を読み込み、例えばROM30に格納できるようになっている。また、バス7には、通信装置46が接続されており、上述のような記録媒体45を使用せずに、通信装置46を介してインターネット等から配信される種々の情報をダウンロード可能に構成されている。
A
ここで、図3を参照して、コンピュータ19内の画像処理部2の詳細について説明する。即ち、図3に示すように、画像処理部2は、特徴量相対関係記憶部8、入力画像記憶部9、エッジ画像記憶部10、エッジ特徴量記憶部51、特徴量ヒストグラム記憶部11、及びエッジ‐特徴量対応記憶部12を有している。エッジ‐特徴量対応記憶部12は、選択部12aと位置算出部12bとを有している。
Here, the details of the
このような画像処理部2では、カメラ1から提供された入力画像が入力画像記憶部9に記憶され、またCPU5は、バス7を介して各記憶部8〜12,51に適時アクセスして各処理を実行する。
In such an
CPU5及び特徴量相対関係記憶部8により、記憶部が構成されている。記憶部は、予め検出対象ワーク3を撮像した参照画像上の複数のエッジ(14,15)の夫々について算出された、エッジに対して一定の位置関係にあるサンプリング領域20〜22(図5参照)の輝度値kからなる特徴量K,N1,N2の大小関係を記憶する。
The
即ち、特徴量相対関係記憶部8は、CPU5の指示に従って、参照画像13から、検出対象の検出対象エッジ14と検出対象以外の非検出対象エッジ15とに対し一定の位置関係にあるサンプリング領域20,21,22の輝度値kを算出する。そして、後述の特徴量算出部で算出された特徴量K、特徴量N1,N2として記憶する。その際、検出対象エッジ14の特徴量Kと非検出対象エッジ15の特徴量N1,N2との大小関係を記憶する。つまり、特徴量相対関係記憶部8は、CPU5の指示に従って、照明状態で撮像された検出対象ワーク3の参照画像13から、上記エッジ14,15に対して一定の位置関係にあるサンプリング領域20〜22毎の平均輝度値(k)をそれぞれ算出する。そして、検出対象エッジ14に対応する特徴量Kと非検出対象エッジ15に対応する特徴量N1,N2として設定すると共に、それら特徴量K,N1,N2の大小関係を記憶する。特徴量相対関係記憶部8は、大小関係を、例えば後述の大小関係フラグ(flag)の「1」「2」「3」として記憶する。
In other words, the feature amount relative
入力画像記憶部9は、CPU5の指示に従って、カメラ1から提供された入力画像を記憶する。CPU5は、カメラ1から提供された入力画像から、検出対象の画像の比較対象となるワーク画像である参照画像13(図4参照)を作成して、入力画像記憶部9に記憶させる。
The input
CPU5及びエッジ画像記憶部10により、取得した入力画像上の検出対象ワーク3のエッジを抽出するエッジ抽出部が構成されている。即ち、エッジ画像記憶部10は、CPU5の指示に従って、検出対象画像や参照画像からエッジを検出してその画像を記憶する。
The
CPU5及びエッジ特徴量記憶部51により、上記エッジ抽出部(5,10)によって抽出された各エッジについて特徴量K、特徴量N1,N2を算出する特徴量算出部が構成されている。即ち、エッジ特徴量記憶部51は、CPU5の指示に従って、抽出された各エッジにおける特徴量K、特徴量N1,N2を算出する。
The
CPU5及び特徴量ヒストグラム記憶部11により、エッジ区分部が構成されている。エッジ区分部は、算出された入力画像上の各エッジの特徴量から輝度値及び頻度の度数分布を示す特徴量ヒストグラムを作成し、このヒストグラムの分布状態に基づき求められた閾値で区分される特徴量の範囲により、エッジ抽出部にて抽出されたエッジを区分する。
The
即ち、特徴量ヒストグラム記憶部11は、上記特徴量算出部(5,51)によって得られたエッジの特徴量K,N1,N2に基づき、CPU5の指示に従って特徴量ヒストグラムを作成する。そして、このヒストグラムから閾値を決定(設定)して記憶すると共に、この閾値により区分される特徴量の範囲により、上記エッジ抽出部で抽出されたエッジを区分する。
That is, the feature amount
CPU5及びエッジ‐特徴量対応記憶部12により、エッジ関係設定部が構成されている。エッジ関係設定部は、上記閾値によって区分された特徴量の範囲の大小関係と、上記記憶部(5,8)に記憶された特徴量K,N1,N2の大小関係(特徴相対関係)とを比較する。そして、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと、参照画像13上でのエッジ(14,15)とを対応付ける。
The
即ち、エッジ‐特徴量対応記憶部12は、CPU5の指示に従って、エッジ‐特徴量の対応表(図8(b)参照)を記憶し、検出対象エッジ14の特徴量範囲と非検出対象エッジ15の特徴量範囲とを分離し区別する。そして、検出対象エッジ14の特徴量範囲内の特徴量を持つエッジを検出対象のエッジとして選択する。つまり、エッジ‐特徴量対応記憶部12は、今回検出するべき検出対象ワーク3の検出対象エッジ14の特徴量Kの範囲を決定する。
That is, the edge-feature amount
上記選択部12aは、上記エッジ関係設定部(5,12)によって設定されたエッジの対応関係に基づいて、検出対象の検出対象エッジ14を入力画像上にて選択する。また、上記位置算出部12bは、選択部12aによって選択されたエッジから検出対象ワーク3の位置情報を算出する。
The
以下、図13及び図14を参照して、本実施形態の詳細について説明する。図13は、本実施の形態におけるメインフローを示すフローチャートであり、図14は、ステップS2のエッジ特徴量大小関係処理のサブルーチンを示すフローチャートである。 Hereinafter, details of the present embodiment will be described with reference to FIGS. 13 and 14. FIG. 13 is a flowchart showing a main flow in the present embodiment, and FIG. 14 is a flowchart showing a subroutine of the edge feature quantity magnitude relation processing in step S2.
まず、図13において処理がスタートすると、オフラインで教示を行う。つまり、予めカメラ1で検出対象ワーク3を撮像した参照画像13を入力する。そして、画像処理部2に接続されたディスプレイ40に表示した状態で、オペレータは、検出したい検出対象エッジ14のみを選択するための教示の操作を、マウス43を使用して行う(ステップS1)。
First, when the process starts in FIG. 13, teaching is performed offline. That is, the
ステップS2では、CPU5及び特徴量相対関係記憶部8により、エッジ特徴量K、N1、N2の大小関係を判定する。エッジ特徴量大小関係の判定処理は、図14におけるステップS2-1において、特徴量の計算に用いるエッジを参照画像13から選択し、ステップS2-2において、検出対象エッジ14の特徴量をK、非検出対象エッジ15の特徴量をN1,N2として計算する。つまり、上記特徴量算出部(5,51)が、上記エッジ抽出部(5,10)によって抽出された各エッジについて特徴量K、特徴量N1,N2を算出する。
In step S2, the
即ち、図4(a),(b)に示すように、参照画像13において検出したいエッジを最内径の検出対象エッジ14とし、その他の検出を望まないエッジを非検出対象エッジ15とする。教示は、オペレータがディスプレイ40の画面を見ながらマウス43を使用して行うが、その具体的な方法は下記に示す。
That is, as shown in FIGS. 4A and 4B, the edge to be detected in the
まず、ステップS2-1において、ディスプレイ40に表示された図4(a)の参照画像13に対し、次のように操作する。つまり、図4(b)のように検出対象エッジ14上の適宜の点17と、非検出対象エッジ15上の適宜の点18、及び、中心付近の一点である点16の各位置を、夫々マウスポインタにより設定する。このマウスポインタによる設定とは、マウスポインタが指している参照画像13上の座標情報(x,y)を画像処理部2に送信することを意味する。
First, in step S2-1, the
そしてステップS2-2では、参照画像13に対して設定した上記の位置(点16,17,18)から一定の位置関係にある領域の輝度値をサンプリングし、その領域の輝度値の平均を算出する。一定の位置関係にある領域については以下に示す。
In step S2-2, the luminance value of a region having a certain positional relationship is sampled from the above-described position (points 16, 17, and 18) set with respect to the
まず、図5(a)に示すように、前記設定した中心付近の点16を基準点とし、この基準点(16)と前記設定したエッジ上の点17とを結ぶ直線と、参照画像13のy軸(図の上下方向)とで成す角度θを求める。
First, as shown in FIG. 5A, a
ついで、図5(b)に示すように、前記エッジ上の点17が矩形の底辺の中心となる位置に、マウスを用いて矩形のサンプリング領域20を設定する。そして図5(c)のように、エッジ上の点17を固定点として求めた直線の角度θだけ、矩形のサンプリング領域20を時計方向に回転させ、非検出対象エッジ15上の点18(図4(b))に対しても、図5(d)のようにサンプリング領域21,22を設定する。そして、上記と同様に点18を固定点として求めた直線の角度だけ、矩形のサンプリング領域21,22を図の時計方向に回転させる。
Next, as shown in FIG. 5B, a
このように、本実施形態では、サンプリング領域20,21,22を、検出対象エッジ14及び非検出対象エッジ15の一方側においてそのエッジ(14,15)の接線に接する位置関係となるように設定する。つまり、検出対象ワーク3が円形のエッジで構成される場合、上記矩形のサンプリング領域21,22において、次のように処理する。まず、抽出された各エッジ上の任意の一点を選択し、検出対象ワーク3における中心付近の一点16を基準点として、基準点(16)と各エッジ上の任意の一点とを結ぶ直線とで成す角度θを求める。さらに、各エッジ上の任意の一点に設定した領域を角度θに相当する角度だけ回転させることで、隣接する検出対象エッジ14の領域と非検出対象エッジ15の領域とが交差しないように設定する。
As described above, in this embodiment, the
なお、ここまでは、検出対象のエッジが円形の場合について説明したが、検出対象のエッジが直線である場合には、下記の方法により、一定の位置関係にある領域を求めることができる。 Up to this point, the case where the detection target edge is circular has been described. However, when the detection target edge is a straight line, an area having a certain positional relationship can be obtained by the following method.
即ち、検出対象である計測対象ワークのエッジが、図6(a)に示すように直線的なエッジで構成される場合、例えば正方形を構成するような場合も、上記と同様に処理する。つまり、検出対象エッジ23上の点23a、非検出対象エッジ24上の点24a、及び、中心付近の一点である点25の位置を、それぞれマウスポインタで設定する。そして、図6(b)の破線で示すように設定したエッジ23,24上の各点23a,24aを中心とした領域のエッジを抽出し、そのエッジの画像のx軸(図の左右方向)に対する角度を求める。
That is, when the edge of the workpiece to be measured, which is the detection target, is configured with a straight edge as shown in FIG. That is, the positions of the
つまり、エッジ上の点23a,24aが矩形の底辺の中心となる位置に矩形のサンプリング領域を設定し(図6(a))、この領域の大きさを、検出対象エッジに対して作成した矩形のサンプリング領域が隣接する非検出対象エッジと交差しないように設定する。例えば、検出対象エッジと隣接する非検出対象エッジ間の幅がLピクセル程度である場合は、矩形の一辺の大きさをL/2とする。また、設定する領域は、矩形のサンプリング領域に限らず円領域や楕円領域でもよい。
That is, a rectangular sampling region is set at a position where the
さらに、上記設定した矩形のサンプリング領域を、図6(c)に示すように前記エッジ上の点23a,24aを固定点として、前記求めたエッジの角度分だけ回転させる。この回転をさせる際に、図6(d)に示すように、矩形のサンプリング領域の上辺の中心位置28が基準位置26から遠ざかる方向へ回転させる。
Further, as shown in FIG. 6 (c), the set rectangular sampling area is rotated by the determined edge angle with the
図6(d)のような場合は、エッジの角度がx軸に対して90度であるため、回転方向がプラス90度とマイナス90度の2つが考えられる。右周りの方向をプラスとすると、矩形のサンプリング領域の上辺の中心位置(中心点)28が基準位置(基準点)26から遠ざかるのはプラス90度方向であるため、プラス90度回転させる。実際の判断は、両方の回転を行い、基準位置26と上辺中心位置28との距離を計算し、距離が長いほうの回転方向を採用することにより行う。
In the case of FIG. 6D, the angle of the edge is 90 degrees with respect to the x-axis, so two rotation directions of plus 90 degrees and minus 90 degrees are conceivable. Assuming that the clockwise direction is plus, the center position (center point) 28 of the upper side of the rectangular sampling area is away from the reference position (reference point) 26 in the plus 90 degree direction, so that it is rotated plus 90 degrees. The actual judgment is made by performing both rotations, calculating the distance between the
このように、検出対象ワーク3が直線的なエッジで構成される場合、矩形のサンプリング領域において、抽出された各エッジ上の任意の一点を選択し、選択した前記任意の一点の近傍のエッジ角度を求める。さらに、各エッジ上の任意の一点に設定した領域をエッジ角度に相当する角度分だけ回転させることで、隣接する検出対象エッジ14の領域と非検出対象エッジ15の領域とが交差しないように設定する。
In this way, when the
領域を設定した後、前述したように参照画像から設定した各領域内の輝度平均値を算出する。この輝度平均値は、一領域内の輝度値の総和を領域の面積で割ることによって算出することができる。前記算出した検出対象エッジの領域と、非検出対象エッジの領域との輝度平均値を、それぞれのエッジの特徴量とする。特徴量とする値は、領域の輝度平均値に限らず、領域の輝度の中央値、領域の中心一画素の輝度値(代表画素の輝度値)とすることもできる。 After the area is set, the luminance average value in each area set from the reference image is calculated as described above. The average luminance value can be calculated by dividing the total luminance value in one area by the area of the area. The calculated luminance average value of the detection target edge region and the non-detection target edge region is used as the feature amount of each edge. The value as the feature amount is not limited to the average luminance value of the region, but may be a median value of the luminance of the region or a luminance value of one central pixel of the region (a luminance value of the representative pixel).
この後、ステップS2-3において、特徴量K>特徴量N1>特徴量N2である場合には、大小関係フラグ(flag)=1と設定し、特徴量相対関係記憶部8に記憶する(ステップS2-6)。 After that, in step S2-3, if feature quantity K> feature quantity N1> feature quantity N2, the magnitude relation flag (flag) = 1 is set and stored in the feature quantity relative relationship storage unit 8 (step S2-3). S2-6).
また、ステップS2-4において、特徴量N1>特徴量K>特徴量N2である場合には、大小関係フラグ(flag)=2と設定し、特徴量相対関係記憶部8に記憶する(ステップS2-7)。 In step S2-4, if feature quantity N1> feature quantity K> feature quantity N2, the magnitude relation flag (flag) = 2 is set and stored in the feature quantity relative relationship storage unit 8 (step S2). -7).
また、ステップS2-5において、特徴量N1>特徴量N2>特徴量Kである場合には、大小関係フラグ(flag)=3として設定し、特徴量相対関係記憶部8に記憶する(ステップS2-8)。 In step S2-5, if feature quantity N1> feature quantity N2> feature quantity K, the magnitude relation flag (flag) = 3 is set and stored in the feature quantity relative relationship storage unit 8 (step S2). -8).
以上のステップS2-3〜S2-8では、検出対象エッジ14の特徴量と非検出対象エッジ15の特徴量との大小関係を算出して特徴量相対関係記憶部8に記憶する処理を行った。つまり、画像の輝度値が大きいと白に近く、小さいと黒くなる。このため、本実施形態では、図5(d)に示す検出対象エッジ14の領域の特徴量Kが非検出対象エッジ15の矩形のサンプリング領域21,22の特徴量N1,N2より大きいという旨を、特徴量相対関係記憶部8に記憶しておく。言い換えると、検出対象エッジ14の特徴量K>非検出対象エッジ15の特徴量N1>非検出対象エッジ15の特徴量N2、であるという旨を特徴量相対関係記憶部8に記憶しておく。
In the above steps S2-3 to S2-8, the size relationship between the feature amount of the
具体的には、特徴量の大小関係は、下記3通りの第1〜第3の状態(1)〜(3)が考えられる。
(1)検出対象エッジ14の特徴量Kが最も大きいとき、即ち、検出対象エッジ14の特徴量K>非検出対象エッジ15の特徴量N1>非検出対象エッジ15の特徴量N2、であるとき。
(2)検出対象エッジ14の特徴量Kが2番目に大きいとき、即ち、非検出対象エッジ15の特徴量N1>検出対象エッジ14の特徴量K>非検出対象エッジ15の特徴量N2、であるとき。
(3)検出対象エッジ14の特徴量Kが最も小さいとき、即ち、非検出対象エッジ15の特徴量N1>非検出対象エッジ15の特徴量N2>検出対象エッジ14の特徴量K、であるとき。
Specifically, the following three first to third states (1) to (3) can be considered as the magnitude relationship of the feature amounts.
(1) When the feature quantity K of the
(2) When the feature value K of the
(3) When the feature quantity K of the
上記3通りの内のどの状態かを記憶しておく。そのため、特徴量相対関係記憶部8には、第1の状態(1)の場合はフラグ1を(S2-3,S2-6)、第2の状態(2)の場合はフラグ2を(S2-4,S2-7)、第3の状態(3)の場合はフラグ3を(S2-5,S2-8)を格納しておくだけでよい。つまり、特徴量相対関係記憶部8は、参照画像13を入力として特徴量の算出を行い、特徴量K,N1,N2の大小関係を表した値(フラグの1、2、3のいずれか)を出力とする。
One of the above three states is stored. Therefore, the feature quantity relative
以上のようなエッジ特徴量の大小関係処理の後、ステップS3において、検出対象の画像を入力する。つまり、ステップS3は、検出対象となる検出対象ワーク3の入力画像に対して、実際にオンラインで行う検出工程であり、このステップS3にて、カメラ1により検出対象となる検出対象ワーク3の画像を入力し、入力画像記憶部9に記憶しておく。
After the edge feature amount magnitude relation processing as described above, an image to be detected is input in step S3. That is, step S3 is a detection process that is actually performed online with respect to the input image of the
そして、ステップS4において、CPU5及びエッジ画像記憶部10からなるエッジ抽出部により、エッジを抽出する。つまり、このステップS4にて、エッジ抽出部は、ステップS3で入力された検出対象ワーク3の入力画像に対し、例えば代表的な手法であるソーベル(SobeL)フィルタを使用して、エッジの抽出を行う。エッジ抽出フィルタとしては様々なものが知られているが、SobeLフィルタ以外のものを使用しても良い。
In step S4, an edge is extracted by an edge extraction unit including the
エッジ抽出では、物体の輪郭を抽出することができる。つまり、図7(a)に示す入力画像をエッジ抽出すると、図7(b)に示すような画像となる。また、実際の画像では、背景やワークの傷、照明のムラ等、様々な原因により細かなノイズエッジが出てくる。しかし、図7(b)に示すエッジ抽出後の画像は、エッジの長さを基準にして、短いエッジをノイズエッジとして除去した後のエッジ画像として、エッジ画像記憶部10に記憶される。
In edge extraction, the contour of an object can be extracted. That is, when the edge of the input image shown in FIG. 7A is extracted, an image as shown in FIG. 7B is obtained. In an actual image, fine noise edges appear due to various causes such as scratches on the background and work, uneven illumination, and the like. However, the image after edge extraction shown in FIG. 7B is stored in the edge
細かいノイズエッジの除去方法としては、様々なものが知られているため、長さによる除去に限定されるものではない。また、抽出したエッジは、近傍での連結性があるものを1つのエッジとしてまとめるラべリング処理を行い、それぞれの連結したエッジに番号を振り分け識別できるようにして(図8(b)のエッジ番号1,2,・・)、エッジ‐特徴量対応記憶部12に記憶される。
Since various methods for removing fine noise edges are known, they are not limited to removal by length. In addition, the extracted edges are subjected to a labeling process in which those having connectivity in the vicinity are combined as one edge so that numbers can be assigned to each connected edge so as to be identified (edges in FIG. 8B). No. 1, 2,...) And the edge-feature amount
さらに、ステップS5において、CPU5及びエッジ特徴量記憶部51からなる特徴量算出部により、全エッジの特徴量を計算(算出)する。つまり、このステップS5では、特徴量算出部は、前記エッジ抽出部で取得したエッジ画像から、各エッジ上の或る一点の位置を選択する。この或る一点とは、エッジの中心に位置する点、もしくは任意の点でよい。
Further, in step S5, the feature amount calculation unit including the
そして図8(a)に示すように、その各点の位置をエッジ上の点として、特徴量相対関係記憶部8と同様に、一定の位置関係に矩形のサンプリング領域を設定する。その際、基準点となるワークの中心位置は、検出対象ワーク3がカメラ1に対して毎回一定の位置に来る場合には、特徴量相対関係記憶部8の参照画像13で使用した基準位置をそのまま使用してもよい。一方、検出対象ワーク3の中心位置が毎回ずれるような場合には、パターンマッチング等により検出対象ワーク3の概略中心位置を予め求めておく必要がある。
Then, as shown in FIG. 8A, a rectangular sampling region is set in a fixed positional relationship, like the feature amount relative
そして、各サンプリング領域(矩系領域)20,21,22に位置する前記入力画像の輝度値を取得して、矩形のサンプリング領域毎に平均輝度値を算出し、算出した平均輝度値を各エッジの特徴量とする。また各エッジの特徴量を記憶するため、CPU5及びエッジ画像記憶部10からなるエッジ抽出部で求めたエッジ番号(図8(b)参照)と、そのエッジの特徴量との対応がわかるエッジ‐特徴量の対応表を作成し、エッジ‐特徴量対応記憶部12に記憶しておく。
Then, the luminance value of the input image located in each sampling region (rectangular region) 20, 21, 22 is acquired, an average luminance value is calculated for each rectangular sampling region, and the calculated average luminance value is calculated for each edge. Feature amount. In addition, since the feature values of each edge are stored, the edge number (see FIG. 8B) obtained by the edge extraction unit including the
さらに、ステップS6において、CPU5及び特徴量ヒストグラム記憶部11からなるエッジ区分部が、CPU5及びエッジ特徴量記憶部51からなる特徴量算出部で得られた全エッジの特徴量K,N1,N2に基づき、特徴量ヒストグラムを作成する。さらに、ステップS7において、上記エッジ区分部が、特徴量ヒストグラムから閾値を決定して記憶する。
Furthermore, in step S6, the edge segmentation unit composed of the
上記ステップS6〜ステップS7の処理工程は、上記エッジ区分部によって実行される。このエッジ区分部は、まず、前記算出した特徴量(平均輝度値)を、図9(b)に示すような横軸に平均の輝度値をとり且つ縦軸に頻度をとったヒストグラムを作成し、特徴量ヒストグラム記憶部11に記憶する。実際には、ヒストグラムの作成は、図9(a)に示すように0〜255の256個のテーブルを用意しておき、テーブル値と一致する前記平均輝度値がいくつあるかを記憶していく。例えば、平均輝度値30が2つある場合は、テーブル値30に「2」を入力する。そして、作成したヒストグラムから閾値(しきい値)を求める。閾値の求め方を以下に示す。
The processing steps from Step S6 to Step S7 are executed by the edge segmentation unit. The edge segmentation unit first creates a histogram of the calculated feature value (average luminance value) with the average luminance value on the horizontal axis and the frequency on the vertical axis as shown in FIG. 9B. And stored in the feature amount
前記特徴量ヒストグラムより輝度値kのときの頻度をH[k]とすると、まず、下記式(1)に示す加重移動平均法により、HWMA[k]を求める。 Assuming that the frequency at the luminance value k is H [k] from the feature amount histogram, first, H WMA [k] is obtained by the weighted moving average method shown in the following equation (1).
上記式(1)において、nは平均化する区間を表し、nの値が大きければ平滑化を強くすることができ、小さければ平滑化を弱くすることができる。図9(b)のヒストグラムをn=3で平滑化したヒストグラムを、図10の折れ線によるヒストグラム29として示す。
In the above formula (1), n represents an interval to be averaged, and if the value of n is large, smoothing can be strengthened, and if it is small, smoothing can be weakened. A histogram obtained by smoothing the histogram of FIG. 9B with n = 3 is shown as a
次に、下記式(2)に示す条件式を満たすHWMA[k]を探索する。ただし、式(2)では、kの値が小さいほうの閾値を閾値1、もう一方を閾値2とする。本実施の形態では、図4に示すような画像の場合に2種類の非検出対象エッジ15が出るため、このように2つの極小値を、閾値1、2として設定する。
Next, H WMA [k] that satisfies the conditional expression shown in the following expression (2) is searched. However, in equation (2), the threshold with the smaller value of k is
平滑化後の上記ヒストグラム29が極小値となる位置を見つけ、その値を閾値として設定する。極小値の探索方法は、HWMA[k]のkを0〜255まで変化させてゆく。そして、現在のHWMA[k]に対し、前後のヒストグラム(頻度)の値HWMA[k−1]、HWMA[k+1]がHWMA[k]より大きければ、前記作成したヒストグラムの極小値とみなす。
A position where the
ステップS8では、ステップS2で特徴量相対関係記憶部8に記憶された、特徴量K,N1,N2の大小関係を表した値(フラグ1、2、3の何れか)に基づき、大小関係のフラグ=1であるか否かを判断する。そして、大小関係フラグ=1である場合はステップS11に進み、そうでなければ、ステップS9に進む。ステップS11では、検出対象エッジ14の特徴量K>閾値2(非検出対象エッジ15のN1)、を満たすエッジを選択して、ステップS14に進む。ステップS14では、次の画像が有るか否かを判断し、有る場合にはステップS3に戻って検出対象の画像を入力し、次の画像が無い場合には処理を終了する。
In step S8, based on the value (any one of
また、ステップS9では、大小関係のフラグ=2であるか否かを判断し、大小関係フラグ=2である場合はステップS12に進み、そうでなければ、ステップS10に進む。ステップS12では、閾値2(N1)>特徴量K>閾値1(N2)、を満たすエッジを選択して、ステップS14に進む。 In step S9, it is determined whether or not the magnitude relation flag = 2. If the magnitude relation flag = 2, the process proceeds to step S12. Otherwise, the process proceeds to step S10. In step S12, an edge that satisfies threshold value 2 (N1)> feature value K> threshold value 1 (N2) is selected, and the process proceeds to step S14.
ステップS10では、大小関係のフラグ=3であるか否かを判断し、大小関係フラグ=3である場合はステップS13に進む。ステップS13では、閾値1(N2)>特徴量K、を満たすエッジを選択して、ステップS14に進む。 In step S10, it is determined whether or not the magnitude relation flag = 3. If the magnitude relation flag = 3, the process proceeds to step S13. In step S13, an edge satisfying threshold 1 (N2)> feature quantity K is selected, and the process proceeds to step S14.
以上のステップS8〜S13の処理工程は、CPU5及びエッジ‐特徴量対応記憶部12からなるエッジ関係設定部によって実行される。つまり、エッジ関係設定部は、特徴量相対関係記憶部8に記憶しておいた値(フラグ)が「1」であれば、閾値2(非検出対象エッジ15のN1)以上の特徴量Kを持つエッジが検出対象であると判断する(S8,S11)。
The processing steps in steps S8 to S13 are executed by the edge relationship setting unit including the
また、エッジ関係設定部は、特徴量相対関係記憶部8の値が「2」であれば、閾値1(非検出対象エッジ15のN2)以上且つ閾値2(非検出対象エッジ15のN1)以下の特徴量Kを持つエッジが検出対象であると判断する(S9,S12)。さらに、特徴量相対関係記憶部8の値が「3」であれば、閾値1(非検出対象エッジ15のN2)以下の特徴量を持つエッジが検出対象であると判断する(S10,S13)。
Further, when the value of the feature quantity relative
以上のように本実施の形態では、前記2つの閾値1、2と、予め記憶しておいた特徴量の大小関係フラグ1(特徴量K>特徴量N1>特徴量N2)とにより、閾値2以上の特徴量Kを持つエッジが検出対象であると判断できる。すると、エッジ関係設定部は、前記作成したエッジ‐特徴量対応表(図8(b))に基づいて、閾値2以上の特徴量Kを持つエッジのみを選択する。エッジ関係設定部は、CPU5及びエッジ画像記憶部10からなるエッジ抽出部によって抽出された全エッジの中から、検出対象エッジと判断したエッジのみを残したエッジ画像を生成して、出力する。
As described above, in the present embodiment, the
また、図11(a),(b),(c)に示す参照画像48の場合のように、非検出対象エッジ50が1種類しか出なければ、作成したヒストグラム(図12(a))から、判別分析法によって閾値を求めることができる。下記にその方法を示す。
Also, as in the case of the
即ち、輝度値kのときの頻度をH[k]とし、仮の閾値をtとする。ここで、図12(b)における符号30は、閾値tを示している。この閾値tで、ヒストグラムを分割したときの左側をクラス1、右側をクラス2とし、クラス1内のエッジ数(頻度の総和)をω1、輝度値の平均をm1、分散をσ1とする。一方、クラス2内のエッジ数(頻度の総和)をω2、輝度値の平均をm2、分散をσ2とすると、下記式(3)により、クラス1、クラス2におけるクラス内分散σWが求まる。
That is, the frequency at the luminance value k is H [k], and the temporary threshold is t. Here,
次に、ヒストグラム全体の平均輝度値をmtとすると、下記式(4)によりクラス1とクラス2のクラス間分散σbが求まる。
Next, when the average brightness value of the entire histogram and m t, the following equation (4)
そして、下記式(5)を分離度として、仮の閾値tを0から255まで変更し、分離度が最大のときのtを閾値として設定する。 Then, the following equation (5) is used as the degree of separation, the temporary threshold t is changed from 0 to 255, and t when the degree of separation is maximum is set as the threshold.
上記エッジ関係設定部は、閾値によって区分された特徴量の範囲の大小関係と上記記憶部(5,8)に記憶された特徴量K,N1,N2の大小関係とを比較する。そして、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと参照画像13上でのエッジ(14,15)とを対応付ける。つまり、エッジ関係設定部は、上記閾値と、予め記憶しておいた輝度値の相対関係(検出対象エッジ近傍の輝度値>非検出対象エッジ近傍の輝度値)より、閾値以上の特徴量を持つエッジが検出対象であると判断できる。
The edge relationship setting unit compares the size relationship between the ranges of the feature amounts classified by the threshold and the size relationship between the feature amounts K, N1, and N2 stored in the storage units (5, 8). Then, the edge on the input image and the edge (14, 15) on the
上記処理フローが、入力画像1枚に対する本発明の画像処理方法(エッジ検出方法)である。連続して次の画像を入力して本画像処理方法を行う場合は、上述のように、ステップS3に戻って、新たに検出対象となる次の検出対象ワーク3の画像を入力する(ステップS14)。
The above processing flow is the image processing method (edge detection method) of the present invention for one input image. When the next image is continuously input and this image processing method is performed, the process returns to step S3 as described above, and an image of the next
以上のように、参照画像13から予め算出しておいた検出対象エッジ14周辺の輝度値と、非検出対象エッジ15周辺の輝度値との相対関係と、順次送られてくる検出対象ワーク3の入力画像毎に算出する閾値とを用いて、必要な検出対象エッジのみを選択できる。つまり、照明装置105の照明状態に変化が生じた場合、この変化に応じて閾値を動的に変更できるので、予め算出した特徴量の相対関係が変わらない限り、照明装置105の照明状態に拘わらず、検出対象エッジのみをロバストに検出することができる。
As described above, the relative relationship between the luminance value around the
以上の本実施形態では、参照画像13から、予め検出対象エッジ14と非検出対象エッジ15とに対して一定の位置関係にある領域の輝度値kを特徴量Kとして算出する。そして、検出対象エッジ14の特徴量Kと非検出対象エッジ15の特徴量N1,N2との大きさを比較し、その大小関係を記憶しておく。そして、検出対象となる入力画像からエッジを抽出し、抽出した全エッジの特徴量K,N1,N2を算出し、その特徴量のヒストグラムを作成する。
In the present embodiment described above, the luminance value k of a region having a certain positional relationship with respect to the
さらに、作成したヒストグラムから閾値を求め、求めた閾値と、参照画像13から予め算出しておいた特徴量K,N1,N2の大小関係とにより、検出対象エッジ14の特徴量範囲と非検出対象エッジ15の特徴量範囲とを分離し、区別することができる。そして、検出対象エッジ14の特徴量範囲内の特徴量を持つエッジのみを選択することで、照明装置105の明るさの変化に拘わらず、入力画像から検出対象エッジ14のみを的確に検出することができる。
Further, a threshold value is obtained from the created histogram, and the feature amount range of the
このように、検出対象の検出対象ワーク3の入力画像に対して、毎回エッジ特徴量を計算し、検出対象エッジ14と非検出対象エッジ15とを分離するための特徴量の閾値を動的に計算することができる。また、その特徴量は、サンプリング領域の輝度値に基づいて計算される。そのため、照明装置105の劣化等が原因で入力画像内の輝度変動が大きくなった場合でも、参照画像13から予め求めておいた検出対象エッジ14と非検出対象エッジ15の各特徴量の大小関係が変わらない限り、両エッジ14,15を安定に分離できる。
As described above, the edge feature amount is calculated every time for the input image of the
また、特徴量を算出するためのエッジに対して一定の位置関係にある領域を求める際に、各エッジ上の一点を選択する。そして、検出対象物体(検出対象ワーク3)が円形の場合には、中心付近の一点16を基準点として、基準点(16)と各エッジ上の点17,21,22との角度を求める。一方、検出対象物体が直線的な場合には、選択した点上のエッジ23,24の角度を求める。
Further, when obtaining a region having a certain positional relationship with respect to the edge for calculating the feature amount, one point on each edge is selected. Then, when the detection target object (detection target workpiece 3) is circular, the angle between the reference point (16) and the
そして、図5(b)及び図6(a)に示すように、エッジ上の点に設定しておいた領域を求めた角度分だけ回転させる。これにより、円形の場合にはエッジの接線に沿わせ、直線的な場合にはエッジの長さ方向に沿わせることで、各エッジと、設定した領域とが交差する不都合をなくする。そのため、領域の輝度値に基づいてエッジの特徴量を求める場合に、誤った特徴量を算出することを確実に防ぐことができる。 Then, as shown in FIGS. 5B and 6A, the region set at the point on the edge is rotated by the calculated angle. This eliminates the inconvenience of crossing each edge with the set area by following the edge tangent in the case of a circle and along the length of the edge in the case of a straight line. Therefore, it is possible to reliably prevent an erroneous feature amount from being calculated when the edge feature amount is obtained based on the luminance value of the region.
オペレータは、参照画像13により、検出対象エッジ14の特徴量Kと非検出対象エッジ15の特徴量N1,N2との大小関係を教示する。その際に、検出対象エッジ14上の任意の一点17、対象以外の各エッジ上の任意の一点(21,22)、検出対象物体の中心付近の一点16を、マウスポインタ等を使用して教示してやるだけでよい。前記角度、特徴量の計算や大小関係の記憶等は、各点16,17(21,22)の位置さえ分かれば、プログラムにより自動で設定できるため、上記のように簡易的な教示で済むことになる。
The operator uses the
1…カメラ、3…ワーク(検出対象ワーク)、5,8…記憶部(CPU,特徴量相対関係記憶部)、5,10…エッジ抽出部(CPU,エッジ画像記憶部)、5,11…エッジ区分部(CPU,特徴量ヒストグラム記憶部)、5,12…エッジ関係設定部(CPU,エッジ‐特徴量対応記憶部)、5,51…特徴量算出部(CPU,エッジ特徴量記憶部)、13…参照画像、14…エッジ(検出対象エッジ)、15…エッジ(非検出対象エッジ)、19…コンピュータ、20,21,22…サンプリング領域(矩形領域)、105…照明装置、K,N1,N2…特徴量
DESCRIPTION OF
Claims (6)
取得した入力画像上のワークのエッジを抽出するエッジ抽出部と、
前記エッジ抽出部によって抽出された各エッジについて前記特徴量を算出する特徴量算出部と、
算出された前記入力画像上の各エッジの特徴量から輝度値及び頻度の度数分布を示すヒストグラムを作成し、このヒストグラムの分布状態に基づいて求められた閾値により区分される特徴量の範囲により、前記エッジ抽出部によって抽出されたエッジを区分するエッジ区分部と、
前記閾値によって区分された特徴量の範囲の大小関係と前記記憶部に記憶された特徴量の大小関係とを比較して、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと前記参照画像上でのエッジとを対応付けるエッジ関係設定部と、を備えた、
ことを特徴とする画像処理装置。 A storage unit that stores a magnitude relationship of feature amounts including brightness values of a sampling area that is calculated with respect to each of the plurality of edges on a reference image obtained by imaging a workpiece in advance and in a fixed positional relationship with the edges;
An edge extraction unit for extracting the edge of the workpiece on the acquired input image;
A feature amount calculation unit that calculates the feature amount for each edge extracted by the edge extraction unit;
A histogram showing the frequency distribution of the luminance value and frequency is created from the calculated feature value of each edge on the input image, and the feature value range divided by the threshold obtained based on the distribution state of this histogram, An edge segmentation unit that segments the edges extracted by the edge extraction unit;
By comparing the magnitude relation of the range of the feature quantity divided by the threshold and the magnitude relation of the feature quantity stored in the storage unit, an edge on the input image within the corresponding feature quantity range and An edge relationship setting unit that associates an edge on the reference image,
An image processing apparatus.
請求項1記載の画像処理装置。 The sampling region is set so as to be in a positional relationship in contact with the tangent of the edge on one side of the edge.
The image processing apparatus according to claim 1.
前記選択部によって選択されたエッジからワークの位置情報を算出する位置算出部と、を備えた、
請求項1又は2記載の画像処理装置。 A selection unit that selects an edge to be detected on the input image based on the correspondence between the edges set by the edge relationship setting unit;
A position calculation unit that calculates position information of the workpiece from the edge selected by the selection unit,
The image processing apparatus according to claim 1 or 2.
ことを特徴とする画像処理プログラム。 Allowing a computer to function as the image processing apparatus according to any one of claims 1 to 3;
An image processing program characterized by that.
前記照明装置に照らされたワークを撮像するカメラと、
請求項3記載の画像処理装置と、
前記カメラが撮像した入力画像に基づいて前記画像処理装置が算出した位置情報に基づいて、ワークに対して所定の処理を施す作動アームと、を備えた、
ことを特徴とするロボット装置。 A lighting device for illuminating the workpiece;
A camera for imaging a workpiece illuminated by the illumination device;
An image processing apparatus according to claim 3,
An actuating arm that performs a predetermined process on the workpiece based on position information calculated by the image processing device based on an input image captured by the camera.
A robot apparatus characterized by that.
前記画像処理装置が、取得した入力画像上のワークのエッジを抽出するエッジ抽出工程と、
前記画像処理装置が、前記エッジ抽出工程にて抽出された各エッジについて前記特徴量を算出する特徴量算出工程と、
前記画像処理装置が、算出された前記入力画像上の各エッジの特徴量から輝度値及び頻度の度数分布を示すヒストグラムを作成し、このヒストグラムの分布状態に基づいて求められた閾値により区分される特徴量の範囲により、前記エッジ抽出工程にて抽出されたエッジを区分するエッジ区分工程と、
前記画像処理装置が、前記閾値によって区分された特徴量の範囲の大小関係と前記記憶工程にて記憶された特徴量の大小関係とを比較して、対応する大小関係にある特徴量の範囲内の入力画像上のエッジと前記参照画像上でのエッジとを対応付けるエッジ関係設定工程と、を備えた、
ことを特徴とする画像処理方法。 A memory for storing a magnitude relationship of feature amounts composed of luminance values of a sampling area having a fixed positional relationship with respect to an edge, which is calculated for each of a plurality of edges on a reference image obtained by imaging a workpiece in advance. Process,
An edge extraction step in which the image processing apparatus extracts an edge of a workpiece on the acquired input image;
A feature amount calculating step in which the image processing apparatus calculates the feature amount for each edge extracted in the edge extraction step;
The image processing apparatus creates a histogram indicating a frequency distribution of luminance values and frequencies from the calculated feature values of each edge on the input image, and is classified by threshold values obtained based on the distribution state of the histogram. An edge division step of dividing the edge extracted in the edge extraction step according to a range of feature amounts;
The image processing apparatus compares the size relationship of the feature amount range classified by the threshold value with the feature amount stored in the storing step, and within the corresponding feature amount range. An edge relationship setting step for associating an edge on the input image with an edge on the reference image,
An image processing method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011195285A JP5769559B2 (en) | 2011-09-07 | 2011-09-07 | Image processing apparatus, image processing program, robot apparatus, and image processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2011195285A JP5769559B2 (en) | 2011-09-07 | 2011-09-07 | Image processing apparatus, image processing program, robot apparatus, and image processing method |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2013058036A JP2013058036A (en) | 2013-03-28 |
JP5769559B2 true JP5769559B2 (en) | 2015-08-26 |
Family
ID=48133889
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2011195285A Expired - Fee Related JP5769559B2 (en) | 2011-09-07 | 2011-09-07 | Image processing apparatus, image processing program, robot apparatus, and image processing method |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5769559B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11361249B2 (en) * | 2017-03-14 | 2022-06-14 | Nec Corporation | Image processing device for machine learning and setting of a teaching signal in accordance with detection and target regions, image processing method for machine learning and setting of a teaching signal, and storage medium |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6415066B2 (en) | 2014-03-20 | 2018-10-31 | キヤノン株式会社 | Information processing apparatus, information processing method, position and orientation estimation apparatus, robot system |
JP6964031B2 (en) * | 2018-03-27 | 2021-11-10 | Tasmit株式会社 | Pattern edge detection method |
JP6985210B2 (en) * | 2018-05-29 | 2021-12-22 | 株式会社 日立産業制御ソリューションズ | Inspection function diagnostic device, inspection function diagnosis method and inspection function diagnosis program |
JP2020170323A (en) * | 2019-04-02 | 2020-10-15 | キヤノン株式会社 | Processing method, article manufacturing method, processing apparatus, robot apparatus, program and recording media |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004272885A (en) * | 2003-02-21 | 2004-09-30 | Shinko Electric Ind Co Ltd | Device and method for edge extraction |
JP2010113466A (en) * | 2008-11-05 | 2010-05-20 | Toshiba Corp | Object tracking apparatus, object tracking program, and method |
JP5290864B2 (en) * | 2009-05-18 | 2013-09-18 | キヤノン株式会社 | Position and orientation estimation apparatus and method |
-
2011
- 2011-09-07 JP JP2011195285A patent/JP5769559B2/en not_active Expired - Fee Related
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11361249B2 (en) * | 2017-03-14 | 2022-06-14 | Nec Corporation | Image processing device for machine learning and setting of a teaching signal in accordance with detection and target regions, image processing method for machine learning and setting of a teaching signal, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
JP2013058036A (en) | 2013-03-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP4137969B2 (en) | Eye detection device, eye detection method, and program | |
JP5699788B2 (en) | Screen area detection method and system | |
US8073233B2 (en) | Image processor, microscope system, and area specifying program | |
JP4871144B2 (en) | Image processing apparatus, method, and program | |
JP5769559B2 (en) | Image processing apparatus, image processing program, robot apparatus, and image processing method | |
JP5351673B2 (en) | Appearance inspection device, appearance inspection method | |
JP6557943B2 (en) | Image collation device, image sensor, processing system, and image collation method | |
US8780223B2 (en) | Automatic determination of compliance of a part with a reference drawing | |
CN112352149A (en) | System and method for automatically analyzing air samples | |
JP2020502490A (en) | System and method for performing automatic analysis of air samples | |
CN107085850B (en) | The method and book scanning method that masking acquires the marked body of foreign matter in image, identifies foreign matter marked body in image | |
JP6727228B2 (en) | Lead tip position image recognition method and lead tip position image recognition system | |
JP2008192100A (en) | Eyelid detector and program | |
US10373021B2 (en) | Object detection device, object detection method, and recording medium | |
JP5939775B2 (en) | Image processing apparatus, image processing program, robot apparatus, and image processing method | |
CN106504262A (en) | A kind of small tiles intelligent locating method of multiple features fusion | |
CN112025693B (en) | Pixel-level target capture detection method and system of asymmetric three-finger grabber | |
JP2007188407A (en) | Image processing device and image processing program | |
JP5960433B2 (en) | Image processing apparatus and image processing method | |
JP6264008B2 (en) | Image processing apparatus, image processing method, and image processing program | |
JP2006163662A (en) | Device and method for recognizing number of fingers | |
JP7380332B2 (en) | Image processing device, control method and program for the image processing device | |
JP5921190B2 (en) | Image processing apparatus and image processing method | |
JPH07121713A (en) | Pattern recognition method | |
JP5812284B2 (en) | Belt-like structure detecting device, method and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20130228 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20140903 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20150521 |
|
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: 20150526 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20150623 |
|
R151 | Written notification of patent or utility model registration |
Ref document number: 5769559 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R151 |
|
LAPS | Cancellation because of no payment of annual fees |