# US 2024/0202887 A1 · Method for detecting vehicle deviation, electronic device, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0202887 A1
- Document ID: US20240202887A1
- Status: Published application
- Kind: A1
- Application number: 18/199,878
- Filed: 2023-05-19
- Published: 2024-06-20
- Earliest claimed: 2022-12-20
- Assignees: Hon Hai Precision Industry Co., Ltd.
- Applicants: Hon Hai Precision Industry Co., Ltd.
- Inventors: YU-HSUAN CHIEN; CHIN-PIN KUO
- Web page: https://patentgrep.com/patent/US20240202887A1

## CPC

- G06T 5/80: Geometric correction
- G06T 3/04: Context-preserving transformations, e.g. by using an importance map (panospheric to cylindrical image transformations G06T3/12)
- G06T 5/70: Denoising; Smoothing
- G06T 7/12: Edge-based segmentation
- G06T 7/13: Edge detection
- G06T 7/194: involving foreground-background segmentation
- G06T 7/73: using feature-based methods
- G06T 7/80: Analysis of captured images to determine intrinsic or extrinsic camera parameters, i.e. camera calibration
- G06V 10/247: {by affine transforms, e.g. correction due to perspective effects; Quadrilaterals, e.g. trapezoids}
- G06V 20/588: {Recognition of the road, e.g. of lane markings; Recognition of the vehicle driving pattern in relation to the road}
- G06T 2200/04: involving 3D image data
- G06T 2207/10032: Satellite or aerial image; Remote sensing
- G06T 2207/20021: Dividing image into blocks, subimages or windows
- G06T 2207/30256: Lane; Road marking
- G06T: IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06V: IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING

## Abstract

A method for detecting vehicle deviation, an electronic device and a storage medium are provided. In the method, a first foreground image is acquired, a first corrected image is obtained by performing a distortion correction on the first foreground image and an aerial view is obtained. Based on the aerial view, a distribution map of non-zero pixel points is generated. An initial position of a left lane line and an initial position of a right lane line in the aerial view are determined. A first curve corresponding to the left lane line and a second curve corresponding to the right lane line are fitted. It can be determined whether the vehicle deviates from any lane line according to a distance between the vehicle and any lane line. The method can effectively detect lane lines, and improve an accuracy of identifying lane line detection.

## Claims

### Claim 1

A method for detecting vehicle deviation, the method comprising:
acquiring a first foreground image;
performing a distortion correction on the first foreground image and obtaining a first corrected image;
performing a perspective transformation on the first corrected image and obtaining an aerial view;
generating a distribution map of non-zero pixel points corresponding to the aerial view, based on a number of non-zero pixel points in each column of pixel points in the aerial view, the distribution map of non-zero pixel points is provided with a first peak and a second peak, and the first peak being on the left of the second peak;
determining an initial position of a left lane line in the aerial view according to the first peak, and determining an initial position of a right lane line in the aerial view according to the second peak;
determining the initial position of the left lane line and the initial position of the right lane line as a starting position of a sliding window respectively, and starting moving the sliding window in the aerial view from the starting position;
fitting a first curve corresponding to the left lane line and a second curve corresponding to the right lane line according to non-zero pixel points covered by the sliding window while moving the sliding window and before arriving at a current position of the sliding window respectively;
fitting a third curve corresponding to the left lane line according to the first curve corresponding to the left lane line and non-zero pixel points covered by the sliding window at the current position, and fitting a fourth curve corresponding to the right lane line according to the second curve corresponding to the right lane line and non-zero pixel points covered by the sliding window at the current position, dynamically adjusting a movement of the sliding window according to the first curve and the second curve;
determining the left lane line according to the third curve corresponding to the left lane line, and determining the right lane line according to the fourth curve corresponding to the right lane line;
calculating a first distance between a vehicle and the left lane line, and calculating a second distance between the vehicle and the right lane line; and
determining whether the vehicle deviates from any one of the left lane line and the right lane line according to the first distance and the second distance.

### Claim 2 (depends on 1)

The method of claim 1, wherein determining whether the vehicle deviates from any one of the left lane line and the right lane line according to the first distance and the second distance comprises:
calculating a first deviation proportion of the vehicle from the left lane line and a second deviation proportion of the vehicle from the right lane line according to the first distance and the second distance;
calculating an absolute value corresponding to a difference between the first deviation proportion and the second deviation proportion;
in response that the absolute value corresponding to the difference is less than a deviation preset threshold, determining that the vehicle does not deviate from any one of the left lane line and the right lane line;
in response that the absolute value corresponding to the difference is greater than or equal to the deviation preset threshold, determining that the vehicle deviates from any one of the left lane line and the right lane line.

