TWI819928B - Method for detecting skewing of vehicle and related devices - Google Patents

Method for detecting skewing of vehicle and related devices Download PDF

Info

Publication number
TWI819928B
TWI819928B TW111149033A TW111149033A TWI819928B TW I819928 B TWI819928 B TW I819928B TW 111149033 A TW111149033 A TW 111149033A TW 111149033 A TW111149033 A TW 111149033A TW I819928 B TWI819928 B TW I819928B
Authority
TW
Taiwan
Prior art keywords
distance
vehicle
lane line
coordinate
sliding window
Prior art date
Application number
TW111149033A
Other languages
Chinese (zh)
Inventor
簡瑜萱
郭錦斌
Original Assignee
鴻海精密工業股份有限公司
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 鴻海精密工業股份有限公司 filed Critical 鴻海精密工業股份有限公司
Priority to TW111149033A priority Critical patent/TWI819928B/en
Application granted granted Critical
Publication of TWI819928B publication Critical patent/TWI819928B/en

Links

Images

Abstract

The present application provides a method for detecting skewing of vehicle and related devices. The method includes: converting a first foreground image of a vehicle into an aerial view, determining an initial position of a left lane line and an initial position of a right lane line according to a deployment of non-zero pixels in the aerial view, moving a sliding window according to the initial position of the left lane line and the initial position of the right lane line, fitting non-zero pixels in all sliding windows before a current sliding window and non-zero pixels in in the current sliding window into a second curve. Based on corresponding second curves, the left lane line and the right lane line are obtained respectively. A distance between the vehicle and the left lane line and a distance between the vehicle and the right lane line are calculated, for determining whether the vehicle is skewing. The present application can effectively detect lane lines and improve the accuracy of identifying lane lines.

Description

車輛偏移檢測方法及相關設備 Vehicle offset detection method and related equipment

本發明涉及人工智慧技術領域,尤其涉及一種車輛偏移檢測方法及相關設備。 The present invention relates to the field of artificial intelligence technology, and in particular, to a vehicle offset detection method and related equipment.

車道線檢測是無人駕駛或者輔助駕駛場景中的重要技術,車道線檢測是指對道路上的交通指示線(即車道線)進行檢測,藉由車道線檢測可以判斷車輛在行駛的過程中是否產生偏移。目前基於車道線的車輛偏移檢測,藉由將檢測出來的車道線寬與預先設定的閥值進行比較,來判斷車輛是否產生偏移。由於不同車道線的寬度存在不一致的情況,基於單一的閥值進行比對,會導致結果不準確,從而無法有效地檢測車輛在行駛的過程中是否發生偏移。 Lane line detection is an important technology in driverless or assisted driving scenarios. Lane line detection refers to the detection of traffic indicators (i.e. lane lines) on the road. Through lane line detection, it can be determined whether the vehicle is driving. offset. Current vehicle deviation detection based on lane lines determines whether the vehicle has deviated by comparing the detected lane line width with a preset threshold. Since the widths of different lane lines are inconsistent, comparison based on a single threshold will lead to inaccurate results, making it impossible to effectively detect whether the vehicle has drifted while driving.

鑒於以上內容,有必要提供一種車輛偏移檢測方法及相關設備,解決了車輛偏移檢測不精確的問題。 In view of the above, it is necessary to provide a vehicle offset detection method and related equipment to solve the problem of inaccurate vehicle offset detection.

本申請提供一種車輛偏移檢測方法,所述方法包括:獲取車輛行駛過程中拍攝的第一前景圖像;對所述第一前景圖像進行畸變校正,得到第一校正圖像;對所述第一校正圖像進行透視變換,得到鳥瞰圖;基於所述鳥瞰圖中每一列圖元點中非零圖元點的個數,生成所述鳥瞰圖對應的非零圖元點分佈圖,所述非零圖元點分佈圖包括第一峰值和第二峰值,所述第一峰值位於所述第二峰值的左邊;根據所述第一峰值在所述鳥瞰圖中確定左車道線初始位置,根據 所述第二峰值在所述鳥瞰圖中確定右車道線初始位置;以所述左車道線初始位置和所述右車道線初始位置分別作為滑動視窗的起始位置開始在所述鳥瞰圖中移動,根據當前滑動視窗之前的所有滑動視窗內的非零圖元點擬合成第一曲線,根據所述第一曲線以及所述當前滑動視窗內的非零圖元點擬合成第二曲線,其中,所述滑動視窗的移動根據所述第一曲線進行動態調整;根據以所述左車道線初始位置作為滑動視窗的起始位置擬合成的第二曲線得到左車道線,根據以所述右車道線初始位置作為滑動視窗的起始位置擬合成的第二曲線得到右車道線;計算所述車輛與所述左車道線之間的第一距離,以及計算所述車輛與所述右車道線之間的第二距離;根據所述第一距離和所述第二距離,確定所述車輛是否偏移車道。 The present application provides a vehicle offset detection method. The method includes: acquiring a first foreground image captured while the vehicle is driving; performing distortion correction on the first foreground image to obtain a first corrected image; and performing distortion correction on the first foreground image. The first corrected image undergoes perspective transformation to obtain a bird's-eye view; based on the number of non-zero primitive points in each column of primitive points in the bird's-eye view, a non-zero primitive point distribution map corresponding to the bird's-eye view is generated, so The non-zero primitive point distribution map includes a first peak and a second peak, and the first peak is located to the left of the second peak; the initial position of the left lane line is determined in the bird's-eye view according to the first peak, according to The second peak determines the initial position of the right lane line in the bird's-eye view; the initial position of the left lane line and the initial position of the right lane line are used as the starting positions of the sliding window to start moving in the bird's-eye view. , a first curve is fitted according to the non-zero primitive points in all sliding windows before the current sliding window, and a second curve is fitted according to the first curve and the non-zero primitive points in the current sliding window, where, The movement of the sliding window is dynamically adjusted according to the first curve; the left lane line is obtained according to the second curve fitted with the initial position of the left lane line as the starting position of the sliding window, and the left lane line is obtained according to the right lane line. The initial position is used as the starting position of the sliding window to fit the second curve to obtain the right lane line; calculate the first distance between the vehicle and the left lane line, and calculate the distance between the vehicle and the right lane line a second distance; determine whether the vehicle deviates from the lane according to the first distance and the second distance.

在一些可選的實施方式中,所述根據所述第一距離和所述第二距離,確定所述車輛是否偏移車道,包括:根據所述第一距離與所述第二距離,計算所述車輛向所述左車道線偏移的第一比例以及向所述右車道線偏移的第二比例;計算所述第一比例與所述第二比例的差值對應的絕對值;若所述差值對應的絕對值小於預設閥值,確定所述車輛沒有偏移車道;若所述差值對應的絕對值大於或等於所述預設閥值,確定所述車輛偏移車道。 In some optional implementations, determining whether the vehicle deviates from a lane based on the first distance and the second distance includes: calculating the distance based on the first distance and the second distance. The first proportion of the vehicle's deviation to the left lane line and the second proportion of the deviation to the right lane line; calculate the absolute value corresponding to the difference between the first proportion and the second proportion; if If the absolute value corresponding to the difference is less than the preset threshold, it is determined that the vehicle has not deviated from the lane; if the absolute value corresponding to the difference is greater than or equal to the preset threshold, it is determined that the vehicle has deviated from the lane.

在一些可選的實施方式中,所述根據所述第一距離與所述第二距離,計算所述車輛向所述左車道線偏移的第一比例以及向所述右車道線偏移的第二比例,包括:計算所述第一距離與所述第二距離的和,將所述第一距離與所述第二距離的和作為第三距離;計算所述第一距離與所述第三距離的比值,將所述第一距離與所述第三距離的比值作為所述第一比例;計算所述第二距離與所述第三距離的比值,將所述第二距離與所述第三距離的比值作為所述第二比例。 In some optional implementations, a first ratio of the vehicle's deviation to the left lane line and a first ratio of the vehicle's deviation to the right lane line are calculated based on the first distance and the second distance. The second ratio includes: calculating the sum of the first distance and the second distance, and taking the sum of the first distance and the second distance as the third distance; calculating the sum of the first distance and the third distance. For the ratio of three distances, use the ratio of the first distance to the third distance as the first ratio; calculate the ratio of the second distance to the third distance, and use the ratio of the second distance to the third distance. The ratio of the third distance serves as the second ratio.

在一些可選的實施方式中,所述方法還包括:獲取所述車輛在行駛過程中第二時刻拍攝的第二前景圖像,所述第二時刻為第一時刻的下一時刻,所述第一時刻為拍攝所述第一前景圖像對應的時刻;對所述第二前景圖像進行 畸變校正,得到第二校正圖像;根據預設的擴展距離將所述左車道線向第一方向擴展,得到第一邊界;根據所述預設的擴展距離將所述右車道線向第二方向擴展,得到第二邊界;根據所述第一邊界以及所述第二邊界在所述第二校正圖像上進行區域劃分,確定所述第二校正圖像中車道線所在的區域。 In some optional implementations, the method further includes: obtaining a second foreground image taken at a second moment while the vehicle is driving, the second moment being a moment next to the first moment, and the The first moment is the moment corresponding to the shooting of the first foreground image; the second foreground image is Distortion correction is performed to obtain a second corrected image; the left lane line is expanded to the first direction according to the preset expansion distance to obtain the first boundary; the right lane line is expanded to the second direction according to the preset expansion distance. Expand in the direction to obtain a second boundary; perform area division on the second corrected image according to the first boundary and the second boundary to determine the area where the lane line in the second corrected image is located.

