1228086 玖、發明說明: 【發明所屬之技術領域】 本發明係_駕柄辅助纽,朗是 警示裝置财法,可裝設在車_轉行車的2 【先前技術】 駕駛汽車這件事包含好—連串的動作,包括駕敬者 對當時環境的知覺、做出觸、織再控制汽車的行進方 向,在安全的駕車程序中,駕駛者對週遭環境做出正媒的 判斷是-個關鍵時刻,但是駕驶者很容易被分散注意力, 也因為人的生理知覺系統無法同時處理很多突發的事件, 為了協助和保護駕駛人,目前正研究一系列有關智慧型運 輸系統(intelligent transportation systems,ITS),而其中的 智慧車(intelligent vehicle,IV)技術強調利用先進的偵測、 辨識、通訊與自動控制的方式,達到主動式安全的目的, 在事故可能發生之前,主動察覺並提供辅助以避免事故的 發生。 傳統之車輛安全防護技術中使用的感測器主要有超 音波感測器(ultra-sonar sensor)、毫米波雷達 (millimeter-wave radar)、和視覺攝影機(image camera)。圖 一為一傳統之車輛警示系統的結構示意圖,其使用超音波 感測器來實現近距離的側面來車警示及倒車警示。超音波 感測器價格便宜但缺點是測量距離短,僅適用於近距離且 1228086 移動速度慢的應用。除了偵測距離短的特性外,超音波感 測器遇到錢狀況時也會有較A的干擾,對於車道上 物體侧的贿度絲,&且車道縣料讀超音波的 反射有任㈣響,所料法進行車道標線的_,也無法 實現車道偏移警示的功能。 關於偵測車道標、線的技術,圖二的和圖二(的說明傳統 之使用-鋪殊的油漆於車道上晝製道路標雜標線的技 術。此油漆是微波/毫米波(mim_meter_wave,讀|)輕射 偵測用途與道路標誌偵測方法的強化漆,透過一個微波/ 毫米波輻射偵測器由車輛攜帶,用來提供道路標誌之 MMW幅射偵測,藉由塗覆強化漆的標線與普通路面對 MMW有不同反射能量的特性,而達到偵測車道標線的目 的。雖然MMW有較佳的精準度並且適用於各種天候,但 此種方法需將所有車道標線重新畫製,工程規模浩大且成 本高昂,而且MMW缺點是感測的區域較小,大約在4到 8度的範圍之内,所以需要針對不同的車型,精確地考量 偵測器安裝的角度與位置,增加裝設上的複雜度和不便。 以上兩種主動式感測器有發射波干擾、反射、接收角 度的問題。屬於被動式感測器的視覺攝影機則沒有這些考 量,是唯一能自動感測車道標線、交通標誌、以及行路人 的感測器。CCD與CMOS感測技術提升了視覺感測器的品 質,並且有效地降低了成本,因此,以視覺攝影機作為車 7 1228086 輛安王應用所需的感測器,是一個非常合適的方法也是技 術發展的趨勢。 關於使用視覺攝影機來祿取車道資訊的技術,在圖三 之傳摘-種合作式人工副駕H財,就是糊視覺攝 ”機來取得車輛運動方向與道路曲率資訊,配合轉向驅動 子系統與。作式副駕驶決策與控制中樞,來達成所謂的電 腦輔助式、A轉向祕。此技術的目標是計算道路的曲 率’右疋車輛行駛在多線車道的道路時(例如高速公路或快 速道路),雖然可以求得道路的曲率,但是卻無法知道車輛 目前位於哪-個車道,也就是說當車輛髓車道或是跨車 道行駛時,沒辦法判斷車子是否有偏移車道的情形,無法 達到偏移警示的目的;甚且此技術也無法處理虛線型式的 車道標線,並限制視覺攝影機必須安裝在車子橫轴的中點 位置,否則會影響演算法的判斷正確率。 在美國專利5,530,420揭露的文獻裡,使用兩個攝影 機來操取道路資訊,利用兩個攝影機之間的視角差異來進 行立體座標轉換運算,並使用攝影機視野邊界與視野内特 定直線間夹角的大小來判斷標線的位置。雖然使用立體視 覺除了可將車道辨識出來外,也能計算出位於車道上物體 之間的相對距離,但是,安裝立體攝影機所需的精準度很 高,校正的機制也非常複雜,而且立體座標轉換的運算量 很大,所以需要額外獨立的運算主機,造成安裝上的不便 8 1228086 與降低使用的方便性。 在美國專利5,689,249揭露的文獻裡,使用直接朝向 地面的攝影機來擷取車道資訊,雖然所得到的影像比較單 純,車道標線的資訊較易擷取出來,然而為了讓攝影機的 角度能照到整個車道,攝影機安裝的高度必須大於特定 值,也就是具有高車頂的車型才能符合條件,因此無法讓 一般的小客車來使用。在美國專利6,489,887揭露的文獻 裡,利用攝影機來取得道路模型參數,並計算出道路的彎 曲率,配合裝置在車上的偏航角度感測器(yaw rate sensor),當車子的偏航角度無法滿足道路的彎曲率時,則 發出警訊來提醒駕驶者;然而其採用s〇bel濾破器來分析 各種角度的標線,並藉此算出道路的彎曲率,演算法運算 量過多且複雜;此外需要額外的偏航角度感測器才能達到 目的’徒增裝設上的成本與複雜度。 【發明内容】 為克服上述傳統技術未能解決的問題,本發明主要目 的為&供一種裝設在車輕内的車道偏移警示裝置與方法。 本發明之車道偏移警示技術係利用單一視覺攝影機及新穎 的影像處理方法,自動偵測車輛不當偏移車道的情形,並 給予駕敌人警示,以保障行車的安全。 本發明的車道偏移警示裝置主要包含一車道視訊資 9 1228086 訊擷取單元、一車道偏移偵測單元、和一警示單元。其中 車道視訊資訊擷取單元使用一視覺攝影機在行車中拍攝路 面的原始影像,擷取路面原始影像資訊,透過車道偏移债 測單元裡的標線偵測單元的運算,利用一高通濾波器 (spatial high-pass filter)及根據一亮度下限值將車道標線從 該車道中過濾出來,再利用此資訊將搜尋區域(region of interested,R0I)初始化,並利用搜尋區域來偵測車道標 線,並由車道偏移偵測單元裡的車道偏移判斷單元判斷是 否有車道偏移,若為車道偏移,則經由警示單元來提醒駕 根據本發明,車道視訊資訊擷取單元之視覺攝影機可 架設在多處,包括在左或右後視鏡和擋風玻璃的中間位 置、或是近中央後視鏡的位置、或是車輛内的中間位置。 車道偏移偵測單元裡的標線偵測單元包括影像處理子單 元、動態ROI計算子單元、ROI記憶子單元、R〇I内標線 檢測子單元、和ROI設定子單元。而rqI的設定可由使用 者來設定、或是設定幾组存於記憶子單元以供套用、或是 使用動態计算ROI以方便使用者來校正、或是結合上述幾 種方式來設定。警示單元除了使用者自行決定使用的時機 外,更包括一個自動判斷機制來決定暫時關閉或回復警 示,例如使用兩個輸入端來實現自動關閉警示的功能,此 機制分別為「開啟方向燈」與「車速小於某速限值」。 10 1228086 依此,本發明的車道偏移警示方法主要包含影像輸入 的步驟、影像分析處理的步驟、R0I設定的步驟、判斷車 道偏移的步驟、以及能自動啟動或關閉警示車道偏移的步 驟。根據本發明,若在R0I内找不到標線,並持續發生一 段時間,便判斷車道偏移並對駕駛人發出警告;而在車道 偏移狀態中,ROI内偵測出標線,並持續一段時間,則判 斷車輛回復正常車道,並停止警告。除此之外,在警示車 道偏移的步驟裡可加入自動關閉警告的參數,例如車速低 於一定限制時,或是當方向燈開啟時。 综上所述,本發明之車道偏移警示裝置不但不用限制 視覺攝影機安裝的位置,而藉由搜尋特殊區域的車道標線 來降低運算量’並且能自動啟動或_系統來避免誤判的 情形發生,例如··當駕駛者是有意識地打了方向燈來變換 車道,或是進㈣站及下交流道咖車流量多且標線標示 複雜時,自動關閉系統來避免誤判的情形發生,待車速高 於某-下限值咖自行啟動,若分析結果顯示有碰撞的可 能則以蜂鳴聲、閃光、或是語音方^給駕驶者提醒警示, 以保障行車的安全。 茲配合下列圖式、實施例之詳細說明及專利申請範 圍,將上述及本創作之其他目的與優點詳述於後。 【實施方式】 1228086 圖四為本發明之車道偏移警示裝置的一方塊示意 圖。參考圖四,此車道偏移警示裝置主要包含一車道視訊 資訊擷取單元4〇卜一車道偏移偵測單元403、和一警示單 元405。其中車道視訊資訊擷取單元4〇1使用一視覺攝影 機在行車中拍攝路面的原始影像,擷取路面原始影像資 訊,透過車道偏移偵測單元403裡的標線偵測單元403a的 運算,利用影像處理技術及結合動態計算搜尋區域,於搜 尋區域内偵測車道標線,根據車道標線偵測結果,由車道 偏移偵測單元403裡的車道偏移判斷單元4〇3b來判斷是否 有車道偏移,並送出一警示指令。警示單元4〇5根據此警 不指令的結果,自動啟動或關閉提醒駕駛人的警示。 根據本發明,針對車道標線而言,如圖五所示,標線 偵測單元403a接收路面原始影像後,進行該原始影像的影 像處理(如標號5〇1所示),利用一高通濾波器,如Prewitt 運算子’初步找出影像中線條明顯的部分。若再加上亮度 限制,可以得到更進一步的結果。根據此結果,動態計算 搜尋區域(如標號503所示),經過搜尋一段時間後,定義 出一組搜尋區域,然後在此搜尋區域内偵測標線(如標號 5〇5所示),並將標線偵測結果回應給車道偏移判斷單元 403b。 有了搜尋區域和標線偵測結果之後,便可進行車道偏 移偵測及警示。車道偏移判斷法則及流程以圖六之有限狀 12 1228086 態機(finite state automata)來作說明。一開始,車道偏移判 斷單元403b接收到標線偵測結果時,車輛可能處於兩種情 況’亦即,在搜尋區域内找到標線與找不到標線兩種情況。 若在搜尋區域内找到標線(即標線Yes),則車道偏移判斷單 元403b判斷車輛處於「不偏移」狀態。若在搜尋區域内找 不到標線(即標線No),則可能處於偏移狀態,也可能搜尋 區域恰好在車道標線為虛線時,沒畫線的空檔,因此車道 偏移判斷單元403b判斷車輛處於「偵測偏移」狀態。待找 不到標線一段時間後,如連續10張畫面(frame),車道偏移 判斷單元403b才判斷車輛處於「偏移」狀態並發出警告。 「偵測回復」狀態是車輛從「偏移」狀態回復到「非偏移」 狀態的中間狀態。處於「偏移」狀態的車輛若在搜尋區域 内找到標線,則進入「偵測回復」狀態,並減緩警示。待 一小段時間内,如連續3張畫面,搜尋區域内有標線,則 回復並進入「不偏移」狀態,並停止警示。 關於車道偏移警示指令的發送,本發明考量除了使用 者自行決定使用的時機外,可再加入一個自動判斷機制來 決定暫時中斷警示指令的發送,以免誤警示動作頻繁而增 加使用者的困擾。而決定暫時中斷警示指令的參數如「開 啟方向燈」與「車速小於某速限值」等。方向燈判斷為駕 駛人本身想變換車道或轉彎;而車速小於某速限值則有較 多不同意義,一般而言,車速變慢時的情況都非常適合關 閉警示裝置,例如:當駕驶於市區道路時,市區道路可能 13 1228086 因為車流量多,或者車道標線標減雜,*適合進行偵測, 反之,若行車速度較快,則可能駕駛於省道或是其他快速 道路上,則為適合啟動裝置的時機;若行車期間遇到紅燈 而讓車速變慢,則再謂閉此裝置;若行柄高速公路上, 也非$適合目前進收費站及下交流道時使用此中斷機制。 實施例中,本發明使用「方向燈」及「車速下限」為 暫時中斷警示齡紐的參數,圖七為根據本發明之車道 偏移判斷單元4〇;3b的一個較佳實施架構。此實施架構中, 將圖/、之有限狀態機與暫時中斷警示指令之自動判斷機制 搭配實施。圖七之實施例中,「方向燈開啟」為邏輯〇,「車 速太低」為邏輯〇。因此當車道偏移有限狀態機7〇1為「偏 移」狀態,且車輛之「方向燈未開啟」,且車輛之「車速不 夠高」時,車道「偏移」的警示指令才會發送以提醒駕駛 警示單元405接收到車道偏移判斷單元403b發送的 車道「偏移」警示指令後,可以多種方式給予駕駛者提醒 警示,例如以蜂鳴聲、閃光、或是語音方式、或是其中任 何一種組合方式來實施,以保障駕駛者行車的安全。 根據本發明,車道視訊資訊操取單元之視覺攝影機不 需一定架設在車輛内的中間位置,可架設在多處,包括在 近左或右後視鏡的位置、或是擋風玻璃的上下方位置、或 14 1228086 是近中央後視鏡的位置、或是車輛内的中間位置、或是兩 個刖大燈之間的位置,如圖八所示。惟,為了避免辦污攝 影機鏡頭,增加視訊擷取和處理困難,宜將攝影機架設於 車輛内。 以上描述本發明之車道偏移警示裝置中各單元的功 能和運作,以及彼此之間的相關性。依此,本發明同時也 提供了一種以連續影像判斷車道偏移的方法,如圖九所 示,主要包含影像輸入的步驟9〇1、影像分析處理的步驟 903、ROI設定的步驟9〇5、車道偏移偵測的步驟9〇7、以 及能自動啟動或關閉警示車道偏移的步驟9〇9。以下再參 考圖九,並詳細說明各步驟及彼此之間的運作流程。 一開始,輸入視覺攝影機在行車中拍攝路面的原始影 像,如步驟901。然後進行此原始影像初步的分析處理, 如步驟903,包括擷取其下一張影像畫面(步驟9〇3a)和邊 界偵測(edge detection,步驟903b)以找出影像中線條明顯 的部分’以及加上一亮度門檻值(brightness threshold,步驟 903c)的限制,得到影像中線條更進一步的結果。利用此資 訊接著進行R0I設定的步驟905,以提供一搜尋區域作為 偵測車輛是否有車道偏移的判斷依據。 在步驟905裡,首先必須考量尺01是否已設定好(步 驟905a) ’若R0I已設定好,則接續進行判斷車道偏移的 15 1228086 步驟9〇7;否則必須考量是否重新設定R〇I(步驟9〇5的,若 要重新設定ROI,則進行另一 R〇I的初始化(步驟9〇5 c), 若不重新設定RQI,舰―儲存單元裡下載此R〇i(步驟 905d)並接、續進行判斷車道偏移的步驟術。而是否重新設 定ROI,則可依輸入之使用者的命令來蚊,如標號術 所示。 有了 δ又疋好的ROI後’判斷車道偏移則在此R〇I内 進行(步驟907a),而決定是否有車道偏移(步驟9〇7b)如圖 六所述。在ROI内判斷無車道偏移的話,則返回步驟9Q3, 否則考量是否暫時中斷車道偏移的警示(步驟9〇9a)。若暫 時中斷車道偏移的警示,則返回步驟9〇3;若不中斷車道偏 移的警示,則將車道偏移的警示結果會知警示單元(步驟 909b)。而是否暫時中斷警示指令可依輸入的參數,如「車 輛指示燈的狀態」與「車輛的行駛速度」等,來決定(步驟 909c)。 為了更了解本發明之判斷車道偏移的方法,在步驟 903之原始影像分析處理完後,以下將再詳細說明rOI的 設定流程,包括ROI的搜尋和定義。 根據視角與距離之關係,距離越遠,相同橫向位移造 成視角變化越小;反之,距離越近,視角變化越大。根據 此原則,以標線偵測車道是否偏移,當然是實際距離越近 16 1228086 的標線越好,而由處理後的二元化影像畫面上來看,最接 近車道標線的位置,在畫面左右下角兩端附近範圍内,同 時也希望ROI的位置出現在最接近此位置之地方。由於本 發明之裝置可由使用者自行安裝於車内,所以安裝位置不 盡相同,且由於駕駛人對於車道置中感覺也不盡相同,因 此本發明之設計可讓使用者進行R〇I初始化。其方式為將 連續3〇張影像畫面,用兩組” L “形及,’」“形的搜尋 方式,圖十所示為,在處理後的二元化影像畫面的左右下 角兩端附近範圍内用兩組” L “形及”」“形的搜尋方 式。 關於’’ L “形搜尋方式,以畫面左下角之” L “為 例,說明如下:(1)搜尋初始點為” L “頂點,搜尋範圍 為分別向上、向右由近而遠搜尋。(2)初始時,以畫面左 下角為搜尋初始點,此時搜尋範圍大,如圖十一(a)所示。 (3)若搜尋到車道標線,將該點列入統計,並以該點為新的 搜寻初始點’且將搜尋犯圍改為小,如圖十^(b)所示。 如此搜尋一段時間後,如30張畫面,能找出畫面中 四個點之位置。圖十二為係說明用此兩組” L “形及”」 “形的搜尋方式找出四個對應點之流程圖。參考圖十二, 首先’取得下一張處理後的二元化影像(binary image)(步驟 1201)。然後利用” L “形及”」“形的搜尋方式,以畫 面左下角為搜尋初始點來搜尋車道標線(步驟12〇3)。之 17 1228086 後’檢查是否搜尋到車道標線(步驟1205)。若搜尋到車道 標線’將該點列入統計,並以該點為新的搜尋初始點,且 將搜尋範圍改為小(步驟12〇7)。如此搜尋,並檢查是否已 搜尋一段時間(步驟1209),如30張畫面,每秒10張畫面。 待搜尋過一段時間後,輸出這些搜尋初始點的平均位置(步 驟 1210)。 有了此搜尋初始點之平均位置的四個點後,就可定義 出ROI,現依序搭配圖十三說明如下。 圖十三(a)為之前以圖十一⑻和圖•一(b)所搜尋之平 均位置的四個點。將搜尋所得到兩組各兩點座標相連,即 為標線所在位置,而兩線交點,大約位於道路消失點位置, 圖十三(b)為由這四點所決定之兩條直線與其交點。以此交 點為圓心對兩條線往内展開α角度,如圖十三(c)所示。在 α角度的範圍内,取1/3線段距離内範圍,定義為r〇i。圖 十二(d)為將圖十三(c)之線段切為三個等分;圖十三(e)為取 最靠近下方之範圍内定為ROI。實施例中取α角度為3。 本發明之裝置一旦安裝於車輛内後,變更位置機率不 大,因此可設計幾組常用的ROI並儲存起來,方便駕駛人 套用,不需要每次使用皆初始化ROI—次。也可使用動態 計算ROI方式,方便使用者使用校正。甚且可使用記憶體 模組,以結合靜態強制ROI和動態計算ROI方式兩者的優 18 12280861228086 发明 Description of the invention: [Technical field to which the invention belongs] The present invention is _ driving handle auxiliary button, Lang is a warning device financial method, which can be installed in the car _ transit traffic 2 [prior art] driving a car includes a good thing — A series of actions, including the respect of the driver ’s awareness of the current environment, making contact, weaving and controlling the direction of the car. In a safe driving process, the driver ’s judgment of the surrounding environment is a key At times, but drivers are easily distracted, and because human physiological perception systems cannot handle many emergencies at the same time, in order to assist and protect drivers, a series of intelligent transportation systems (intelligent transportation systems, ITS), and the intelligent vehicle (IV) technology emphasizes the use of advanced detection, identification, communication, and automatic control methods to achieve active safety. Before an accident may occur, proactively detect and provide assistance to Avoid accidents. The sensors used in traditional vehicle safety protection technologies are mainly ultrasonic-sonar sensors, millimeter-wave radars, and image cameras. Fig. 1 is a schematic structural diagram of a conventional vehicle warning system, which uses an ultrasonic sensor to implement a near-side side vehicle warning and a back-up warning. Ultrasonic sensors are inexpensive but have the disadvantage of short measurement distances and are only suitable for applications with short distances and slow movement speeds of 1228086. In addition to the short detection distance, the ultrasonic sensor will also have more A interference when it encounters money conditions. For the bridging wire on the object side of the lane, & the lane county can read the ultrasonic reflection. Snoring, the expected method of lane marking can not achieve the function of lane departure warning. As for the technique of detecting lane markings and lines, Figures 2 and 2 (illustrate the traditional use-the technique of paving special road marking marks on the lanes. This paint is microwave / millimeter wave (mim_meter_wave, READ |) Strengthening paint for light shot detection and road sign detection method, carried by a vehicle through a microwave / millimeter wave radiation detector, used to provide MMW radiation detection of road signs, by coating with enhanced paint Marking lines and ordinary roads have different reflection energy characteristics to MMW, so as to detect lane markings. Although MMW has better accuracy and is suitable for various weather, this method requires all lane markings Repainting, the scale of the project is large and the cost is high, and the disadvantage of MMW is that the sensing area is small, in the range of about 4 to 8 degrees, so it is necessary to accurately consider the angle and Location, increasing the complexity and inconvenience of installation. The above two types of active sensors have problems with interference, reflection, and reception angles of transmitted waves. Vision cameras that are passive sensors do not have these considerations Is the only sensor that can automatically detect lane markings, traffic signs, and pedestrians. CCD and CMOS sensing technologies improve the quality of visual sensors and effectively reduce costs. Therefore, visual cameras are used as Car 7 1228086 The sensors required for the application of Anwang are a very suitable method and a trend of technological development. About the technology of using the visual camera to take the lane information, it is excerpted in Figure 3-a cooperative manual co-driver Hcai is a visual camera to obtain vehicle movement direction and road curvature information, and cooperate with the steering drive subsystem and the operating co-pilot decision-making and control center to achieve the so-called computer-assisted, A steering secret. The goal is to calculate the curvature of the road. When the vehicle is driving on a multi-lane road (such as a highway or expressway), although the curvature of the road can be obtained, it is not possible to know which lane the vehicle is currently in, that is, When the vehicle is driving in the lane or across the lane, there is no way to determine whether the car has deviated from the lane, and the deviation warning cannot be achieved. Even this technology cannot handle the lane markings of the dotted line type, and restricts the vision camera to be installed at the midpoint of the horizontal axis of the car, otherwise it will affect the accuracy of the algorithm's judgment. In the document disclosed in US Patent 5,530,420, Use two cameras to manipulate road information, use the perspective difference between the two cameras to perform stereo coordinate transformation calculations, and use the size of the angle between the camera's field boundary and a specific line in the field of view to determine the position of the marking line. Although used In addition to identifying the lane, stereo vision can also calculate the relative distance between objects located on the lane. However, the accuracy required for installing a stereo camera is very high, the correction mechanism is also very complicated, and the calculation of stereo coordinate transformation The amount is very large, so an additional independent computing host is required, which causes inconvenience in installation and reduces the convenience of use. In the document disclosed in US Pat. No. 5,689,249, a camera directly facing the ground is used to capture lane information. Although the obtained image is relatively simple, the information of lane markings is easier to retrieve. However, in order to allow the camera angle to cover the entire In the lane, the height of the camera installation must be greater than a certain value, that is, a model with a high roof can meet the conditions, so ordinary passenger cars cannot be used. In the document disclosed in U.S. Patent 6,489,887, a camera is used to obtain road model parameters and calculate the curvature of the road. In conjunction with the yaw rate sensor installed on the car, when the yaw rate of the car cannot When the curvature of the road is satisfied, a warning signal is issued to remind the driver; however, it uses a sobel filter to analyze the markings at various angles, and uses this to calculate the curvature of the road. The calculation amount of the algorithm is excessive and complicated; In addition, an additional yaw angle sensor is needed to achieve the purpose, which increases the cost and complexity of installation. [Summary of the Invention] In order to overcome the problems that cannot be solved by the above-mentioned conventional technology, the main purpose of the present invention is to provide a lane departure warning device and method installed in a vehicle light. The lane departure warning technology of the present invention utilizes a single vision camera and a novel image processing method to automatically detect the vehicle's improper lane departure and give warnings to the enemy to ensure the safety of driving. The lane departure warning device of the present invention mainly includes a lane video information acquisition unit, a 1228086 information acquisition unit, a lane departure detection unit, and a warning unit. The lane video information acquisition unit uses a visual camera to capture the original image of the road surface while driving, and captures the original image information of the road surface. The calculation is performed by the lane detection unit in the lane offset debt measurement unit, and a high-pass filter ( spatial high-pass filter) and filter lane markings from the lane according to a lower brightness value, then use this information to initialize the region of interest (R0I), and use the search area to detect lane markings And the lane deviation judging unit in the lane deviation detecting unit determines whether there is a lane deviation. If it is a lane deviation, the warning unit is used to remind the driver. According to the present invention, the visual camera of the lane video information acquisition unit may It is erected in many places, including the middle position of the left or right rearview mirror and the windshield, or the position near the center rearview mirror, or the middle position in the vehicle. The lane detection unit in the lane shift detection unit includes an image processing sub-unit, a dynamic ROI calculation sub-unit, a ROI memory sub-unit, a ROI internal standard line detection sub-unit, and a ROI setting sub-unit. The setting of rqI can be set by the user, or several groups stored in the memory sub-unit for application, or the dynamic calculation of ROI for the user to make corrections, or a combination of the above methods. In addition to the user's decision on when to use the warning unit, it also includes an automatic judgment mechanism to decide to temporarily close or reply to the warning. For example, two input terminals are used to automatically close the warning function. This mechanism is "turn on the direction light" and "The vehicle speed is less than a certain speed limit." 10 1228086 Accordingly, the lane departure warning method of the present invention mainly includes a step of inputting an image, a step of image analysis processing, a step of setting R0I, a step of judging a lane departure, and a step of automatically enabling or disabling a warning of lane departure. . According to the present invention, if a marking line is not found in R0I, and it continues for a period of time, the lane deviation is judged and a warning is issued to the driver; while in the lane deviation state, the marking line is detected in the ROI and continues For a period of time, the vehicle is judged to return to the normal lane, and the warning is stopped. In addition, you can add parameters that automatically turn off the warning in the step of warning lane departure, such as when the vehicle speed is below a certain limit, or when the direction light is turned on. In summary, the lane departure warning device of the present invention not only does not need to limit the position where the visual camera is installed, but also reduces the amount of calculation by searching for lane markings in special areas, and can automatically start or _ the system to avoid misjudgment. For example, when the driver consciously turned on the direction light to change lanes, or when the traffic volume at the entry station and the lower interchange was heavy and the markings were complicated, the system was automatically shut down to avoid misjudgment. If the vehicle speed is higher than a certain lower limit value, the driver will start automatically. If the analysis result shows that there is a possibility of collision, the driver will be warned with a beep, a flash, or a voice ^ to ensure driving safety. In conjunction with the following drawings, detailed description of the embodiments, and the scope of patent applications, the above and other purposes and advantages of this creation are detailed below. [Embodiment] 1228086 FIG. 4 is a block diagram of the lane departure warning device of the present invention. Referring to FIG. 4, the lane departure warning device mainly includes a lane video information acquisition unit 40, a lane departure detection unit 403, and a warning unit 405. The lane video information acquisition unit 401 uses a visual camera to capture the original image of the road surface while driving, and retrieves the original image information of the road surface. The calculation is performed by the lane detection unit 403a in the lane deviation detection unit 403, and The image processing technology and the dynamic calculation of the search area are used to detect the lane markings in the search area. According to the lane marking detection results, the lane deviation determination unit 403b in the lane deviation detection unit 403 determines whether there is The lane is deviated and a warning instruction is issued. The warning unit 405 automatically activates or deactivates the warning to remind the driver based on the result of this warning not instructing. According to the present invention, for lane markings, as shown in FIG. 5, the marking line detection unit 403a receives the original image of the road surface, performs image processing of the original image (as shown by reference numeral 501), and uses a high-pass filter. Such as the Prewitt operator 'to initially find the obvious lines in the image. If the brightness limit is added, further results can be obtained. According to this result, the search area is dynamically calculated (as shown by reference numeral 503). After searching for a period of time, a set of search areas are defined, and then a graticule is detected in this search area (as shown by reference numeral 505), and The detection result of the marking line is returned to the lane departure judging unit 403b. With the search area and graticule detection results, lane deviation detection and warning can be performed. The lane departure judging rule and flow are described with the finite state 12 1228086 state machine in Figure 6 (finite state automata). At the beginning, when the lane departure judging unit 403b receives the detection result of the marking line, the vehicle may be in two situations', that is, the marking line is found in the search area and the marking line is not found. If a marking line is found in the search area (ie, the marking line Yes), the lane departure judging unit 403b judges that the vehicle is in a "not offset" state. If no marking line is found in the search area (that is, the marking line No), it may be in an offset state, or the search area may not be drawn when the lane marking line is a dotted line, so the lane deviation determination unit 403b determines that the vehicle is in the "detection of deviation" state. After the marking line is not found for a period of time, the lane shift judging unit 403b judges that the vehicle is in the "shift" state and issues a warning if there are 10 frames continuously. The "Detection Recovery" state is an intermediate state where the vehicle returns from the "Offset" state to the "Non-Offset" state. If a vehicle in the "Offset" state finds a marking line in the search area, it enters the "Detection Recovery" state and mitigates the warning. After a short period of time, if there are 3 lines in the search area, there are marked lines in the search area, then it will reply and enter the "non-shift" state, and stop warning. Regarding the transmission of the lane departure warning instruction, the present invention considers that in addition to the user's discretion to use the timing, an automatic judgment mechanism can be added to decide to temporarily stop the sending of the warning instruction, so as to avoid frequent false warning actions and increasing user trouble. The parameters that decide to temporarily stop the warning command are "turn on the lights" and "vehicle speed is less than a certain speed limit". The direction light judges that the driver himself wants to change lanes or turn; while the speed is less than a certain speed limit, it has more different meanings. Generally speaking, when the speed is slower, it is very suitable to turn off the warning device, for example, when driving in the city For district roads, urban roads may be 13 1228086 because of heavy traffic or lane markings reduced, * suitable for detection. Conversely, if the driving speed is fast, you may drive on provincial roads or other fast roads. It is a suitable time to start the device; if you encounter a red light during driving to slow down the vehicle speed, the device is said to be closed; if it is on the highway, it is not suitable for using the toll station and the interchange Interrupt mechanism. In the embodiment, the present invention uses “direction lights” and “vehicle speed lower limit” as parameters for temporarily discontinuing the warning age. FIG. 7 shows a preferred implementation structure of the lane departure judging unit 40; 3b according to the present invention. In this implementation framework, the finite state machine of figure / and the automatic judgment mechanism for temporarily interrupting the warning instruction are implemented together. In the embodiment of FIG. 7, "direction light is on" is logic 0, and "vehicle speed is too low" is logic 0. Therefore, when the lane departure finite state machine 701 is in the "offset" state, and the vehicle's "direction light is not turned on", and the vehicle "vehicle speed is not high enough", the warning instruction of the lane "offset" will be sent to After the driving alert unit 405 receives the lane "departure" warning command sent by the lane departure judging unit 403b, the driver can be alerted in various ways, such as a beep, a flash, or a voice, or any of them A combined approach is implemented to ensure the safety of the driver. According to the present invention, the vision camera of the lane video information operation unit does not need to be installed in the middle position in the vehicle, and can be installed in multiple places, including near the left or right rearview mirror, or above and below the windshield. The position, or 14 1228086, is the position near the center rearview mirror, or the middle position in the vehicle, or the position between the two headlights, as shown in Figure 8. However, in order to avoid contaminating the camera lens and increase the difficulty of video capture and processing, it is advisable to set the camera frame in the vehicle. The above describes the functions and operations of the units in the lane departure warning device of the present invention, and the correlation between them. According to this, the present invention also provides a method for judging the lane shift based on continuous images. As shown in FIG. 9, the method mainly includes the step of inputting the image 101, the step of analyzing the image 903, and the step of setting the ROI 905. , Step 907 for lane departure detection, and Step 009, which can automatically turn on or off the warning lane departure. Refer to Figure 9 below and explain each step and the operation flow between them in detail. Initially, an input visual camera is used to take an original image of the road surface while driving, as shown in step 901. Then perform an initial analysis and processing of this original image, such as step 903, including capturing the next image frame (step 903a) and edge detection (step 903b) to find the obvious lines in the image ' And adding a limitation of the brightness threshold (step 903c) to obtain further results of the lines in the image. Using this information, the R0I setting step 905 is performed to provide a search area as a judgment basis for detecting whether the vehicle has a lane shift. In step 905, we must first consider whether the ruler 01 has been set (step 905a) 'If R0I has been set, then proceed to determine the lane departure 15 1228086 step 907; otherwise, we must consider whether to reset R〇I ( In step 905, if you want to reset the ROI, perform another R0I initialization (step 905c). If you do not reset the RQI, download this Roi in the ship-storage unit (step 905d) and Follow the steps to determine the lane shift. Whether to reset the ROI can be determined by the user ’s command, as shown in the labeling technique. With a δ and a good ROI, determine the lane shift. Then it is performed in this ROI (step 907a), and the determination of whether there is a lane shift (step 907b) is shown in Figure 6. If there is no lane shift in the ROI, then return to step 9Q3, otherwise consider whether Interrupt the warning of lane departure temporarily (step 909a). If the warning of lane departure is temporarily interrupted, return to step 903; if the warning of lane departure is not interrupted, the warning result of the lane departure will be notified Unit (step 909b), and whether to temporarily stop the warning command can be entered according to Parameters such as "state of vehicle indicator light" and "vehicle speed" are determined (step 909c). In order to better understand the method of judging the lane shift of the present invention, after the original image analysis processing in step 903 is completed, The following will explain the setting process of rOI in detail, including the search and definition of ROI. According to the relationship between viewing angle and distance, the longer the distance, the smaller the change in viewing angle caused by the same lateral displacement; conversely, the closer the distance, the larger the viewing angle change. According to Based on this principle, the lane is used to detect whether the lane is deviated. Of course, the closer the actual distance is, the better the line is. 1228086 The processed binary image shows that the position closest to the lane mark is on the screen. In the vicinity of the left and right bottom corners, it is also desirable that the position of the ROI appears closest to this position. Since the device of the present invention can be installed in the car by the user, the installation position is different, and because the driver is The feeling is also different, so the design of the present invention allows the user to initialize the ROI. The way is to draw 30 consecutive images Use two sets of "L" shape and "" "shape search methods. Figure 10 shows the use of two sets of" L "shape and" in the vicinity of the left and right bottom corners of the processed binary image screen. "" Shape search method. Regarding "L" shape search method, take the "L" in the lower left corner of the screen as an example, the description is as follows: (1) The initial point of the search is "L", and the search range is upward and right respectively. Search from near to far. (2) Initially, the bottom left corner of the screen is used as the initial search point. At this time, the search range is large, as shown in Figure 11 (a). (3) If a lane marking is found, the point Include statistics, and use this point as the new initial search point 'and change the search off limit to small, as shown in Figure 10 ^ (b). After searching in this way for a period of time, such as 30 pictures, you can find the position of the four points in the picture. Figure 12 is a flowchart illustrating how to find the four corresponding points by using these two sets of "L" and "" and "shape" search methods. Referring to Figure 12, first 'get the next binary image after processing (binary image) (step 1201). Then use the search method of "L" and "" to find the lane markings using the bottom left corner of the screen as the initial search point (step 1203). 17 1228086 'Check Whether a lane marking is found (step 1205). If a lane marking is found, the point is included in the statistics, and this point is used as a new initial search point, and the search range is changed to small (step 1207). Search in this way, and check if you have searched for a period of time (step 1209), such as 30 frames, 10 frames per second. After searching for a period of time, output the average position of these search initial points (step 1210). With this search After the four points of the average position of the initial points, the ROI can be defined, which will be explained in sequence with Figure 13 below. Figure 13 (a) is the one previously searched by Figure 11 图 and Figure • 1 (b). Four points at the average position. Connect the two points of the two groups obtained by the search That is where the marking line is, and the intersection of the two lines is approximately at the vanishing point of the road. Figure 13 (b) is the intersection of two straight lines determined by these four points. Use the intersection as the center of the two lines inward Expand the α angle, as shown in Fig. 13 (c). Within the range of the α angle, take the range within 1/3 of the line segment and define it as r0i. Fig. 12 (d) is the same as Fig. 13 (c) The line segment is cut into three equal divisions; Figure 13 (e) is taken as the region closest to the bottom as ROI. In the embodiment, the angle α is 3. Once the device of the present invention is installed in the vehicle, the probability of changing the position is not Large, so several sets of commonly used ROIs can be designed and stored, which is convenient for the driver to apply, without the need to initialize the ROI every time. It can also use the dynamic calculation of the ROI method, which is convenient for users to use correction. Even memory Module to combine the advantages of both static forced ROI and dynamically calculated ROI 18 1228086
ο 綜上所述,本發明提供一種裝設在車辆内的車道偏移 警示裝置和以連續影像判斷車道偏移的方法。利用所發明 的車道偏移綱影像處理技術,能自動制車淋當偏移 車道的情形,並給予駕敬人警示以保障行車安全。更包括 一個自動判斷機制來決定暫時關閉警示裝置,以免誤動作 頻繁而增加駕致人的困擾。同時,此警示裝置安裳位置的 限制小。 惟’以上所述者,僅為本創作之較佳實施例而已,當 不能以此限定本創作實施之範圍。即大凡依本創作申請專 利範圍所作之均等變化與修飾,皆應仍屬本創作專利涵蓋 之犯圍内。 1228086 圖號說明: 403車道偏移偵測單元 403b車道偏移判斷單元 401車道視訊資訊操取單元 403a標線偵測單元 405警示單元 503動態計算搜尋區域 5〇1影像處理 505在搜哥區域内偵測標線 701車道偏移有限狀態機 903b邊界偵測 901輸入路面的原始影像 903原始影像分析處理 903a擷取其下一張影像畫面 903c加上一亮度門檻值的限制 905搜尋區域的設定 905a搜尋區域是否已設定好 905b是否重新設定搜尋區域 905c進行另一搜尋區域的初始化 905d從一儲存單元裡下載此搜尋區域 905e使用者的命令 9〇7車道偏移偵測 907a在搜尋區域内進行車道偏移偵測 907b是否有車道偏移 909自動啟動或關閉警示車道偏移 909a是否暫時中斷車道偏移的警示 909b將車道偏移的警示結果會知警示單元 22 1228086 909c輸入參數,如「車輛指示燈的狀態」與「車輛的行駛速度 1201取得下一張處理後的二元化影像 1203以畫面左下角為搜尋初始點來搜尋車道標線 1205是否搜尋到車道標線 且將搜尋範圍 1207將該點列入統計,並以該點為新的搜尋初始點 改為小 1209是否已搜尋一段時間 1210輸出搜尋初始點的平均位置 23ο In summary, the present invention provides a lane departure warning device installed in a vehicle and a method for judging lane departure based on continuous images. Utilizing the invented lane shift outline image processing technology, it can automatically control the situation when the lane is shifted, and give drivers warnings to ensure driving safety. It also includes an automatic judgment mechanism to decide to temporarily turn off the warning device, so as to avoid frequent misoperations and increase driver's distress. At the same time, there is less restriction on the location of this warning device Ansang. However, the above is only a preferred embodiment of this creation, and it should not be used to limit the scope of this creation. That is to say, all equal changes and modifications made in accordance with the scope of the patent for this creative application shall still fall within the scope of the crime covered by this creative patent. 1228086 Description of drawing number: 403 lane deviation detection unit 403b lane deviation judgment unit 401 lane video information operation unit 403a marking line detection unit 405 warning unit 503 dynamic calculation of the search area 501 image processing 505 within the search brother area Detection line 701 Lane shift finite state machine 903b Boundary detection 901 Input original image of road surface 903 Original image analysis processing 903a Capture the next image frame 903c plus a limit of brightness threshold 905 Search area setting 905a Whether the search area has been set 905b Whether to reset the search area 905c Initialize another search area 905d Download this search area 905e from a storage unit User's command 907 Lane shift detection 907a Perform a lane in the search area Offset detection 907b Whether there is a lane departure 909 Automatic start or close warning Lane departure 909a Whether the lane departure warning is temporarily interrupted 909b The warning result of lane departure will be notified to the warning unit 22 1228086 909c Input parameters, such as "vehicle instructions The state of the lights "and" the vehicle's running speed 1201 obtain the next processed binary image 1203 The lower left corner of the screen is the initial search point to find whether the lane marking 1205 has been found and the search range 1207 is included in the statistics. This point is used as the new initial search point and changed to a small 1209. Has it been searched for a period of time? 1210 output average position of search initial point 23