### Claim 3 (depends on 2)

The method of claim 2, wherein calculating the first deviation proportion of the vehicle from the left lane line and the second deviation proportion of the vehicle from the right lane line according to the first distance and the second distance comprises:
calculating a sum of the first distance and the second distance, and using the sum of the first distance and the second distance as a third distance;
calculating a ratio of the first distance to the third distance, and using the ratio of the first distance to the third distance as the first deviation proportion;
calculating a ratio of the second distance to the third distance, and using the ratio of the second distance to the third distance as the second deviation proportion.

### Claim 4 (depends on 1)

The method of claim 1, further comprising:
acquiring a second foreground image at a second moment, the second moment being after a first moment that acquires the first foreground image;
performing a distortion correction on the second foreground image and obtaining a second corrected image;
extending the left lane line towards a first direction according to a preset extension distance, and obtaining a first boundary;
extending the right lane line towards a second direction according to the preset extension distance, and obtaining a second boundary;
dividing regions on the second corrected image according to the first boundary and the second boundary, and determining a region of the left lane line and the right lane line in the second corrected image.

### Claim 5 (depends on 1)

The method of claim 1, wherein performing the distortion correction on the first foreground image and obtaining the first corrected image comprises:
establishing an image coordinate system for the first foreground image, and obtaining first coordinates of each non-zero pixel point on the first foreground image in the image coordinate system;
obtaining internal parameters of a camera device that captures the first foreground image, and determining second coordinates corresponding to the first coordinates according to the internal parameters and the first coordinates;
calculating a distortion distance between the first coordinates and coordinates of a center point of the first foreground image;
calculating an image complexity of the first foreground image according to a gray value of each pixel point on the first foreground image, and determining correction parameters of the first foreground image according to the image complexity;
determining a smoothing coefficient corresponding to the distortion distance and the correction parameters, according to a preset smoothing function;
smoothing the first coordinates according to the smoothing coefficient and the second coordinates, and obtaining the first corrected image.

### Claim 6 (depends on 5)

The method of claim 5, wherein smoothing the first coordinates according to the smoothing coefficient and the second coordinates, and obtaining the first corrected image comprises:
determining a first weight of the first coordinates and a second weight of the second coordinates according to the smoothing coefficient;
calculating a first product of the first weight and the first coordinates, and calculating a second product of the second weight and the second coordinates;
smoothing the first coordinates according to a sum of the first product and the second product and obtaining the first corrected image.

### Claim 7 (depends on 1)

The method of claim 1, wherein performing the perspective transformation on the first corrected image and obtaining the aerial view comprises:
using each non-zero pixel point in the first corrected image as a target point, calculating the target point according to a coordinate transformation formula and obtaining an inverse perspective transformation matrix;
obtaining the aerial view based on the inverse perspective transformation matrix.

### Claim 8 (depends on 1)

The method of claim 1, wherein fitting the third curve corresponding to the left lane line according to the first curve corresponding to the left lane line and non-zero pixel points covered by the sliding window at the current position, and fitting the fourth curve corresponding to the right lane line according to the second curve corresponding to the right lane line and non-zero pixel points covered by the sliding window at the current position comprises:
obtaining the non-zero pixel points of the first curve and the second curve respectively;
calculating a number of the non-zero pixels in current sliding window;
in response that the number of the non-zero pixels in the current sliding window is greater than or equal to a preset threshold, fitting the third curve according to the non-zero pixel points of the first curve and non-zero pixel points in the current sliding window, and fitting the forth curve according to the non-zero pixel points of the second curve and non-zero pixel points in the current sliding window.

### Claim 9