在一些可選的實施方式中,所述對所述第一前景圖像進行畸變校正,得到第一校正圖像,包括:對所述第一前景圖像建立圖像座標系,獲取所述第一前景圖像中每個非零圖元點在所述圖像座標系中的第一座標;獲取拍攝所述第一前景圖像的相機模組的內參,根據所述內參與所述第一座標確定所述第一座標對應的第二座標,其中,所述第二座標是無畸變座標;基於所述第一座標以及所述第一前景圖像的中心座標點,確定所述第一座標與所述中心座標點之間的畸變距離;根據所述第一前景圖像中每個圖元點的灰階值,計算所述第一前景圖像的圖像複雜度,根據所述圖像複雜度確定所述第一前景圖像的校正參數;根據預設的平滑處理函數,確定與所述畸變距離和所述校正參數對應的平滑處理係數;根據所述平滑處理係數與所述第二座標對所述第一座標進行平滑校正,得到所述第一校正圖像。 In some optional implementations, performing distortion correction on the first foreground image to obtain a first corrected image includes: establishing an image coordinate system for the first foreground image, and obtaining the first corrected image. The first coordinate of each non-zero primitive point in a foreground image in the image coordinate system; obtain the internal parameters of the camera module that captured the first foreground image, and use the internal parameters to determine the first coordinate according to the internal parameters. Determine the second coordinate corresponding to the first coordinate, wherein the second coordinate is a distortion-free coordinate; determine the first coordinate based on the first coordinate and the center coordinate point of the first foreground image and the center coordinate point; calculate the image complexity of the first foreground image according to the grayscale value of each primitive point in the first foreground image, and calculate the image complexity according to the image The complexity determines the correction parameters of the first foreground image; determines a smoothing coefficient corresponding to the distortion distance and the correction parameter according to a preset smoothing function; and determines a smoothing coefficient corresponding to the distortion distance and the correction parameter according to the smoothing coefficient and the second The coordinates are used to smoothly correct the first coordinates to obtain the first corrected image.

在一些可選的實施方式中,所述根據所述平滑處理係數與所述第二座標對所述第一座標進行平滑校正,得到所述第一校正圖像,包括:根據所述平滑處理係數確定所述第一座標的第一權重和所述第二座標的第二權重;計算所述第一權重和所述第一座標的第一乘積,以及計算所述第二權重與所述第二座標的第二乘積;根據所述第一乘積和所述第二乘積之和對所述第一座標進行平滑校正,得到所述第一校正圖像。 In some optional implementations, the smoothing correction of the first coordinate according to the smoothing coefficient and the second coordinate to obtain the first corrected image includes: according to the smoothing coefficient Determine a first weight of the first coordinate and a second weight of the second coordinate; calculate a first product of the first weight and the first coordinate, and calculate the second weight and the second The second product of the coordinates; perform smooth correction on the first coordinate according to the sum of the first product and the second product to obtain the first corrected image.

在一些可選的實施方式中,所述對所述第一校正圖像進行透視變換,得到鳥瞰圖,包括:將所述第一校正圖像中的每個非零圖元點作為目標點,利用座標轉換公式對所述目標點進行計算,得到逆透視變換矩陣;基於所述逆透視變換矩陣,得到所述鳥瞰圖。 In some optional implementations, performing perspective transformation on the first corrected image to obtain a bird's-eye view includes: using each non-zero primitive point in the first corrected image as a target point, The target point is calculated using a coordinate conversion formula to obtain an inverse perspective transformation matrix; based on the inverse perspective transformation matrix, the bird's-eye view is obtained.

在一些可選的實施方式中,所述根據所述第一曲線以及所述當前滑 動視窗內的非零圖元點擬合成第二曲線,包括:獲取擬合成所述第一曲線對應的非零圖元點;計算所述當前滑動視窗內的非零圖元點的數量;若所述當前滑動視窗內的非零圖元點的數量大於或等於預設閥值,將所述擬合成所述第一曲線對應的非零圖元點與所述當前滑動視窗內的非零圖元點擬合成所述第二曲線。 In some optional implementations, the first curve and the current sliding Fitting the non-zero primitive points in the moving window into a second curve includes: obtaining the non-zero primitive points corresponding to the first curve; calculating the number of non-zero primitive points in the current sliding window; if The number of non-zero graphic element points in the current sliding window is greater than or equal to the preset threshold, and the non-zero graphic element points corresponding to the first curve are fitted to the non-zero graphic element points in the current sliding window. The element points are fitted to the second curve.

本申請還提供一種電子設備,所述電子設備包括處理器和儲存器,所述處理器用於執行所述儲存器中存儲的電腦程式時實現所述的車輛偏移檢測方法。 This application also provides an electronic device. The electronic device includes a processor and a storage. The processor is configured to implement the vehicle offset detection method when executing a computer program stored in the storage.

本申請還提供一種電腦可讀存儲介質,所述電腦可讀存儲介質上存儲有電腦程式,所述電腦程式被處理器執行時實現所述的車輛偏移檢測方法。 The application also provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the vehicle offset detection method is implemented.

本申請提供的車輛偏移檢測方法及相關設備,利用第一曲線動態調整滑動視窗,將當前滑動視窗之前的所有滑動視窗內的非零圖元點與當前滑動視窗內的非零圖元點擬合成第二曲線,能夠有效的檢測車道線的位置,以及能夠有效的判斷車輛在行駛過程中是否發生偏移,提高車輛駕駛的安全性。 The vehicle offset detection method and related equipment provided by this application use the first curve to dynamically adjust the sliding window, and simulating the non-zero element points in all sliding windows before the current sliding window with the non-zero element points in the current sliding window. Synthesizing the second curve can effectively detect the position of the lane line and effectively determine whether the vehicle has deviated during driving, thereby improving the safety of vehicle driving.

1:電子設備 1: Electronic equipment

11:儲存器 11:Storage

12:處理器 12: Processor

13:通訊匯流排 13: Communication bus

14:拍攝裝置 14: Shooting device

141:相機模組 141:Camera module

S21~S29:步驟 S21~S29: Steps

A1:第一個位置 A1: first position

A2:第二個位置 A2: The second position

A3:第三個位置 A3: The third position

圖1是本發明較佳實施例的電子設備的結構示意圖。 Figure 1 is a schematic structural diagram of an electronic device according to a preferred embodiment of the present invention.

圖2是本發明較佳實施例提供的車輛偏移檢測方法的流程圖。 Figure 2 is a flow chart of a vehicle deviation detection method provided by a preferred embodiment of the present invention.

圖3是利用滑動視窗擬合第二曲線的示意圖。 Figure 3 is a schematic diagram of fitting the second curve using a sliding window.

圖4是第一距離和第二距離的示意圖。 Figure 4 is a schematic diagram of the first distance and the second distance.

圖5是根據第二時刻車道線所在區域的示意圖。 Figure 5 is a schematic diagram of the area where the lane line is located at the second moment.

為了便於理解,示例性的給出了部分與本申請實施例相關概念的說明以供參考。 To facilitate understanding, some descriptions of concepts related to the embodiments of the present application are exemplarily provided for reference.

需要說明的是,本申請中“至少一個”是指一個或者多個,“多個” 是指兩個或多於兩個。“和/或”,描述關聯物件的關聯關係,表示可以存在三種關係,例如,A和/或B可以表示:單獨存在A,同時存在A和B,單獨存在B的情況,其中A,B可以是單數或者複數。本申請的說明書和請求項書及附圖中的術語“第一”、“第二”、“第三”、“第四”等(如果存在)是用於區別類似的物件,而不是用於描述特定的順序或先後次序。 It should be noted that “at least one” in this application refers to one or more, and “multiple” means two or more than two. "And/or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and/or B can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can Is singular or plural. The terms "first", "second", "third", "fourth", etc. (if present) in the description, claims and drawings of this application are used to distinguish similar objects, rather than to Describe a specific order or sequence.

為了更好地理解本申請實施例提供的車輛偏移檢測方法及相關設備,下面首先對本申請車輛偏移檢測方法的應用場景進行描述。 In order to better understand the vehicle offset detection method and related equipment provided by the embodiments of the present application, the application scenarios of the vehicle offset detection method of the present application are first described below.

圖1為本申請實施例提供的電子設備1的結構示意圖。參閱圖1所示,所述電子設備1包括,但不限於,儲存器11、至少一個處理器12和拍攝裝置14。儲存器11、處理器12和拍攝裝置14之間可以藉由通訊匯流排13連接,也可以直接連接。所述電子設備1設置在車輛上,所述電子設備1可以是車載電腦,在一些實施例中,所述電子設備1可包括拍攝裝置14(例如,攝像頭)以及所述拍攝裝置14內部的相機模組141,以拍攝車輛前方的多個圖像或視頻,圖1僅為示例性說明,在其他實施例中,所述電子設備1也可以不包括拍攝裝置,而是外接於拍攝裝置,例如,行車記錄器,或者是車輛內部的一個或多個拍攝裝置,從而直接從外接的拍攝裝置中獲取多個圖像或視頻。例如,電子設備1可以與車輛中的行車記錄器進行通信連接並獲取相應的圖像或視頻。 Figure 1 is a schematic structural diagram of an electronic device 1 provided by an embodiment of the present application. Referring to FIG. 1 , the electronic device 1 includes, but is not limited to, a storage 11 , at least one processor 12 and a camera 14 . The storage 11, the processor 12 and the photographing device 14 can be connected through the communication bus 13 or directly. The electronic device 1 is provided on a vehicle. The electronic device 1 may be a vehicle-mounted computer. In some embodiments, the electronic device 1 may include a shooting device 14 (for example, a camera) and a camera inside the shooting device 14 The module 141 is used to shoot multiple images or videos in front of the vehicle. Figure 1 is only an exemplary illustration. In other embodiments, the electronic device 1 may not include a shooting device, but may be externally connected to the shooting device, such as , driving recorder, or one or more shooting devices inside the vehicle, thereby acquiring multiple images or videos directly from external shooting devices. For example, the electronic device 1 can communicate with a driving recorder in the vehicle and obtain corresponding images or videos.

本領域技術人員應該瞭解,圖1示出的電子設備1的結構並不構成本發明實施例的限定,所述電子設備1還可以包括比圖1更多或更少的其他硬體或者軟體,或者不同的元件配置。 Those skilled in the art should understand that the structure of the electronic device 1 shown in Figure 1 does not constitute a limitation of the embodiment of the present invention. The electronic device 1 may also include more or less other hardware or software than in Figure 1. Or different component configurations.

