JP2007249555A - Image processor and approximate straight line calculation apparatus - Google Patents

Image processor and approximate straight line calculation apparatus Download PDF

Info

Publication number
JP2007249555A
JP2007249555A JP2006071567A JP2006071567A JP2007249555A JP 2007249555 A JP2007249555 A JP 2007249555A JP 2006071567 A JP2006071567 A JP 2006071567A JP 2006071567 A JP2006071567 A JP 2006071567A JP 2007249555 A JP2007249555 A JP 2007249555A
Authority
JP
Japan
Prior art keywords
coordinates
evaluation value
coordinate
straight line
coordinate group
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.)
Withdrawn
Application number
JP2006071567A
Other languages
Japanese (ja)
Inventor
Shiro Fujieda
紫朗 藤枝
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.)
Omron Corp
Original Assignee
Omron Corp
Omron Tateisi Electronics Co
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 Omron Corp, Omron Tateisi Electronics Co filed Critical Omron Corp
Priority to JP2006071567A priority Critical patent/JP2007249555A/en
Publication of JP2007249555A publication Critical patent/JP2007249555A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To achieve a highly accurate approximate straight line by efficiently removing an outlier from coordinates included in a coordinate group. <P>SOLUTION: A CPU acquires the coordinate group composed of the coordinates indicating an edge position (step S2) and selects three or more coordinates from the coordinate group according to a prescribed rule (step S4). Then, the CPU calculates an evaluation value indicating the degree of being arranged on the same straight line for the selected coordinates (step S6), and cumulatively adds the evaluation value in association with each of the selected coordinates (step S8). Further, the CPU repeatedly executes the steps S4-S10 so that the respective coordinates constituting the coordinate group are selected for the same number of times. Thereafter, the CPU extracts the plurality of coordinates with the relatively high degree of being arranged on the same straight line from the coordinate group on the basis of the cumulatively added evaluation values (cumulative values) of the respective coordinates (step S12) and calculates the approximate straight line (step S14). <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

この発明は複数の座標を含む座標群から近似直線を算出する画像処理装置および近似直線算出装置に関し、特に誤差発生要因となる外れ値を効率的に取除いて、近似直線を高精度に算出する技術に関するものである。   The present invention relates to an image processing device and an approximate line calculation device that calculate an approximate line from a group of coordinates including a plurality of coordinates, and in particular, efficiently removes an outlier that causes an error and calculates the approximate line with high accuracy. It is about technology.

製造現場においては、省力化および高効率化の観点から、オートメーション化が推進されている。このようなオートメーション化を実現するためには、数多くのセンサ類が用いられている。特に、製品や半製品などを撮影し、その撮影した画像を処理することで、当該製品の寸法計測検査や位置決めなどを行なうことのできる画像処理装置が有効である。   In the manufacturing field, automation is promoted from the viewpoint of labor saving and high efficiency. In order to realize such automation, many sensors are used. In particular, an image processing apparatus that can photograph a product, a semi-finished product, and the like and process the photographed image to perform dimension measurement inspection and positioning of the product is effective.

このような画像処理装置においては、撮影した画像内の情報(明度、輝度、色差など)により、対象物(製品や半製品など)のエッジ(輪郭)検出が行なわれる。特に、対象物の直線形状部位に対してエッジ検出が行なわれることが多い。これは、対象物の多くは直線形状部位を含むことと、直線形状部位を基準にすることにより、精度の高い寸法計測や位置決めを容易に実現できることによる。   In such an image processing apparatus, an edge (contour) of an object (product, semi-finished product, etc.) is detected based on information (lightness, brightness, color difference, etc.) in the captured image. In particular, edge detection is often performed on a linear portion of an object. This is because most of the objects include a linear portion, and by using the linear portion as a reference, highly accurate dimensional measurement and positioning can be easily realized.

しかしながら、対象物の背景における汚れや、対象物の欠陥(成型バリや欠け)などにより、誤ったエッジ位置が検出される場合も多い。そこで、所定の領域内で検出された複数のエッジ位置に基づいて、対象物の直線形状部位を示す近似直線を算出することが一般的に行なわれる。たとえば、特許第2850608号公報(特許文献1)には、複数のエッジ点の座標を計測し、直線近似することが開示されている。   However, an erroneous edge position is often detected due to dirt in the background of the object or a defect (molding burr or chipping) of the object. In view of this, it is common practice to calculate an approximate straight line indicating a linear shape portion of an object based on a plurality of edge positions detected within a predetermined region. For example, Japanese Patent No. 2850608 (Patent Document 1) discloses that the coordinates of a plurality of edge points are measured and linear approximation is performed.

さらに、直線近似の精度をより高めるために、たとえば非特許文献1に開示されるようなLTS推定法(Least Trimmed Squares Estimate Method)が提案されている。LTS推定法によれば、最小二乗法により複数のエッジ位置から暫定近似直線が算出し、複数のエッジ位置のうち、各エッジ位置から暫定近似直線までの距離(残差)が小さいものを抽出する。そして、抽出されたエッジ位置から、再度、最小二乗法により近似直線が算出される。このLTS推定法によれば、本来の値から大きく外れた外れ値(outlier)の影響を低減できる。
特許第2850608号公報 佐久間 彩、「回帰分析法のロバストネスの理論とその応用に関する研究」、2004年度 卒業論文要旨集、2005年3月7日、南山大学数理情報学部数理科学科、インターネット<URL:http://www.seto.nanzan-u.ac.jp/msie/gr-thesis/ms/2004/kimura/01mm075.pdf>
Furthermore, in order to further improve the accuracy of linear approximation, for example, an LTS estimation method (Least Trimmed Squares Estimate Method) as disclosed in Non-Patent Document 1 has been proposed. According to the LTS estimation method, a provisional approximate line is calculated from a plurality of edge positions by the least square method, and a plurality of edge positions having a small distance (residual) from each edge position to the provisional approximate line are extracted. . Then, an approximate straight line is calculated again from the extracted edge position by the least square method. According to this LTS estimation method, it is possible to reduce the influence of outliers that deviate significantly from the original values.
Japanese Patent No. 2850608 Aya Sakuma, "Research on Robustness Theory of Regression Analysis and its Application", Summary of 2004 Graduation Thesis, March 7, 2005, Nanzan University, Department of Mathematical Sciences, Internet <URL: http: // www .seto.nanzan-u.ac.jp / msie / gr-thesis / ms / 2004 / kimura / 01mm075.pdf>

しかしながら、上述のようなLTS推定法を用いたとしても、検出された複数のエッジ位置に数多くの外れ値が含まれている場合には、暫定近似直線自体が大きな誤差影響を受けてしまう。そのため、本来正常なエッジ位置であっても、暫定近似直線からの距離が大きくなる場合があり、このような場合には、本来正常なエッジ位置が取除かれてしまい、外れ値に基づいて誤差の大きな近似直線が算出されてしまう場合があった。   However, even if the above-described LTS estimation method is used, if a large number of outliers are included in a plurality of detected edge positions, the provisional approximate line itself is greatly affected by errors. For this reason, even if the edge position is normally normal, the distance from the provisional approximate straight line may be large. In such a case, the normal normal edge position is removed, and an error is caused based on the outlier. In some cases, a large approximate straight line is calculated.

そこで、この発明は、かかる問題を解決するためになされたものであり、その目的は、座標群に含まれる座標から外れ値を効率的に取除いて、精度の高い近似直線を算出できる画像処理装置および近似直線算出装置を提供することである。   Accordingly, the present invention has been made to solve such a problem, and an object of the present invention is to perform image processing capable of calculating an approximate straight line with high accuracy by efficiently removing outliers from coordinates included in a coordinate group. An apparatus and an approximate line calculation device are provided.

第1の発明によれば、画像の特定の位置を示す座標を4個以上含む座標群を取得する座標群取得手段と、所定規則に従って、座標群から3個以上の座標を選択する座標選択手段と、座標選択手段により選択された3個以上の座標について、同一直線上に配置される度合を示す評価値を算出する評価値算出手段と、当該3個以上の座標の各々と対応付けて、評価値算出手段により算出される評価値を累積加算する評価値加算手段と、座標群の各座標が互いに同一回数だけ選択されるように、座標選択手段、評価値算出手段および評価値加算手段における処理を繰返し実行させる繰返手段と、評価値加算手段により累積加算された評価値に基づいて、座標群から同一直線上に配置される度合が相対的に高い複数の座標を抽出する抽出手段と、抽出手段により抽出された複数の座標に基づいて近似直線を算出する近似直線算出手段とを備える画像処理装置である。   According to the first invention, a coordinate group acquisition unit that acquires a coordinate group including four or more coordinates indicating a specific position of an image, and a coordinate selection unit that selects three or more coordinates from the coordinate group according to a predetermined rule And, with respect to three or more coordinates selected by the coordinate selection means, an evaluation value calculation means for calculating an evaluation value indicating the degree of arrangement on the same straight line, and each of the three or more coordinates, In the coordinate value selecting means, the evaluation value calculating means, and the evaluation value adding means, the evaluation value adding means for accumulating the evaluation values calculated by the evaluation value calculating means and the coordinates of the coordinate group are selected the same number of times. Repetitive means for repeatedly executing the processing, and extraction means for extracting a plurality of coordinates having a relatively high degree of arrangement on the same straight line from the coordinate group based on the evaluation values accumulated and added by the evaluation value addition means , Extraction An image processing apparatus and a approximate line calculating means for calculating an approximate line based on a plurality of coordinates extracted by stage.

第1の発明によれば、座標群から選択された3個以上の座標の組合せ毎に、同一直線上に配置される度合を示す評価値が算出される。このように、評価値は、座標群全体から算出される暫定近似直線に基づいて算出されるのではなく、選択された3個以上の座標の間でミクロ的に算出される。外れ値である座標は、いずれの組合せにおいても、同一直線上に配置される度合が低い一方、正常な座標は、正常な座標同士の組合せにおいて、同一直線上に配置される度合が高くなる。その結果、座標の各々と対応付けて評価値が累積されることで、正常な座標と外れ値の座標との差が顕著に表れるため、外れ値を効率的に取除くことができる。   According to the first invention, an evaluation value indicating the degree of arrangement on the same straight line is calculated for each combination of three or more coordinates selected from the coordinate group. As described above, the evaluation value is not calculated based on the provisional approximate straight line calculated from the entire coordinate group, but is calculated microscopically between three or more selected coordinates. Coordinates that are outliers are less likely to be placed on the same straight line in any combination, while normal coordinates are more likely to be placed on the same straight line in a combination of normal coordinates. As a result, since the evaluation values are accumulated in association with each of the coordinates, the difference between the normal coordinates and the coordinates of the outlier appears significantly, so that the outlier can be efficiently removed.

好ましくは、座標群取得手段は、画像を取得する画像取得部と、画像取得部により取得された画像中において、色情報に変化を生じるエッジ位置を検出して座標群を取得するエッジ検出部とを含む。   Preferably, the coordinate group acquisition unit includes an image acquisition unit that acquires an image, an edge detection unit that acquires a coordinate group by detecting an edge position that causes a change in color information in the image acquired by the image acquisition unit, and including.