An electronic device comprising:
a processor; and
a storage device that stories a plurality of instructions, which when executed by the processor, cause the processor to:
acquire a first foreground image;
perform a distortion correction on the first foreground image and obtain a first corrected image;
perform a perspective transformation on the first corrected image and obtain an aerial view;
generate a distribution map of non-zero pixel points corresponding to the aerial view, based on a number of non-zero pixel points in each column of pixel points in the aerial view, the distribution map of non-zero pixel points is provided with a first peak and a second peak, and the first peak being on the left of the second peak;
determine an initial position of a left lane line in the aerial view according to the first peak, and determine an initial position of a right lane line in the aerial view according to the second peak;
determine the initial position of the left lane line and the initial position of the right lane line as a starting position of a sliding window respectively, and start moving the sliding window in the aerial view from the starting position;
fit a first curve corresponding to the left lane line and a second curve corresponding to the right lane line according to non-zero pixel points covered by the sliding window while moving the sliding window and before arriving at a current position of the sliding window respectively;
fit a third curve corresponding to the left lane line according to the first curve corresponding to the left lane line and non-zero pixel points covered by the sliding window at the current position, and fit a fourth curve corresponding to the right lane line according to the second curve corresponding to the right lane line and non-zero pixel points covered by the sliding window at the current position, dynamically adjusting a movement of the sliding window according to the first curve and the second curve;
determine the left lane line according to the third curve corresponding to the left lane line, and determine the right lane line according to the fourth curve corresponding to the right lane line;
calculate a first distance between a vehicle and the left lane line, and calculate a second distance between the vehicle and the right lane line; and
determine whether the vehicle deviates from any one of the left lane line and the right lane line according to the first distance and the second distance.

### Claim 10 (depends on 9)

The electronic device of claim 9, wherein the processor is further caused to:
calculate a first deviation proportion of the vehicle from the left lane line and a second deviation proportion of the vehicle from the right lane line according to the first distance and the second distance;
calculate an absolute value corresponding to a difference between the first deviation proportion and the second deviation proportion;
in response that the absolute value corresponding to the difference is less than a deviation preset threshold, determine that the vehicle does not deviate from any one of the left lane line and the right lane line;
in response that the absolute value corresponding to the difference is greater than or equal to the deviation preset threshold, determine that the vehicle deviates from any one of the left lane line and the right lane line.

### Claim 11 (depends on 10)

The electronic device of claim 10, wherein the processor is further caused to:
calculate a sum of the first distance and the second distance, and use the sum of the first distance and the second distance as a third distance;
calculate a ratio of the first distance to the third distance, and use the ratio of the first distance to the third distance as the first deviation proportion;
calculate a ratio of the second distance to the third distance, and use the ratio of the second distance to the third distance as the second deviation proportion.

### Claim 12 (depends on 9)

The electronic device of claim 9, wherein the processor is further caused to:
acquire a second foreground image at a second moment, the second moment being after a first moment that acquires the first foreground image;
perform a distortion correction on the second foreground image and obtain a second corrected image;
extend the left lane line towards a first direction according to a preset extension distance, and obtain a first boundary;
extend the right lane line towards a second direction according to the preset extension distance, and obtain a second boundary;
divide regions on the second corrected image according to the first boundary and the second boundary, and determine a region of the left lane line and the right lane line in the second corrected image.

### Claim 13 (depends on 9)

The electronic device of claim 9, wherein the processor is further caused to:
establish an image coordinate system for the first foreground image, and obtain first coordinates of each non-zero pixel point on the first foreground image in the image coordinate system;
obtain internal parameters of a camera device that captures the first foreground image, and determine second coordinates corresponding to the first coordinates according to the internal parameters and the first coordinates;
calculate a distortion distance between the first coordinates and coordinates of a center point of the first foreground image;
calculate an image complexity of the first foreground image according to a gray value of each pixel point on the first foreground image, and determine correction parameters of the first foreground image according to the image complexity;
determine a smoothing coefficient corresponding to the distortion distance and the correction parameters, according to a preset smoothing function;
smooth the first coordinates according to the smoothing coefficient and the second coordinates, and obtain the first corrected image.

### Claim 14 (depends on 13)

The electronic device of claim 13, wherein the processor is further caused to:
determine a first weight of the first coordinates and a second weight of the second coordinates according to the smoothing coefficient;
calculate a first product of the first weight and the first coordinates, and calculate a second product of the second weight and the second coordinates;
smooth the first coordinates according to a sum of the first product and the second product and obtain the first corrected image.

### Claim 15