所述電子設備1中的處理器12可以在執行電腦程式時,實現下文將詳細介紹的車輛偏移檢測方法,所述電腦程式包括車輛偏移檢測程式。 The processor 12 in the electronic device 1 can implement the vehicle offset detection method that will be described in detail below when executing a computer program. The computer program includes a vehicle offset detection program.

圖2是本申請實施例提供的車輛偏移檢測方法的流程圖。所述車輛偏移檢測方法應用在電子設備(例如圖1中的電子設備1)中,能夠提高車輛偏移檢測的準確度,保障車輛行駛的安全性。根據不同的需求,該流程圖中步 驟的順序可以改變,某些步驟可以省略。在本實施方式中,所述車輛偏移檢測方法包括以下步驟: Figure 2 is a flow chart of a vehicle offset detection method provided by an embodiment of the present application. The vehicle offset detection method is applied in electronic equipment (such as electronic equipment 1 in Figure 1), which can improve the accuracy of vehicle offset detection and ensure the safety of vehicle driving. According to different needs, the flow chart steps The order of steps can be changed and some steps can be omitted. In this embodiment, the vehicle offset detection method includes the following steps:

S21,獲取車輛行駛過程中拍攝的第一前景圖像。 S21: Obtain the first foreground image taken while the vehicle is driving.

第一前景圖像是車輛前方景象的圖像,第一前景圖像包括車輛所在的車道。 The first foreground image is an image of the scene in front of the vehicle, and includes the lane in which the vehicle is located.

在電子設備包括拍攝裝置的情況下,可以藉由電子設備的拍攝裝置獲取第一前景圖像。在電子設備不包括拍攝裝置的情況下,可以藉由車輛上的拍攝裝置(例如行車記錄器)獲取第一前景圖像。可以對車輛前方景象進行圖像拍攝,得到第一前景圖像。或者,可以對車輛前方景象進行視頻拍攝,從拍攝的視頻中獲取第一前景圖像。 In the case where the electronic device includes a photographing device, the first foreground image can be acquired by the photographing device of the electronic device. In the case where the electronic device does not include a photographing device, the first foreground image can be obtained through a photographing device on the vehicle (such as a driving recorder). The image of the scene in front of the vehicle can be captured to obtain the first foreground image. Alternatively, a video of the scene in front of the vehicle can be captured, and the first foreground image can be obtained from the captured video.

S22,對第一前景圖像進行畸變校正,得到第一校正圖像。 S22, perform distortion correction on the first foreground image to obtain a first corrected image.

由於拍攝裝置拍攝時的角度、旋轉、縮放等問題,可能會導致第一前景圖像出現失真(即畸變),需要對第一前景圖像進行畸變校正。 Due to problems such as angle, rotation, and scaling of the shooting device when shooting, the first foreground image may be distorted (ie, distorted), and the first foreground image needs to be corrected for distortion.

在一實施例中,對所述第一前景圖像進行畸變校正,得到第一校正圖像,包括:對第一前景圖像建立圖像座標系,獲取第一前景圖像中每個非零圖元點在圖像座標系中的第一座標;獲取拍攝第一前景圖像的相機模組的內參,根據內參與所述第一座標確定第一座標對應的第二座標,其中,第二座標是無畸變座標;基於第一座標以及第一前景圖像的中心座標點,確定第一座標與中心座標點之間的畸變距離;根據第一前景圖像中每個圖元點的灰階值,計算第一前景圖像的圖像複雜度,根據圖像複雜度確定第一前景圖像的校正參數;根據預設的平滑處理函數,確定與畸變距離和校正參數對應的平滑處理係數;根據平滑處理係數與第二座標對第一座標進行平滑校正,得到第一 校正圖像。 In one embodiment, performing distortion correction on the first foreground image to obtain the first corrected image includes: establishing an image coordinate system for the first foreground image, and obtaining each non-zero value in the first foreground image. The first coordinate of the primitive point in the image coordinate system; obtain the internal parameters of the camera module that captured the first foreground image, and determine the second coordinate corresponding to the first coordinate according to the internal parameter, where, the second The coordinates are distortion-free coordinates; based on the first coordinate and the center coordinate point of the first foreground image, determine the distortion distance between the first coordinate and the center coordinate point; based on the grayscale of each primitive point in the first foreground image value, calculate the image complexity of the first foreground image, and determine the correction parameters of the first foreground image according to the image complexity; determine the smoothing coefficient corresponding to the distortion distance and correction parameter according to the preset smoothing function; Perform smoothing correction on the first coordinate according to the smoothing coefficient and the second coordinate to obtain the first Correct the image.

在一實施例中,所述根據所述平滑處理係數與所述第二座標對所述第一座標進行平滑校正,得到所述第一校正圖像,包括:根據所述平滑處理係數確定所述第一座標的第一權重和所述第二座標的第二權重;計算所述第一權重和所述第一座標的第一乘積,以及計算所述第二權重與所述第二座標的第二乘積;根據所述第一乘積和所述第二乘積之和對所述第一座標進行平滑校正,得到所述第一校正圖像。 In one embodiment, performing smooth correction on the first coordinate according to the smoothing coefficient and the second coordinate to obtain the first corrected image includes: determining the first coordinate according to the smoothing coefficient. a first weight of the first coordinate and a second weight of the second coordinate; calculating a first product of the first weight and the first coordinate, and calculating a first product of the second weight and the second coordinate. Two products; perform smooth correction on the first coordinate according to the sum of the first product and the second product to obtain the first corrected image.

在本實施中,藉由在車輛上拍攝的第一前景圖像是畸變圖像,對第一前景圖像進行畸變校正。建立第一前景圖像的圖像座標系,得到第一前景圖像中的每一個非零圖元點對應的第一座標,第一前景圖像對應的第一座標是具有一定畸變的座標。獲取拍攝第一前景圖像的相機模組的內參,所述相機模組的內參用於判斷第一座標的畸變程度,根據所述內參與第一座標,獲取所述第一座標對應的無畸變座標作為第二座標。 In this implementation, since the first foreground image captured on the vehicle is a distorted image, distortion correction is performed on the first foreground image. Establish an image coordinate system of the first foreground image, and obtain the first coordinate corresponding to each non-zero element point in the first foreground image. The first coordinate corresponding to the first foreground image is a coordinate with a certain distortion. Obtain the internal parameters of the camera module that captured the first foreground image. The internal parameters of the camera module are used to determine the degree of distortion of the first coordinate. According to the internal parameters of the first coordinate, obtain the distortion-free corresponding to the first coordinate. coordinate as the second coordinate.

計算第一前景圖像中每個圖元點的灰階值,根據每個圖元點的灰階值計算第一前景圖像的圖像複雜度,計算每個圖元點的灰階值,以便計算所有灰階值的總和來表示圖像複雜度。第一前景圖像的灰階值總和越高,表徵圖像包含的內容越豐富,圖像複雜度越高。進一步,根據計算得到的圖像複雜度確定第一前景圖像的校正參數,可以藉由將圖像複雜度輸入預先建立的深度學習模型,基於該深度學習模型的輸出確定校正參數。 Calculate the grayscale value of each primitive point in the first foreground image, calculate the image complexity of the first foreground image based on the grayscale value of each primitive point, and calculate the grayscale value of each primitive point, In order to calculate the sum of all grayscale values to represent the image complexity. The higher the sum of grayscale values of the first foreground image, the richer the content of the representation image and the higher the complexity of the image. Further, the correction parameters of the first foreground image are determined based on the calculated image complexity. The image complexity can be input into a pre-established deep learning model, and the correction parameters are determined based on the output of the deep learning model.

基於相機模組拍攝機制,越靠近圖像邊緣的畸變程度越高,越靠近圖像中心區域的畸變程度就越小。因此,可以獲取第一前景圖像的中心座標點,計算第一座標與中心座標點之間的畸變距離。根據預設的平滑處理函數和距離計算平滑處理係數,該平滑處理係數用於對第一前景圖像進行校正處理。 Based on the camera module shooting mechanism, the closer to the edge of the image, the higher the degree of distortion, and the closer to the center of the image, the smaller the degree of distortion. Therefore, the center coordinate point of the first foreground image can be obtained, and the distortion distance between the first coordinate and the center coordinate point can be calculated. A smoothing coefficient is calculated according to a preset smoothing function and distance, and the smoothing coefficient is used to correct the first foreground image.

計算畸變距離與校正參數的和作為目標值,基於預設的平滑處理函 數,得到所述目標值與平滑處理係數的正相關關係,也就是說,越靠近第一前景圖像的邊緣的區域,第一前景圖像對應的圖像複雜度越高,對應的目標值與平滑處理係數越大,需要較強的校正處理。針對第一前景圖像非邊緣的區域,對應的目標值與平滑處理係數越小,需要較弱的校正處理。基於目標值與平滑處理係數的正相關關係,針對不同的區域,本實施例採用平滑處理係數與第二座標對第一座標進行平滑校正,有效的提升了計算效率。 Calculate the sum of the distortion distance and correction parameters as the target value, based on the preset smoothing function Number, the positive correlation between the target value and the smoothing coefficient is obtained. That is to say, the closer the area is to the edge of the first foreground image, the higher the complexity of the image corresponding to the first foreground image, and the corresponding target value The larger the smoothing coefficient, the stronger the correction process is required. For non-edge areas of the first foreground image, the smaller the corresponding target value and smoothing coefficient are, the weaker correction processing is required. Based on the positive correlation between the target value and the smoothing coefficient, this embodiment uses the smoothing coefficient and the second coordinate to smooth the first coordinate for different areas, which effectively improves the calculation efficiency.