好ましくは、画像取得部は、直線形状部位を有する対象物を撮影して得られた画像を取得する。   Preferably, the image acquisition unit acquires an image obtained by photographing an object having a linear part.

好ましくは、評価値算出手段は、3個以上の座標のうち2個の座標を含む直線を規定し、残余の座標の各々と当該規定された直線との距離に基づいて評価値を算出する。   Preferably, the evaluation value calculation means defines a straight line including two coordinates among the three or more coordinates, and calculates an evaluation value based on a distance between each of the remaining coordinates and the defined straight line.

好ましくは、評価値算出手段は、3個以上の座標についての相関係数に基づいて、評価値を算出する。   Preferably, the evaluation value calculation means calculates an evaluation value based on a correlation coefficient for three or more coordinates.

好ましくは、繰返手段は、座標選択手段により座標群から3個以上の座標を選ぶ組合せのすべてが選択されるまで、座標選択手段、評価値算出手段および評価値加算手段における処理を繰返し実行させる。   Preferably, the repeating unit repeatedly executes the processes in the coordinate selecting unit, the evaluation value calculating unit, and the evaluation value adding unit until all the combinations for selecting three or more coordinates from the coordinate group are selected by the coordinate selecting unit. .

好ましくは、座標群は、2次元または3次元の座標からなる。
第2の発明によれば、4個以上の座標を含む座標群を取得する座標群取得手段と、所定規則に従って、座標群から3個以上の座標を選択する座標選択手段と、座標選択手段により選択された3個以上の座標について、同一直線上に配置される度合を示す評価値を算出する評価値算出手段と、当該3個以上の座標の各々と対応付けて、評価値算出手段により算出される評価値を累積加算する評価値加算手段と、座標群の各座標が互いに同一回数だけ選択されるように、座標選択手段、評価値算出手段および評価値加算手段における処理を繰返し実行させる繰返手段と、評価値加算手段により累積加算された評価値に基づいて、座標群から同一直線上に配置される度合が相対的に高い複数の座標を抽出する抽出手段と、抽出手段により抽出された複数の座標に基づいて近似直線を算出する近似直線算出手段とを備える近似直線算出装置である。
Preferably, the coordinate group includes two-dimensional or three-dimensional coordinates.
According to the second invention, the coordinate group acquisition means for acquiring a coordinate group including four or more coordinates, the coordinate selection means for selecting three or more coordinates from the coordinate group according to a predetermined rule, and the coordinate selection means For the three or more selected coordinates, the evaluation value calculating means for calculating the evaluation value indicating the degree of arrangement on the same straight line and the evaluation value calculating means in association with each of the three or more coordinates. An evaluation value adding means for accumulating the evaluation values to be accumulated, and a process for repeatedly executing the processes in the coordinate selecting means, the evaluation value calculating means and the evaluation value adding means so that each coordinate of the coordinate group is selected the same number of times. Based on the evaluation value cumulatively added by the evaluation value addition means, an extraction means for extracting a plurality of coordinates arranged on the same straight line from the coordinate group and having a relatively high degree, and extracted by the extraction means The An approximate straight line calculation device and a approximate line calculating means for calculating an approximate line based on the number of coordinates.

第2の発明によれば、座標群から選択された3個以上の座標の組合せ毎に、同一直線上に配置される度合を示す評価値が算出される。このように、評価値は、座標群全体から算出される暫定近似直線に基づいて算出されるのではなく、選択された3個以上の座標の間でミクロ的に算出される。外れ値である座標は、いずれの組合せにおいても、同一直線上に配置される度合が低い一方、正常な座標は、正常な座標同士の組合せにおいて、同一直線上に配置される度合が高くなる。その結果、座標の各々と対応付けて評価値が累積されることで、正常な座標と外れ値の座標との差が顕著に表れるため、外れ値を効率的に取除くことができる。   According to the second invention, for each combination of three or more coordinates selected from the coordinate group, an evaluation value indicating the degree of arrangement on the same straight line is calculated. As described above, the evaluation value is not calculated based on the provisional approximate straight line calculated from the entire coordinate group, but is calculated microscopically between three or more selected coordinates. Coordinates that are outliers are less likely to be placed on the same straight line in any combination, while normal coordinates are more likely to be placed on the same straight line in a combination of normal coordinates. As a result, since the evaluation values are accumulated in association with each of the coordinates, the difference between the normal coordinates and the coordinates of the outlier appears significantly, so that the outlier can be efficiently removed.

この発明によれば、座標群に含まれる座標から外れ値を効率的に取除いて、精度の高い近似直線を算出できる画像処理装置および近似直線算出装置を実現できる。   According to the present invention, it is possible to realize an image processing device and an approximate line calculation device that can efficiently remove outliers from coordinates included in a coordinate group and calculate an approximate line with high accuracy.

この発明の実施の形態について、図面を参照しながら詳細に説明する。なお、図中の同一または相当部分については、同一符号を付してその説明は繰返さない。   Embodiments of the present invention will be described in detail with reference to the drawings. Note that the same or corresponding parts in the drawings are denoted by the same reference numerals and description thereof will not be repeated.

[実施の形態1]
図1は、この発明の実施の形態1に従う近似直線算出装置を備える画像処理装置100の概略構成図である。
[Embodiment 1]
FIG. 1 is a schematic configuration diagram of an image processing apparatus 100 including an approximate straight line calculation apparatus according to Embodiment 1 of the present invention.

図1を参照して、画像処理装置100は、カメラ2により撮影された画像を取得して、近似直線を算出した後、その算出結果を表示装置4や外部機器6へ出力する。   With reference to FIG. 1, the image processing apparatus 100 acquires an image photographed by the camera 2, calculates an approximate straight line, and then outputs the calculation result to the display device 4 and the external device 6.

カメラ2は、一例として、CCD(Coupled Charged Device)やCMOS(Complementary Metal Oxide Semiconductor)センサなどの撮像素子およびレンズからなり、製造ライン上などを連続的に搬送される製品や半製品といった対象物を撮影し、その撮影した画像を画像処理装置100へ出力する。なお、カメラ2が撮影する画像は、濃淡画像(白黒画像)およびカラー画像のいずれでもよく、さらに静止画像および動画像のいずれでもよい。この発明の実施の形態1においては、カラー画像を用いる場合について説明を行なう。   As an example, the camera 2 includes an imaging element such as a CCD (Coupled Charged Device) or a CMOS (Complementary Metal Oxide Semiconductor) sensor and a lens. The captured image is output to the image processing apparatus 100. The image captured by the camera 2 may be either a grayscale image (black and white image) or a color image, and may be either a still image or a moving image. In the first embodiment of the present invention, a case where a color image is used will be described.

表示装置4は、画像処理装置100において算出された近似直線や検出されたエッジ位置などを、カメラ2により撮影された画像とともに表示する。一例として、表示装置4は、液晶ディスプレイ(LCD:Liquid Crystal Display)、プラズマディスプレイ(Plasma Display)、有機ELディスプレイ(Electro Luminescence display)などからなる。   The display device 4 displays the approximate straight line calculated by the image processing device 100, the detected edge position, and the like together with the image taken by the camera 2. As an example, the display device 4 includes a liquid crystal display (LCD), a plasma display, an organic EL display (Electro Luminescence display), and the like.

外部機器6は、一例として、製造ラインなどを監視制御するプログラマブルコントローラなどからなり、画像処理装置100において算出された近似直線に応じて、各種の制御や計測を実行する。   The external device 6 includes, for example, a programmable controller that monitors and controls a production line and the like, and executes various types of control and measurement according to the approximate straight line calculated in the image processing apparatus 100.

画像処理装置100は、CPU10と、ROM(Read Only Memory)12と、RAM(Random Access Memory)14と、HDD(Hard Disk Drive:ハードディスクドライブ)16と、入出力部18と、画像入力部20と、フィルタ22と、画像メモリ24と、エッジ検出部26と、画像出力部28とからなる。そして、画像入力部20を除く各部は、バス30を介して互いに接続される。画像処理装置100は、一例としてパーソナルコンピュータなどで実現される。   The image processing apparatus 100 includes a CPU 10, a ROM (Read Only Memory) 12, a RAM (Random Access Memory) 14, an HDD (Hard Disk Drive) 16, an input / output unit 18, and an image input unit 20. , A filter 22, an image memory 24, an edge detection unit 26, and an image output unit 28. The units other than the image input unit 20 are connected to each other via the bus 30. The image processing apparatus 100 is realized by a personal computer or the like as an example.

画像入力部20は、カメラ2と電気的に接続され、カメラ2で撮影された映像信号を受け、所定の信号変換処理を行ない各画素の色情報を取得した後、その取得した色情報をフィルタ22へ出力する。具体的には、画像入力部20は、カメラ2から受けた映像信号に対してフレーム同期を行ない、時間軸上に展開されて伝送される各画素の色情報を復調し、各画素についての色情報を取得する。   The image input unit 20 is electrically connected to the camera 2, receives a video signal captured by the camera 2, performs predetermined signal conversion processing, acquires color information of each pixel, and then filters the acquired color information 22 to output. Specifically, the image input unit 20 performs frame synchronization on the video signal received from the camera 2, demodulates the color information of each pixel developed and transmitted on the time axis, and determines the color for each pixel. Get information.

フィルタ22は、画像入力部20から順次出力される画像を受けて、当該画像の各画素に対して色情報変換などのフィルタ処理を行なう。そして、フィルタ22は、フィルタ処理後の画像を画像メモリ24およびエッジ検出部26へ出力する。一例として、フィルタ22は、CPU10により設定された所定の規則(テーブル)に従って処理を行なう、LUT(Look-Up Table)型のフィルタである。そのため、フィルタ22は、対象物や撮影条件などに応じて、フィルタ処理の内容を変更することが可能に構成される。   The filter 22 receives images sequentially output from the image input unit 20 and performs filter processing such as color information conversion on each pixel of the image. Then, the filter 22 outputs the filtered image to the image memory 24 and the edge detection unit 26. As an example, the filter 22 is a LUT (Look-Up Table) type filter that performs processing in accordance with a predetermined rule (table) set by the CPU 10. For this reason, the filter 22 is configured to be able to change the content of the filter process in accordance with the object, shooting conditions, and the like.

画像メモリ24は、所定周期毎またはCPU10から指令を受けたタイミングで、フィルタ22から出力される画像を一次的に格納する。また、画像メモリ24は、エッジ検出部26から受けたエッジ位置についても一次的に格納する。そして、画像メモリ24は、格納している画像を画像出力部28やCPU10などへ出力する。   The image memory 24 temporarily stores an image output from the filter 22 at predetermined intervals or at a timing when a command is received from the CPU 10. The image memory 24 also temporarily stores the edge position received from the edge detection unit 26. Then, the image memory 24 outputs the stored image to the image output unit 28, the CPU 10, or the like.

