TWI253021B - Object recognizing and positioning method - Google Patents

Object recognizing and positioning method Download PDF

Info

Publication number
TWI253021B
TWI253021B TW93132126A TW93132126A TWI253021B TW I253021 B TWI253021 B TW I253021B TW 93132126 A TW93132126 A TW 93132126A TW 93132126 A TW93132126 A TW 93132126A TW I253021 B TWI253021 B TW I253021B
Authority
TW
Taiwan
Prior art keywords
image
gradient
data
positioning
gradient direction
Prior art date
Application number
TW93132126A
Other languages
Chinese (zh)
Other versions
TW200614091A (en
Inventor
Chern-Sheng Lin
Chien-Ming Tseng
Chia-Wen Tsai
Chao-Chi Chang
Yu-Wen Wang
Original Assignee
Metal Ind Res & Dev Ct
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 Metal Ind Res & Dev Ct filed Critical Metal Ind Res & Dev Ct
Priority to TW93132126A priority Critical patent/TWI253021B/en
Application granted granted Critical
Publication of TWI253021B publication Critical patent/TWI253021B/en
Publication of TW200614091A publication Critical patent/TW200614091A/en

Links

Landscapes

  • Image Analysis (AREA)

Abstract

The present invention discloses an object recognizing and positioning method, which includes the following steps: (1) image reading step, (2) dot-by-dot encoding step, (3) similarity computing step, (4) target searching step, (5) positioning step, and (6) measuring step. In the present invention, the original image with a grey level is computed dot by dot to determine its gradients in X-direction and Y-direction, which are first converted into angles in gradient direction and then mapped to the codes in gradient direction, so as to reserve and simplify the features in the original image. Further, the complicated computation is significantly simplified and the similarity computation using binary trees is incorporated to greatly increase the operation speed. Therefore, the present invention is provided with the functions of being free from the influence of non-uniform light source, and having fast operation speed and low erroneous determination rate.

Description

1253021 九、發明說明: 【發明所屬之技術領域】 本發明係有關一種物體辨別定位之方法,特別是 指一種利用梯度方向編碼技術之物體辨別定位之方 法,其兼具不受光源不均勻之影響、處理速度快與誤 判率較低之優點及功效。 【先前技術】 在日常生活及工業檢測相關應用上,存在著許多 需要分類或辨識比對的動作,如辨識物體種類或其差 異性、印刷電路板(簡稱PCB)的電路檢測等。而這些 動作所保有一個特點是重複性高,也因為這樣的重複 性,我們能簡化這樣的動作方式,定義一個標準樣版 ,重複對其資料群作一個搜尋及比對的工作。 在電腦視覺、影像處理及圖形識別的領域内,由 於影像是一個光強度函數及反射函數兩個量的摺積 ,同時,具有運算資料龐大的特性。我們對一個圖形 作一所謂的前處理、後處理及相關的圖形強化動作, 這些動作的處理,無非是要拿掉一些不合用、不相干 的雜訊資料,只將相關合用的資料保留下來。而這樣 的流程,最後的目的,是為了提供我們作一個物體識 別、比對及分類。而比對識別的工作,便需先明確定 義出資料與資料之間的重疊關係有多少,也必須在繁 雜重複的動作裡,盡可能讓識別時間不因資料量的龐 大而增長。 5 1253021 在進行資料重疊關係的比對時,我們選擇樣版比 對法,作為一個比對的基準法則,以此為進行方向。 在影像樣版比對這類問題裡,如圖形比對,區塊 運動估測、三維(3 D )立體對應、圖形分類等等。 如第一圖所示,我們在資料庫中,明確定了一個 或數個之標準樣版 9 2,而樣版的定義,可以是經過 設計的資料排列方式或是區塊内容等,以指定的標準 樣版9 2去和搜尋範圍9 1内的所有區塊作一個匹配媒 合,找出與標準樣版92匹配程度最大、差異程式最 小的區塊或資料。 樣版與樣版之間的距離,我們常設為平方差的和 或絕對值差的和。為了要找出變異程度最小、相似程 度最大的樣版區塊,必須在指定的搜尋範圍内作一個 全域整體搜尋,而在進行全域搜尋時,由於影像函數 有著巨量資料,也因此,比對識別時間的拉長,也就 變得令人難以忍受。 為了解決樣版比對所延伸的相關問題,在過去幾 十年來,不斷有許多新的研究在各個期刊或會議中, 被發表出來,這些研究還能針對各種不同的應用作一 量身打造及各式各樣的變化與簡化,因而有了 一些新 的演算法被提出,如三步搜尋法則,適應法則等等。 另外,解決這類延伸問題,除了可從演算法則中 作一改變外,也可從比對的方式、特徵資料的選取上 著眼進行。在對區塊樣版作一個資料選取時,除了一 6 1253021 般對樣版自身的影像顏色深度變化外,尚可利用鄰近 區塊的深度關係或鄰近區塊的運動向量預先估測,縮 小欲搜尋的範圍,也可再利用累加平方差或絕對值的 方法,設定一個目標,及早跳出讓搜尋過程結束,也 因而能降低許多計算量並縮短時間耗費,另外,也可 看到一些視訊處理時,用到一些梯度下降的方法。但 是,這些方法雖然有它一定的效率,卻不能保證一定 能找到全域裡和目標樣版最為匹配且變異最小的區 塊樣本,也因而,除了計算量的降低、時間的耗費需 被考量外,正確目標的搜尋與否,才是更需要被加以 關注的。 隨著多媒體環境及相關工業的影像數據來源變 得更加容易,也更廣大,這也使得以影像為基礎出發 的觀點,更普及地被應用到工業檢測或相關需求上。 也因而如何不失效率、準確找出物體的位置,並進行 定位或分類工作,便成為需多人研究的焦點,而樣版 比對便是一個常用且強大的搜尋比對方法。 當然,樣版比對所能進行的應用層面不僅僅是作 一區塊搜尋工作,若以此為出發點,則可將應用面拓 展到許多層面,如視覺控制、醫學影像、監視裝置、 智能傳輸系統、工業檢測、圖像資料檢索、影像追蹤 和將物體從複雜背景分離等等。 在定義一個樣版比對的問題前,首先,必須先對 樣版本身可預期的所有變化,作一個清楚的定義。在 7 1253021 主要的一此 二應用面上,樣版比對會 1 ·位移 *生二個問題: 2·旋轉 3·尺寸大小1253021 IX. Description of the Invention: [Technical Field] The present invention relates to a method for discriminating and positioning an object, and more particularly to a method for discriminating and positioning an object using a gradient direction coding technique, which is not affected by the unevenness of the light source. The advantages and effects of fast processing speed and low false positive rate. [Prior Art] In daily life and industrial inspection related applications, there are many actions that need to be classified or identified, such as identifying the type of object or its difference, and circuit detection of a printed circuit board (PCB). One of these features is characterized by high repeatability. Because of this repetitiveness, we can simplify this type of action, define a standard pattern, and repeat the search and comparison work for its data set. In the field of computer vision, image processing and pattern recognition, the image is a product of a light intensity function and a reflection function, and has a large amount of computational data. We do a so-called pre-processing, post-processing and related graphics enhancement actions on a graph. The processing of these actions is nothing more than removing some unusable and irrelevant noise data and keeping only the relevant data. The final purpose of such a process is to provide us with an object identification, comparison and classification. In the work of comparing and identifying, it is necessary to clearly determine the overlapping relationship between the data and the data. It is also necessary to make the recognition time not increase due to the large amount of data in the complicated and repeated actions. 5 1253021 In the comparison of data overlap relationships, we choose the pattern comparison method as a benchmark rule for comparison, which is used as the direction. In the image pattern comparison such problems, such as graphic comparison, block motion estimation, three-dimensional (3 D) stereo correspondence, graphic classification and so on. As shown in the first figure, we have identified one or several standard patterns in the database, and the definition of the pattern can be the designed data arrangement or block content to specify The standard version 9 2 is used to match all the blocks in the search range 9 1 to find the block or data with the largest matching and the smallest difference program. The distance between the pattern and the pattern, we are standing as the sum of the squared difference and the absolute difference. In order to find the smallest morphological block with the least degree of similarity, a global search must be performed within the specified search range. In the case of global search, the image function has a huge amount of data, and therefore, the comparison The lengthening of the recognition time becomes unbearable. In order to solve the problems associated with the extension of the pattern comparison, in the past few decades, many new researches have been published in various journals or conferences. These studies can also be tailored to different applications. A variety of changes and simplifications have been made, and some new algorithms have been proposed, such as the three-step search rule, the adaptation rule, and so on. In addition, to solve such extension problems, in addition to making a change from the algorithm, it is also possible to focus on the comparison method and the selection of feature data. When making a data selection for the block pattern, in addition to the change of the image color depth of the sample itself, in addition to a 6 1253021, the depth relationship of the adjacent block or the motion vector of the adjacent block may be used to estimate in advance, and the desire is reduced. The scope of the search can also be used to add a squared difference or an absolute value to set a target. The early jump is allowed to end the search process, which can reduce the amount of calculation and shorten the time consumption. In addition, some video processing can be seen. , using some methods of gradient descent. However, although these methods have certain efficiency, they cannot guarantee that the most suitable and least mutated block samples in the whole domain and the target pattern can be found. Therefore, in addition to the reduction of calculation amount and the time consumption, it is necessary to be considered. The search for the right target is more important to be concerned. As the source of image data in the multimedia environment and related industries becomes easier and wider, this also makes image-based perspectives more widely used for industrial inspection or related requirements. Therefore, how to achieve efficiency, accurately locate the object, and locate or classify it becomes the focus of many people's research. The pattern comparison is a common and powerful method of searching and comparing. Of course, the application level of the pattern comparison is not only a block search work, but if it is used as a starting point, the application surface can be extended to many levels, such as visual control, medical imaging, monitoring devices, intelligent transmission. System, industrial inspection, image data retrieval, image tracking and separation of objects from complex backgrounds. Before defining a pattern alignment problem, first of all, you must first make a clear definition of all the changes that can be expected from the sample version. In the main application of 7 1253021, the pattern comparison will be 1 · Displacement * Two problems: 2 · Rotation 3 · Size

,一 而解決這三個問題的方法,可分A 仃規劃·· 為兩個方向來進 像自相關為基礎方向 •以影像特徵瞭解為基礎方向 這兩個方向的著眼點不同,以 ’是以標準檨脱访U ~仏自相關為基礎 較, ,版/、比對樣版間的相關程产去 越相關的則越匹配,而以影像:去作-個比 則是針對f i 、政瞭解為基礎, t對払準樣版的區塊特徵,設計—個方4 版作一曹Efc Μ + 個方式對其樣 Ϊ點的貧料特徵擷取。 傳統的樣版比對法則有自相關係數法(cc)和平 方總和差異(Sum of Square“ifference)。自相關 係數法能被下面這個方程式定義: (ΣΧ (· ·>〇-· >〇)2 n (办—)ι/2 其中: M,N為主體影像之χ及γ方向之像素 P,Q為移動區塊影像之X及γ方向之像素 χ,y為影像的二維座標i W^y)為主體影像,原點為其左上端 w(x,>〇為w(x,y)的平均值 1253021 t ( X,y )為移動區塊影像,原點為其中心 ?為t(x,y)的像素平均值 而此方程式的範圍在介於-1. 0至1. 0中間。 故,如第二圖所示,在一個 MxN 的主體影像 w(x,y)中,可以在其中尋找一個PxQ的區塊影像(斜 陰影線區)的匹配基礎。 在照明光源均勻分佈於整個全域區域的情況下 ,自相關係數法是一個很有用的方法,能夠避免錯誤 的匹配發生,然而,在發生部分物體被遮蔽、部分陰 影和背景變化產生、目標變形和合併上述情形同時存 在時,並沒有一個可對應的合適方法,去解決這些情 況下所發生的錯誤辨識。請參閱附件一之右下圖,其 中,四個角落很明顯產生較暗的陰影區,影響整體檢 測。因此,有被陰影遮住而誤判之缺點。 其次,當目標物體有旋轉情況發生時,自相關係 數法只能偵測出大約5至1 0度的變化情形,若大於 此,則會發生辨識錯誤或偵測遺漏情形。 另外,計算時間耗費的問題,也是自相關係數法 的嚴重缺點。例如,當進行印刷電路板上之電路之線 寬檢測時,若運算時間過久,則無法進形即時檢測。 因此,有必要研發新技術以解決上述缺點。 【發明内容】 本發明之主要目的,在於提供一種物體辨別定位 之方法,其利用梯度方向碼保留影像之特徵,故不受 9 1253021 光源不均勻之影響。 本發明之次一目的,在於提供一種物體辨別定位 之方法,其搭配二分樹之相似度計算,處理速度炔。 本發明之又一目的,在於提供一種物體辨別定位 之方法,其誤判率較低。 本發明係提供一種物體辨別定位之方法,其包括 一、 讀入影像步驟:利用一影像擷取元件讀入一 原始影像,該原始影像包含X乘γ個像素,且取得一 原始灰階值; 二、 逐點編碼步驟:逐點將每一像素之X方向之 灰階值梯度及Y方向之灰階值梯度設為dx及dy,並 以(0,0)為中心點,梯度方向角度則為 0 = tan_1(dy/dx),其係介於0至2冗間,再將其分割為 N個等份,使每一梯度方向角度0對應至N個等份其 中之一,且,其梯度方向大小係大於一預定閥值時, 則為得到一對應之梯度方向碼;反之,若梯度方向大 小係小於該預定閥值時,則以另一值處理; 三、 相似度計算步驟:取得一由梯度方向碼所組 成之目標區塊影像;讀取一子區塊影像,其亦由梯度 方向碼所組成;先選定一初始根節點,再將每一子區 塊影像與目標區塊影像進行相似度計算評估,依二分 樹大於根節點即屬右節點,小於根節點即屬左節點的 基本特性,將所算出之相似度建構成一個二分樹資料 10 1253021 庫; 四、 目標搜尋步驟:利用前述二分樹資料庫進行 二元樹搜尋法,找出吻合相似度的目標區塊範圍及其 目標區塊座標位置; 五、 定位步驟:由找到的目標區塊之物體之中心 點定位,再將該物體透過一電子元件樣式資料庫作一 分類,將相對應之電子元件樣式中心資料送至伺服機 構,計算與畫面中心誤差並進行補償; 六、 量測步驟:進行特定位置之線狀資料列之讀 取,而取得一包含K個像素之掃描線資料,再利用次 像素的技術,求出一長度值。 本發明之上述目的與優點,不難從下述所選用實 施例之詳細說明與附圖中,獲得深入瞭解。 茲以下列實施例並配合圖式詳細說明本發明於 後·· 【實施方式】 本發明之基本原理,是在影像特徵選取上,選取 梯度方向來作為描述影像特徵的基礎。它的好處是可 以在相鄰區域的灰度劇烈變化中,保持一個最不容易 發生改變的特性。也就是說,即使當欲搜尋的目標物 體與鄰域灰度變化差異大時,其梯度方向反映在物體 與影像的變化關係卻是較不明顯的,也因而能保留出 原目標物體的物理梯度特性,藉由這些資料信號的保 留,便能用以作為一個更好的辨識基礎平台。 1253021 請參閱第三圖,本發明係為一種物體辨別定位之 方法,其主要包括:一、讀入影像步驟 1 1、二、逐 點編碼步驟1 2、二、相似度計鼻步驟1 3、四、目標 搜尋步驟 1 4、五、定位步驟 1 5及六、量測步驟1 6 。詳細說明如下: 一、 讀入影像步驟 1 1 :利用一影像擷取元件讀 入一原始影像,該原始影像包含X乘Y個像素,且取 得一原始灰階值 G (X,Y ),如第四圖所示。假設為 640x480 像素,則 X=640,Y=480,共有 307200 個像素 ,每一個像素均具有一介於0至2 5 5之灰階值。請 參閱第五圖,其為一原始影像中,A、B、C三個區域 中之灰階值數據。由第五圖可看出,A區域光線較暗 ,所以灰階值主要分佈在7 0至1 1 0間;而B區域較 亮,灰階值主要分佈在18 0至21 0間;又,C區域亮 度中等,灰階值主要分在1 5 0至1 8 0間。 二、 逐點編碼步驟1 2 :逐點將每一像素之X方 向之灰階值梯度及Y方向之灰階值梯度設為dx及dy ,並以(0,0)為中心點,梯度方向角度則為0 = tan_1(dy/dx),其係介於0至2;τ間,再將其分割為 Ν個等份,使每一梯度方向角度<9對應至Ν個等份其 中之一,且,其梯度方向大小 L(實務上,為一遮罩 摺積運算,依權重求得水平及垂直各自梯度大小, [dx2 + dy2]1/2,並計算求得該處整體梯度大小)係大 於一預定閥值時,則為得到一對應之梯度方向碼 12 1253021 C ( X,Υ );反之,若梯度方向大小L小 ,則表示無謂之微量變化,以另一值 之物理意義。請參閱第六圖,此係將 16等份,亦即,梯度方向為0至15 放大至0至2 5 5間之灰階分佈,以利 度深淺之特徵,第七圖即為本發明經 像圖(已轉換成較易辨視之逐點編碼 三、 相似度計算步驟 1 3 :取得 C ( X,Y )所組成之目標區塊影像0τ ( i, 塊影像0! ( i,j ),其亦由梯度方向碼 先選定一初始根節點,再將每一子i 與目標區塊影像0τ (i,j )進行相似度 分樹大於根節點即屬右節點,小於根 的基本特性,將所算出之相似度建構 料庫;如第八圖所示,此為二分樹資 其中,每一資料結構單元包括:一 tree pointer 之縮寫)、一資料 BC(Block coordinate)及一右指標 pointer) 〇 四、 目標搜尋步驟 14 :利用前 進行二分樹搜尋法找出吻合相似度 及其目標區塊座標位置。實務上,在 「二分樹搜尋法」的概念,並不逐一 點,徒增時間的耗費,可分為兩個動 於一預定閥值時 處理,不具特別 0至2 7Γ間分成 間。並將其加權 使用者觀察出灰 梯度轉換後之影 後之圖)。 一由梯度方向碼 j );讀取一子區 C ( X,Y )所組成; :塊影像0! ( i,j ) 計算評估,依二 節點即屬左節點 成一個二分樹資 料庫之不意圖。 左指標 LP(Left Data、一位址 RPCRight tree 述二分樹資料庫 的目標區塊範圍 搜尋過程中,用 去拜訪各個子節 f作,第一,利用 13 1253021 「第一個搜尋值」與「根節點」比較的方式,來決定 左子樹或右子樹被選擇的路徑,一次過濾一半的節點 數量;第二,其後進行各子節點的比較,大於該子節 點往右子樹走,捨棄左子樹,當這樣過濾的動作反覆 被進行時,很快可找出我們關切的節點,其執行效率 為 0 ( 1 〇 g N ),在此時,並不作一停止,而以此節點 為根節點作一個中序走訪動作,由樹左下葉節點起始 ,逐一拜訪其他節點、父節點、右節點或右葉節點, 重複此拜訪動作,直至拜訪完其根節點展開的右子樹 ;經過這個搜尋方式走訪完畢,便可以找到吻合相似 度的範圍區塊及相對應的搜尋區塊座標位置,再作一 自動追尋比對區塊,便能每一次精確縮小比對區塊數 量,而不用對其檢測圖形依新參數或收斂因子作一窮 舉搜尋,可以非常大量降低圖形比對的巨量計算,使 比對工作耗費時間縮短。 五、 定位步驟1 5 :由找到的目標區塊之物體(例 如電晶體 2 0 )之中心點定位(例如電晶體中心點 2 1 ) ,再將該物體透過一電子元件樣式資料庫作一分類, 將相對應之電子元件樣式中心資料送至伺服機構,計 算與畫面中心誤差並進行補償。 六、 量測步驟:進行特定位置之線狀資料列之讀 取(例如量測一線路2 2之線寬),而取得一包含K個 像素之掃描線資料 L (K ),再利用次像素的技術,求 出一長度值。當然,如第十圖所示,此長度值可能為 14 1253021 線寬W、上、下線距L1、L 2。 關於本發明之之實際應用,主要是應用到液晶顯 示器(例如T F T - L C D )面板的電路檢測工作上,並進一 步去解決檢測範圍内,目標影像超過一個以上的定位 檢測工作,同時,針對光源分佈不均或光源偏離中心 的情況發生時,能給予一不受干擾的定位搜尋,其詳 細流程如第九圖所示。而液晶顯示器(TFT-LCD)中相 關電晶體20(兹列舉三種)如第十一 A、十一 B、十一 C圖所示。 利用光學檢測設備擷取液晶顯示器(LCD )電晶體 圖像時,打光方式是以同軸光源投至畫面中心,由於 同軸光源投射中心點在晝面中心,在一個光源半徑内 ,影像品質可以維持照明均勻且清晰,若以此液晶顯 示器(LCD )面板檢測應用為例,當倍率較大,景深較 淺,視野範圍較小,也就是只放大檢測單一電晶體 2 0時,由於檢測目標與光源分佈均在光源中心附近 ,所以,整體影像品質照明均勻清晰,當需求為倍率 較小,景深稍大,視野範圍較大,也就是檢測晝面不 僅存在一個電晶體,而同時有 2至 3個(3個為一 6 4 0 X 4 8 0畫面所能納入的最大個數)時,由於景深的 拉長,可視範圍也拉大,因此,影像品質與光源的關 係,便會隨著可視範圍包含光源半徑的大小而遞減, 相關情形說明如附件一所示。 當光學倍率由大變小時,鏡頭與液晶顯示器 15 1253021 (LCD)面板的工作距離就越不貼近,工作距離越大, 也因而能攝入檢測晝面的光源半徑也就越大,甚至超 過整個光源半徑,也因而影像就會在晝面邊角地帶產 生照明度不夠的情況,也使得影像品質大打折扣,更 造成物體辨識與追尋的難度大幅上升。 另外,由於線上的檢測工作,每個環節的反應時 間不能太長,也必須有一定程度的系統穩定性。本發 明的搜尋方法,能有效的將目標物體特徵保留,並能 穩定的作一追尋定位的工作,而效率能保持良好的範 圍,因而,能適用於此檢測上的應用,以達到線上檢 測的高效率、高穩定性。 整個物體識別定位系統的詳細流程如第九圖所 示,在此不重覆贅述。 在線寬量測方面,由於邊緣資訊為一高頻變化劇 烈的資料,找到線寬量測範圍後,如第十二圖所示, 可以從其顏色橫跨分佈得知,由於影像有一種漸進的 特性,一個線的出現,會在細部變化中,呈現一個高 峰和兩個波谷,如第十三圖所示。利用觀察斜率變化 的方式,乃找出兩個波谷點,以次像素的技術(屬習 知技術,故不詳述),求出線寬的範圍。亦即,第十 二圖之左方框線部份為一線寬量測範圍,其結果如第 十三圖所示,線寬為 14.342像素(pixel),而完成 實際之即時檢測,準確性高。 本發明之優點及功效可歸納為: 16 1253021 [1 ]不受光源不均勻之影響。縱使是光源分佈不 均勻,由於本發明已將其灰階變化轉換成梯度方向碼 ,所以已將其特徵保留下,因此,不受光源不均勻之 影響 [2 ]處理速度快。本發明經轉換後之特徵已變成 梯度方向碼,再搭配二分樹之相似度計算,處理速度 快。 [3 ]誤判率較低。由於本發明可以在相鄰區域的 灰度劇烈變化中,保持一個最不容易發生改變的特性 。所以,處理時誤判率較低。 以上僅是藉由較佳實施例詳細說明本發明,對於 該實施例所做的任何簡單修改與變化,皆不脫離本發 明之精神與範圍。 由以上詳細說明,可使熟知本項技藝者明瞭本發 明的確可達成前述目的,實已符合專利法之規定,爰 提出發明專利申請。 【附件】 附件一:影像品質與光源的關係之示意圖 17 1253021 【圖式簡單說明】 第一圖係習知技術中標準樣版及搜尋樣版之示 意圖 第二圖係習知的樣版比對法中自相關係數法之 計算時之示意圖 第三圖係本發明之方法之流程圖 第四圖係本發明之原始影像之簡化示意圖 第五圖係本發明之原始影像之實際照片與局部 之數據之示意圖 第六圖係本發明分割成1 6等份之示意圖 第七圖係本發明經梯度轉換後之影像圖 第八圖係本發明之二分樹資料庫之示意圖 第九圖係本發明之詳細流程圖 第十圖係本發明液晶顯示器之電晶體之量測示 意圖 第十一 A、十一 B、十一 C圖係本發明液晶顯示 器之電晶體一、二及三之 第十二圖係本發明量 第十三圖係本發明量 【主要元件符號說明】 1 1讀入影像步驟 1 3相似度計算步驟 1 5定位步驟 20電晶體 實際影像圖 測線寬之ΐ測區域不意圖 線寬之不意圖 1 2逐點編碼步驟 1 4目標搜尋步驟 1 6量測步驟 21電晶體中心點 18 1253021 22線路 9 1搜尋範圍 9 2標準樣版 A、Β、C區域 M,N主體影像之X及Y方向之像素 P,Q移動區塊影像之X及 Y方向之像素 X,y影像的二維座標值 W ( X,y )主體影像 w(x,j/)為w(x,y)的平均值 t ( X,y )移動區塊影像 ^為t(x,y)的像素平均值 G ( X,Y )原始灰階值 L梯度方向大小 〇T(i,j)目標區塊影像 (h(i,j)子區塊影像 L掃描線資料 LP左指標 D a t a貢料 B C位址 RP右指標 0梯度方向角度 C ( X,Y )梯度方向碼 W線寬 L 2下線距 L 1上線距 19One way to solve these three problems can be divided into A 仃 planning · for the two directions to enter the direction of the image-based auto-correlation • The direction of the image feature is based on the two directions of the different points, to 'Yes Based on the standard 檨 U U 仏 仏 仏 U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U U Based on the understanding, the block features of the standard sample, the design of the four versions of a Cao Efc Μ + way to draw the poor characteristics of its sample points. The traditional pattern matching rule has an autocorrelation coefficient method (cc) and a sum of squares (Sum of Square “ifference.” The autocorrelation coefficient method can be defined by the following equation: (ΣΧ (··>〇-· > 〇) 2 n (do —) ι / 2 where: M, N is the pixel of the main image and the pixel P in the γ direction, Q is the pixel of the moving block image in the X and γ directions, and y is the two-dimensional coordinate of the image i W^y) is the main image, and the origin is the upper left end w(x, > 平均值 is the average value of w(x, y) 1253021 t (X, y) is the moving block image, the origin is its center ? is the average value of the pixel of t(x, y) and the range of the equation is between -1.0 and 1.0. Therefore, as shown in the second figure, the main image w(x, y) in an MxN In it, you can find the matching basis of a PxQ block image (oblique hatched area). The autocorrelation coefficient method is a useful method to avoid errors when the illumination source is evenly distributed throughout the whole area. Matching occurs, however, while partial objects are obscured, partial shadows and background changes occur, target deformations, and the above conditions are combined When present, there is no suitable method to solve the error identification that occurs in these cases. Please refer to the lower right figure in Annex I, where the four corners obviously produce darker shadow areas, which affect the overall detection. Therefore, there are shortcomings of being misunderstood by shadows. Secondly, when the target object has a rotation, the autocorrelation coefficient method can only detect a change of about 5 to 10 degrees. If it is larger than this, identification will occur. Errors or detection of missing situations. In addition, the calculation of time consumption is also a serious shortcoming of the autocorrelation coefficient method. For example, when performing line width detection on a circuit board, if the operation time is too long, it cannot be shaped. Therefore, it is necessary to develop a new technology to solve the above disadvantages. SUMMARY OF THE INVENTION The main object of the present invention is to provide a method for discriminating and positioning an object, which uses the gradient direction code to preserve the characteristics of the image, and thus is not subject to the 9 1253021 light source. The second object of the present invention is to provide a method for distinguishing and positioning an object, which is matched with a binary tree. The similarity calculation, the processing speed of the alkyne. Another object of the present invention is to provide a method for object identification and positioning, which has a low false positive rate. The present invention provides a method for object identification and positioning, which includes the steps of reading an image. : reading an original image by using an image capturing component, the original image containing X by γ pixels, and obtaining an original grayscale value; 2. Step by point encoding step: setting the grayscale value of the X direction of each pixel point by point The grayscale gradients in the gradient and Y direction are set to dx and dy, with (0,0) as the center point, and the gradient direction angle is 0 = tan_1(dy/dx), which is between 0 and 2 verbs. Then dividing it into N equal parts, so that each gradient direction angle 0 corresponds to one of N aliquots, and when the gradient direction size is greater than a predetermined threshold, a corresponding gradient direction code is obtained. Conversely, if the magnitude of the gradient direction is less than the predetermined threshold, it is processed by another value; 3. Similarity calculation step: obtaining a target block image composed of gradient direction codes; reading a sub-block image Gradient direction Firstly, an initial root node is selected, and then each sub-block image is compared with the target block image for similarity calculation. According to the binary tree, the root node is larger than the root node, which is the right node, and the root node is less than the root node. The calculated similarity is constructed into a binary tree data 10 1253021 library; Fourth, the target search step: using the aforementioned binary tree database to perform a binary tree search method to find the target block range and its target area with similarity degree Block coordinate position; V. Positioning step: positioning the center point of the object of the found target block, and then classifying the object through an electronic component style database, and sending the corresponding electronic component style center data to the servo mechanism Calculate and compensate for the error in the center of the picture; 6. Measurement step: read the line data column at a specific position, and obtain a scan line data containing K pixels, and then use the sub-pixel technology to find a Length value. The above objects and advantages of the present invention will be readily understood from the following detailed description of the embodiments of the invention. BRIEF DESCRIPTION OF THE DRAWINGS The present invention will be described in detail with reference to the following embodiments in conjunction with the drawings. [Embodiment] The basic principle of the present invention is to select a gradient direction as a basis for describing image features in image feature selection. It has the advantage of maintaining a property that is least susceptible to change in the dramatic changes in gray levels in adjacent areas. That is to say, even when the difference between the target object and the neighborhood gray scale change is large, the gradient direction is reflected in the relationship between the object and the image is less obvious, and thus the physical gradient of the original target object can be retained. The characteristics, by retaining these data signals, can be used as a better identification basis. 1253021 Please refer to the third figure. The present invention is a method for object positioning and positioning, which mainly comprises: 1. reading the image step 1 1 , 2, step by point coding step 1 2, 2, similarity meter nose step 1 3, Fourth, the target search step 1 4, 5, positioning steps 1 5 and 6, measurement steps 1 6 . The detailed description is as follows: 1. Read the image in step 1 1 : Read an original image by using an image capturing component, the original image contains X by Y pixels, and obtain an original grayscale value G (X, Y), such as The fourth picture shows. Assuming 640x480 pixels, X=640, Y=480, a total of 307200 pixels, each pixel has a grayscale value between 0 and 255. Please refer to the fifth figure, which is the grayscale value data in the three regions A, B, and C in an original image. It can be seen from the fifth graph that the light in the A region is dark, so the grayscale value is mainly distributed between 70 and 110; and the B region is brighter, and the grayscale value is mainly distributed between 180 and 21; The C area has medium brightness, and the gray scale values are mainly divided between 150 and 180. 2. Point-by-point coding step 1 2: Set the gray-scale value gradient of the X-direction of each pixel and the gray-scale value gradient of the Y direction to dx and dy point by point, and take the (0, 0) as the center point, the gradient direction angle Then it is 0 = tan_1(dy/dx), which is between 0 and 2; τ, and then divided into two equal parts, so that each gradient direction angle <9 corresponds to one of the equal parts And, the gradient direction size L (actually, for a mask folding operation, according to the weight to find the horizontal and vertical respective gradient size, [dx2 + dy2] 1/2, and calculate the overall gradient size) When the system is greater than a predetermined threshold, a corresponding gradient direction code 12 1253021 C (X, Υ ) is obtained; conversely, if the gradient direction size L is small, it means that there is no unnecessary slight change, and the physical value of the other value. Please refer to the sixth figure, which is to divide 16 equal parts, that is, the gradient direction is 0 to 15 to the gray scale distribution between 0 and 25 5, which is characterized by the degree of sharpness. The seventh figure is the Image (converted into point-by-point code that is easier to recognize. III. Similarity calculation step 13: Obtain the target block image 0τ composed of C (X, Y) (i, block image 0! (i,j) The gradient root direction code first selects an initial root node, and then each sub-i is compared with the target block image 0τ (i, j). The similarity degree sub-tree is larger than the root node, that is, the right node is smaller than the basic characteristics of the root. The calculated similarity construction database; as shown in the eighth figure, this is a binary tree, each data structure unit includes: a tree pointer abbreviation), a data BC (Block coordinate) and a right indicator pointer 〇 Fourth, target search step 14: Perform a binary tree search method before use to find the coincidence degree and its target block coordinate position. In practice, the concept of the "two-tree search method" is not one-by-one. The cost of increasing the time can be divided into two cases, which are processed at a predetermined threshold. There is no special 0 to 2 7 divisions. And weight it, the user observes the image after the gray gradient is converted). A gradient direction code j); read a sub-area C (X, Y); : block image 0! (i, j) calculation evaluation, according to the two nodes that belong to the left node into a binary tree database intention. The left indicator LP (Left Data, address RPCRight tree) in the target block range search process, to visit each sub-section f, first, using 13 1253021 "first search value" and " The root node is compared to determine the path selected by the left or right subtree, filtering the number of nodes at half; second, then comparing the subnodes, which is greater than the subnode going to the right subtree. Discarding the left subtree, when the filtering action is repeated, we can quickly find out the nodes we are concerned with, and the execution efficiency is 0 (1 〇g N ). At this time, we do not stop, but this node Make a mid-order visit operation for the root node, starting from the left lower leaf node of the tree, visiting other nodes, parent nodes, right nodes, or right leaf nodes one by one, repeating the visit action until the right subtree expanded by the root node is visited; After the search method is completed, you can find the range block that matches the similarity degree and the corresponding search block coordinate position, and then make an automatic pursuit comparison block to accurately narrow the comparison every time. The number of blocks, without an exhaustive search for their detection patterns according to new parameters or convergence factors, can greatly reduce the huge amount of graphics comparison calculations, making the comparison work take less time. 5. Positioning step 1 5: by Positioning the center point of the object (such as the transistor 20) of the target block found (for example, the center point of the transistor 2 1 ), and then classifying the object through an electronic component style database to match the corresponding electronic component pattern The center data is sent to the servo mechanism to calculate and compensate for the error in the center of the screen. 6. Measurement step: reading the linear data column at a specific position (for example, measuring the line width of a line 2 2), and obtaining an inclusion K-pixel scan line data L (K), and then use the sub-pixel technology to find a length value. Of course, as shown in the tenth figure, the length value may be 14 1253021 line width W, upper and lower line spacing L1 L 2. Regarding the practical application of the present invention, it is mainly applied to the circuit detection work of a liquid crystal display (such as a TFT-LCD) panel, and further solves the target image within the detection range. More than one positioning detection work, at the same time, for the uneven distribution of the light source or the deviation of the light source from the center, can give an undisturbed positioning search, the detailed process is shown in Figure 9. The liquid crystal display (TFT- The relevant transistor 20 in the LCD) (three types are listed) is shown in the eleventh A, eleventh, and eleventh C. When the liquid crystal display (LCD) transistor image is captured by the optical detecting device, the lighting mode is The coaxial light source is thrown to the center of the screen. Since the center point of the coaxial light source is at the center of the plane, the image quality can maintain uniform and clear illumination within a radius of the light source. If the liquid crystal display (LCD) panel detection application is taken as an example, when the magnification is Larger, shallower depth of field, smaller field of view, that is, only amplifying and detecting a single transistor 20, since the detection target and the light source are distributed near the center of the light source, the overall image quality illumination is even and clear, when the demand is magnification Small, the depth of field is slightly larger, and the field of view is larger. That is, there is not only one transistor but also two to three (3 for one 6 4 0). When the maximum number of images that can be included in the X 4 8 0 screen is extended, the visual range is also widened. Therefore, the relationship between the image quality and the light source is decremented as the visible range includes the radius of the light source. A description of the relevant situation is shown in annex I. When the optical magnification changes from large to small, the working distance between the lens and the liquid crystal display 15 1253021 (LCD) panel is less, and the working distance is larger, so the radius of the light source that can be ingested to detect the surface is larger, even more than the whole. The radius of the light source, and thus the image, will produce insufficient illumination in the corners of the face, which also makes the image quality greatly reduced, and the difficulty of object recognition and pursuit increases greatly. In addition, due to the online inspection work, the reaction time of each link should not be too long, and there must be a certain degree of system stability. The searching method of the invention can effectively retain the characteristics of the target object, and can stably perform the work of pursuing the positioning, and the efficiency can maintain a good range, and thus can be applied to the application of the detection to achieve on-line detection. High efficiency and high stability. The detailed flow of the entire object recognition and positioning system is as shown in the ninth figure, and will not be repeated here. In terms of online wide measurement, since the edge information is a highly variable data, after finding the line width measurement range, as shown in the twelfth figure, it can be known from the color distribution, because the image has a gradual The characteristic, the appearance of a line, will present a peak and two troughs in the detail change, as shown in Figure 13. By observing the change in slope, it is found that two valley points are obtained by the sub-pixel technique (which is not known in detail), and the range of the line width is obtained. That is to say, the left part of the box line of the twelfth figure is a line width measurement range, and the result is as shown in the thirteenth figure, the line width is 14.342 pixels (pixel), and the actual real-time detection is completed, and the accuracy is high. . The advantages and effects of the present invention can be summarized as follows: 16 1253021 [1] is not affected by the unevenness of the light source. Even if the light source is unevenly distributed, since the present invention has converted its gray scale change into a gradient direction code, its characteristics have been retained, and therefore, it is not affected by the unevenness of the light source [2]. The converted feature of the present invention has become a gradient direction code, and is calculated by the similarity of the binary tree, and the processing speed is fast. [3] The rate of false positives is low. Since the present invention can maintain a characteristic that is least likely to change in the violent change of the gradation of the adjacent area. Therefore, the rate of false positives during processing is low. The present invention has been described in detail with reference to the preferred embodiments of the present invention. From the above detailed description, it will be apparent to those skilled in the art that the present invention can achieve the foregoing objects and is in accordance with the provisions of the Patent Law. [Attachment] Attachment 1: Schematic diagram of the relationship between image quality and light source 17 1253021 [Simple description of the diagram] The first diagram is a schematic diagram of the standard pattern and the search pattern in the conventional technique. The second diagram is a conventional pattern comparison. The third diagram of the method of the present invention is a simplified schematic diagram of the original image of the present invention. The fifth diagram is the actual photograph and the partial data of the original image of the present invention. Figure 6 is a schematic view of the present invention divided into 16 equal parts. The seventh figure is the image of the present invention after the gradient conversion. The eighth figure is a schematic diagram of the binary tree database of the present invention. The ninth figure is the details of the present invention. FIG. 11 is a schematic view showing the measurement of the crystal of the liquid crystal display of the present invention. FIGS. 11A, 11B, and 11C are the twelfth drawings of the transistors 1, 2, and 3 of the liquid crystal display of the present invention. The thirteenth figure of the invention is the quantity of the invention [the main component symbol description] 1 1 reading the image step 1 3 the similarity calculation step 1 5 positioning step 20 the actual image of the transistor image line width measurement area Intention line width is not intended. 1 2 point-by-point coding step 1 4 target search step 1 6 measurement step 21 transistor center point 18 1253021 22 line 9 1 search range 9 2 standard pattern A, Β, C area M, N body Pixels in the X and Y directions of the image, Q in the X and Y directions of the Q block image, and the 2D coordinate value of the X, y image W ( X, y ) The main image w (x, j /) is w (x) , y) average t ( X, y ) moving block image ^ is the average value of the pixel of t (x, y) G ( X, Y ) original gray scale value L gradient direction size 〇 T (i, j) target Block image (h(i,j) sub-block image L-scan line data LP left indicator D ata tribute BC address RP right indicator 0 gradient direction angle C (X,Y) gradient direction code W line width L 2 offline Distance from L 1 on line 19

Claims (1)

1253021 十、申請專利範圍: 1 · 一種物體辨別定位之方法,其包括: 一、 讀入影像步驟:利用一影像擷取元件 一原始影像,該原始影像包含X乘Y個像素,且 一原始灰階值; 二、 逐點編碼步驟:逐點將每一像素之X 之灰階值梯度及Y方向之灰階值梯度設為dx及 並以(0,0)為中心點,梯度方向角度則 = tan_1(dy/dx),其係介於0至2冗間,再將其分 N個等份,使每一梯度方向角度0對應至N個等 中之一,且,其梯度方向大小係大於一預定閥信 則為得到一對應之梯度方向碼;反之,若梯度方 小係小於該預定閥值時,則以另一值處理; 三、 相似度計算步驟:取得一由梯度方向 組成之目標區塊影像;讀取一子區塊影像,其亦 度方向碼所組成;先選定一初始根節點,再將每 區塊影像與目標區塊影像進行相似度計算評估, 分樹大於根節點即屬右節點,小於根節點即屬左 的基本特性,將所算出之相似度建構成一個二分 料庫, 四、 目標搜尋步驟:利用前述二分樹資料 行二元樹搜尋法,找出吻合相似度的目標區塊範 其目標區塊座標位置; 五、 定位步驟:由找到的目標區塊之物體 讀入 取得 方向 dy, % Θ 割為 份其 時, 向大 碼所 由梯 一子 依二 節點 樹資 庫進 圍及 之中 20 1253021 心點定位,再將該物體透過一電子元件樣式資料庫作 一分類,將相對應之電子元件樣式中心資料送至伺服 機構,計算與晝面中心誤差並進行補償; 六、量測步驟:進行特定位置之線狀資料列之 讀取,而取得一包含κ個像素之掃描線資料,再利用 次像素的技術,求出一長度值。 2 ·如申請專利範圍第1項所述之物體辨別定位之方 法,其中,該梯度方向角度係被區分成1 6個等份 〇 3 ·如申請專利範圍第1項所述之物體辨別定位之方 法,其中,每一資料結構單元包括:一左指標、 一資料、一位址及一右指標。 211253021 X. Patent application scope: 1 · A method for discriminating and positioning an object, comprising: 1. Step of reading in an image: using an image capturing component, an original image, the original image containing X by Y pixels, and an original gray Step-by-point coding step: Set the grayscale value gradient of X and the grayscale value gradient of Y direction of each pixel to dx and point to (0,0) as the center point, and the gradient direction angle = Tan_1(dy/dx), which is between 0 and 2 redundancy, and then divides it into N equal parts, so that each gradient direction angle 0 corresponds to one of N and the like, and the gradient direction size is larger than A predetermined valve letter is to obtain a corresponding gradient direction code; otherwise, if the gradient square is less than the predetermined threshold, then another value is processed; 3. Similarity calculation step: obtaining a target composed of gradient directions Block image; reading a sub-block image, which is also composed of direction code; first select an initial root node, and then perform similarity calculation and evaluation on each block image and the target block image, and the sub-tree is larger than the root node. Is a right node, smaller than the root node It is the basic characteristic of the left, and the calculated similarity is constructed into a binary library. Fourth, the target search step: using the binary tree search method of the above binary tree data to find the target block of the similarity degree Position of the block coordinates; 5. Positioning step: the object in the target block is found to be read in the direction dy, % Θ is cut into the shares, and the ladder is divided into two nodes by the ladder. Center 20 1253021 heart point positioning, then the object is classified into an electronic component style database, and the corresponding electronic component style center data is sent to the servo mechanism to calculate and compensate for the center error of the kneading surface; Step: reading a linear data column of a specific position, and obtaining a scan line data containing κ pixels, and then using a sub-pixel technique to obtain a length value. 2. The method of object discrimination positioning according to claim 1, wherein the gradient direction angle is divided into 16 aliquots · 3 · Object discrimination positioning according to claim 1 The method, wherein each data structure unit comprises: a left indicator, a data, an address, and a right indicator. twenty one
TW93132126A 2004-10-22 2004-10-22 Object recognizing and positioning method TWI253021B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW93132126A TWI253021B (en) 2004-10-22 2004-10-22 Object recognizing and positioning method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW93132126A TWI253021B (en) 2004-10-22 2004-10-22 Object recognizing and positioning method

Publications (2)

Publication Number Publication Date
TWI253021B true TWI253021B (en) 2006-04-11
TW200614091A TW200614091A (en) 2006-05-01

Family

ID=37564982

Family Applications (1)

Application Number Title Priority Date Filing Date
TW93132126A TWI253021B (en) 2004-10-22 2004-10-22 Object recognizing and positioning method

Country Status (1)

Country Link
TW (1) TWI253021B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103295022B (en) * 2012-02-24 2018-01-26 富泰华工业(深圳)有限公司 Image similarity calculation system and method

Also Published As

Publication number Publication date
TW200614091A (en) 2006-05-01

Similar Documents

Publication Publication Date Title
KR101298024B1 (en) Method and interface of recognizing user's dynamic organ gesture, and electric-using apparatus using the interface
US20080205769A1 (en) Apparatus, method and program product for matching with a template
CN110781885A (en) Text detection method, device, medium and electronic equipment based on image processing
JP7450848B2 (en) Transparency detection method based on machine vision
US8867784B2 (en) Apparatus and method for detecting a vertex of an image
WO2008137051A1 (en) Photo-document segmentation method and system
CN110569782A (en) Target detection method based on deep learning
JP2014228357A (en) Crack detecting method
CN112464829B (en) Pupil positioning method, pupil positioning equipment, storage medium and sight tracking system
CN110660072A (en) Method and device for identifying straight line edge, storage medium and electronic equipment
CN116777877A (en) Circuit board defect detection method, device, computer equipment and storage medium
CN113688846A (en) Object size recognition method, readable storage medium, and object size recognition system
WO2021227289A1 (en) Deep learning-based low-quality two-dimensional barcode detection method in complex background
CN110084818B (en) Dynamic down-sampling image segmentation method
CN109146768A (en) image conversion method, system and application
CN116843633A (en) Image detection method, device, electronic equipment and storage medium
TWI253021B (en) Object recognizing and positioning method
JP4550768B2 (en) Image detection method and image detection apparatus
AUGMENTED Grayscale image enhancement for enhancing features detection in marker-less augmented reality technology
CN113284158B (en) Image edge extraction method and system based on structural constraint clustering
CN115471537A (en) Monocular camera-based moving target distance and height measuring method
WO2003010622A2 (en) Automatic separation of subject pixels using segmentation based on multiple planes of measurement data
CN115619678A (en) Image deformation correction method and device, computer equipment and storage medium
CN109389595B (en) Table line intersection point detection method, electronic device and readable storage medium
JPWO2022247162A5 (en)