為了提高第一校正圖像的平滑度,獲取第一座標對應的第一權重以及第二座標對應的第二權重,其中,第一權重和平滑處理係數成反比關係,第二權重和平滑處理係數成正比關係,利用加權的方式,對第一座標進行平滑校正,保障了圖像的真實性。 In order to improve the smoothness of the first corrected image, a first weight corresponding to the first coordinate and a second weight corresponding to the second coordinate are obtained, where the first weight is inversely proportional to the smoothing coefficient, and the second weight is inversely proportional to the smoothing coefficient. Proportional to the relationship, the first coordinate is smoothly corrected using a weighted method to ensure the authenticity of the image.

S23,對第一校正圖像進行透視變換,得到鳥瞰圖。 S23: Perform perspective transformation on the first corrected image to obtain a bird's-eye view.

在本申請的一個實施例中,將第一校正圖像進行圖像灰階化、梯度閥值和顏色閥值以及飽和度閥值預處理等,去除第一校正圖像中不相關的車道線資訊,得到二進位圖,對二進位圖進行透視變換,得到鳥瞰圖。所述鳥瞰圖是根據透視原理,用高視點法從高處某一點俯視地面起伏繪製而成的立體圖,相較於平面圖更具有真實感。 In one embodiment of the present application, the first corrected image is subjected to image grayscale, gradient threshold, color threshold, saturation threshold preprocessing, etc., to remove irrelevant lane lines in the first corrected image. Information, obtain a binary image, perform perspective transformation on the binary image, and obtain a bird's-eye view. The bird's-eye view is a three-dimensional view drawn based on the perspective principle and using the high viewpoint method to look down at the ground undulations from a high point. It is more realistic than a plan view.

在一實施例中,對所述第一校正圖像進行透視變換,得到鳥瞰圖,包括:將第一校正圖像中的每個非零圖元點作為目標點,利用座標轉換公式對目標點進行計算,得到逆透視變換矩陣;基於逆透視變換矩陣,得到所述鳥瞰圖。 In one embodiment, performing perspective transformation on the first corrected image to obtain a bird's-eye view includes: using each non-zero primitive point in the first corrected image as a target point, and using a coordinate conversion formula to convert the target point Calculation is performed to obtain an inverse perspective transformation matrix; based on the inverse perspective transformation matrix, the bird's-eye view is obtained.

利用相同路面上的車道近似平行的特性,利用透視變換消除透視效應,將第一校正圖像中的每個非零圖元點作為目標點,利用座標轉換公式對目標點進行計算,得到逆變換矩陣,利用逆變換矩陣,得到鳥瞰圖。所述鳥瞰圖消除了道路周邊環境和天空的幹擾,只保留車道線檢測中感興趣區域包含的路面車道資訊,用以減小複雜的背景計算量,便於後期的車道線檢測。 Utilize the approximately parallel characteristics of lanes on the same road surface, use perspective transformation to eliminate the perspective effect, use each non-zero element point in the first corrected image as a target point, use the coordinate conversion formula to calculate the target point, and obtain the inverse transformation Matrix, use the inverse transformation matrix to get a bird's eye view. The bird's-eye view eliminates the interference of the road surrounding environment and the sky, and only retains the road lane information contained in the area of interest in lane line detection, which is used to reduce the amount of complex background calculations and facilitate later lane line detection.

S24,基於鳥瞰圖中每一列圖元點中非零圖元點的個數,生成鳥瞰圖對應的非零圖元點分佈圖,非零圖元點分佈圖包括第一峰值和第二峰值,第一峰值位於第二峰值的左邊。 S24, based on the number of non-zero primitive points in each column of primitive points in the bird's-eye view, generate a non-zero primitive point distribution map corresponding to the bird's-eye view. The non-zero primitive point distribution map includes the first peak and the second peak, The first peak is to the left of the second peak.

由於車輛在行駛的過程中,車道線是無線延伸的,車道線表現為具有縱向走勢的曲線,且車道線在較短的距離內不可能具有很大的彎曲程度,因此在較近的一段距離內近似為直線,在鳥瞰圖中表現為一段與圖像底部接近垂直的線。考慮到上述特性,可以對鳥瞰圖的下半部分圖像建立非零圖元點分佈圖,所述鳥瞰圖的下半部分可以是距離車輛最近的區域。 Since the lane lines extend wirelessly when the vehicle is driving, the lane lines appear as curves with a longitudinal trend, and the lane lines cannot have a large degree of curvature in a short distance, so in a relatively short distance It is approximately a straight line, which appears as a line nearly vertical to the bottom of the image in a bird's-eye view. Considering the above characteristics, a non-zero primitive point distribution map can be established for the lower half of the bird's-eye view image, which can be the area closest to the vehicle.

對所述鳥瞰圖的下半部分對應的非零圖元點建立非零圖元點分佈圖,藉由對每一列圖元點的非零圖元點的數量的累加值,得到第一峰值和第二峰值。其中,第一峰值可以是非零圖元點分佈圖的左邊區域對應的峰值,第二峰值可以是非零圖元點分佈圖的右邊區域對應的峰值,所述第一峰值在所述第二峰值的左邊,根據車道線的特性,所述第一峰值與所述第二峰值所在的位置之間存在一定的距離。 A non-zero primitive point distribution map is established for the non-zero primitive points corresponding to the lower half of the bird's-eye view, and the first peak sum is obtained by accumulating the number of non-zero primitive points in each column of primitive points. second peak. Wherein, the first peak value may be the peak value corresponding to the left area of the non-zero graphic element point distribution chart, and the second peak value may be the peak value corresponding to the right area of the non-zero graphic element point distribution chart, and the first peak value is between the second peak value and the left area of the non-zero graphic element point distribution chart. On the left, according to the characteristics of the lane line, there is a certain distance between the positions of the first peak and the second peak.

S25,根據第一峰值在鳥瞰圖中確定左車道線初始位置,根據第二峰值在鳥瞰圖中確定右車道線初始位置。 S25: Determine the initial position of the left lane line in the bird's-eye view based on the first peak value, and determine the initial position of the right lane line in the bird's-eye view based on the second peak value.

為了提高識別車道線的準確度,將鳥瞰圖中的第一峰值作為搜索左車道線的左車道線初始位置,將第二峰值作為搜索右車道線的右車道線初始位置。搜索車道線的方向可以是沿著車道線的方向上下搜索。 In order to improve the accuracy of identifying lane lines, the first peak in the bird's-eye view is used as the initial position of the left lane line to search for the left lane line, and the second peak is used as the initial position of the right lane line to search for the right lane line. The direction of searching the lane lines may be to search up and down along the direction of the lane lines.

S26,以所述左車道線初始位置和所述右車道線初始位置分別作為滑動視窗的起始位置開始在所述鳥瞰圖中移動,根據當前滑動視窗之前的所有滑動視窗內的非零圖元點擬合成第一曲線,根據所述第一曲線以及所述當前滑動視窗內的非零圖元點擬合成第二曲線,其中,所述滑動視窗的移動根據所述第一曲線進行動態調整。 S26, use the initial position of the left lane line and the initial position of the right lane line as the starting positions of the sliding window and start moving in the bird's-eye view, based on the non-zero elements in all sliding windows before the current sliding window. The points are fitted into a first curve, and the second curve is fitted according to the first curve and the non-zero primitive points in the current sliding window, wherein the movement of the sliding window is dynamically adjusted according to the first curve.

本實施例採用滑動視窗的方式對車道線進行搜索,根據預設尺寸確定滑動視窗的大小,在本實施例中,可以將滑動視窗在縱向上的寬度設置為移 動距離,例如,可以使用200圖元(pixel)寬的滑動視窗進行移動,每一次移動的距離可以是200圖元。 This embodiment uses a sliding window to search for lane lines, and determines the size of the sliding window according to the preset size. In this embodiment, the vertical width of the sliding window can be set to Moving distance, for example, you can use a sliding window with a width of 200 pixels to move, and the distance of each movement can be 200 pixels.

在一具體實施例中,針對初始滑動視窗(即初始滑動視窗為當前滑動視窗),根據左車道線初始位置和右車道線初始位置確定初始滑動視窗的橫座標,根據預設的移動距離(即縱座標)以及所述橫座標,獲取所述初始滑動視窗內的非零圖元點,得到每個非零圖元點的座標,對所述初始滑動視窗內的非零圖元點進行擬合,擬合成初始滑動視窗對應的第一曲線,所述第一曲線包括以所述左車道線初始位置開始移動擬合成的第一曲線,以所述右車道線初始位置開始移動擬合成的第一曲線。 In a specific embodiment, for the initial sliding window (that is, the initial sliding window is the current sliding window), the abscissa of the initial sliding window is determined based on the initial position of the left lane line and the initial position of the right lane line, and the abscissa of the initial sliding window is determined based on the preset movement distance (i.e. ordinate) and the abscissa, obtain the non-zero primitive points in the initial sliding window, obtain the coordinates of each non-zero primitive point, and fit the non-zero primitive points in the initial sliding window , fitted into the first curve corresponding to the initial sliding window, the first curve includes the first curve fitted starting from the initial position of the left lane line, and the first fitted curve starting from the initial position of the right lane line. curve.

根據初始滑動視窗對應的第一曲線以及移動距離,計算得到滑動視窗在第二個移動位置的橫座標,即滑動視窗中心對應的橫座標,此時,第二個移動位置對應的滑動視窗為當前滑動視窗。當前滑動視窗的移動根據第一曲線進行動態調整,例如:第一曲線為y=p(x),根據移動距離y確定當前滑動視窗的滑動視窗中心對應的橫座標x,根據計算得到第二個移動位置對應的當前滑動視窗,將初始滑動視窗內的非零圖元點與當前滑動視窗(即第二個移動位置對應的滑動視窗)內的非零圖元點擬合成第二曲線。 According to the first curve corresponding to the initial sliding window and the movement distance, the abscissa coordinate of the sliding window at the second moving position is calculated, that is, the abscissa corresponding to the center of the sliding window. At this time, the sliding window corresponding to the second moving position is the current Sliding window. The movement of the current sliding window is dynamically adjusted according to the first curve. For example: the first curve is y=p(x). The abscissa x corresponding to the center of the sliding window of the current sliding window is determined based on the movement distance y. The second curve is obtained based on the calculation. Move the current sliding window corresponding to the moving position, and fit the non-zero primitive points in the initial sliding window and the non-zero primitive points in the current sliding window (ie, the sliding window corresponding to the second moving position) into a second curve.