エッジ検出部26は、CPU10からの指令を受けて、フィルタ22から出力される画像を構成する各画素の色情報に基づいて、画像中において色情報に変化を生じるエッジ位置(輪郭)を検出する。そして、エッジ検出部26は、検出した複数のエッジ位置を座標群としてCPU10および画像メモリ24へ出力する。さらに、エッジ検出部26は、入出力部18などを介して与えられるマスク領域に応じて、フィルタ22から出力される画像の特定領域に対するエッジ位置の検出が可能に構成される。なお、濃淡画像(白黒画像)が入力される場合には、色情報は濃淡値であり、カラー画像が入力される場合には、色情報はRGB値(赤色、緑色、青色の各濃淡値)、CMY値(シアン、マゼンダ、黄色の各濃淡値)もしくは色変数(色相(Hue)、明度(Value)、彩度(Chroma))などである。   The edge detection unit 26 receives an instruction from the CPU 10 and detects an edge position (contour) that causes a change in the color information in the image based on the color information of each pixel constituting the image output from the filter 22. . Then, the edge detection unit 26 outputs the detected plurality of edge positions to the CPU 10 and the image memory 24 as a coordinate group. Furthermore, the edge detection unit 26 is configured to be able to detect an edge position with respect to a specific region of the image output from the filter 22 in accordance with a mask region given via the input / output unit 18 or the like. When a grayscale image (black and white image) is input, the color information is a grayscale value. When a color image is input, the color information is an RGB value (red, green, and blue grayscale values). , CMY values (cyan values of cyan, magenta, and yellow) or color variables (hue, value, and saturation).

画像出力部28は、画像メモリ24からの画像、およびCPU10などからの各種表示情報を受け、映像信号を生成して表示装置4へ出力する。一例として、画像出力部28は、表示装置4に対応してアナログ信号(コンポジット信号やコンポーネント信号)またはデジタル信号を出力する。   The image output unit 28 receives an image from the image memory 24 and various display information from the CPU 10, etc., generates a video signal, and outputs it to the display device 4. As an example, the image output unit 28 outputs an analog signal (composite signal or component signal) or a digital signal corresponding to the display device 4.

ROM12は、CPU10の起動時などに実行されるプログラムや各種設定を格納する。   The ROM 12 stores programs executed when the CPU 10 is activated and various settings.

RAM14は、CPU10で実行されるプログラムや後述する近似直線算出に係るワークデータなどを格納する。そして、RAM14は、一例として、DRAM(Dynamic Random Access Memory)やSRAM(Static Random Access Memory)などの半導体記憶素子からなる。   The RAM 14 stores programs executed by the CPU 10, work data related to approximate straight line calculation described later, and the like. The RAM 14 includes, for example, a semiconductor storage element such as a DRAM (Dynamic Random Access Memory) and an SRAM (Static Random Access Memory).

