201239813 六、發明說明: 【發明所屬之技術領域】 本發明係關於一種球型攝影機自動追蹤之方法,尤指— 種利用運動向量(m〇ti〇nvect〇r)來協助作前景物之切割方 式’進而能降低硬體的負擔’讓球型攝影機之運行更為流暢, 並具有優異的追蹤絲,㈣用於監㈣、攝錄機、球型攝 影機或類似裝置者。 【先前技術】 目則監控系統相當多樣化,許多室喊室外之影像監控 系統在習知的固定式攝影機無法涵蓋所有監視範圍的限制下 夕使用%場攝#彡機,㈣場攝職其監控的棚軸比傳統 固定式攝職大上許多’但是騎監控範_變大,在影像 时質控制上的_也隨之增加。其—困難來自於環場攝影機 的鏡頭無法放大或縮小,對於監控4st的雜物體經常益 法正確_取,導致影像可能過小或是模糊不清。 ‘、、、 因而進一步發展出具有旋轉變焦式p T Z (Pan-Tilt-Z_)攝影機,所· p τ z是表示攝影機的鏡 頭可以進行左右轉動(pan)、上下傾斜㈤t)與改變焦距、 放大(Zoom)等不同功能,透過ρτζ攝影機不僅可以隨時 改變拍攝的角度與·蓋的翻,更能透過焦距的改變調整 影像的大小與清晰程度,她彡機可續得更 監控效果與品質的維持。 而在習知的目標物體追縱技術中,最傳統且研發歷程也 最長的是自動目標物體特徵追蹤技術(a_atic处細 fea她仕acking technique),其主要係利用特徵抽取 201239813 (eature extraction)及特徵比對(feafure 贴^比丨呢) =方法,從目標物體中擷取出影像特徵,再根據影像特徵鎖 ^並追蹤目標物體,然而在目標物體的移動中,監視區域的 背景通常也跟著變化,而目標物體轉動時,影像特徵也會變 化,加上P丁Z攝影機持續掃瞄動作,種種的上述因素皆會 造成特徵比對方法在實際操作上的困難度。 而另種I知的目標物體追縱技術,係運用兩部攝影 機’利用外極對應法則(epipGlar rule),根據相對應之成 像面的特徵點(fearure points)以求出投影基本矩陣 (projection fundamental matrix),用以鎖定並追蹤目標 物體但^其中一部攝影機執行掃描而轉動時,對應之成像 面也跟著改變,兩部攝影機之架設對應關係已經改變,要利 用外極對應法則來計算出精準之特徵點對應,並不容易。 在者’從關於追蹤(tracking)的演算法發展歷史來看, 也有許多有效的方法被提出,而其中的CamShift演算法是以 顏色機率分布來追蹤,藉由計算出色彩機率分佈並不斷的疊 代收斂後,以找出該目標的中心及尺寸,進而找出欲追蹤= 目私物,但其缺點為如果遇到相近顏色的物體,例如追蹤中 的人物,顏色為紅色,而椅子的顏色剛好是紅色,當人走到 椅子附近,則CamShift演算法可能會跳至顏色相近的椅子 上,造成追蹤的錯誤’而且CamShift演算法因需計算色彩機 率分佈,故需要大量的資料處理及運算,因此需要額外的訊 號處理積體電路(DSP)來輔助或是用高效能的電腦來協助運 算。 因此’本發明人有鑑於上述缺失,期能提出透過利用運 動向量(motionvect〇r)來協助做前景物的切割方式的球型 201239813 蹤之方法,以降低硬體的負擔,讓攝影機運行 【發二】乃潛心研思、設計組製,以提供消費大眾使用。 ^發明之主要目的在提供—種球型攝影機自動追蹤之方 切割過利用運動向量(motionvector)來協助作前景物之 :二方式,使能快速發現欲追蹤之目標物,進而能控制球型 =機=方向、速度以及焦距來自動跟拍目標物,使具有優 二目^物自動追蹤之效果,進而增加整體之實雜及優異 性者。 發明之次一目的係在提供一種球型攝影機自動追蹤之 八宝透過场景圖像一值化,再從場景圖像二值化之雛型中 为割出具有運動向量的連通物件(connected components), 且藉由影像分析來排除掉雜訊,以形成欲追蹤之目標物,進 而增加整體之便利性及快速性者。 与為達上述之目的’本發明其主要步驟係包括:取得一張 德象,過ptz鏡頭所監視的晝面中_取出-張靜態影 ’取得影像之運動向量:將影像_成複數個巨集區塊 i^acroblock) ’並由影像中每一個巨集區塊(_灿) 仔個運動向量(motion vector);判斷目前球型攝影機 之運動狀態··當球麵職為移動狀糾,能配合 運動方向及速度等資訊,將移動中場景的運動向^ f原’場景圖像進行二值化:當運動向量還原後,即進行場 厅、圖像一值化,以能看出場景中物件的雛型;分割運動向旦 中之連通物件:從場景圖像二值化之麵中分辦 向量的連if物件(GQnneetedec)mpc_ts) ;分析並追鞭所分 201239813 ^ f之連通物件·再將連通物件(connected components) 像分析來齡掉雜訊’⑽成欲追蹤之目標物;以及目 ^物追縱_當目標物成為追蹤目標後,即透過控制球型攝影 機的方向、速度及焦距來自動跟拍目標物,以利進行目桿物 的追蹤者。 、 ^本發明之其他特點及具體實施例,可於以下列配合附圖 之詳細說明中,進一步瞭解。 【實施方式】 ,%參考第1至3®所示’係為本發明球型攝影機自動追 蹤之方法之流程示意0及實餘態示意圖。本發明追縦之方 法主要步驟係包括: 步驟S1〇〇取得—張影像:透過ρτζ鏡頭Η所監 視的晝面中擷取出一張靜態影像; 步驟s 1 1 Q取得影像之運動向量:將影像蝴成複數 個巨集區塊(macroblock),並由影像中每一個巨集區塊 (maCr〇bl〇Ck)取得—個運動向量(贈i〇n vect〇r); 步驟S12 0判斷目前球型攝影機之運動狀態:當球型 攝影機1 Q為移動狀態時,能配合球賴影機丨q目前的運 動方向及速度等資訊’將移動巾場景崎動向量還原; 步驟S13 0場景圖像進行二值化:當運動向量還原 後,即進打場景圖像二值化,以能看出場景中物件的雛型; 步驟S14 0分割運動向量中之連通物件:從場景圖像 二值化之睛俺具峨㈣連件(咖_ 201239813 components); 步驟S 1 5 Q分析並追賴分邮之連通物件:再將連 通物件(删ected⑽卿nts)以影像分析來排除掉雜訊, 以形成欲追蹤之目標物2〇; 步驟s 160目標物追蹤:當目標物2〇成為追細標 後,即透過控制_攝織1⑽方向、速度及焦距來自動 跟拍目標物2 0,以利進行目標物2 〇的追蹤者。 其中該步驟S 1 6 0目標物追觀—步含有下列步驟: 步驟S 1 6 1判斷目—否為追蹤目標:確認目標物2 〇 為欲追蹤目標,並開始進行追縱;步驟s i 6 2判斷追縱目 標於畫面中大小:當追縱目標於晝面中太大或太小時,即調 整球型攝雜1 °之倍率以能符合畫面之視窗;步驟s i 6 3判斷追蹤目標是否接近畫面邊緣:當追蹤目標太接近畫面 邊緣時即調整球型攝影機丄Q速度來跟隨追縱目標;其中 當步驟S161判斷目標物不是追縱目標時,即進行下一步 驟.步驟S1611騎失去追縱目標時間是否超過臨界 值:當超過臨界值時即追蹤目標遺失而結束追蹤,反之未超 過臨界值時,當魏目標出現時即降低球型攝雜2 〇速度 來跟隨追蹤目標影像分析係進-步包含該目標物 2 0之位置(P〇sition)、大小(size)、行進方向 (direction)、色彩(c〇1〇r)歧理⑷血代)等分析, 以能更提昇目標物2Q判斷之精準;另該每—個巨集區塊 201239813201239813 VI. Description of the Invention: [Technical Field] The present invention relates to a method for automatically tracking a ball camera, and more particularly to using a motion vector (m〇ti〇nvect〇r) to assist in cutting a foreground object. 'The ability to reduce the burden on the hardware' makes the dome camera run more smoothly, and has excellent tracking wire, (4) for monitoring (4), camcorders, dome cameras or similar devices. [Prior Art] The monitoring system is quite diverse. Many studios call the outdoor video surveillance system to use the % field camera #彡机, (4) field to monitor its monitoring when the conventional fixed camera cannot cover all the limits of the monitoring range. The shed shaft is much larger than the traditional fixed-type camera. But the riding monitor _ becomes larger, and the _ in the image quality control increases. It is difficult to enlarge or reduce the lens of the ring camera. It is often correct to monitor the 4st miscellaneous objects, which may cause the image to be too small or blurred. ',,, and thus further developed a rotary zoom type p TZ (Pan-Tilt-Z_) camera, where p τ z means that the lens of the camera can be rotated left and right (pan), tilted up and down (f) t) and changed focal length, zoomed in (Zoom) and other functions, through the ρτζ camera, not only can change the angle of the shooting and the flip of the cover at any time, but also adjust the size and clarity of the image through the change of the focal length. She can continue to monitor the effect and maintain the quality. . In the conventional target object tracking technology, the most traditional and longest development process is the automatic target object feature tracking technology (a_atic at the affining technique), which mainly uses feature extraction 201239813 (eature extraction) and Feature comparison (feafure stickers) = method, extract image features from the target object, and then track the target object according to the image features, but in the movement of the target object, the background of the surveillance area usually changes When the target object rotates, the image features will also change, and the P-Z camera continuously scans, all of the above factors will cause the difficulty of the feature comparison method in practical operation. Another kind of target object tracking technology is to use two cameras to use the outer pole correspondence rule (epipGlar rule) to find the projection basic matrix according to the corresponding feature points of the imaging plane (projection fundamental). Matrix), used to lock and track the target object. However, when one of the cameras performs scanning and rotates, the corresponding imaging surface also changes. The correspondence between the two cameras has changed. The external pole correspondence rule is used to calculate the accuracy. The corresponding feature points are not easy. In the history of the algorithm about tracking, there are also many effective methods, and the CamShift algorithm is tracked by the color probability distribution, by calculating the color probability distribution and constantly stacking After the convergence is converged, to find the center and size of the target, and then find out the object to be tracked, but the disadvantage is that if you encounter objects of similar color, such as the characters in the tracking, the color is red, and the color of the chair is just right. It’s red. When people walk near the chair, the CamShift algorithm may jump to a chair of similar color, causing tracking errors. And the CamShift algorithm requires a lot of data processing and calculation because it needs to calculate the color probability distribution. Additional signal processing integrated circuits (DSPs) are needed to assist or use a high-performance computer to assist in the calculations. Therefore, in view of the above-mentioned deficiencies, the present inventors have proposed a method of tracking the ball type 201239813 by using a motion vector (motionvect〇r) to assist in cutting the foreground object, thereby reducing the burden on the hardware and allowing the camera to operate. Secondly, it is a research and design system to provide consumer consumption. The main purpose of the invention is to provide a ball-type camera to automatically track the use of motion vectors to assist in the foreground: two ways to enable rapid detection of the target to be tracked, and thus control the ball type = Machine = direction, speed and focal length to automatically follow the target, so that the effect of automatic tracking of the excellent two objects, thereby increasing the overall complexity and excellence. The second object of the invention is to provide a ball camera automatic tracking of the eight treasures through the scene image binarization, and then from the prototype of the scene image binarization to cut out connected components with motion vectors (connected components) And by image analysis to eliminate the noise to form the target to be traced, thereby increasing the overall convenience and speed. And for the purpose of the above, the main steps of the present invention include: obtaining a picture, and taking the image of the image taken from the inside of the face monitored by the ptz lens: taking the image into a plurality of macro regions Block i^acroblock) 'and each macro block in the image (_can) a motion vector (motion vector); to determine the current state of motion of the dome camera · · When the spherical position is moving, can match Information such as direction of motion and speed, the motion of the moving scene is binarized to the original image of the scene: when the motion vector is restored, the scene and the image are binarized to see the objects in the scene. The prototype of the segmentation movement to the tanned object: the even if object (GQnneetedec) mpc_ts from the binarization of the scene image; the analysis and chasing the point of the 201239813 ^ f connected object · again Connected components are analyzed to age the noise '(10) into the target to be tracked; and the target is tracked _ when the target becomes the tracking target, that is, by controlling the direction, speed and focal length of the dome camera Come to automatically Shot object, in order to facilitate for the rod mesh followers thereof. Further features and specific embodiments of the present invention will be further understood from the following detailed description taken in conjunction with the accompanying drawings. [Embodiment] The % reference to the first to third embodiment is a flow chart of the method for automatically tracking the ball camera of the present invention, and a schematic diagram of the real state. The main steps of the method of the present invention include: Step S1: Acquiring a picture: extracting a still image through the 监视 监视 监视 监视 监视 监视 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; Butterfly into a plurality of macroblocks, and each motion block (maCr〇bl〇Ck) in the image is obtained as a motion vector (giving i〇n vect〇r); step S12 0 determines the current ball The motion state of the camera: When the dome camera 1 Q is in the moving state, it can cooperate with the current motion direction and speed of the ball camera 'q to restore the motion vector scene of the moving scene; step S13 0 scene image is performed Binarization: When the motion vector is restored, the scene image is binarized to see the prototype of the object in the scene; Step S14 0 The connected object in the motion vector: binarized from the scene image俺 俺 四 四 四 四 四 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 咖 2012 2012 2012 2012 2012 2012 2 targets to be tracked; Object tracking step s 160: When the object to recover fine 2〇 become standard, i.e., by controlling weave 1⑽ _ camera direction, speed and the focal length of the object with the film to automatically 20, to facilitate the object 2 billion for the followers. The step S 1 6 0 target tracking step includes the following steps: Step S 1 6 1 judges the target-No as the tracking target: confirms that the target 2 is the target to be tracked, and starts to track; step si 6 2 Determine the size of the tracking target in the picture: when the tracking target is too large or too small in the face, adjust the ball type 1 ° magnification to match the window of the screen; step si 6 3 to determine whether the tracking target is close to the screen Edge: adjusts the dome camera 丄Q speed to follow the tracking target when the tracking target is too close to the edge of the screen; wherein when the step S161 determines that the target is not the target, the next step is performed. Step S1611 rides the lost target Whether the time exceeds the critical value: when the threshold value is exceeded, the tracking target is lost and the tracking is ended. Otherwise, when the threshold value is not exceeded, when the Wei target appears, the spherical motion is reduced to follow the tracking target image analysis system. It includes analysis of the position (P〇sition), size (size), direction of travel, color (c〇1〇r), and (4) blood generation of the target, so as to improve the target 2Q. Accurate judgment; another every macro block 201239813
Uacroblock)係為Ν χ N像素點’且物、丄 =或其他靖;科’纖嫩—墙含有位置向 置、位移向量、速度向量及加速度向量;另該步驟S 1 2 〇 判斷目前球型攝影機之運雛態進—步為靜止狀態時,即進 订下-步驟S13 Q之場景圖像進行二值化者。 ▲凊參考第1至3圖所示’係為本發明球型攝影機自動追 蹤之方法之流麵意實施狀_糊。本發明最佳操作 原理係為應用在球型攝影機Η自動追縱移動物體(本發明 之^票物2 0係為汽車)上,經由ρ τ ζ鏡頭丄i快速移動 以攝錄場景影像30,而透過本發明之方法的ρτζ鏡頭丄 1於一秒内可以攝錄出Y張靜態影像來分析及追蹤,所以一 張靜態影像只需不到1/γ秒内(γ可為i5或其他數字) 就可以絲所有步·^(如第以卿),所以在步驟Η 2 〇中取得—張影像:透過p τ Z鏡頭1〇所監視的畫面中 °取出一張靜態影像;係在將攝錄的場景影像3〇投射在影 像感應器上,而該影像感應器係為電荷耦合元件感應器⑽) 或互補式錢半導體影像錢It (CMOS)射-種,藉以從 ^像感應H中掏取出—張張的靜態影像以能進行下一步驟的 分析及追縱’而在步驟s i !Q取得影像之 像切割成細㈣暖·秦k),蝴像中每一個 巨集區塊(macroblock)取得一個運動向量(船ti〇n t〇r )’田從衫像感應器中掏取出一張的靜態影像後即將影 8 201239813 像切割成複數個巨集區塊(macr〇bi〇ck),其中該每一個巨集 區塊(macroblock)係為N X N像素點,且N為8、1 6、 3 2或其他數子,再從巨集區塊(macr〇bi〇ck)中取得運動 向量’該運動相量包含又分量及γ分量,而每一個分量都有 正負之分’且運動相量包含有位置向量、位移向量速度向 量及加速度向量’其中位置向量係由座標顧指向質點位置 丁乃、穴Λΐ、Π· 速度向量又分有平均速度: rit . v = lim-^- = ^.7+^ 速度· “°Δ/ Λ j 丄 + a ~AV Av,~ Δν 加速4 : 5 = fe|7=a/+^ 而位移向量係為位置向量的變化量,由初位置指 向末位置的向量,,再者該 β . _ Ar Ky 一 Λ、, j=v:J + vy] 而加速度向量又分有平均 /+<ν ’及瞬時加速度: 曰 因此透過巨集Q塊(macroblock)中的運 動向篁可以得知場景影像3 q中哪邊有物體在運動,並估算 出其運動之方向及速度,以使能判斷㈣景影像3 〇中是否 有物體在移動,而能進行下—步驟,而步驟S120判斷目 前球獅職之運她態:當球鶴频! 0為移動狀態 時’月匕配合球型攝影機1◦目前的運動方向及速度等資訊, 將移動中場景的運動向量還原;由於球型攝影船〇經常快 速移動PTZ鏡頭11,會讓影像之運動向量變成無用的資 訊,於疋配合球型攝影機1()目前的運動(移動)方向及速 度(轉速)等身訊,以使能將場景影像3〇中的運動向量還 201239813 原來判斷出物體真正的運動向量其巾該步驟$ 12 〇判斷 目前球型攝影機之運動狀態如為靜止狀態時,即能判斷出場 景影像3 Q巾的倾是在移動中,且能算出其運動之方向及 速度,因此當目前球型攝影機1〇之運動狀態判斷出後即能 進行下—步驟’步驟s13 0場景圖像進行二值化:當運動 向量還原後,即進行場景圖像二值化,以能看出場景中物件 的離型’·當從每一巨集區塊(macr〇bl〇ck)中之運動向量判 斷出場景影像3 Q㈣邊有物體在運動,並估算出其運動之 方向及速度後,即侧灰階影像二值化(黑與白)來將場景 影像中形成物件(0bject)圖像和背景(Backgr〇und)圖像 的顯現,其場景圖像二值化時係把A於某健界灰度值的像 素灰度設献度極大值’把小於這個制像素灰度設為灰度 極小值’從而實現二值化,而這個工作主要的任務是正確地 找出物件(Object)的邊緣和線條,已便於看出場景中物件 的雛型,因此當物件的離型顯現時即能進行下一步驟,步驟 S14 0分割運動向量中之連通物件:從場景圖像二值化之 雛型中分割出具有運動向量的連通物件(connected components);當每一巨集區塊(macr〇bl〇ck)經由場景圖像 二值化後,將具有運動向量的物件雛型顯現出來,進而能進 行分割出具有運動向量的連通物件(c〇nnected components)’以取得連通物件的外貌及型態,便於判斷連通 物件是否為欲追蹤之目標物2〇,因此當具有運動向量的連 10 201239813 通物件(connected components)分割下來後即能進行下一 步驟,步驟S15 0分析並追蹤所分割出之連通物件:再將 連通物件(connected components)以影像分析來排除掉雜 訊,以形成欲追蹤之目標物2 Q ;然而分漏連通物件因包 3有大量的雜訊,使得分割出來的連通物件不夠確實及可 靠,而容易造成欲追蹤之目標物2 〇追蹤錯誤的現象,故需 再透過影像分析來排轉雜訊,其巾郷像分析係包含有該 目標物2 0之位置(position)、大小(size)、行進方向 (direction)、色彩(col〇r)或紋理(texture)等分析, 使將雜訊it掉樣呈現出較具雜及可靠的連職件,進而 能更提昇目標物2 0觸之鮮,以便於躺出是否為欲追 縱之目標物2 G,因此當影像分析域後即進行下-步驟, 步驟S16 0目標物追縱:當目標物2 〇成為追蹤目標後, 即透過控觀賴频1⑽方向、速度及驗來自_拍 目標物2 0,以利進行目標物2◦的追蹤;而當連通物件經 將雜訊雜成為-目標物2 Q後’即進行分析是否為欲追縱 ==〇即=當分析後其欲追蹤之目標物2 〇確認為 追賴满’即敵即透過控制球型攝影機1 Q的方向、速 度及焦距來自動跟_追縱目標,_進行目標 、 動追蹤者。 v目 而當欲追蹤之目標物2 Q確認為追細標時即 列步驟(如第2圖所示^ )步驟S161判斷目標物是否為追 201239813 蹤目標:確認目標物2 〇為欲追蹤目標,並開始進行追縱; 經確認目標物2 〇為欲追蹤目標後,即能立即透過控制球型 攝影機10的方向、速度及焦距來自動跟拍該追蹤目標而 當步驟S161判斷目標物2 〇不是追蹤目標時,即進行另 -步驟’步驟S i 6 i i判斷失去追蹤目標時間是否超過臨 界值:當超過臨界值時即追蹤目標遺失而結束追蹤,故一般 臨界值的時間大_設為3至5秒,所以—但超過臨界值^ 時間該追縱目標極有可能已不在球賴影機i Q所能攝錄的 範圍内’或是被障礙賴遮蔽,或是跟物件交料即喪失了 追蹤目標,而結束了本次追蹤目標的追蹤,以便重新進行新 追蹤目標的追蹤,反之,未超過所設定臨界值時間時,其追 蹤目標出現於球型攝影機i 〇所能攝錄的範圍内時,立即以 降低球型攝影機丄0的速度來跟隨追蹤目標移動,使球型攝 心機1〇忐攝錄到該追蹤目標’而當追蹤目標出現於球型攝 影機1〇之PTZ鏡頭1 1中(如第3圖所示)即進行下— 步驟’步驟s16 2判斷追蹤目標於晝面中大小:當追鞭目 標於晝面中太大或太小時,即調整球型攝影機1〇之倍率以 能符合晝面之視窗;經由目標物2 〇成為追蹤目標後,該p T z鏡頭11即會跟著追蹤目標的方位、位移、速度來移動 及調整’而當發現追蹤目標於晝面中太大時,該球型攝影機 1〇即能自動調整縮小倍率,以便追蹤目標能位於ΡΤζ於 頭11的正中央,反之,當發現追蹤目標於晝面中太小時, 201239813 該球型攝影機1Q亦能自_整放大倍率 ,以便追蹤目標能 位於PTz鏡頭11的正中央,使追蹤目標不管遠或近,其 〜@1 OtPTz鏡頭1 1均能追蹤到該追蹤目標, 而田追蹤目標位於ρτζ鏡頭i i中時即進行下一步驟,步 驟s16 3判斷追縱目標是否接近晝面邊緣:當追蹤目標太 接近晝面邊緣時’即調整球型攝雜1 0速度來跟隨追蹤目 才示’而球型攝影機1 ◦之PTZ鏡頭1 1在攝錄追蹤目標 時’有時因為魏目標本身的速度忽快忽慢 ,以使PTZ鏡 頭11在追蹤過程巾其追蹤目標會因太接近畫面邊緣而快要 跑出PTZ鏡頭11外’此時需透過調整加快球型攝影機1 〇之速度,使ΡΤΖ鏡頭11能加快往追蹤目標方向移動, 以能跟上該追蹤目標,反之,如追蹤目標沒有接近畫面邊緣 快的話’只要微調球型攝影機10之速度,使Ρ Τ Ζ鏡頭1 1能跟隨追蹤目標方向移動,—直到追縱目標已不在球型攝 影機1◦所能攝錄的範圍内,而喪失了追蹤目標,進而結束 本次追蹤目標的追蹤。 由以上可知’本發明之追縱之方法,具有如下之優點: 1、 該欲追蹤之目標物就算有突然加速、減速、被障礙物遮 蔽或是跟另-物件交錯,都可以雜優異的追縱效果者。 2、 本發明之綠適合實現在硬舰雜差的嵌入式平台 中,且不需要額外的訊號處理積體電路(DSp)輔助,就 能讓球型攝影機運行的更流暢者。 13 201239813 藉由以上詳細說明,可使熟知本項技藝者明瞭本發明的 確可達成前述目的,已符合專利法之規定,爰提出專利申請。 惟以上所述者,僅為本發明之較佳實施例而已,當不能 以此限定本發明實施之範圍;故’凡依本發明申請專利範圍 及說明書内容所作之簡單的等效變化與修飾,皆應仍屬本發 明專利涵蓋之範圍内。 【圖式簡單說明】 第1圖為本發明之主要步驟流程示意圖。 第2圖為本發明之追蹤目標步驟流程示意圖。 第3圖為本發明之實施狀態示意圖。 【主要元件符號說明】 10、 球型攝影機 11、 PTZ鏡頭 2 0、目標物 場景影像 步驟S10 0、取得-張影像 步驟S110、取絲像之運動向量 =;:::2:攝::之運_ 向量― 步驟s16 0、目標物^所分割出之連通物件 =;:;;判:;標失=否為追-標 步驟s 1 6 2、_細日^目標_是否超過臨界值 步驟s 163、判崎縱中大小 叫疋否接近畫面邊緣Uacroblock) is Ν χ N pixel point 'and object, 丄 = or other jing; section 'slim-wall contains position orientation, displacement vector, velocity vector and acceleration vector; another step S 1 2 〇 judge the current sphere When the camera is in a stationary state, that is, the scene image of the step S13 Q is binned. ▲ 凊 Refer to the figures 1 to 3 for the method of automatic tracking of the ball camera of the present invention. The best operating principle of the present invention is to apply to the moving image object (the ticket of the present invention is a car) in the dome camera, and quickly move through the ρ ζ ζ lens 丄i to record the scene image 30, The ρτζ lens 丄1 through the method of the present invention can record and record Y static images in one second for analysis and tracking, so a static image takes less than 1/γ seconds (γ can be i5 or other numbers) ) You can take all the steps ^^ (such as Diqing), so in step Η 2 取得 to obtain - image: through the p τ Z lens 1 〇 monitor the screen to take a static image; The recorded scene image 3〇 is projected on the image sensor, and the image sensor is a charge coupled device sensor (10)) or a complementary money semiconductor image money It (CMOS) shot type, thereby sensing from the image sensing H Take out the static image of the sheet to enable analysis and tracking of the next step. In step si!Q, the image of the image is cut into fine (four) warm·qin k), and each macro block in the butterfly (macroblock) ) Get a motion vector (ship ti〇nt〇r ) After taking a static image, the image will be cut into a plurality of macroblocks (macr〇bi〇ck), where each macroblock is an NXN pixel, and N For 8, 16, 3 or other numbers, the motion vector is obtained from the macroblock (macr〇bi〇ck). The motion phasor contains the re-component and the gamma component, and each component has a positive or negative The 'movement phasor contains position vector, displacement vector velocity vector and acceleration vector' where the position vector is divided by the coordinate point to the particle position Ding Na, the hole, the Π · velocity vector and the average velocity: rit . v = lim -^- = ^.7+^ Velocity · "°Δ/ Λ j 丄+ a ~AV Av,~ Δν acceleration 4 : 5 = fe|7=a/+^ and the displacement vector is the amount of change in the position vector, The vector from the initial position to the end position, and then the β. _ Ar Ky Λ, j=v:J + vy] and the acceleration vector is divided into average /+<ν ' and instantaneous acceleration: The motion direction in the macroblock can know which side of the scene image 3 q is moving, and estimate The direction and speed of the movement, in order to enable judgment (4) scene image 3 是否 whether there is an object moving, but can carry out the next step, and step S120 judges the current ball lion position of her state: when the ball crane frequency! 0 for the mobile In the state, the monthly movement and the speed of the dome camera are used to restore the motion vector of the moving scene. Since the spherical photography boat often moves the PTZ lens 11 quickly, the motion vector of the image becomes useless. The information, Yu Yu cooperates with the current motion (moving) direction and speed (rotation speed) of the dome camera 1 to enable the motion vector in the scene image 3〇201239813 to determine the true motion vector of the object. The step of the towel is $12 〇. When the motion state of the current dome camera is at rest, it can be judged that the scene image 3 is tilted while moving, and the direction and speed of the motion can be calculated, so the current ball After the motion state of the camera is judged, the next step can be performed. Step s13 0 The scene image is binarized: when the motion vector is restored, the scene graph is performed. Binarization to see the object's separation from the scene'. When the motion vector in each macroblock (macr〇bl〇ck) is used to determine the scene image 3 Q (four) side of the object is moving, and estimated After the direction and speed of the motion, the side grayscale image binarization (black and white) is used to visualize the object (0bject) image and the background (Backgr〇und) image in the scene image, and the scene image 2 In the case of value, the maximum value of the pixel gradation of A in a certain gray value is set to 'the minimum value of this pixel is set to the minimum value of the gray level' to achieve binarization, and the main task of this work is Correctly finding the edge and line of the object makes it easy to see the prototype of the object in the scene, so the next step can be performed when the object is released, and the connected object in the motion vector is segmented in step S14 0: Segmented components with motion vectors are segmented from the prototype of scene image binarization; when each macroblock (macr〇bl〇ck) is binarized via the scene image, it will have motion The vector prototype of the vector appears and can be carried out Cut out the connected objects (c〇nnected components) with motion vectors to obtain the appearance and shape of the connected objects, and to judge whether the connected objects are the target objects to be tracked, so when the motion vector has the connection 10 201239813 After the connected components are segmented, the next step can be performed. Step S15 0 analyzes and tracks the separated connected objects: and then connects the connected components with image analysis to eliminate the noise to form the target to be tracked. Object 2 Q; however, the leaky connected object has a large amount of noise due to the packet 3, so that the separated connected object is not reliable and reliable, and it is easy to cause the target to be tracked 2 〇 tracking error, so it is necessary to pass the image analysis again. To circulate the noise, the image analysis system includes analysis of the position, size, direction, color (col〇r) or texture of the object. The noise is dropped out of the sample to present a more complicated and reliable job, which can further improve the target's 20 touches, so as to lie down for the purpose of squatting. 2 G, so when the image analysis domain is followed by the next step, step S16 0 target tracking: when the target 2 〇 becomes the tracking target, that is, by controlling the frequency 1 (10) direction, speed and inspection from the _ shooting target Object 2 0, in order to facilitate the tracking of the target 2◦; and when the connected object becomes the target 2 Q after the noise is mixed, it is analyzed whether it is intended to be traced ==〇〇=When the analysis is to be traced The target 2 is confirmed to be a full-track, that is, the enemy automatically controls the target, speed, and focal length by controlling the direction, speed, and focal length of the dome camera. v target and the target to be tracked 2 Q is confirmed as a trace target when the step (as shown in Fig. 2) Step S161 determines whether the target is chasing 201239813 Track target: Confirm target 2 欲 is the target to be tracked And after the target 2 is confirmed to be the target to be tracked, the tracking target can be automatically taken by controlling the direction, speed and focal length of the dome camera 10, and the target 2 is judged in step S161. When the target is not tracked, the other step 'step S i 6 ii is judged whether the lost tracking target time exceeds the critical value: when the critical value is exceeded, the tracking target is lost and the tracking is ended, so the time of the general threshold is large _ is set to 3 Up to 5 seconds, so - but beyond the threshold ^ time, the tracking target is very likely not in the range that can be recorded by the camera i Q' or is blocked by the obstacle, or lost when the object is delivered Tracking the target, and ending the tracking of the tracking target, in order to re-track the new tracking target. Otherwise, when the threshold time is not exceeded, the tracking target appears in the dome camera i When the range of the camera can be recorded, the tracking target movement is immediately followed by lowering the speed of the dome camera ,0, so that the dome camera is recorded to the tracking target' while the tracking target appears on the dome camera 1 In the PTZ lens 1 1 (as shown in Figure 3), proceed to the next step - step s16 2 to determine the size of the tracking target in the face: when the target is too large or too small in the face, adjust the ball type The magnification of the camera is one that matches the window of the face; after the target 2 becomes the tracking target, the p T lens 11 moves and adjusts along with the orientation, displacement, and speed of the tracking target. When the surface of the dome is too large, the dome camera can automatically adjust the reduction ratio so that the tracking target can be located in the center of the head 11; otherwise, when the tracking target is found to be too small in the face, 201239813 The camera 1Q can also self-calibrate the magnification so that the tracking target can be located in the center of the PTz lens 11, so that the tracking target can be tracked to the tracking target regardless of the distance or near, and the @1 OtPTz lens 1 1 can track the tracking target. When the target is located in the ρτζ lens ii, the next step is performed, and the step s16 3 determines whether the tracking target is close to the edge of the face: when the tracking target is too close to the edge of the face, the angle of the ball is adjusted to follow the tracking target. 'The ball camera 1 ◦ PTZ lens 1 1 when recording the tracking target' sometimes because the speed of the Wei target itself is slow and slow, so that the tracking target of the PTZ lens 11 in the tracking process will be too close to the screen The edge is about to run out of the PTZ lens 11'. At this time, it is necessary to adjust the speed of the dome camera 1 to make the lens 11 move faster toward the tracking target to keep up with the tracking target. Otherwise, if the tracking target is not If the edge of the screen is fast, 'just fine-tune the speed of the dome camera 10 so that the 1 Ζ Ζ lens 1 1 can follow the tracking target direction—until the tracking target is no longer within the range that the dome camera can record, and The tracking target was lost, and the tracking of this tracking target was ended. It can be seen from the above that the method of the present invention has the following advantages: 1. The object to be tracked can be chaotically chased even if it is suddenly accelerated, decelerated, obscured by obstacles or staggered with another object. Vertical effect. 2. The green of the present invention is suitable for implementation in an embedded platform of hard ship noise, and does not require additional signal processing integrated circuit (DSp) assistance, so that the ball camera can run more smoothly. 13 201239813 By the above detailed description, it will be apparent to those skilled in the art that the present invention can achieve the foregoing objects, and the patent law has been met. The above is only the preferred embodiment of the present invention, and the scope of the present invention is not limited thereto; therefore, the simple equivalent changes and modifications made by the scope of the present application and the contents of the specification, All should remain within the scope of the invention patent. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a schematic flow chart showing the main steps of the present invention. Figure 2 is a flow chart showing the steps of the tracking target of the present invention. Figure 3 is a schematic view showing the state of implementation of the present invention. [Description of main component symbols] 10. Spherical camera 11, PTZ lens 20, target scene image step S10 0, acquisition-image step S110, motion vector of the taken image =;:::2:photo:: _ _ vector - step s16 0, the connected object ^ separated by the connected object =;:;; judgment:; mark loss = no for the chase - standard step s 1 6 2, _ fine day ^ target _ whether the threshold value is exceeded s 163, the size of the judgment is vertical and the size is close to the edge of the picture