根據第一曲線以及移動距離,計算得到滑動視窗在當前位置的橫座標,例如,將滑動視窗中心對應的橫座標作為滑動視窗當前位置的橫座標。在一實施例中,滑動視窗的移動根據第一曲線進行動態調整,具體地,所述第一曲線根據滑動視窗在當前位置之前的所有滑動視窗內的非零圖元點進行擬合得到,針對初始位置的滑動視窗,可直接擬合滑動視窗內的非零圖元點,針對非初始位置的滑動視窗,利用滑動視窗已經移動過的區域擬合成第一曲線,進一步,根據第一曲線確定下一個滑動視窗的位置(具體可參照下文對圖3的詳細描述),即滑動視窗的移動位置可以根據第一曲線來確定,而第一曲線的擬合是根據滑動視窗在移動過程的覆蓋區域內的非零圖元點的數量動態變化,因此,在本實施例中,滑動視窗的移動可以根據第一曲線進行動態調整。根據第 一曲線以及滑動視窗在當前位置覆蓋的非零圖元點可以進一步擬合成第二曲線。 According to the first curve and the movement distance, the abscissa coordinate of the sliding window at the current position is calculated. For example, the abscissa coordinate corresponding to the center of the sliding window is used as the abscissa coordinate of the current position of the sliding window. In one embodiment, the movement of the sliding window is dynamically adjusted according to a first curve. Specifically, the first curve is obtained by fitting the non-zero primitive points in all sliding windows before the current position of the sliding window. For The sliding window at the initial position can directly fit the non-zero primitive points in the sliding window. For the sliding window at the non-initial position, the area that the sliding window has moved is used to fit the first curve. Further, the next curve is determined based on the first curve. The position of a sliding window (for details, please refer to the detailed description of Figure 3 below), that is, the moving position of the sliding window can be determined based on the first curve, and the fitting of the first curve is based on the sliding window within the coverage area of the moving process. The number of non-zero primitive points changes dynamically. Therefore, in this embodiment, the movement of the sliding window can be dynamically adjusted according to the first curve. According to Article A curve and the non-zero primitive points covered by the sliding window at the current position can be further fitted into a second curve.

在一實施例中,根據所述第一曲線以及所述當前滑動視窗內的非零圖元點擬合成第二曲線,包括:獲取擬合成所述第一曲線對應的非零圖元點;計算所述當前滑動視窗內的非零圖元點的數量;若所述當前滑動視窗內的非零圖元點的數量大於或等於預設閥值,將所述擬合成所述第一曲線對應的非零圖元點與所述當前滑動視窗內的非零圖元點擬合成所述第二曲線。 In one embodiment, fitting a second curve based on the first curve and the non-zero primitive points in the current sliding window includes: obtaining the non-zero primitive points fitted to the first curve; calculating The number of non-zero primitive points in the current sliding window; if the number of non-zero primitive points in the current sliding window is greater than or equal to the preset threshold, fit the curve corresponding to the first curve The non-zero primitive points and the non-zero primitive points in the current sliding window are fitted into the second curve.

獲取擬合成第一曲線對應的非零圖元點,可以是起始位置對應的滑動視窗擬合而成的第一曲線,也可以是多個移動後的滑動視窗擬合而成的第一曲線。 Obtain the non-zero primitive point corresponding to the first curve fitted, which can be the first curve fitted by the sliding window corresponding to the starting position, or the first curve fitted by multiple moved sliding windows. .

當搜索至當前滑動視窗時,獲取當前滑動視窗之前擬合成第一曲線對應的非零圖元點,根據第一曲線計算得到當前滑動視窗內的非零圖元點的數量,如果當前滑動視窗內的非零圖元點的數量小於預設閥值,不對當前視窗內的非零圖元點進行擬合,如果當前滑動視窗內的非零圖元點的數量大於或等於預設閥值,將當前滑動視窗之前擬合成第一曲線對應的非零圖元點與當前滑動視窗內的非零圖元點擬合成第二曲線。 When searching for the current sliding window, obtain the non-zero primitive points corresponding to the first curve previously fitted to the current sliding window, and calculate the number of non-zero primitive points in the current sliding window based on the first curve. If the current sliding window is within The number of non-zero primitive points in the current sliding window is less than the preset threshold, and the non-zero primitive points in the current sliding window will not be fitted. If the number of non-zero primitive points in the current sliding window is greater than or equal to the preset threshold, the fitting will be performed. The non-zero primitive points corresponding to the first curve previously fitted in the current sliding window and the non-zero primitive points in the current sliding window are fitted into the second curve.

上述僅僅展示了兩個位置對應的滑動視窗之間的擬合,本實施例所述的第一曲線可以是由初始滑動視窗擬合而成,也可以是由上述舉例的初始滑動視窗以及第二個位置對應的滑動視窗擬合而成。本實施例可以根據已經擬合的第一曲線以及預設的移動距離,得到當前滑動視窗移動的位置,避免遺漏而導致識別不準確。 The above only shows the fitting between the sliding windows corresponding to the two positions. The first curve described in this embodiment can be fitted by the initial sliding window, or can be fitted by the initial sliding window and the second curve in the above example. The sliding window corresponding to each position is fitted. In this embodiment, the current moving position of the sliding window can be obtained based on the fitted first curve and the preset moving distance to avoid omissions and inaccurate recognition.

圖3是利用滑動視窗擬合第二曲線的示意圖,圖3所示為第一個位置A1對應的滑動視窗、第二個位置A2對應的滑動視窗以及第三個位置A3對應的滑動視窗,對鳥瞰圖建立座標系,X軸和Y軸分別為在鳥瞰圖中建立座標 系的橫座標和縱座標,在一具體的實施例中,左車道線與右車道線的擬合方式相同,以擬合左車道線為例,利用最小二乘法擬合初始滑動視窗內非零圖元點並得到曲線F1。根據第二個位置對應的滑動視窗內的縱座標(即根據預設的移動距離確定滑動視窗對應的頂點座標的縱座標作為所述滑動視窗對應的縱座標)與F1,計算得到第二個位置對應的滑動視窗中心對應的橫座標(即滑動視窗中心位置),進一步計算第二個位置對應的滑動視窗內的非零圖元點的數量以及每個非零圖元點對應的座標,利用最小二乘法將初始滑動視窗與第二個位置對應的滑動視窗內的非零圖元點擬合成F2。根據第三個位置滑動視窗的縱座標以及F2,計算出第三個位置的滑動視窗中心對應的橫座標,進一步計算第三個位置的滑動視窗內的非零圖元點的數量每個非零圖元點對應的座標,利用最小二乘法將第一個位置的滑動視窗、第二個位置的滑動視窗以及第三個位置的滑動視窗內的非零圖元點擬合成F3,以此類推,得到第二曲線Fn,n表示滑動視窗移動的位置。 Figure 3 is a schematic diagram of using a sliding window to fit the second curve. Figure 3 shows the sliding window corresponding to the first position A1, the sliding window corresponding to the second position A2, and the sliding window corresponding to the third position A3. Establish a coordinate system in the bird's-eye view. The X-axis and Y-axis are the coordinates established in the bird's-eye view respectively. The abscissa and ordinate of the system. In a specific embodiment, the left lane line and the right lane line are fitted in the same way. Taking the left lane line as an example, the least squares method is used to fit the non-zero values in the initial sliding window. Point the primitive and get the curve F1. The second position is calculated according to the ordinate in the sliding window corresponding to the second position (that is, the ordinate of the vertex coordinate corresponding to the sliding window is determined according to the preset movement distance as the ordinate corresponding to the sliding window) and F1 The abscissa corresponding to the center of the corresponding sliding window (i.e., the center position of the sliding window), further calculates the number of non-zero primitive points in the sliding window corresponding to the second position and the coordinates corresponding to each non-zero primitive point, using the minimum The square method fits the non-zero primitive points in the initial sliding window and the sliding window corresponding to the second position to F2. According to the ordinate of the sliding window at the third position and F2, calculate the abscissa corresponding to the center of the sliding window at the third position, and further calculate the number of non-zero primitive points in the sliding window at the third position. Each non-zero For the coordinates corresponding to the primitive points, use the least squares method to fit the non-zero primitive points in the sliding window at the first position, the sliding window at the second position, and the sliding window at the third position to F3, and so on, The second curve Fn is obtained, and n represents the position where the sliding window moves.

本實施例所述的方法使得搜索得到的車道線更準確,在彎道時也能更好的找到車道線的位置,避免遺漏而導致識別不準確。 The method described in this embodiment makes the lane lines searched more accurate, and the position of the lane lines can be better found when turning, so as to avoid omissions that lead to inaccurate recognition.

S27,根據以左車道線初始位置作為滑動視窗的起始位置擬合成的第二曲線得到左車道線,根據以右車道線初始位置作為滑動視窗的起始位置擬合成的第二曲線得到右車道線。 S27, obtain the left lane line based on the second curve fitted using the initial position of the left lane line as the starting position of the sliding window, and obtain the right lane based on the second curve fitted using the initial position of the right lane line as the starting position of the sliding window. String.

利用滑動視窗搜索車道線,根據當前滑動視窗之前的所有滑動視窗內的非零圖元點擬合成的第一曲線以及根據所述第一曲線確定的滑動視窗中心所在的位置,提高了搜索車道線的準確度。根據左車道線初始位置作為搜索起點搜索得到的第二曲線作為左車道線,根據右車道線初始位置作為搜索起點搜索得到的第二曲線作為右車道線。 Using the sliding window to search for lane lines, the first curve fitted based on the non-zero primitive points in all sliding windows before the current sliding window and the location of the center of the sliding window determined based on the first curve improves the search for lane lines accuracy. The second curve obtained by searching based on the initial position of the left lane line as the search starting point is used as the left lane line, and the second curve obtained by searching based on the initial position of the right lane line as the search starting point is used as the right lane line.