HDD16は、CPU10で実行されるプログラムやCPU10における算出結果などを格納し、CPU10からの要求により読出しおよび書込みを行なう。なお、HDD16に代えて、半導体メモリ(フラッシュメモリカード、SDメモリカード、ICメモリカードなど)や、光ディスク(CD(Compact Disk)、DVD(Digital Versatile Disc)−ROM/RAM/R/RW、MO(Magnetic Optical Disc)、MD(Mini Disc))などの不揮発的にデータを担持可能な装置を用いてもよい。   The HDD 16 stores programs executed by the CPU 10, calculation results in the CPU 10, and the like, and reads and writes in response to requests from the CPU 10. Instead of the HDD 16, a semiconductor memory (flash memory card, SD memory card, IC memory card, etc.), an optical disk (CD (Compact Disk), a DVD (Digital Versatile Disc) -ROM / RAM / R / RW, MO ( A device capable of supporting data in a nonvolatile manner such as Magnetic Optical Disc) or MD (Mini Disc) may be used.

入出力部18は、CPU10における算出結果などを外部機器6へ出力する。一例として、入出力部18は、フォトダイオード、トランジスタまたはリレーなどから構成される接点出力(DO)や、フィールドバス、USB(Universal Serial Bus)、RS−232C(Recommended Standard 232 version C)、IEEE(Institute of Electrical and Electronic Engineers)1394、SCSI(Small Computer System Interface)およびイーサネット(登録商標)などに従う通信手段などからなる。   The input / output unit 18 outputs a calculation result in the CPU 10 to the external device 6. As an example, the input / output unit 18 includes a contact output (DO) composed of a photodiode, a transistor, or a relay, a field bus, a USB (Universal Serial Bus), an RS-232C (Recommended Standard 232 version C), an IEEE ( It consists of communication means according to Institute of Electrical and Electronic Engineers (1394), SCSI (Small Computer System Interface), Ethernet (registered trademark), and the like.

CPU10は、カメラ2により撮影された画像に対してエッジ検出部26により検出された複数のエッジ位置(2次元座標)を示す座標群を取得する。特に、この発明の実施の形態1においては、CPU10は、4個以上のエッジ位置からなる座標群を取得する。そして、CPU10は、取得した座標群から所定規則に従って3個以上の座標を選択し、選択した3個以上の座標について、同一直線上に配置される度合を示す評価値を算出する。さらに、CPU10は、当該選択した3個以上の評価値の各々と対応付けて、算出した評価値を累積加算する。   The CPU 10 acquires a coordinate group indicating a plurality of edge positions (two-dimensional coordinates) detected by the edge detection unit 26 with respect to the image captured by the camera 2. In particular, in Embodiment 1 of the present invention, the CPU 10 acquires a coordinate group including four or more edge positions. Then, the CPU 10 selects three or more coordinates from the acquired coordinate group according to a predetermined rule, and calculates an evaluation value indicating the degree of arrangement on the same straight line for the selected three or more coordinates. Further, the CPU 10 accumulates and adds the calculated evaluation values in association with each of the selected three or more evaluation values.

以下同様にして、CPU10は、座標群の各座標が互いに同一回数だけ選択されるように、3個以上の座標を順次選択して上述の処理を繰返し実行する。   Similarly, the CPU 10 sequentially selects the three or more coordinates and repeatedly executes the above-described process so that the coordinates of the coordinate group are selected the same number of times.

そして、CPU10は、累積加算された評価値に基づいて、座標群から同一直線上に配置される度合が相対的に高い複数の座標を抽出し、抽出した座標に基づいて近似直線を算出する。   Then, the CPU 10 extracts a plurality of coordinates having a relatively high degree of arrangement on the same straight line from the coordinate group based on the accumulated and added evaluation value, and calculates an approximate straight line based on the extracted coordinates.

さらに、CPU10は、それぞれ画像出力部28および入出力部18を介して、算出した近似直線を表示装置4および外部機器6などへ出力する。   Further, the CPU 10 outputs the calculated approximate straight line to the display device 4 and the external device 6 through the image output unit 28 and the input / output unit 18, respectively.

この発明の実施の形態1においては、画像入力部20が「画像取得部」に相当し、画像入力部20およびエッジ検出部26が「座標群取得手段」を実現する。また、CPU10が「座標選択手段」、「評価値算出手段」、「評価値加算手段」、「繰返手段」、「抽出手段」および「近似直線算出手段」を実現する。   In the first embodiment of the present invention, the image input unit 20 corresponds to an “image acquisition unit”, and the image input unit 20 and the edge detection unit 26 implement a “coordinate group acquisition unit”. Further, the CPU 10 implements “coordinate selection means”, “evaluation value calculation means”, “evaluation value addition means”, “repetition means”, “extraction means”, and “approximate straight line calculation means”.

(エッジ位置の検出処理)
図2は、エッジ検出部26におけるエッジ位置の検出処理の概要を説明するための図である。
(Edge position detection process)
FIG. 2 is a diagram for explaining the outline of the edge position detection processing in the edge detection unit 26.

図2を参照して、一例として、エッジ検出部26は、カメラ2により撮影された画像IMGに対してx方向に走査を行ない、エッジ位置を順次検出する。   With reference to FIG. 2, as an example, the edge detection unit 26 scans an image IMG taken by the camera 2 in the x direction, and sequentially detects edge positions.

具体的には、エッジ検出部26は、画像IMG中の予め定められたx方向の走査位置40.1を中心として、所定幅をもつ領域42.1を定義する。そして、エッジ検出部26は、定義された領域42.1に含まれる画素の色情報を、y方向の値と対応付けて、x方向に累積加算した色情報ヒストグラム46.1を算出する。なお、図2の場合には、1次元の色情報から色情報ヒストグラム46.1を算出するので、カラー画像の場合には、色情報として1次元の明度(赤色、青色および緑色の各濃淡値の合計)などを用いることができる。そして、エッジ検出部26は、この算出された色情報ヒストグラム46.1において、急激な変化を生じるy方向の変化位置48.1を検出する。   Specifically, the edge detection unit 26 defines a region 42.1 having a predetermined width around a predetermined scanning position 40.1 in the x direction in the image IMG. The edge detection unit 26 then associates the color information of the pixels included in the defined region 42.1 with the value in the y direction, and calculates a color information histogram 46.1 that is cumulatively added in the x direction. In the case of FIG. 2, the color information histogram 46.1 is calculated from the one-dimensional color information. Therefore, in the case of a color image, the one-dimensional lightness (red, blue, and green gray values are used as the color information. For example) can be used. Then, the edge detection unit 26 detects a change position 48.1 in the y direction that causes a sudden change in the calculated color information histogram 46.1.

このような手順によって、エッジ検出部26は、x方向の走査位置40.1と、y方向の変化位置48.1との交差点であるエッジ位置44.1を検出し、このエッジ位置44.1の座標(x,y)を取得する。 By such a procedure, the edge detection unit 26 detects the edge position 44.1 which is the intersection of the scanning position 40.1 in the x direction and the change position 48.1 in the y direction, and this edge position 44.1. The coordinates (x 1 , y 1 ) are acquired.

続いて、エッジ検出部26は、x方向の次の走査位置40.2を中心として、所定幅をもつ領域42.2を定義する。そして、エッジ検出部26は、上述したのと同様に、色情報ヒストグラム46.2を算出する。さらに、エッジ検出部26は、この算出された色情報ヒストグラム46.2において、急激な変化を生じるy方向の変化位置48.2を検出する。エッジ検出部26は、このx方向の走査位置40.2およびy方向の変化位置48.2から、エッジ位置44.2を検出し、その座標(x,y)を取得する。 Subsequently, the edge detection unit 26 defines a region 42.2 having a predetermined width around the next scanning position 40.2 in the x direction. Then, the edge detection unit 26 calculates the color information histogram 46.2 as described above. Further, the edge detection unit 26 detects a change position 48.2 in the y direction that causes a sudden change in the calculated color information histogram 46.2. The edge detection unit 26 detects the edge position 44.2 from the scan position 40.2 in the x direction and the change position 48.2 in the y direction, and acquires the coordinates (x 2 , y 2 ).

以下同様にして、エッジ検出部26は、x方向に順次走査を行なって、複数のエッジ位置からなるエッジ位置群44を検出し、各エッジ位置を示す座標からなる座標群を取得する。   Similarly, the edge detector 26 sequentially scans in the x direction, detects an edge position group 44 composed of a plurality of edge positions, and acquires a coordinate group composed of coordinates indicating each edge position.

なお、エッジ検出部26は、入出力部18(図1)を介して与えられるマスク領域(図示しない)に従い、画像IMGの全領域ではなく、特定の領域のみに対してエッジ位置の検出を行なうことも可能である。   The edge detection unit 26 detects an edge position only for a specific region, not the entire region of the image IMG, according to a mask region (not shown) given via the input / output unit 18 (FIG. 1). It is also possible.

このようにしてエッジ検出部26により取得された座標群は、CPU10へ出力される。   The coordinate group acquired by the edge detection unit 26 in this way is output to the CPU 10.

(近似直線の算出処理)
図3は、CPU10における近似直線の算出処理の概要を説明するための図である。なお、図3は、画像メモリ24(図1)に格納される画像IMGを模式的に記載したものである。
(Approximate line calculation process)
FIG. 3 is a diagram for explaining the outline of the approximate straight line calculation process in the CPU 10. FIG. 3 schematically shows the image IMG stored in the image memory 24 (FIG. 1).

図3を参照して、画像IMGは、直線形状部位を有する対象物OBJを撮影したものである。一例として、エッジ検出部26は、予め設定されたマスク領域50内においてエッジ検出を実行し、エッジ位置a〜eにそれぞれ対応する座標a〜eを取得しているものとする。このとき、エッジ検出部26は、対象物OBJの直線状の輪郭線EDG上にエッジ位置a〜dを検出する一方、対象物OBJの背景にある汚れなどのノイズ領域52をエッジ位置eであると誤検出しているとする。CPU10は、このエッジ位置a〜eにそれぞれ対応する座標a〜eに基づいて、最小二乗法に従って近似直線を算出し、算出した近似直線を対象物OBJの輪郭線EDGとみなす。   Referring to FIG. 3, an image IMG is an image of an object OBJ having a linear shape part. As an example, it is assumed that the edge detection unit 26 performs edge detection in a preset mask region 50 and acquires coordinates a to e corresponding to the edge positions a to e, respectively. At this time, the edge detection unit 26 detects the edge positions a to d on the linear outline EDG of the object OBJ, while the noise region 52 such as dirt on the background of the object OBJ is the edge position e. Is erroneously detected. The CPU 10 calculates an approximate line according to the least square method based on the coordinates a to e corresponding to the edge positions a to e, respectively, and regards the calculated approximate line as the outline EDG of the object OBJ.

しかしながら、このエッジ位置eは、輪郭線EDGから大きくずれた「外れ値」であり、このような座標を含んで算出した近似直線は、本質的に大きな誤差を含む。そこで、CPU10は、このような外れ値を効率的に取除いた上で、近似直線を算出する。   However, the edge position e is an “outlier” greatly deviating from the contour line EDG, and the approximate straight line calculated including such coordinates essentially includes a large error. Therefore, the CPU 10 calculates an approximate straight line after efficiently removing such outliers.

図4は、CPU10における近似直線算出に係る制御構造を示すフローチャートである。   FIG. 4 is a flowchart showing a control structure related to approximate straight line calculation in the CPU 10.

図4を参照して、CPU10は、まず、エッジ検出部26により検出されたエッジ位置を示す座標からなる座標群を取得する(ステップS2)。そして、CPU10は、所定の規則に従って座標群から3個以上の座標を選択する(ステップS4)。続いて、CPU10は、選択した座標について、同一直線上に配置される度合を示す評価値を算出する(ステップS6)。すなわち、CPU10は、選択した座標についての評価値を後述する方法に従って算出する。そして、CPU10は、当該選択した座標の各々と対応付けて、算出した評価値を累積加算する(ステップS8)。   With reference to FIG. 4, the CPU 10 first acquires a coordinate group including coordinates indicating the edge position detected by the edge detection unit 26 (step S <b> 2). Then, the CPU 10 selects three or more coordinates from the coordinate group according to a predetermined rule (step S4). Then, CPU10 calculates the evaluation value which shows the degree arrange | positioned on the same straight line about the selected coordinate (step S6). That is, the CPU 10 calculates an evaluation value for the selected coordinates according to a method described later. Then, the CPU 10 accumulates and adds the calculated evaluation values in association with each of the selected coordinates (step S8).

さらに、CPU10は、座標群を構成する各座標が互いに同一回数だけ選択されたか否かを判断する(ステップS10)。座標群を構成する各座標が互いに同一回数だけ選択されていない場合(ステップS10においてNOの場合)には、CPU10は、上述したステップS4〜S10を繰返し実行する。   Further, the CPU 10 determines whether or not the coordinates constituting the coordinate group have been selected the same number of times (step S10). When the coordinates constituting the coordinate group are not selected the same number of times (NO in step S10), CPU 10 repeatedly executes steps S4 to S10 described above.

座標群を構成する各座標が互いに同一回数だけ選択されていた場合(ステップS10においてYESの場合)には、CPU10は、累積加算された各座標の評価値(累積値)に基づいて、座標群から同一直線上に配置される度合が相対的に高い複数の座標を抽出する(ステップS12)。そして、CPU10は、抽出した複数の座標に基づいて、最小二乗法に従って近似直線を算出する(ステップS14)。なお、最小二乗法に従う近似直線の算出は周知の方法であるので、詳細な説明は省略する。さらに、CPU10は、その算出した近似直線を表示装置4や外部機器6へ出力し(ステップS16)、処理を終了する。   When the coordinates constituting the coordinate group have been selected the same number of times (YES in step S10), the CPU 10 determines the coordinate group based on the evaluation value (cumulative value) of each coordinate that has been cumulatively added. To extract a plurality of coordinates having a relatively high degree of arrangement on the same straight line (step S12). Then, the CPU 10 calculates an approximate straight line according to the least square method based on the extracted plurality of coordinates (step S14). The calculation of the approximate straight line according to the least square method is a well-known method, and thus detailed description thereof is omitted. Further, the CPU 10 outputs the calculated approximate straight line to the display device 4 and the external device 6 (step S16), and ends the process.

上述したように、本発明によれば、各座標と対応付けて評価値を累積加算するので、各座標は互いに同一回数だけ選択されなければならない。そこで、CPU10は、所定規則に従って、座標群から3個以上の座標の組合せを順次選択する。   As described above, according to the present invention, since the evaluation values are cumulatively added in association with each coordinate, each coordinate must be selected the same number of times. Therefore, the CPU 10 sequentially selects combinations of three or more coordinates from the coordinate group according to a predetermined rule.

一般的には、n個の座標を含む座標群から異なるr個の座標を選ぶ組合せは、nCr=n!/{r!×(n−r)!}通り存在する。このすべての組合せについて見ると、各座標は、いずれもnCr×r/n回選択されることになる。したがって、座標群を構成する各座標が互いに同一回数だけ選択される一例として、CPU10は、座標群から3個以上の座標を選ぶすべての組合せに対して、上述のステップS6およびS8を実行する。   In general, the combination of selecting different r coordinates from a group of coordinates including n coordinates is nCr = n! / {R! × (n−r)! } There are streets. Looking at all the combinations, each coordinate is selected nCr × r / n times. Therefore, as an example in which the coordinates constituting the coordinate group are selected the same number of times, the CPU 10 executes the above-described steps S6 and S8 for all combinations in which three or more coordinates are selected from the coordinate group.

以下では、理解を容易にするために、評価値を算出するために選択される座標の数が3個である場合について例示する。   In the following, in order to facilitate understanding, a case where the number of coordinates selected for calculating the evaluation value is three will be exemplified.

(評価値の算出処理および累積加算処理)
CPU10は、選択する3個の座標に対して、同一直線上に配置される度合を示す評価値を算出する。
(Evaluation value calculation processing and cumulative addition processing)
CPU10 calculates the evaluation value which shows the degree arrange | positioned on the same straight line with respect to three coordinates to select.

図5は、評価値の算出に係る処理の一例を説明するための図である。
図5(a)は、図3に示す座標a、座標cおよび座標eに対して評価値を算出する場合である。
FIG. 5 is a diagram for explaining an example of processing related to calculation of an evaluation value.
FIG. 5A shows a case where evaluation values are calculated for the coordinates a, coordinates c, and coordinates e shown in FIG.

図5(b)は、図3に示す座標a、座標cおよび座標dに対して評価値を算出する場合である。   FIG. 5B shows a case where evaluation values are calculated for the coordinates a, coordinates c, and coordinates d shown in FIG.

図5(a)および図5(b)を参照して、CPU10は、選択した3個の座標のうち、2個の座標を含む直線を規定する。そして、CPU10は、残余の座標と当該直線との距離に基づいて評価値を算出する。すなわち、残余の座標と当該直線との距離が小さいほど、選択された3個の座標は、同一直線上に配置される度合が高いと言える。   With reference to FIG. 5A and FIG. 5B, the CPU 10 defines a straight line including two coordinates among the selected three coordinates. Then, the CPU 10 calculates an evaluation value based on the distance between the remaining coordinates and the straight line. That is, it can be said that the smaller the distance between the remaining coordinates and the straight line, the higher the selected three coordinates are arranged on the same straight line.

図5(a)を参照して、外れ値である座標eを含む場合には、座標aおよび座標eを含む直線60aeと残余の座標である座標cとの距離Lは、比較的大きな値となる。   Referring to FIG. 5A, when a coordinate e that is an outlier is included, the distance L between the straight line 60ae including the coordinate a and the coordinate e and the coordinate c that is the remaining coordinate is a relatively large value. Become.

一方、図5(b)を参照して、いずれも対象物OBJの輪郭線EDGに沿って検出された座標a、座標cおよび座標dからなる場合には、座標aおよび座標dを含む直線60adと残余の座標である座標cとの距離は、略ゼロとなる。   On the other hand, referring to FIG. 5B, in the case where each of the coordinates consists of coordinates a, coordinates c and coordinates d detected along the contour line EDG of the object OBJ, a straight line 60ad including the coordinates a and coordinates d. And the coordinate c which is the remaining coordinates are substantially zero.

そこで、この発明の実施の形態1においては、同一直線上に配置される度合が大きいほど、高い値をとる評価値を採用する。具体的には、選択される3個の座標を、座標i(x,y)、座標j(x,y)、座標k(x,y)とすると、座標iおよび座標kを含む直線と座標jとの距離Lijkについて座標iから座標kまでの距離で規格化して、(1)式に示す評価値Vijkを採用する。 Therefore, in Embodiment 1 of the present invention, an evaluation value that takes a higher value as the degree of arrangement on the same straight line is larger is adopted. Specifically, assuming that the three selected coordinates are coordinates i (x i , y i ), coordinates j (x j , y j ), and coordinates k (x k , y k ), coordinates i and coordinates The distance L ijk between the straight line including k and the coordinate j is normalized by the distance from the coordinate i to the coordinate k, and the evaluation value V ijk shown in the equation (1) is adopted.

Figure 2007249555
Figure 2007249555

この評価値Vijkは、座標i、座標j、座標kが同一直線上に配置される場合において、最大値である「1」をとる。なお、座標i、座標j、座標kの配置順はいずれでもよく、たとえば座標上において、座標jが座標iと座標kとの間に配置されていなくともよい。 This evaluation value V ijk takes a maximum value of “1” when the coordinates i, j, and k are arranged on the same straight line. Note that the arrangement order of the coordinates i, the coordinates j, and the coordinates k may be any. For example, the coordinates j do not have to be arranged between the coordinates i and k.

そして、CPU10は、選択された座標i、座標j、座標kとそれぞれ対応付けて評価値Vijkをそれぞれ累積値P(i)、P(j)、P(k)に累積加算する。すべての組合せに対する評価値Vijkの算出、および評価値の加算が終了すると、CPU10は、座標群の中から累積値が相対的に高い座標を抽出する。一例として、座標群に含まれる座標のうち累積値が上位から所定数にある座標を抽出してもよい。 Then, the CPU 10 accumulates and adds the evaluation values V ijk to the accumulated values P (i), P (j), and P (k) in association with the selected coordinates i, j, and k, respectively. When the calculation of the evaluation values V ijk for all the combinations and the addition of the evaluation values are completed, the CPU 10 extracts coordinates having a relatively high cumulative value from the coordinate group. As an example, out of the coordinates included in the coordinate group, coordinates having a predetermined number of cumulative values from the top may be extracted.

図6は、図4に示すステップS4〜S10における処理をより具体的に実現するためのフローチャートである。なお、座標群には、座標1,座標2,・・・,座標nまでのn個の座標が含まれるとし、各座標は、(x,y;但し、1≦i≦n)で表されるとする。 FIG. 6 is a flowchart for more specifically realizing the processing in steps S4 to S10 shown in FIG. It is assumed that the coordinate group includes n coordinates from coordinate 1, coordinate 2,..., Coordinate n, and each coordinate is (x i , y i ; 1 ≦ i ≦ n) Let it be represented.

図6を参照して、CPU10は、累積値P(i)(但し、1≦i≦n)にゼロを代入して累積値を初期化する(ステップS100)。続いて、CPU10は、ループカウンタiに1を代入して初期化し(ステップS102)、ループカウンタjにループカウンタiの値に1を加算した値を代入し(ステップS104)、ループカウンタkにループカウンタjの値に1を加算した値を代入する(ステップS106)。   Referring to FIG. 6, CPU 10 initializes the accumulated value by substituting zero into accumulated value P (i) (where 1 ≦ i ≦ n) (step S100). Subsequently, the CPU 10 initializes the loop counter i by substituting 1 for the loop counter i (step S102), substitutes a value obtained by adding 1 to the value of the loop counter i for the loop counter j (step S104), and loops to the loop counter k. A value obtained by adding 1 to the value of the counter j is substituted (step S106).

CPU10は、エッジ検出部26により検出された座標群から、座標(x,y),(x,y),(x,y)を取得し、評価値Vijkを算出する(ステップS108)。さらに、CPU10は、算出した評価値Vijkをそれぞれ累積値P(i),P(j),P(k)に累積加算する(ステップS110)。 The CPU 10 acquires the coordinates (x i , y i ), (x j , y j ), (x k , y k ) from the coordinate group detected by the edge detection unit 26, and calculates the evaluation value V ijk . (Step S108). Further, the CPU 10 cumulatively adds the calculated evaluation value V ijk to the cumulative values P (i), P (j), and P (k), respectively (step S110).

そして、CPU10は、ループカウンタkに1を加算し(ステップS112)、ループカウンタkが座標数nを超過していないか否かを判断する(ステップS114)。ループカウンタkが座標数nを超過していない場合(ステップS114においてNOの場合)には、CPU10は、ステップS108〜S114を繰返し実行する。   Then, the CPU 10 adds 1 to the loop counter k (step S112), and determines whether or not the loop counter k has exceeded the coordinate number n (step S114). When the loop counter k does not exceed the coordinate number n (NO in step S114), the CPU 10 repeatedly executes steps S108 to S114.

一方、ループカウンタkが座標数nを超過している場合(ステップS114においてYESの場合)には、CPU10は、ループカウンタjに1を加算し(ステップS116)、ループカウンタjが(座標数n−1)を超過していないか否かを判断する(ステップS118)。ループカウンタjが(座標数n−1)を超過していない場合(ステップS118においてNOの場合)には、CPU10は、ステップS106〜S118を繰返し実行する。   On the other hand, when the loop counter k exceeds the coordinate number n (YES in step S114), the CPU 10 adds 1 to the loop counter j (step S116), and the loop counter j (the coordinate number n). -1) is determined whether it has not been exceeded (step S118). If loop counter j does not exceed (number of coordinates n−1) (NO in step S118), CPU 10 repeatedly executes steps S106 to S118.

一方、ループカウンタjが(座標数n−1)を超過している場合(ステップS118においてYESの場合)には、CPU10は、ループカウンタiに1を加算し(ステップS120)、ループカウンタiが(座標数n−2)を超過していないか否かを判断する(ステップS122)。ループカウンタiが(座標数n−2)を超過していない場合(ステップS122においてNOの場合)には、CPU10は、ステップS104〜S122を繰返し実行する。   On the other hand, when the loop counter j exceeds (the number of coordinates n−1) (YES in step S118), the CPU 10 adds 1 to the loop counter i (step S120), and the loop counter i is It is determined whether or not (the number of coordinates n−2) has been exceeded (step S122). When loop counter i does not exceed (number of coordinates n−2) (NO in step S122), CPU 10 repeatedly executes steps S104 to S122.

一方、ループカウンタiが(座標数n−2)を超過している場合(ステップS122においてYESの場合)には、CPU10は、図4に示すステップS12以降の処理を実行する。   On the other hand, when the loop counter i exceeds (the number of coordinates n−2) (YES in step S122), the CPU 10 executes the processing after step S12 shown in FIG.

上述した処理の内容をより理解できるように、一例として図3に示すエッジ位置a〜eに対して、本発明を適用した場合の処理結果を表1に示す。なお、エッジ位置a〜eの座標は、一例として、それぞれ(x,y)=(1,0),(x,y)=(2,0),(x,y)=(3,0),(x,y)=(4,0),(x,y)=(5,−1)とした。 Table 1 shows the processing results when the present invention is applied to the edge positions a to e shown in FIG. The coordinates of the edge positions a to e are, for example, (x a , y a ) = (1, 0), (x b , y b ) = (2, 0), (x c , y c ), respectively. = (3, 0), (x d , y d ) = (4, 0), (x e , y e ) = (5, −1).

Figure 2007249555
Figure 2007249555

表1を参照して、5個のエッジ位置から3個を選ぶ組合せは、=10通りとなる。そして、CPU10は、各組合せに対して評価値Vを算出する。なお、表中において「○」印は、対応する座標が評価値Vの算出に用いられたことを示し、その右側の値は、そのときの評価値Vを示す。 Referring to Table 1, there are 5 C 3 = 10 combinations for selecting three from the five edge positions. Then, the CPU 10 calculates an evaluation value V for each combination. In the table, “◯” indicates that the corresponding coordinate was used for calculation of the evaluation value V, and the value on the right side indicates the evaluation value V at that time.

各座標a〜eは、それぞれ6回ずつ選択され、各選択時において算出された評価値Vの累積値Pは、表1の最下欄に示された値となる。特に、外れ値である座標eについては、いずれの組合せにおいても相対的に低い評価値Vが算出される一方、それ以外の座標a〜dのみからなる組合せでは、高い評価値Vが算出されている。   Each of the coordinates a to e is selected six times, and the accumulated value P of the evaluation values V calculated at the time of each selection is the value shown in the bottom column of Table 1. In particular, for the coordinate e which is an outlier, a relatively low evaluation value V is calculated in any combination, while in a combination consisting only of the other coordinates a to d, a high evaluation value V is calculated. Yes.

そのため、座標eにおける累積値Pは、座標a〜dのいずれにおける累積値Pに対しても、大幅に低い値となっている。そして、座標a〜eのうち、たとえば累積値Pの上位3個までを抽出する場合には、座標a〜cが抽出されることになる。この結果、外れ値である座標eが取除かれ、高い精度の近似直線が算出されることがわかる。   For this reason, the cumulative value P at the coordinate e is significantly lower than the cumulative value P at any of the coordinates a to d. Then, when extracting, for example, the top three of the accumulated values P among the coordinates a to e, the coordinates a to c are extracted. As a result, it is understood that the coordinate e which is an outlier is removed and an approximate straight line with high accuracy is calculated.

(比較例)
図7は、本発明の効果を従来のLTS推定法における効果と比較する比較例である。
(Comparative example)
FIG. 7 is a comparative example comparing the effect of the present invention with the effect of the conventional LTS estimation method.

図7(a)は、従来のLTS推定法による近似直線算出を示す。
図7(b)は、本発明による近似直線算出を示す。
FIG. 7A shows approximate line calculation by a conventional LTS estimation method.
FIG. 7B shows approximate straight line calculation according to the present invention.

なお、図7(a)および図7(b)においては、同一の画像に対して直線算出処理が行なわれており、マスク領域50内において検出された32個のエッジ位置(+マーク)は、互いに同一である。そして、従来のLTS推定法(図7(a))においては、各エッジ位置から暫定近似直線までの距離(残差)が小さい順に全体の50%(16個)を抽出して近似直線を算出した。一方、本発明の場合(図7(b))においては、累積値が大きい順に全体の50%(16個)を抽出して近似直線を算出した。なお、図7(a)および図7(b)においては、近似直線の算出に使用されたエッジ位置は、その+マークの中心に○印をさらに付加している。   7A and 7B, straight line calculation processing is performed on the same image, and the 32 edge positions (+ marks) detected in the mask area 50 are: Are identical to each other. In the conventional LTS estimation method (FIG. 7A), 50% (16 pieces) of the whole are extracted in order from the smallest distance (residual) from each edge position to the provisional approximate line to calculate the approximate line. did. On the other hand, in the case of the present invention (FIG. 7B), approximate straight lines were calculated by extracting 50% (16 pieces) of the whole in descending order of the cumulative value. In FIG. 7A and FIG. 7B, the edge position used for calculating the approximate straight line is further added with a circle mark at the center of the + mark.

図7(a)を参照して、マスク領域50の紙面右上において、対象物OBJの輪郭線以外の位置が集中的にエッジ位置として誤検出されている。このように対象物OBJの輪郭線以外で検出されたエッジ位置は、本来的に外れ値であるが、その数が多いため、結果的に外れ値が優勢となっている。そのため、対象物OBJの輪郭線を正常に検出しているエッジ位置が取除かれて、誤った近似直線60aが算出されていることがわかる。   With reference to FIG. 7A, in the upper right of the mask area 50 in the drawing, positions other than the contour line of the object OBJ are intensively erroneously detected as edge positions. As described above, the edge positions detected outside the contour line of the object OBJ are inherently outliers. However, since the number of the edge positions is large, the outliers are dominant as a result. Therefore, it can be seen that the edge position where the contour line of the object OBJ is normally detected is removed, and an incorrect approximate line 60a is calculated.

一方、図7(b)を参照して、本発明を適用した場合には、マスク領域50の紙面右上において集中的に誤検出されている外れ値のエッジ位置がすべて取除かれていることがわかる。この結果、算出される近似直線60bは、対象物OBJの輪郭線と略一致した、正確なものとなる。   On the other hand, referring to FIG. 7B, when the present invention is applied, all the outlier edge positions that have been erroneously detected in the upper right of the mask area 50 are removed. Recognize. As a result, the calculated approximate straight line 60b is an accurate one that substantially matches the contour line of the object OBJ.

この発明の実施の形態1によれば、座標群から選択された3個の座標の組合せ毎に、同一直線上に配置される度合を示す評価値が算出される。このように、評価値は、座標群全体から算出される暫定近似直線に基づいて算出されるのではなく、選択された3個の座標の間でミクロ的に算出される。外れ値である座標は、いずれの組合せにおいても、同一直線上に配置される度合が低い一方、正常な座標は、正常な座標同士の組合せにおいて、同一直線上に配置される度合が高くなる。その結果、座標の各々と対応付けて評価値が累積されることで、正常な座標と外れ値の座標との差が顕著に表れるため、外れ値を効率的に取除くことができる。よって、座標群に含まれる座標から外れ値を効率的に取除いて、精度の高い近似直線を算出できる画像処理装置を実現できる。   According to Embodiment 1 of the present invention, an evaluation value indicating the degree of arrangement on the same straight line is calculated for each combination of three coordinates selected from the coordinate group. Thus, the evaluation value is not calculated based on the provisional approximate straight line calculated from the entire coordinate group, but is calculated microscopically among the three selected coordinates. Coordinates that are outliers are less likely to be placed on the same straight line in any combination, while normal coordinates are more likely to be placed on the same straight line in a combination of normal coordinates. As a result, since the evaluation values are accumulated in association with each of the coordinates, the difference between the normal coordinates and the coordinates of the outlier appears significantly, so that the outlier can be efficiently removed. Therefore, it is possible to realize an image processing apparatus that can efficiently remove outliers from coordinates included in a coordinate group and calculate an approximate straight line with high accuracy.

(変形例1)
上述したこの発明の実施の形態1においては、座標群から異なる3個の座標を選んで評価値を算出する場合について説明したが、4個以上の座標を選んで評価値を算出してもよい。この場合には、選ばれた4個以上の座標のうち、2個の座標を含む直線を規定し、当該直線に対する残余の各座標との距離の積算値に基づいて評価値を算出する。
(Modification 1)
In the first embodiment of the present invention described above, the case has been described in which the evaluation value is calculated by selecting three different coordinates from the coordinate group, but the evaluation value may be calculated by selecting four or more coordinates. . In this case, a straight line including two coordinates among the four or more selected coordinates is defined, and an evaluation value is calculated based on an integrated value of distances from the remaining coordinates with respect to the straight line.

すなわち、選択されるr(r≧4)個の座標を、座標i(x,y)、座標l(x,y)、・・・、座標m(x,y)、座標k(x,y)とすると、上述した(1)式を拡張して、(2)式のような評価値Vi〜kが算出できる。 That is, r (r ≧ 4) selected coordinates are represented by coordinates i (x i , y i ), coordinates l (x l , y l ),..., Coordinates m (x m , y m ), If the coordinates are k (x k , y k ), the evaluation values V i to k like the equation (2) can be calculated by extending the above equation (1).

Figure 2007249555
Figure 2007249555

この評価値Vi〜kについても、同一直線上に配置される度合が大きいほど高い値をとる。評価値Vi〜kの算出方法を除いては、上述したこの発明の実施の形態1と同様であるので、詳細な説明は繰返さない。 The evaluation values V i to k also take higher values as the degree of arrangement on the same straight line increases. Except for the method of calculating evaluation values V i to k , it is the same as that of the first embodiment of the present invention described above, and therefore detailed description will not be repeated.

この発明の実施の形態1の変形例1によれば、評価値を算出するために座標群から選ぶ座標の数を4個以上に拡張できる。そのため、その選ばれる座標の個数を適切に選択することで、座標群から異なる3個の座標を選ぶ場合に比較して、組合せ数をより少なくできる。これにより、上述したこの発明の実施の形態1における効果に加えて、その評価値を算出するための処理回数を低減できるので、多数の座標からなる座標群に対して本発明を適用する場合においても、その処理速度を維持できる。   According to the first modification of the first embodiment of the present invention, the number of coordinates selected from the coordinate group for calculating the evaluation value can be expanded to four or more. Therefore, by appropriately selecting the number of selected coordinates, the number of combinations can be reduced as compared with the case of selecting three different coordinates from the coordinate group. As a result, in addition to the effects of the first embodiment of the present invention described above, the number of processing for calculating the evaluation value can be reduced. Therefore, when the present invention is applied to a coordinate group consisting of a large number of coordinates However, the processing speed can be maintained.

(変形例2)
上述したこの発明の実施の形態1およびその変形例1においては、選択された座標のうち2個の座標を含む直線を規定し、残余の座標の各々と当該規定された直線との距離に基づいて評価値を算出する構成について説明した。一方、この発明の実施の形態1の変形例2においては、選択された座標についての相関係数に基づいて評価値を算出する構成について説明する。
(Modification 2)
In Embodiment 1 of the present invention described above and Modification 1 thereof, a straight line including two coordinates among the selected coordinates is defined, and based on the distance between each of the remaining coordinates and the defined straight line. The configuration for calculating the evaluation value has been described. On the other hand, in Modification 2 of Embodiment 1 of the present invention, a configuration for calculating an evaluation value based on a correlation coefficient for a selected coordinate will be described.

評価値を算出するために選択されるr(r≧3)個以上の座標の組合せを、座標i(x,y;1≦i≦r)とすると、座標i(1≦i≦r)についての相関係数と一致する評価値Vを算出することができる。 If a combination of r (r ≧ 3) or more coordinates selected for calculating the evaluation value is a coordinate i (x i , y i ; 1 ≦ i ≦ r), the coordinate i (1 ≦ i ≦ r) The evaluation value V coinciding with the correlation coefficient can be calculated.

Figure 2007249555
Figure 2007249555

この評価値Vは、座標iについての相関係数と一致するので、座標の同一直線上に配置される度合に応じて、−1≦V≦1の範囲で変化し、いずれの座標も同一直線上に配置される場合には、最大値の「1」をとる。したがって、上述したこの発明の実施の形態1およびその変形例1と同様に、累積値の大きい順に所定の数の座標を抽出することで、近似直線を算出できる。   Since this evaluation value V coincides with the correlation coefficient for the coordinate i, it changes in the range of −1 ≦ V ≦ 1 depending on the degree of arrangement on the same straight line of coordinates, and all the coordinates are identical. When arranged on a line, the maximum value “1” is taken. Therefore, similar to Embodiment 1 of the present invention described above and Modification 1 thereof, an approximate straight line can be calculated by extracting a predetermined number of coordinates in descending order of the cumulative value.

この評価値の算出方法以外は、上述したこの発明の実施の形態1と同様であるので、詳細な説明は繰返さない。   Since the method other than the method of calculating the evaluation value is the same as that of the first embodiment of the present invention described above, detailed description will not be repeated.

この発明の実施の形態1の変形例2によれば、評価値を算出するために座標群から選ばれる座標の数にかかわらず同一の演算式を用いることができる。これにより、上述したこの発明の実施の形態1における効果に加えて、評価値の算出に係る処理を比較的自由に変更できるため、対象物の大きさや画像の品質(サイズや解像度)などに応じて、処理を最適化できる。   According to the second modification of the first embodiment of the present invention, the same arithmetic expression can be used regardless of the number of coordinates selected from the coordinate group in order to calculate the evaluation value. As a result, in addition to the effects of the first embodiment of the present invention described above, the processing related to the calculation of the evaluation value can be changed relatively freely. Process optimization.

[実施の形態2]
上述のこの発明の実施の形態1およびその変形例においては、2次元画像を対象として近似直線を算出する構成について説明した。一方、この発明の実施の形態2においては、3次元画像を対象として近似直線を算出する構成について説明する。3次元画像には、一例として、いわゆるステレオ画像などが含まれ、3次元の値で各座標が定義される。
[Embodiment 2]
In the above-described first embodiment of the present invention and its modifications, the configuration for calculating an approximate line for a two-dimensional image has been described. On the other hand, in Embodiment 2 of the present invention, a configuration for calculating an approximate straight line for a three-dimensional image will be described. As an example, the three-dimensional image includes a so-called stereo image, and each coordinate is defined by a three-dimensional value.

図8は、この発明の実施の形態2に従う近似直線算出装置を備える画像処理装置100#の概略構成図である。   FIG. 8 is a schematic configuration diagram of an image processing device 100 # provided with the approximate straight line calculation device according to the second embodiment of the present invention.

図8を参照して、画像処理装置100#は、2つのカメラ2.1,2.2により撮影された2次元画像をそれぞれ取得して3次元画像を生成すると同時に、3次元画像上のエッジ位置に基づいて近似直線を算出する。そして、画像処理装置100#は、図1に示すこの発明の実施の形態1に従う画像処理装置100において、画像入力部20、フィルタ22、画像メモリ24に代えて、それぞれ画像入力部20.1,20.2、フィルタ22.1,22.2、画像メモリ24.1,24.2を配置し、エッジ検出部26および画像出力部28に代えて、それぞれエッジ検出部26および画像出力部28を配置したものである。   Referring to FIG. 8, image processing apparatus 100 # obtains two-dimensional images taken by two cameras 2.1 and 2.2 to generate a three-dimensional image, and at the same time, an edge on the three-dimensional image. An approximate straight line is calculated based on the position. Then, in image processing apparatus 100 according to the first embodiment of the present invention shown in FIG. 1, image processing apparatus 100 # replaces image input unit 20, filter 22, and image memory 24 with image input unit 20.1, 20.2, filters 22.1 and 22.2 and image memories 24.1 and 24.2 are arranged, and instead of the edge detection unit 26 and the image output unit 28, an edge detection unit 26 and an image output unit 28 are respectively provided. It is arranged.

カメラ2.1および2.2は、互いに異なる方向から同一の対象物を撮影するように配置される。その他の点については、カメラ2と同様であるので、詳細な説明は繰返さない。フィルタ22.1,22.2および画像メモリ24.1,24.2は、それぞれフィルタ22および画像メモリ24と同様であるので、詳細な説明は繰返さない。   The cameras 2.1 and 2.2 are arranged so as to photograph the same object from different directions. Since the other points are the same as those of camera 2, detailed description will not be repeated. Filters 22.1 and 22.2 and image memories 24.1 and 24.2 are similar to filter 22 and image memory 24, respectively, and thus detailed description thereof will not be repeated.

画像出力部28#は、カメラ2.1,2.2により撮影された2つの画像を対比し、3次元空間中に対象物が描画された3次元画像を生成する。具体的には、画像出力部28#は、一方の画像の各画素について、他方のいずれの画素に対応するのかを算出し、この画素のずれを画素情報とする視差画像を生成し、この生成した視差画像に基づいて、3次元画像を生成する。   The image output unit 28 # compares the two images taken by the cameras 2.1 and 2.2 and generates a three-dimensional image in which the object is drawn in the three-dimensional space. Specifically, the image output unit 28 # calculates which of the pixels of one image corresponds to which of the other pixels, generates a parallax image using the pixel shift as pixel information, and generates this A three-dimensional image is generated based on the parallax image.

エッジ検出部26#は、カメラ2.1および2.2により撮影された画像のそれぞれにおいてエッジ位置を検出するとともに、上述した画像出力部28#と同様に、2つの画像の対比に基づいて画素のずれを算出し、検出したエッジ位置の3次元空間中における座標を算出する。そして、エッジ検出部26#は、検出した複数のエッジ位置を座標群としてCPU10および画像メモリ24.1,24.2へ出力する。   The edge detection unit 26 # detects an edge position in each of the images taken by the cameras 2.1 and 2.2, and similarly to the image output unit 28 # described above, the pixel is based on the comparison between the two images. And the coordinates of the detected edge position in the three-dimensional space are calculated. Then, the edge detection unit 26 # outputs the detected plurality of edge positions as a coordinate group to the CPU 10 and the image memories 24.1 and 24.2.

その他については、この発明の実施の形態1に従う画像処理装置100と同様であるので、詳細な説明は繰返さない。   Others are similar to those of image processing apparatus 100 according to the first embodiment of the present invention, and thus detailed description will not be repeated.

このような3次元画像に対して本発明を適用する場合には、評価値の算出に係る数式を以下のように変更する点を除いて、上述したこの発明の実施の形態1に従う画像処理装置100における処理と同一であるので、詳細な説明は繰返さない。   When the present invention is applied to such a three-dimensional image, the image processing apparatus according to the first embodiment of the present invention described above, except that the mathematical formula for calculating the evaluation value is changed as follows. Since it is the same as the process in 100, detailed description will not be repeated.

(評価値の算出処理)
上述したこの発明の実施の形態1と同様に、座標群から選択された3個以上の座標のうち、2個の座標を含む直線を規定するとともに、残余の座標と当該規定された直線との距離に基づいて評価値を算出する。
(Evaluation value calculation process)
As in the first embodiment of the present invention described above, a straight line including two coordinates among the three or more coordinates selected from the coordinate group is defined, and the remaining coordinates and the defined straight line are defined. An evaluation value is calculated based on the distance.

まず、座標群から3個の座標が選択される場合には、選択される座標を座標i(x,y,z)、座標j(x,y,z)、座標k(x,y,z)とすると、(1)式を拡張して(4)式のような3次元座標についての評価値Vijkを算出できる。 First, when three coordinates are selected from the coordinate group, the selected coordinates are coordinate i (x i , y i , z i ), coordinate j (x j , y j , z j ), coordinate k. Assuming that (x k , y k , z k ), it is possible to calculate the evaluation value V ijk for the three-dimensional coordinates like the equation (4) by expanding the equation (1).

Figure 2007249555
Figure 2007249555

さらに、座標群から4個以上の座標が選択される場合には、選択されるr(r≧4)個の座標を、座標i(x,y,z)、座標l(x,y,z)、・・・、座標m(x,y,z)、座標k(x,y,z)とすると、上述した(4)式を拡張して、(5)式のように評価値Vi〜kを算出できる。 Further, when four or more coordinates are selected from the coordinate group, the selected r (r ≧ 4) coordinates are represented by coordinates i (x i , y i , z i ) and coordinates l (x l , Y l , z l ),..., Coordinates m (x m , y m , z m ), coordinates k (x k , y k , z k ), the above equation (4) is expanded. Evaluation values V i to k can be calculated as shown in Equation (5).

Figure 2007249555
Figure 2007249555

この評価値Vijkおよび評価値Vi〜kについても、同一直線上に配置される度合が大きいほど高い値をとる。CPU10は、このように算出される3次元座標についての評価値を用いて、上述の処理と同様に、近似直線を算出する。 The evaluation value V ijk and the evaluation values V i to k take higher values as the degree of arrangement on the same straight line is larger. The CPU 10 calculates an approximate straight line using the evaluation values for the three-dimensional coordinates calculated in this way, as in the above-described processing.

この発明の実施の形態2においては、この発明の実施の形態1における効果に加えて、今後ますます適用範囲の拡大が予想される3次元画像についても、精度の高い近似直線を算出できる。   In the second embodiment of the present invention, in addition to the effects of the first embodiment of the present invention, an approximate straight line with high accuracy can be calculated for a three-dimensional image that is expected to expand in the future.

(変形例)
さらに、上述したこの発明の実施の形態1の変形例2と同様に、選択された座標についての相関係数に基づいて評価値を算出することもできる。
(Modification)
Furthermore, as in the second modification of the first embodiment of the present invention described above, the evaluation value can be calculated based on the correlation coefficient for the selected coordinates.

具体的には、評価値を算出するために選択されるr(r≧3)個以上の座標を、座標i(x,y,z;1≦i≦r)とすると、2つの成分間(xy成分、yz成分、zx成分)における相関係数(Vxy,Vyz,Vzx)に基づいて、(6)式または(7)式にように、評価値Vを算出できる。 Specifically, when r (r ≧ 3) or more coordinates selected for calculating the evaluation value are coordinates i (x i , y i , z i ; 1 ≦ i ≦ r), Based on the correlation coefficients (V xy , V yz , V zx ) between the components (xy component, yz component, zx component), the evaluation value V can be calculated as in equation (6) or equation (7).

Figure 2007249555
Figure 2007249555

これらの式からわかるように、3つの成分についての相関係数を算出することはできないので、3次元の座標値のうち、いずれか2つの成分についての相関係数をそれぞれ算出した後、各相関係数から評価値Vを算出する。   As can be seen from these equations, since the correlation coefficients for the three components cannot be calculated, after calculating the correlation coefficients for any two of the three-dimensional coordinate values, An evaluation value V is calculated from the number of relations.

(6)式に示す評価値Vにおいては、座標の同一直線上に配置される度合に応じて、−3≦V≦3の範囲で変化し、いずれの座標も同一直線上に配置される場合には、最大値の「3」をとる。   In the evaluation value V shown in the expression (6), when the coordinates are arranged in the range of −3 ≦ V ≦ 3 according to the degree of arrangement on the same straight line of coordinates, any coordinate is arranged on the same straight line. Takes the maximum value of “3”.

一方、(7)式に示す評価値Vにおいては、座標の同一直線上に配置される度合に応じて、−1≦V≦1の範囲で変化し、いずれの座標も同一直線上に配置される場合には、最大値の「1」をとる。   On the other hand, the evaluation value V shown in the equation (7) changes in the range of −1 ≦ V ≦ 1 depending on the degree of arrangement on the same straight line of coordinates, and all the coordinates are arranged on the same straight line. In this case, the maximum value “1” is taken.

したがって、上述したこの発明の実施の形態2と同様に、累積加算後の累積値が大きい順に、所定の数の座標を抽出することで、近似直線を算出できる。この評価値の算出方法以外は、上述したこの発明の実施の形態2と同様であるので、詳細な説明は繰返さない。   Therefore, as in the second embodiment of the present invention described above, an approximate straight line can be calculated by extracting a predetermined number of coordinates in descending order of the cumulative value after cumulative addition. Except for the method of calculating the evaluation value, the method is the same as that of the second embodiment of the present invention described above, and the detailed description will not be repeated.

[その他の実施の形態]
上述した実施の形態の説明においては、エッジ検出部を備える画像処理装置を一例として示したが、エッジ検出部が必ずしも画像処理装置に含まれている必要はない。たとえば、外部装置により検出されたエッジ位置の座標を受けて、当該座標に基づいて近似直線を算出する近似直線算出装置を構成してもよい。
[Other embodiments]
In the description of the above-described embodiment, an image processing apparatus including an edge detection unit is shown as an example. However, the edge detection unit is not necessarily included in the image processing apparatus. For example, an approximate straight line calculation device that receives the coordinates of the edge position detected by the external device and calculates an approximate straight line based on the coordinates may be configured.

上述した実施の形態の説明においては、エッジ検出部が画像中の所定幅をもつ領域に対して色情報を累積してエッジ位置を検出する構成について説明したが、エッジ位置の検出方法は、これに限られず、周知のエッジ位置検出手段を適用することができる。さらに、エッジ位置を検出するための走査方向も対象物の直線形状部位の位置や方向などに応じて、たとえば画像の斜め方向に走査してもよい。   In the above description of the embodiment, the configuration has been described in which the edge detection unit accumulates color information for an area having a predetermined width in an image to detect the edge position. However, it is not limited to this, and a well-known edge position detecting means can be applied. Furthermore, the scanning direction for detecting the edge position may also be scanned, for example, in an oblique direction of the image in accordance with the position or direction of the linear shape portion of the object.

上述した実施の形態の説明においては、エッジ検出部により検出された座標群から選ばれる3個以上の座標の組合せのすべてに対して評価値を算出する構成について説明したが、必ずしもすべての組合せに対して評価値を算出する必要はない。   In the description of the above-described embodiment, the configuration in which the evaluation value is calculated for all the combinations of three or more coordinates selected from the coordinate group detected by the edge detection unit has been described. There is no need to calculate an evaluation value.

たとえば、画像上における距離が所定値(所定画素)以下となるように3個以上の座標を選択してもよい。このように選択された画素は互いに近接するため、より適切にその同一直線上に配置される度合を評価できる。   For example, three or more coordinates may be selected so that the distance on the image is a predetermined value (predetermined pixel) or less. Since the pixels selected in this manner are close to each other, it is possible to evaluate the degree of arrangement on the same straight line more appropriately.

また、各座標に対応するエッジ位置における色情報の変化度に応じて、評価値を算出するための座標の組合せを決定してもよい。具体的には、エッジ位置周辺における画素の「色距離」を評価し、色距離の小さい(色情報の変化が小さい)エッジ位置に対応する座標を、色距離の大きいエッジ位置に対応する座標と組合せるようにしてもよい。この「色距離」とは、互いに直交するように配置された赤軸,緑軸,青軸からなる3次元の色空間において、2つの画素の距離として規定される。このような組合せを採用することで、色距離が小さく信頼性の低い(誤検出された可能性の高い)座標と、色距離が小さく信頼性の高い座標との評価値の差がより顕著となるため、信頼性の低い座標が取除かれる割合が高まる。このため、より正確な近似直線を算出できる。   Further, a combination of coordinates for calculating an evaluation value may be determined according to the degree of change in color information at the edge position corresponding to each coordinate. Specifically, the “color distance” of the pixels around the edge position is evaluated, and the coordinates corresponding to the edge position having a small color distance (color information change is small) are defined as coordinates corresponding to the edge position having a large color distance. You may make it combine. The “color distance” is defined as a distance between two pixels in a three-dimensional color space composed of a red axis, a green axis, and a blue axis arranged so as to be orthogonal to each other. By adopting such a combination, the difference in evaluation value between coordinates with a small color distance and low reliability (highly likely to be erroneously detected) and coordinates with a small color distance and high reliability is more pronounced. Therefore, the rate at which coordinates with low reliability are removed increases. For this reason, a more accurate approximate straight line can be calculated.

今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は、上記した説明ではなく、特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。   The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.

この発明の実施の形態1に従う近似直線算出装置を備える画像処理装置の概略構成図である。It is a schematic block diagram of an image processing apparatus provided with the approximate line calculation apparatus according to Embodiment 1 of this invention. エッジ検出部におけるエッジ位置の検出処理の概要を説明するための図である。It is a figure for demonstrating the outline | summary of the detection process of the edge position in an edge detection part. CPUにおける近似直線の算出処理の概要を説明するための図である。It is a figure for demonstrating the outline | summary of the calculation process of the approximate line in CPU. CPUにおける近似直線算出に係る制御構造を示すフローチャートである。It is a flowchart which shows the control structure which concerns on the approximate line calculation in CPU. 評価値の算出に係る処理の一例を説明するための図である。It is a figure for demonstrating an example of the process which concerns on calculation of an evaluation value. 図4に示すステップS4〜S10における処理をより具体的に実現するためのフローチャートである。5 is a flowchart for more specifically realizing the processing in steps S4 to S10 shown in FIG. 本発明の効果を従来のLTS推定法における効果と比較する比較例である。It is a comparative example which compares the effect of this invention with the effect in the conventional LTS estimation method. この発明の実施の形態2に従う近似直線算出装置を備える画像処理装置の概略構成図である。It is a schematic block diagram of an image processing apparatus provided with the approximate line calculation apparatus according to Embodiment 2 of this invention.

符号の説明Explanation of symbols

2,2.1,2.2 カメラ、4 表示装置、6 外部機器、18 入出力部、20,20.1,20.2 画像入力部、22,22.1,22.2 フィルタ、24,24.1,24.2 画像メモリ、26,26# エッジ検出部、28,28# 画像出力部、30 バス、40.1,40.2 走査位置、42.1,42.2 領域、44 エッジ位置群、44.1,44.2 エッジ位置、46.1,46.2 色情報ヒストグラム、48.1,48.2 変化位置、50 マスク領域、52 ノイズ領域、60a,60b 近似直線、100 画像処理装置、EDG 輪郭線、IMG 画像、OBJ 対象物、P 累積値、V 評価値。   2, 2.1, 2.2 Camera, 4 Display device, 6 External device, 18 Input / output unit, 20, 20.1, 20.2 Image input unit, 22, 22.1, 22.2 Filter, 24, 24.1, 24.2 Image memory, 26, 26 # edge detection unit, 28, 28 # Image output unit, 30 bus, 40.1, 40.2 Scan position, 42.1, 42.2 area, 44 edge Position group, 44.1, 44.2 Edge position, 46.1, 46.2 Color information histogram, 48.1, 48.2 Change position, 50 Mask area, 52 Noise area, 60a, 60b Approximate line, 100 images Processing device, EDG contour, IMG image, OBJ object, P cumulative value, V evaluation value.

Claims (8)

画像の特定の位置を示す座標を4個以上含む座標群を取得する座標群取得手段と、
所定規則に従って、前記座標群から3個以上の座標を選択する座標選択手段と、
前記座標選択手段により選択された前記3個以上の座標について、同一直線上に配置される度合を示す評価値を算出する評価値算出手段と、
当該3個以上の座標の各々と対応付けて、前記評価値算出手段により算出される前記評価値を累積加算する評価値加算手段と、
前記座標群の各座標が互いに同一回数だけ選択されるように、前記座標選択手段、前記評価値算出手段および前記評価値加算手段における処理を繰返し実行させる繰返手段と、
前記評価値加算手段により累積加算された前記評価値に基づいて、前記座標群から同一直線上に配置される度合が相対的に高い複数の座標を抽出する抽出手段と、
前記抽出手段により抽出された複数の座標に基づいて近似直線を算出する近似直線算出手段とを備える、画像処理装置。
Coordinate group acquisition means for acquiring a coordinate group including four or more coordinates indicating a specific position of the image;
Coordinate selecting means for selecting three or more coordinates from the coordinate group according to a predetermined rule;
Evaluation value calculation means for calculating an evaluation value indicating the degree of arrangement on the same straight line for the three or more coordinates selected by the coordinate selection means;
An evaluation value adding means for accumulating the evaluation values calculated by the evaluation value calculating means in association with each of the three or more coordinates;
Repeating means for repeatedly executing the processes in the coordinate selecting means, the evaluation value calculating means, and the evaluation value adding means so that the coordinates of the coordinate group are selected the same number of times.
Extraction means for extracting a plurality of coordinates having a relatively high degree of arrangement on the same straight line from the coordinate group based on the evaluation values cumulatively added by the evaluation value addition means;
An image processing apparatus comprising: an approximate line calculation unit that calculates an approximate line based on a plurality of coordinates extracted by the extraction unit.
前記座標群取得手段は、
画像を取得する画像取得部と、
前記画像取得部により取得された画像中において、色情報に変化を生じるエッジ位置を検出して前記座標群を取得するエッジ検出部とを含む、請求項1に記載の画像処理装置。
The coordinate group acquisition means includes
An image acquisition unit for acquiring images;
The image processing apparatus according to claim 1, further comprising: an edge detection unit that detects an edge position that causes a change in color information in the image acquired by the image acquisition unit and acquires the coordinate group.
前記画像取得部は、直線形状部位を有する対象物を撮影して得られた画像を取得する、請求項2に記載の画像処理装置。   The image processing apparatus according to claim 2, wherein the image acquisition unit acquires an image obtained by photographing an object having a linear shape portion. 前記評価値算出手段は、前記3個以上の座標のうち2個の座標を含む直線を規定し、残余の座標の各々と当該規定された直線との距離に基づいて前記評価値を算出する、請求項1〜3のいずれか1項に記載の画像処理装置。   The evaluation value calculating means defines a straight line including two coordinates among the three or more coordinates, and calculates the evaluation value based on a distance between each of the remaining coordinates and the defined straight line; The image processing apparatus according to claim 1. 前記評価値算出手段は、前記3個以上の座標についての相関係数に基づいて、前記評価値を算出する、請求項1〜4のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the evaluation value calculation unit calculates the evaluation value based on a correlation coefficient for the three or more coordinates. 前記繰返手段は、前記座標選択手段により前記座標群から3個以上の座標を選ぶ組合せのすべてが選択されるまで、前記座標選択手段、前記評価値算出手段および前記評価値加算手段における処理を繰返し実行させる、請求項1〜5のいずれか1項に記載の画像処理装置。   The repeating means performs the processes in the coordinate selecting means, the evaluation value calculating means, and the evaluation value adding means until all the combinations for selecting three or more coordinates from the coordinate group are selected by the coordinate selecting means. The image processing apparatus according to claim 1, which is repeatedly executed. 前記座標群は、2次元または3次元の座標からなる、請求項1〜6のいずれか1項に記載の画像処理装置。   The image processing apparatus according to claim 1, wherein the coordinate group includes two-dimensional or three-dimensional coordinates. 4個以上の座標を含む座標群を取得する座標群取得手段と、
所定規則に従って、前記座標群から3個以上の座標を選択する座標選択手段と、
前記座標選択手段により選択された前記3個以上の座標について、同一直線上に配置される度合を示す評価値を算出する評価値算出手段と、
当該3個以上の座標の各々と対応付けて、前記評価値算出手段により算出される前記評価値を累積加算する評価値加算手段と、
前記座標群の各座標が互いに同一回数だけ選択されるように、前記座標選択手段、前記評価値算出手段および前記評価値加算手段における処理を繰返し実行させる繰返手段と、
前記評価値加算手段により累積加算された前記評価値に基づいて、前記座標群から同一直線上に配置される度合が相対的に高い複数の座標を抽出する抽出手段と、
前記抽出手段により抽出された複数の座標に基づいて近似直線を算出する近似直線算出手段とを備える、近似直線算出装置。
Coordinate group acquisition means for acquiring a coordinate group including four or more coordinates;
Coordinate selecting means for selecting three or more coordinates from the coordinate group according to a predetermined rule;
Evaluation value calculation means for calculating an evaluation value indicating the degree of arrangement on the same straight line for the three or more coordinates selected by the coordinate selection means;
An evaluation value adding means for accumulating the evaluation values calculated by the evaluation value calculating means in association with each of the three or more coordinates;
Repeating means for repeatedly executing the processes in the coordinate selecting means, the evaluation value calculating means, and the evaluation value adding means so that the coordinates of the coordinate group are selected the same number of times.
Extraction means for extracting a plurality of coordinates having a relatively high degree of arrangement on the same straight line from the coordinate group based on the evaluation values cumulatively added by the evaluation value addition means;
An approximate line calculation device comprising: an approximate line calculation means for calculating an approximate line based on a plurality of coordinates extracted by the extraction means.
JP2006071567A 2006-03-15 2006-03-15 Image processor and approximate straight line calculation apparatus Withdrawn JP2007249555A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006071567A JP2007249555A (en) 2006-03-15 2006-03-15 Image processor and approximate straight line calculation apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006071567A JP2007249555A (en) 2006-03-15 2006-03-15 Image processor and approximate straight line calculation apparatus

Publications (1)

Publication Number Publication Date
JP2007249555A true JP2007249555A (en) 2007-09-27

Family

ID=38593787

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006071567A Withdrawn JP2007249555A (en) 2006-03-15 2006-03-15 Image processor and approximate straight line calculation apparatus

Country Status (1)

Country Link
JP (1) JP2007249555A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2884426A1 (en) 2013-12-12 2015-06-17 Omron Corporation Image processing device, image processing method, and image processing program

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2884426A1 (en) 2013-12-12 2015-06-17 Omron Corporation Image processing device, image processing method, and image processing program
JP2015114876A (en) * 2013-12-12 2015-06-22 オムロン株式会社 Image processor, image processing method and image processing program
US9582733B2 (en) 2013-12-12 2017-02-28 Omron Corporation Image processing device, image processing method, and image processing program

Similar Documents

Publication Publication Date Title
TWI389553B (en) Methods and devices for image signal processing
JP4378746B2 (en) Digital image sensor and method capable of detecting defective pixels
JP6701118B2 (en) Image processing apparatus and image processing method
US7684617B2 (en) Apparatus and methods for processing images
US7801357B2 (en) Image processing device, image processing method, program for the same, and computer readable recording medium recorded with program
US10410078B2 (en) Method of processing images and apparatus
JP6021665B2 (en) Image processing apparatus, image processing method, and computer program
JP5155110B2 (en) Monitoring device
JP4275149B2 (en) Boundary position determination apparatus, method for determining boundary position, program for causing computer to function as the apparatus, and recording medium
US11048929B2 (en) Human body detection apparatus, control method for human body detection apparatus
JP5466099B2 (en) Appearance inspection device
JP2009260671A (en) Image processing apparatus and imaging device
JP2009294027A (en) Pattern inspection device and method of inspecting pattern
JP2007249555A (en) Image processor and approximate straight line calculation apparatus
JP2007258923A (en) Image processing apparatus, image processing method, image processing program
JP2013546084A (en) How to identify anomalies in images
JP5754931B2 (en) Image analysis apparatus, image analysis method, and program
EP2775422A2 (en) Object detection apparatus, program, and integrated circuit
JP2009009206A (en) Extraction method of outline inside image and image processor therefor
JP7034781B2 (en) Image processing equipment, image processing methods, and programs
JP2010198476A (en) Defect detecting apparatus, defect detecting method and defect detecting program
JP2016057068A (en) Pattern fault checkup apparatus, and pattern fault checkup method
JP2007249526A (en) Imaging device, and face area extraction method
JP5130257B2 (en) Image processing device
JP2008028475A (en) Image processor, image processing program, recording medium recording image processing program, image processing method

Legal Events

Date Code Title Description
A300 Withdrawal of application because of no request for examination

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20090602