A non-transitory storage medium having stored thereon at least one computer-readable instructions that, when executed by a processor of an electronic device, causes the processor to perform a method for adjusting moment cloud density, the method comprising:
acquiring a first foreground image;
performing a distortion correction on the first foreground image and obtaining a first corrected image;
performing a perspective transformation on the first corrected image and obtaining an aerial view;
generating a distribution map of non-zero pixel points corresponding to the aerial view, based on a number of non-zero pixel points in each column of pixel points in the aerial view, the distribution map of non-zero pixel points is provided with a first peak and a second peak, and the first peak being on the left of the second peak;
determining an initial position of a left lane line in the aerial view according to the first peak, and determining an initial position of a right lane line in the aerial view according to the second peak;
determining the initial position of the left lane line and the initial position of the right lane line as a starting position of a sliding window respectively, and starting moving the sliding window in the aerial view from the starting position;
fitting a first curve corresponding to the left lane line and a second curve corresponding to the right lane line according to non-zero pixel points covered by the sliding window while moving the sliding window and before arriving at a current position of the sliding window respectively;
fitting a third curve corresponding to the left lane line according to the first curve corresponding to the left lane line and non-zero pixel points covered by the sliding window at the current position, and fitting a fourth curve corresponding to the right lane line according to the second curve corresponding to the right lane line and non-zero pixel points covered by the sliding window at the current position, dynamically adjusting a movement of the sliding window according to the first curve and the second curve;
determining the left lane line according to the third curve corresponding to the left lane line, and determining the right lane line according to the fourth curve corresponding to the right lane line;
calculating a first distance between a vehicle and the left lane line, and calculating a second distance between the vehicle and the right lane line; and
determining whether the vehicle deviates from any one of the left lane line and the right lane line according to the first distance and the second distance.

### Claim 16 (depends on 15)

The non-transitory storage medium of claim 15, wherein determining whether the vehicle deviates from any one of the left lane line and the right lane line according to the first distance and the second distance comprises:
calculating a first deviation proportion of the vehicle from the left lane line and a second deviation proportion of the vehicle from the right lane line according to the first distance and the second distance;
calculating an absolute value corresponding to a difference between the first deviation proportion and the second deviation proportion;
in response that the absolute value corresponding to the difference is less than a deviation preset threshold, determining that the vehicle does not deviate from any one of the left lane line and the right lane line;
in response that the absolute value corresponding to the difference is greater than or equal to the deviation preset threshold, determining that the vehicle deviates from any one of the left lane line and the right lane line.

### Claim 17 (depends on 16)

The non-transitory storage medium of claim 16, wherein calculating the first deviation proportion of the vehicle from the left lane line and the second deviation proportion of the vehicle from the right lane line according to the first distance and the second distance comprises:
calculating a sum of the first distance and the second distance, and using the sum of the first distance and the second distance as a third distance;
calculating a ratio of the first distance to the third distance, and using the ratio of the first distance to the third distance as the first deviation proportion;
calculating a ratio of the second distance to the third distance, and using the ratio of the second distance to the third distance as the second deviation proportion.

### Claim 18 (depends on 15)

The non-transitory storage medium of claim 15, further comprising:
acquiring a second foreground image at a second moment, the second moment being after a first moment that acquires the first foreground image;
performing a distortion correction on the second foreground image and obtaining a second corrected image;
extending the left lane line towards a first direction according to a preset extension distance, and obtaining a first boundary;
extending the right lane line towards a second direction according to the preset extension distance, and obtaining a second boundary;
dividing regions on the second corrected image according to the first boundary and the second boundary, and determining a region of the left lane line and the right lane line in the second corrected image.

### Claim 19 (depends on 15)

The non-transitory storage medium of claim 15, wherein performing the distortion correction on the first foreground image and obtaining the first corrected image comprises:
establishing an image coordinate system for the first foreground image, and obtaining first coordinates of each non-zero pixel point on the first foreground image in the image coordinate system;
obtaining internal parameters of a camera device that captures the first foreground image, and determining second coordinates corresponding to the first coordinates according to the internal parameters and the first coordinates;
calculating a distortion distance between the first coordinates and coordinates of a center point of the first foreground image;
calculating an image complexity of the first foreground image according to a gray value of each pixel point on the first foreground image, and determining correction parameters of the first foreground image according to the image complexity;
determining a smoothing coefficient corresponding to the distortion distance and the correction parameters, according to a preset smoothing function;
smoothing the first coordinates according to the smoothing coefficient and the second coordinates, and obtaining the first corrected image.

### Claim 20 (depends on 19)

The non-transitory storage medium of claim 19, wherein smoothing the first coordinates according to the smoothing coefficient and the second coordinates, and obtaining the first corrected image comprises:
determining a first weight of the first coordinates and a second weight of the second coordinates according to the smoothing coefficient;
calculating a first product of the first weight and the first coordinates, and calculating a second product of the second weight and the second coordinates;
smoothing the first coordinates according to a sum of the first product and the second product and obtaining the first corrected image.