S28,計算車輛與左車道線之間的第一距離,以及計算車輛與右車道線之間的第二距離。 S28: Calculate the first distance between the vehicle and the left lane marking, and calculate the second distance between the vehicle and the right lane marking.

圖4是第一距離和第二距離的示意圖,根據機動車道的寬度標準, 可以得到公路中每條車道的寬度,例如:三級以上多車道公路每條機動車道寬度為3.5米,可以根據車道線擬合結果將圖元單位轉換為長度單位,根據左右車道線底部中點與第一前景圖像的中點位置進行比較,也可以藉由計算車輛的寬度,利用兩個車道線的之間的距離減去車輛的寬度得到第一距離和第二距離的總和。在建立的圖像座標系中,可以得到擬合成的左車道線的位置,以及車輛的位置,進而可以得到第一距離,也可以得到逆合成的右車道線的位置,以及車輛的位置,進而可以得到第二距離。 Figure 4 is a schematic diagram of the first distance and the second distance. According to the width standard of the motorway, The width of each lane in the highway can be obtained. For example, the width of each motor vehicle lane on a multi-lane highway above level three is 3.5 meters. The unit of graphics can be converted into a length unit based on the lane line fitting results. According to the midpoint of the bottom of the left and right lane lines Comparing with the midpoint position of the first foreground image, the sum of the first distance and the second distance can also be obtained by calculating the width of the vehicle, subtracting the width of the vehicle from the distance between the two lane lines. In the established image coordinate system, the position of the fitted left lane line and the position of the vehicle can be obtained, and then the first distance can be obtained. The position of the inversely synthesized right lane line and the position of the vehicle can also be obtained, and then The second distance can be obtained.

在一具體的實施例中,假設計算得到左車道位於85pixel(85pixel表示橫座標方向圖元點的數量)的位置,右車道線位於245pixel的位置,則左車道線與右車道線之間的寬為160pixel。預先校正車輛所在的位置位於第一前景圖像的正中間,例如:車輛最左邊位於115pixel的位置,車輛最右邊位於205pixel的位置,即,可以計算得到車輛寬度為90pixel寬。計算除去車子寬度的剩餘距離,剩餘距離=160pixel-90pixel,第一距離=115pixel-85pixel,第二距離=245pixel-205pixel。 In a specific embodiment, assuming that the calculated left lane is located at 85 pixels (85 pixel represents the number of pixel points in the abscissa direction) and the right lane line is located at 245 pixels, then the width between the left lane line and the right lane line is 160pixel. The position of the pre-corrected vehicle is located in the middle of the first foreground image. For example, the leftmost position of the vehicle is located at 115 pixels, and the rightmost position of the vehicle is located at 205 pixels. That is, the vehicle width can be calculated to be 90 pixels wide. Calculate the remaining distance after excluding the width of the car, the remaining distance = 160pixel-90pixel, the first distance = 115pixel-85pixel, the second distance = 245pixel-205pixel.

S29,根據第一距離和第二距離,確定車輛是否偏移車道。 S29: Determine whether the vehicle deviates from the lane based on the first distance and the second distance.

在一實施例中,根據第一距離和第二距離,確定車輛是否偏移車道,包括:根據第一距離與第二距離,計算車輛向左車道線偏移的第一比例以及向右車道線偏移的第二比例;計算第一比例與第二比例的差值對應的絕對值;若差值對應的絕對值小於預設閥值,確定車輛沒有偏移車道;若差值對應的絕對值大於或等於預設閥值,確定車輛偏移車道。 In one embodiment, determining whether the vehicle deviates from the lane based on the first distance and the second distance includes: calculating a first proportion of the vehicle's deviation to the left lane line and the right lane line based on the first distance and the second distance. The second proportion of the offset; calculate the absolute value corresponding to the difference between the first proportion and the second proportion; if the absolute value corresponding to the difference is less than the preset threshold, it is determined that the vehicle has not deviated from the lane; if the absolute value corresponding to the difference Greater than or equal to the preset threshold, it is determined that the vehicle has deviated from the lane.

在一實施例中,根據第一距離與第二距離,計算車輛向左車道線偏移的第一比例以及向右車道線偏移的第二比例,包括:計算第一距離與第二距離的和,將第一距離與第二距離的和作為第三距離;計算第一距離與第三距離的比值,將第一距離與第三距離的比值作為第一比例;計算第二距離與第三距離的比值,將第二距離與第三距離的比值作為第二比例。 In one embodiment, calculating the first ratio of the vehicle's deviation to the left lane line and the second ratio of the vehicle's deviation to the right lane line based on the first distance and the second distance include: calculating the difference between the first distance and the second distance. and, take the sum of the first distance and the second distance as the third distance; calculate the ratio of the first distance to the third distance, take the ratio of the first distance to the third distance as the first ratio; calculate the ratio of the second distance to the third distance The ratio of the distance is the ratio of the second distance to the third distance as the second ratio.

根據第一距離=115pixel-85pixel以及第二距離=245pixel-205pixel,計 算得到第一距離為30pixel,第二距離為40pixel,根據第一距離與第二距離的和,得到第三距離為70pixel,可以計算得到第一比例為30pixel/70pixel=0.43,第二比例為40pixel/70pixel=0.57。 According to the first distance=115pixel-85pixel and the second distance=245pixel-205pixel, calculate The first distance is calculated to be 30pixel, and the second distance is 40pixel. According to the sum of the first distance and the second distance, the third distance is 70pixel. The first ratio can be calculated to be 30pixel/70pixel=0.43, and the second ratio is 40pixel. /70pixel=0.57.

根據上述第一比例與第二比例的計算結果,計算第一比例與第二比例的差值對應的絕對值為0.14,若預設閥值等於0.2,014<0.2,可以得到車輛沒有偏移,本實施例所述的預設閥值可以根據實際情況預先設定,所述預設閥值可以是可偏移的安全距離。 Based on the above calculation results of the first ratio and the second ratio, the absolute value corresponding to the difference between the first ratio and the second ratio is calculated to be 0.14. If the preset threshold is equal to 0.2, 014<0.2, it can be obtained that the vehicle has no offset. The preset threshold described in this embodiment can be preset according to the actual situation, and the preset threshold can be an offset safe distance.

本申請有效的識別出車道線以後,藉由判斷車輛的偏移程度來保障車輛行駛的安全性,進而在車輛偏移程度較大時,對車輛進行告警,特別是為無人駕駛系統增加有效的駕駛依據。 After this application effectively identifies the lane line, it ensures the safety of the vehicle by judging the degree of vehicle deviation, and then warns the vehicle when the vehicle deviation is large, especially to add effective information to the unmanned driving system. Driving basis.

在一實施例中,獲取車輛行駛過程中第二時刻拍攝的第二前景圖像,第二時刻為第一時刻的下一時刻,第一時刻為拍攝第一前景圖像對應的時刻;對第二前景圖像進行畸變校正,得到第二校正圖像;根據預設的擴展距離將左車道線向第一方向擴展,得到第一邊界;根據預設的擴展距離將右車道線向第二方向擴展,得到第二邊界;根據第一邊界以及第二邊界在第二校正圖像上進行區域劃分,確定第二校正圖像中車道線所在的區域。 In one embodiment, a second foreground image captured at a second moment while the vehicle is driving is obtained. The second moment is the next moment after the first moment, and the first moment is the moment corresponding to the first foreground image. Perform distortion correction on the two foreground images to obtain a second corrected image; expand the left lane line to the first direction according to the preset expansion distance to obtain the first boundary; expand the right lane line to the second direction according to the preset expansion distance Expand to obtain the second boundary; perform area division on the second corrected image based on the first boundary and the second boundary to determine the area where the lane line is located in the second corrected image.

圖5是根據第二時刻車道線所在區域的示意圖。本申請實施例中所述的方法考慮到車道變化的連續性,不需要對每一幀圖片都進行完整的視窗搜索,在第一時刻的一幀圖片處理完成以後,可以根據第一時刻得到的左車道線以及右車道線預測第二時刻車道線所在的區域。如圖5所示,利用兩根車道線之間的距離不變的特性,根據第一時刻得到的左車道線確定第一邊界,根據第二時刻得到的右車道線確定第二邊界,獲取第一邊界與第二邊界之間的區域,將拍攝得到的第二前景圖像的其他區域進行遮蔽處理,利用獲取得到的第一邊界與第二邊界之間的區域作為第二時刻車道線所在的區域,提高了檢測車道線的效率。 Figure 5 is a schematic diagram of the area where the lane line is located at the second moment. The method described in the embodiment of the present application takes into account the continuity of lane changes and does not require a complete window search for each frame of picture. After the processing of a frame of picture at the first moment is completed, it can be based on the image obtained at the first moment. The left lane markings and the right lane markings predict the area where the lane markings are located at the second moment. As shown in Figure 5, using the constant distance between two lane lines, the first boundary is determined based on the left lane line obtained at the first moment, the second boundary is determined based on the right lane line obtained at the second moment, and the third boundary is obtained. In the area between the first boundary and the second boundary, other areas of the captured second foreground image are masked, and the obtained area between the first boundary and the second boundary is used as the location of the lane line at the second moment. area, improving the efficiency of detecting lane lines.

本申請基於當前滑動視窗之前的所有滑動視窗內的非零圖元點擬合而成的第一曲線,計算得到當前滑動視窗的視窗中心位置,提高了移動滑動視窗的有效性,進而根據計算當前滑動視窗內的非零圖元點,將當前滑動視窗之前的非零圖元點與當前滑動視窗的非零圖元點進行擬合,生成第二曲線,進而根據第二曲線得到第一時刻的左車道線與右車道線,基於車道線的特點,根據第一時刻得到的車道線獲取第二時刻的車道線所在的區域,提高了檢測車道線的效率。根據得到的左車道線與右車道線可以計算車輛偏移的距離,以保障車輛在行駛過程中的安全性。 This application calculates the window center position of the current sliding window based on the first curve fitted by the non-zero primitive points in all sliding windows before the current sliding window, which improves the effectiveness of moving the sliding window, and then calculates the current For the non-zero primitive points in the sliding window, fit the non-zero primitive points before the current sliding window and the non-zero primitive points of the current sliding window to generate a second curve, and then obtain the first moment based on the second curve. For left lane markings and right lane markings, based on the characteristics of lane markings, the area where the lane markings are located at the second moment is obtained based on the lane markings obtained at the first moment, which improves the efficiency of detecting lane markings. Based on the obtained left lane markings and right lane markings, the vehicle offset distance can be calculated to ensure the safety of the vehicle during driving.

請繼續參閱圖1,本實施例中,所述儲存器11可以是電子設備1的內部儲存器,即內置於所述電子設備1的儲存器。在其他實施例中,所述儲存器11也可以是電子設備1的外部儲存器,即外接於所述電子設備1的儲存器。 Please continue to refer to FIG. 1 . In this embodiment, the storage 11 may be an internal storage of the electronic device 1 , that is, a storage built into the electronic device 1 . In other embodiments, the storage 11 may also be an external storage of the electronic device 1 , that is, a storage external to the electronic device 1 .

在一些實施例中,所述儲存器11用於存儲程式碼和各種資料,並在電子設備1的運行過程中實現高速、自動地完成程式或資料的存取。 In some embodiments, the storage 11 is used to store program codes and various data, and realize high-speed and automatic access to programs or data during the operation of the electronic device 1 .

所述儲存器11可以包括隨機存取儲存器,還可以包括非易失性儲存器,例如硬碟、記憶體(Memory)、插接式硬碟、智慧存儲卡(Smart Media Card,SMC)、安全數位(Secure Digital,SD)卡、記憶卡(Flash Card)、至少一個磁碟儲存元件、快閃儲存器元件、或其他易失性固態儲存元件。 The storage 11 may include random access memory, and may also include non-volatile storage, such as hard disk, memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), Secure Digital (SD) card, memory card (Flash Card), at least one disk storage element, flash memory element, or other volatile solid-state storage element.

在一實施例中,所述處理器12可以是中央處理單元(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現場可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯元件、分立門或者電晶體邏輯元件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器也可以是其它任何常規的處理器等。 In one embodiment, the processor 12 may be a central processing unit (CPU), or other general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), or an application specific integrated circuit (Application Processor). Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic components, discrete gate or transistor logic components, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may be any other conventional processor, etc.

所述儲存器11中的程式碼和各種資料如果以軟體功能單元的形式實現並作為獨立的產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣的理解,本申請實現上述實施例方法中的全部或部分流程,例如車輛 偏移檢測方法,也可以藉由電腦程式來指令相關的硬體來完成,所述的電腦程式可存儲於電腦可讀存儲介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例的步驟。其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可執行檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼的任何實體或裝置、記錄介質、隨身碟、移動硬碟、磁碟、光碟、電腦儲存器、唯讀儲存器(ROM,Read-Only Memory)等。 If the program codes and various data in the storage 11 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, this application implements all or part of the processes in the above embodiment methods, such as vehicle The offset detection method can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the above-mentioned functions can be realized. Steps of method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in the form of original program code, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a flash drive, a mobile hard drive, a magnetic disk, an optical disk, a computer storage, a read-only memory (ROM, Read- Only Memory) etc.

可以理解的是,以上所描述的模組劃分,為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。另外,在本申請各個實施例中的各功能模組可以集成在相同處理單元中,也可以是各個模組單獨物理存在,也可以兩個或兩個以上模組集成在相同單元中。上述集成的模組既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。 It can be understood that the module division described above is a logical function division, and there may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present application can be integrated in the same processing unit, or each module can exist physically alone, or two or more modules can be integrated in the same unit. The above integrated modules can be implemented in the form of hardware or in the form of hardware plus software function modules.

最後應說明的是,以上實施例僅用以說明本申請的技術方案而非限制,儘管參照較佳實施例對本申請進行了詳細說明,本領域的普通技術人員應當理解,可以對本申請的技術方案進行修改或等同替換,而不脫離本申請技術方案的精神和範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be modified. Modifications or equivalent substitutions may be made without departing from the spirit and scope of the technical solution of the present application.

S21~S29:步驟 S21~S29: Steps

Claims (10)

一種車輛偏移檢測方法,應用於電子設備,其中,該方法包括:獲取車輛行駛過程中拍攝的第一前景圖像;對所述第一前景圖像進行畸變校正,得到第一校正圖像;對所述第一校正圖像進行透視變換,得到鳥瞰圖;基於所述鳥瞰圖中每一列圖元點中非零圖元點的個數,生成所述鳥瞰圖對應的非零圖元點分佈圖,所述非零圖元點分佈圖包括第一峰值和第二峰值,所述第一峰值位於所述第二峰值的左邊;根據所述第一峰值在所述鳥瞰圖中確定左車道線初始位置,根據所述第二峰值在所述鳥瞰圖中確定右車道線初始位置;以所述左車道線初始位置和所述右車道線初始位置分別作為滑動視窗的起始位置開始在所述鳥瞰圖中移動,根據當前滑動視窗之前的所有滑動視窗內的非零圖元點擬合成第一曲線,根據所述第一曲線以及所述當前滑動視窗內的非零圖元點擬合成第二曲線,包括:根據所述當前滑動視窗的移動距離以及所述第一曲線,計算得到所述當前滑動視窗中心對應的橫座標,根據所述移動距離與所述橫座標,確定所述當前滑動視窗內的非零圖元點,擬合所述第一曲線對應的非零圖元點與所述當前滑動視窗內的非零圖元點,得到所述第二曲線;其中,所述滑動視窗的移動根據所述第一曲線進行動態調整;根據以所述左車道線初始位置作為滑動視窗的起始位置擬合成的第二曲線得到左車道線,根據以所述右車道線初始位置作為滑動視窗的起始位置擬合成的第二曲線得到右車道線;計算所述車輛與所述左車道線之間的第一距離,以及計算所述車輛與所述右車道線之間的第二距離;根據所述第一距離和所述第二距離,確定所述車輛是否偏移車道。 A vehicle offset detection method, applied to electronic equipment, wherein the method includes: acquiring a first foreground image captured while the vehicle is traveling; performing distortion correction on the first foreground image to obtain a first corrected image; Perform perspective transformation on the first corrected image to obtain a bird's-eye view; based on the number of non-zero primitive points in each column of primitive points in the bird's-eye view, generate a distribution of non-zero primitive points corresponding to the bird's-eye view Figure, the non-zero primitive point distribution map includes a first peak and a second peak, the first peak is located to the left of the second peak; the left lane line is determined in the bird's-eye view according to the first peak Initial position, determine the initial position of the right lane line in the bird's-eye view according to the second peak value; use the initial position of the left lane line and the initial position of the right lane line as the starting positions of the sliding window, starting from the Moving in the bird's-eye view, a first curve is fitted according to the non-zero primitive points in all sliding windows before the current sliding window, and a second curve is fitted according to the first curve and the non-zero primitive points in the current sliding window. The curve includes: calculating the abscissa corresponding to the center of the current sliding window based on the movement distance of the current sliding window and the first curve, and determining the current sliding window based on the movement distance and the abscissa. non-zero primitive points within the first curve, fit the non-zero primitive points corresponding to the first curve and the non-zero primitive points within the current sliding window, and obtain the second curve; wherein, the The movement is dynamically adjusted according to the first curve; the left lane line is obtained according to the second curve fitted with the initial position of the left lane line as the starting position of the sliding window, and the left lane line is obtained based on the initial position of the right lane line as the sliding window. The second curve fitted to the starting position obtains the right lane line; calculates the first distance between the vehicle and the left lane line, and calculates the second distance between the vehicle and the right lane line; Based on the first distance and the second distance, it is determined whether the vehicle deviates from the lane. 如請求項1所述的車輛偏移檢測方法,其中,所述根據所述第一距離和所述第二距離,確定所述車輛是否偏移車道,包括: 根據所述第一距離與所述第二距離,計算所述車輛向所述左車道線偏移的第一比例以及向所述右車道線偏移的第二比例;計算所述第一比例與所述第二比例的差值對應的絕對值;若所述差值對應的絕對值小於預設閥值,確定所述車輛沒有偏移車道;若所述差值對應的絕對值大於或等於所述預設閥值,確定所述車輛偏移車道。 The vehicle deviation detection method according to claim 1, wherein determining whether the vehicle deviates from a lane according to the first distance and the second distance includes: Calculate a first proportion of the vehicle's deviation to the left lane line and a second proportion of its deviation to the right lane line based on the first distance and the second distance; calculate the first proportion and The absolute value corresponding to the difference in the second ratio; if the absolute value corresponding to the difference is less than the preset threshold, it is determined that the vehicle does not deviate from the lane; if the absolute value corresponding to the difference is greater than or equal to the The preset threshold is used to determine that the vehicle deviates from the lane. 如請求項2所述的車輛偏移檢測方法,其中,所述根據所述第一距離與所述第二距離,計算所述車輛向所述左車道線偏移的第一比例以及向所述右車道線偏移的第二比例,包括:計算所述第一距離與所述第二距離的和,將所述第一距離與所述第二距離的和作為第三距離;計算所述第一距離與所述第三距離的比值,將所述第一距離與所述第三距離的比值作為所述第一比例;計算所述第二距離與所述第三距離的比值,將所述第二距離與所述第三距離的比值作為所述第二比例。 The vehicle deviation detection method according to claim 2, wherein the first proportion of the vehicle deviation to the left lane line and the deviation to the left lane line are calculated based on the first distance and the second distance. The second proportion of the right lane line offset includes: calculating the sum of the first distance and the second distance, and taking the sum of the first distance and the second distance as the third distance; calculating the third distance. The ratio of a distance to the third distance, taking the ratio of the first distance to the third distance as the first ratio; calculating the ratio of the second distance to the third distance, taking the ratio of the first distance to the third distance as the first ratio; The ratio of the second distance to the third distance serves as the second ratio. 如請求項1所述的車輛偏移檢測方法,其中,所述方法還包括:獲取所述車輛在行駛過程中第二時刻拍攝的第二前景圖像,所述第二時刻為第一時刻的下一時刻,所述第一時刻為拍攝所述第一前景圖像對應的時刻;對所述第二前景圖像進行畸變校正,得到第二校正圖像;根據預設的擴展距離將所述左車道線向第一方向擴展,得到第一邊界;根據所述預設的擴展距離將所述右車道線向第二方向擴展,得到第二邊界;根據所述第一邊界以及所述第二邊界在所述第二校正圖像上進行區域劃分,確定所述第二校正圖像中車道線所在的區域。 The vehicle offset detection method according to claim 1, wherein the method further includes: obtaining a second foreground image taken at a second moment during the driving process of the vehicle, and the second moment is the image of the first moment. At the next moment, the first moment is the moment corresponding to the shooting of the first foreground image; distortion correction is performed on the second foreground image to obtain a second corrected image; and the second foreground image is captured according to the preset extension distance. The left lane line is expanded to the first direction to obtain a first boundary; the right lane line is expanded to the second direction according to the preset expansion distance to obtain a second boundary; according to the first boundary and the second The boundary is divided into areas on the second corrected image to determine the area where the lane line is located in the second corrected image. 如請求項1所述的車輛偏移檢測方法,其中,所述對所述第一前景圖像進行畸變校正,得到第一校正圖像,包括:對所述第一前景圖像建立圖像座標系,獲取所述第一前景圖像中每個非零圖 元點在所述圖像座標系中的第一座標;獲取拍攝所述第一前景圖像的相機模組的內參,根據所述內參與所述第一座標確定所述第一座標對應的第二座標,其中,所述第二座標是無畸變座標;基於所述第一座標以及所述第一前景圖像的中心座標點,確定所述第一座標與所述中心座標點之間的畸變距離;根據所述第一前景圖像中每個圖元點的灰階值,計算所述第一前景圖像的圖像複雜度,根據所述圖像複雜度確定所述第一前景圖像的校正參數;根據預設的平滑處理函數,確定與所述畸變距離和所述校正參數對應的平滑處理係數;根據所述平滑處理係數與所述第二座標對所述第一座標進行平滑校正,得到所述第一校正圖像。 The vehicle offset detection method according to claim 1, wherein performing distortion correction on the first foreground image to obtain the first corrected image includes: establishing image coordinates for the first foreground image. system, obtain each non-zero image in the first foreground image The first coordinate of the element point in the image coordinate system; obtain the internal parameters of the camera module that captured the first foreground image, and determine the third coordinate corresponding to the first coordinate based on the internal parameters of the first coordinate. Two coordinates, wherein the second coordinate is a distortion-free coordinate; based on the first coordinate and the center coordinate point of the first foreground image, the distortion between the first coordinate and the center coordinate point is determined distance; calculate the image complexity of the first foreground image based on the grayscale value of each primitive point in the first foreground image, and determine the first foreground image based on the image complexity correction parameters; determine the smoothing coefficient corresponding to the distortion distance and the correction parameter according to the preset smoothing function; perform smoothing correction on the first coordinate according to the smoothing coefficient and the second coordinate. , to obtain the first corrected image. 如請求項5所述的車輛偏移檢測方法,其中,所述根據所述平滑處理係數與所述第二座標對所述第一座標進行平滑校正,得到所述第一校正圖像,包括:根據所述平滑處理係數確定所述第一座標的第一權重和所述第二座標的第二權重;計算所述第一權重和所述第一座標的第一乘積,以及計算所述第二權重與所述第二座標的第二乘積;根據所述第一乘積和所述第二乘積之和對所述第一座標進行平滑校正,得到所述第一校正圖像。 The vehicle offset detection method according to claim 5, wherein the smoothing correction of the first coordinate according to the smoothing coefficient and the second coordinate to obtain the first corrected image includes: Determine the first weight of the first coordinate and the second weight of the second coordinate according to the smoothing coefficient; calculate the first product of the first weight and the first coordinate, and calculate the second The second product of the weight and the second coordinate; perform smooth correction on the first coordinate according to the sum of the first product and the second product to obtain the first corrected image. 如請求項1所述的車輛偏移檢測方法,其中,所述對所述第一校正圖像進行透視變換,得到鳥瞰圖,包括:將所述第一校正圖像中的每個非零圖元點作為目標點,利用座標轉換公式對所述目標點進行計算,得到逆透視變換矩陣;基於所述逆透視變換矩陣,得到所述鳥瞰圖。 The vehicle offset detection method according to claim 1, wherein said performing perspective transformation on the first corrected image to obtain a bird's-eye view includes: converting each non-zero image in the first corrected image The element point is used as the target point, and the coordinate conversion formula is used to calculate the target point to obtain the inverse perspective transformation matrix; based on the inverse perspective transformation matrix, the bird's-eye view is obtained. 如請求項1所述的車輛偏移檢測方法,其中,所述根據所述第 一曲線以及所述當前滑動視窗內的非零圖元點擬合成第二曲線,包括:獲取擬合成所述第一曲線對應的非零圖元點;計算所述當前滑動視窗內的非零圖元點的數量;若所述當前滑動視窗內的非零圖元點的數量大於或等於預設閥值,將所述擬合成所述第一曲線對應的非零圖元點與所述當前滑動視窗內的非零圖元點擬合成所述第二曲線。 The vehicle offset detection method according to claim 1, wherein the method according to the first Fitting a curve and the non-zero primitive points in the current sliding window into a second curve includes: obtaining the non-zero primitive points fitted to the first curve; calculating the non-zero graphic points in the current sliding window The number of primitive points; if the number of non-zero primitive points in the current sliding window is greater than or equal to the preset threshold, fit the non-zero primitive points corresponding to the first curve and the current sliding window Non-zero primitive points in the view window are fitted to the second curve. 一種電子設備,其中,所述電子設備包括處理器和儲存器,所述處理器用於執行儲存器中存儲的電腦程式以實現如請求項1至8中任意一項的所述車輛偏移檢測方法。 An electronic device, wherein the electronic device includes a processor and a storage, the processor is used to execute a computer program stored in the storage to implement the vehicle offset detection method in any one of claims 1 to 8 . 一種電腦可讀存儲介質,其中,所述電腦可讀存儲介質存儲有至少一個指令,所述至少一個指令被處理器執行時實現如請求項1至8中任意一項所述的車輛偏移檢測方法。 A computer-readable storage medium, wherein the computer-readable storage medium stores at least one instruction. When the at least one instruction is executed by a processor, the vehicle offset detection as described in any one of claims 1 to 8 is implemented. method.
TW111149033A 2022-12-20 2022-12-20 Method for detecting skewing of vehicle and related devices TWI819928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111149033A TWI819928B (en) 2022-12-20 2022-12-20 Method for detecting skewing of vehicle and related devices

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111149033A TWI819928B (en) 2022-12-20 2022-12-20 Method for detecting skewing of vehicle and related devices

Publications (1)

Publication Number Publication Date
TWI819928B true TWI819928B (en) 2023-10-21

Family

ID=89858025

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111149033A TWI819928B (en) 2022-12-20 2022-12-20 Method for detecting skewing of vehicle and related devices

Country Status (1)

Country Link
TW (1) TWI819928B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105966314A (en) * 2016-06-15 2016-09-28 北京联合大学 Lane departure pre-warning method based on double low-cost cameras
US20190387152A1 (en) * 2015-04-27 2019-12-19 Snap-Aid Patents Ltd. Estimating and using relative head pose and camera field-of-view
CN110647850A (en) * 2019-09-27 2020-01-03 福建农林大学 Automatic lane deviation measuring method based on inverse perspective principle

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190387152A1 (en) * 2015-04-27 2019-12-19 Snap-Aid Patents Ltd. Estimating and using relative head pose and camera field-of-view
CN105966314A (en) * 2016-06-15 2016-09-28 北京联合大学 Lane departure pre-warning method based on double low-cost cameras
CN110647850A (en) * 2019-09-27 2020-01-03 福建农林大学 Automatic lane deviation measuring method based on inverse perspective principle

Similar Documents

Publication Publication Date Title
US11816991B2 (en) Vehicle environment modeling with a camera
EP3438777B1 (en) Method, apparatus and computer program for a vehicle
CN111448478B (en) System and method for correcting high-definition maps based on obstacle detection
US10867189B2 (en) Systems and methods for lane-marker detection
JP2019517089A (en) Image processing method for recognizing ground markings, and system for detecting ground markings
US11010622B2 (en) Infrastructure-free NLoS obstacle detection for autonomous cars
EP3438872A1 (en) Method, apparatus and computer program for a vehicle
US20200125861A1 (en) Road line detection device and road line detection method
CN109544635B (en) Camera automatic calibration method based on enumeration heuristic
Pepperell et al. Towards persistent visual navigation using smart
CN113917487A (en) Laser radar-based method for detecting road edge and drivable area of closed road
CN115147328A (en) Three-dimensional target detection method and device
US20200193184A1 (en) Image processing device and image processing method
Raguraman et al. Intelligent drivable area detection system using camera and LiDAR sensor for autonomous vehicle
Itu et al. An efficient obstacle awareness application for android mobile devices
TWI819928B (en) Method for detecting skewing of vehicle and related devices
CN114037977B (en) Road vanishing point detection method, device, equipment and storage medium
CN113902047B (en) Image element matching method, device, equipment and storage medium
TWI823721B (en) Method for identifying lane line and related devices
JP4469980B2 (en) Image processing method for tracking moving objects
CN116129386A (en) Method, system and computer readable medium for detecting a travelable region
JP2020095631A (en) Image processing device and image processing method
JP2020095619A (en) Image processing device and image processing method
Chen et al. Integrated vehicle and lane detection with distance estimation
CN114898321A (en) Method, device, equipment, medium and system for detecting road travelable area