Collision risk determination method and device and computer readable storage medium
By defining the target area and warning area of the target object around the vehicle, and calculating the distance only when the two intersect, the complex problem of detecting multiple obstacles around the vehicle is solved, achieving efficient collision risk assessment and saving computing resources.
Patent Information
- Application Number
- CN202410719104.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2025-12-05
AI Technical Summary
In existing technologies, collision detection calculations involving multiple obstacles around a vehicle are complex and consume a large amount of computing resources.
By defining the target area and warning area of the target object, the distance between the target object and the vehicle is calculated only when the target area and the warning area intersect, thus assessing the collision risk and avoiding the need to calculate the distance between each obstacle and the vehicle.
It saves computing resources, improves the efficiency of collision detection, and reduces computational complexity.
Smart Images

Figure CN121074841A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of vehicles, and more particularly to a method, apparatus, and computer-readable storage medium for determining collision risk. Background Technology
[0002] In related technologies, collision detection methods typically represent vehicles using a point mass or the vehicle's circumcircle, and obstacles using polygonal bounding boxes. Collision is determined by geometric spatial detection to identify whether the polygonal boxes intersect. Specifically, when an obstacle is detected, the polygonal bounding box corresponding to the obstacle is determined, and the distance between the bounding box and the vehicle is calculated. It is then determined whether this distance is less than a preset distance. Further, if the distance between the bounding box and the vehicle is less than or equal to the preset distance, a collision risk between the vehicle and the obstacle is identified.
[0003] However, the process of calculating the distance between the polygonal frame and the vehicle is quite complex. When there are multiple obstacles around the vehicle, it is necessary to calculate the distance between the vehicle and each obstacle, which consumes a lot of computing power. Summary of the Invention
[0004] This application provides a method, apparatus, and computer-readable storage medium for determining collision risk, which saves computing resources.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] Firstly, this application provides a method for determining collision risk, applied to a vehicle, comprising: upon acquiring a target environment image including a target object, determining a target area corresponding to the target object and a warning area. The target area is the area where the target object is located, and the warning area is located on the same side of the vehicle as the target object. The warning area consists of the vehicle's edge line and a warning line, and the distance between the warning line and the vehicle is less than or equal to a first preset distance. When the target area and the warning area intersect, the distance between the target object and the vehicle is calculated, and if the distance between the target object and the vehicle is less than or equal to a second preset distance, a collision risk is determined between the target object and the vehicle. The first preset distance is greater than the second preset distance.
[0007] In one possible implementation, the method further includes: after determining that the target area intersects with the alarm area, acquiring an environmental image of a preset duration, and generating a collision detection video based on the environmental image of the preset duration; storing the collision detection video.
[0008] In one possible implementation, the vehicle includes a first storage space, which is in a dormant state. The method further includes: waking the first storage space from the dormant state to an active state, and storing historical driving videos generated by the vehicle in the first storage space. Storing collision detection videos includes: storing collision detection videos in the first storage space.
[0009] In one possible implementation, the vehicle further includes a second storage space in a dormant state. The method further includes: upon detecting a collision signal, waking the second storage space from the dormant state to an active state, and storing data from the first storage space into the second storage space. The collision signal includes at least one of a deceleration signal, a hazard light signal, and a braking signal.
[0010] In one possible implementation, determining the target region corresponding to the target object includes: determining a grayscale threshold for the target environment image based on its grayscale histogram, and segmenting the target environment image according to the grayscale threshold to obtain a binary image corresponding to the target environment image. The grayscale value of each pixel in the binary image is either a first value or a second value, where the first value is greater than the second value. The target region is then determined. The target region is the connected region of the pixels with the first value in the binary image.
[0011] In one possible implementation, calculating the distance between the target object and the vehicle includes: determining the coordinates of the target edge of the vehicle and the target region in the target coordinate system. The target edge and the target object are located on the same face of the vehicle. Determining the coordinates of a target vertex in the target region. The target vertex is the point in the target region that is closest to the target edge. Based on the coordinates of the target vertex and the coordinates of the target edge, calculating the distance between the target object and the vehicle.
[0012] In one possible implementation, the vehicle includes a panoramic monitoring imaging system (AVM) comprising multiple cameras, wherein the target environment image is an image captured by any one of the multiple cameras.
[0013] Secondly, a collision risk determination device is provided, applied to a vehicle, comprising: a determination unit and a processing unit. The determination unit is used to determine a target area corresponding to the target object and a warning area when a target environment image including the target object is acquired. The target area is the area where the target object is located, and the warning area is located on the same side of the vehicle as the target object. The warning area consists of the vehicle's edge line and a warning line, and the distance between the warning line and the vehicle is less than or equal to a first preset distance. The processing unit is used to calculate the distance between the target object and the vehicle when the target area and the warning area intersect. The determination unit is further used to determine that there is a collision risk between the target object and the vehicle when the distance between the target object and the vehicle is less than or equal to a second preset distance. The first preset distance is greater than the second preset distance.
[0014] In one possible implementation, the determining device further includes an acquisition unit, a generation unit, and a storage unit. The acquisition unit is used to acquire an environmental image of a preset duration after determining that the target area intersects with the alarm area. The generation unit is used to generate a collision detection video based on the environmental image of the preset duration. The storage unit is used to store the collision detection video.
[0015] In one possible implementation, the vehicle includes a first storage space, which is in a dormant state. The processing unit is further configured to wake the first storage space from the dormant state to an active state. The storage unit is also configured to store historical driving videos generated by the vehicle in the first storage space. Specifically, the storage unit is configured to store collision detection videos in the first storage space.
[0016] In one possible implementation, the vehicle further includes a second storage space in a dormant state. The processing unit is further configured to wake the second storage space from the dormant state to an active state upon detection of a collision signal. The storage unit is also configured to store data from the first storage space into the second storage space. The collision signal includes at least one of a deceleration signal, a hazard light signal, and a braking signal.
[0017] In one possible implementation, the determining unit is specifically configured to: determine a grayscale threshold for the target environment image based on its grayscale histogram, and segment the target environment image according to the grayscale threshold to obtain a binary image corresponding to the target environment image. The grayscale value of each pixel in the binary image is either a first value or a second value, where the first value is greater than the second value. A target region is determined. The target region is a connected region of pixels with the first value in the binary image.
[0018] In one possible implementation, the processing unit is specifically configured to: determine the coordinates of the target edge line of the vehicle and the target area in the target coordinate system. The target edge line and the target object are located on the same face of the vehicle. Determine the coordinates of the target vertex in the target area. The target vertex is the point in the target area that is closest to the target edge line. Calculate the distance between the target object and the vehicle based on the coordinates of the target vertex and the coordinates of the target edge line.
[0019] In one possible implementation, the vehicle includes a panoramic monitoring imaging system (AVM) comprising multiple cameras, wherein the target environment image is an image captured by any one of the multiple cameras.
[0020] Thirdly, an electronic device is provided, comprising: a processor and a communication interface; the communication interface and the processor are coupled, the processor being used to run computer programs or instructions to implement the determination method as described in the first aspect.
[0021] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, and when a computer executes the instructions, the computer performs the determination method as described in the first aspect.
[0022] Fifthly, a computer program product is provided, the computer program product including computer instructions, which, when executed on an electronic device, cause the electronic device to perform the determination method as described in the first aspect.
[0023] For a detailed description of aspects two through five and their various implementations in this application, please refer to the detailed description in aspect one and its various implementations; and for a detailed description of the beneficial effects of aspects two through four and their various implementations, please refer to the beneficial effect analysis in aspect one and its various implementations, which will not be repeated here.
[0024] The technical solution provided in this application offers at least the following advantages: Upon detecting a target object (such as a vehicle, pedestrian, or object), it determines the target area of the target object and the alarm area on the same side as the target frame. Furthermore, when the target frame intersects with the alarm area, it determines that the target object and the vehicle are close in position, and then calculates the distance between the target frame and the vehicle. If the distance between the target frame and the vehicle is less than or equal to a second preset distance, it determines that there is a collision risk between the target object and the vehicle. Thus, the distance between the vehicle and the target frame is calculated only when the target object and the vehicle are close, eliminating the need to calculate the distance between the vehicle and each obstacle, thereby saving computational resources.
[0025] These or other aspects of this application will become more readily apparent in the following description. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0027] Figure 1 This is a schematic diagram illustrating a collision risk determination system according to an exemplary embodiment;
[0028] Figure 2 This is a schematic diagram illustrating a storage space in a vehicle according to an exemplary embodiment;
[0029] Figure 3 This is a schematic diagram illustrating a data storage method according to an exemplary embodiment;
[0030] Figure 4This is one of the flowcharts illustrating a method for determining collision risk according to an exemplary embodiment;
[0031] Figure 5 This is a second flowchart illustrating a method for determining collision risk according to an exemplary embodiment;
[0032] Figure 6 This is the third flowchart illustrating a method for determining collision risk according to an exemplary embodiment;
[0033] Figure 7 This is a schematic diagram illustrating an image segmentation method according to an exemplary embodiment;
[0034] Figure 8 This is a schematic diagram illustrating a search for connected regions according to an exemplary embodiment;
[0035] Figure 9 This is a schematic diagram of a target area in a coordinate system according to an exemplary embodiment;
[0036] Figure 10 This is a schematic diagram of the vertices of a target region according to an exemplary embodiment;
[0037] Figure 11 This is a front view of collision detection shown according to an exemplary embodiment;
[0038] Figure 12 This is a rear view with collision detection shown according to an exemplary embodiment;
[0039] Figure 13 This is another rear view with collision detection, as illustrated in an exemplary embodiment.
[0040] Figure 14 This is a right view of collision detection according to an exemplary embodiment;
[0041] Figure 15 This is a right view of another collision detection method shown according to an exemplary embodiment;
[0042] Figure 16 This is a left view of collision detection according to an exemplary embodiment;
[0043] Figure 17 This is another collision detection left view shown according to an exemplary embodiment;
[0044] Figure 18 This is a surround view of a vehicle shown according to an exemplary embodiment;
[0045] Figure 19 This is the fourth flowchart illustrating a method for determining collision risk according to an exemplary embodiment;
[0046] Figure 20 This is the fifth flowchart illustrating a method for determining collision risk according to an exemplary embodiment;
[0047] Figure 21 This is a schematic diagram of the structure of a collision risk determination device according to an exemplary embodiment;
[0048] Figure 22 This is a schematic diagram of the structure of an electronic device according to an exemplary embodiment. Detailed Implementation
[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0050] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0051] Before providing a detailed introduction to the collision risk determination method provided in this application, let's briefly introduce the application scenarios and implementation environment involved in this application.
[0052] First, a brief introduction to the application scenarios involved in this application will be given.
[0053] In related technologies, collision detection methods typically represent vehicles using a point mass or the vehicle's circumcircle, and obstacles using polygonal bounding boxes. Collision is determined by geometric spatial detection to identify whether the polygonal boxes intersect. Specifically, when an obstacle is detected, the polygonal bounding box corresponding to the obstacle is determined, and the distance between the bounding box and the vehicle is calculated. It is then determined whether this distance is less than a preset distance. Further, if the distance between the bounding box and the vehicle is less than or equal to the preset distance, a collision risk between the vehicle and the obstacle is identified.
[0054] However, the process of calculating the distance between the polygonal frame and the vehicle is quite complex. When there are multiple obstacles around the vehicle, it is necessary to calculate the distance between the vehicle and each obstacle, which consumes a lot of computing power.
[0055] To address the aforementioned problems, this application provides a method for determining collision risk, applied to a vehicle, comprising: upon acquiring a target environment image including a target object, determining a target area corresponding to the target object and a warning area. The target area is the region where the target object is located, and the warning area is located on the same side of the vehicle as the target object. The warning area consists of the vehicle's edge line and a warning line, and the distance between the warning line and the vehicle is less than or equal to a first preset distance. When the target area and the warning area intersect, the distance between the target object and the vehicle is calculated, and if the distance between the target object and the vehicle is less than or equal to a second preset distance, a collision risk is determined between the target object and the vehicle. The first preset distance is greater than the second preset distance.
[0056] In this way, upon detecting a target object (such as a vehicle, pedestrian, or object), the target area of the target object and the alarm area on the same side as the target bounding box are determined. Furthermore, if the target bounding box intersects with the alarm area, it is determined that the target object and the vehicle are close in position. The distance between the target bounding box and the vehicle is then calculated, and if the distance is less than or equal to a second preset distance, a collision risk between the target object and the vehicle is determined. Thus, the distance between the vehicle and the target bounding box is calculated only when the target object and the vehicle are close, eliminating the need to calculate the distance between the vehicle and each obstacle, saving computational resources.
[0057] The implementation environment and application scenarios of the embodiments of this application are described below.
[0058] Figure 1 This is a schematic diagram of a collision risk determination system provided in an embodiment of this application. Figure 1 As shown, the collision risk determination system 10 may include a vehicle 101 and a target object 102.
[0059] Vehicle 101 is used to determine the bounding box and alarm area corresponding to the target object when a target environment image including the target object is acquired. The alarm area and the target object are located on the same side of the vehicle, and the distance between the alarm line and the vehicle is less than or equal to a first preset distance. When the bounding box intersects with the alarm line, the distance between the bounding box and the vehicle is calculated, and if the distance between the bounding box and the vehicle is less than or equal to a second preset distance, it is determined that there is a collision risk between the target object and the vehicle. The first preset distance is greater than the second preset distance.
[0060] In some embodiments, the target object 102 may be a vehicle, pedestrian, building, or roadblock, etc.
[0061] In other embodiments, the number of target objects 102 can be multiple. For example, target objects 102 may include multiple vehicles.
[0062] In some embodiments, while the vehicle 101 is in motion, the target object 102 may include all moving and stationary objects. For example, the target object 102 may include at least one of a vehicle, a pedestrian, a building, or a road barrier. When the vehicle 101 is parked, the target object 102 may be a vehicle.
[0063] In some embodiments, vehicle 101 is equipped with a around-view monitoring system (AVM). The AVM includes multiple cameras.
[0064] For example, an AVM includes four fisheye cameras (also known as fisheye cameras).
[0065] In some embodiments, the vehicle 101 is provided with a first storage space, a second storage space, and a third storage space.
[0066] The third storage space is used to store driving videos before a collision risk exists, as well as driving videos after the collision risk is averted.
[0067] like Figure 2 As shown, the states of the first and second storage spaces include a dormant state (disabled state), a working state (activated state), and a completed state. The first and second storage spaces are used to store driving videos before and after the collision.
[0068] In some embodiments, the driving video before the collision risk was detected, and the driving video after the collision risk was eliminated, are referred to as historical driving videos. Figure 3 As shown, for historical driving videos, the historical video data is initialized to empty. When the storage is full, a new frame of data is added, and the first frame of data stored is deleted. Driving videos that detect a collision risk are called collision detection videos, and these collision detection videos are stored sequentially in the corresponding storage space.
[0069] In some embodiments, such as Figure 4 The diagram shows a flowchart of a method for determining collision risk, including steps S11-S14.
[0070] S11, System initialization.
[0071] In some embodiments, when the vehicle 101 is started, the hardware and software of the vehicle 101 are initialized. Specifically, the hardware resources of the vehicle 101 are initialized so that the software can run without errors on the hardware.
[0072] S12, Image distortion correction.
[0073] In some embodiments, the fisheye camera sends the acquired initial image to the electronic equipment of the vehicle 101. Since the initial image captured by the fisheye camera is subject to image distortion, the electronic equipment corrects the initial image to obtain a corrected planar image.
[0074] S13, Alarm line coordinate calculation.
[0075] In some embodiments, when an electronic device detects a target object, it calculates the alarm line corresponding to the target object and determines the coordinates of the alarm line.
[0076] For example, taking the target object located on the left side of vehicle 101 as an example, the electronic device calculates the warning line on the left side of vehicle 101. Specifically, the electronic device uses the midpoint of the rear axle of vehicle 101 as the origin of the coordinate system and calculates the geodetic coordinates of the warning line on the left side of vehicle 101 in the vehicle's geodetic coordinate system based on information such as vehicle width and wheelbase.
[0077] S14. Collision detection.
[0078] In some embodiments, the electronic device, after determining the geodetic coordinates of the warning line and the target object, determines whether the target object intersects with the warning line based on the geodetic coordinates of the warning line and the target object. Further, if the target object intersects with the warning line, the collision risk between the target object and the vehicle is assessed based on the distance between the target object and the vehicle. Subsequently, if the electronic device detects a collision risk between the target object and the vehicle, it acquires and saves a first duration video and a second duration video. The end time of the first duration is the current time, and the start time of the second duration is the current time.
[0079] For example, if the electronic device determines that there is a collision risk at 9:30:23, it acquires a first driving record video from 9:28:23 to 9:30:23 and generates a second driving record video from 9:30:23 to 9:32:23, and saves the first driving record video and the second driving record video.
[0080] Understandably, the system uses warning lines to determine if there are any moving or stationary objects colliding with the vehicle. If a collision occurs, it automatically records and saves the Ts video before and after the collision.
[0081] In some embodiments, such as Figure 5 As shown, a flowchart illustrating another method for determining collision risk is presented, including: S21-S24.
[0082] S21, Collision detection conditions.
[0083] In some embodiments, when the vehicle 101 is started, it is determined whether the collision detection conditions meet preset detection conditions. For example, the preset detection conditions include at least one of the following: the camera is calibrated, the camera has no functional malfunction, and the door is closed.
[0084] In some embodiments, when the vehicle speed of 101 is greater than a preset speed, it detects whether all moving and stationary objects collide with the vehicle 101, thus covering all scenarios where collisions occur during driving. When the vehicle speed of 101 is less than or equal to the preset speed, it detects whether a motor vehicle collides with the vehicle, thus covering scenarios where the vehicle is sideswiped by other vehicles after parking.
[0085] S22, Collision Detection Algorithm.
[0086] In some embodiments, the electronic equipment of vehicle 101 determines whether a target object intersects with a warning line based on a geometric spatial method. If the target object intersects with the warning line, the vertical distance between the farthest point of the target object within the warning line and the warning line is calculated. Further, if the vertical distance is greater than or equal to the distance from the vehicle body to a preset distance, a collision is determined.
[0087] S23, Collision Detection and Tracking.
[0088] In some embodiments, when the electronic device detects a collision risk between a target object and the vehicle 101, it determines the duration for which the vertical distance is greater than or equal to the distance from the vehicle body to a preset distance, and detects a warning signal. For example, the warning signal includes a deceleration signal and a hazard light activation signal.
[0089] Understandably, upon initially detecting a collision risk, electronic devices will further confirm that risk. Specifically, after detecting a collision risk, time tracking and event tracking are required. Time tracking involves determining whether all continuously acquired image frames have been detected after the risk is identified, while event tracking involves determining whether deceleration or hazard lights events occur after the collision risk is detected.
[0090] S24. Collision detection record management.
[0091] In some embodiments, the electronic device manages the recording and output of video for a period of time before and after a collision risk is detected.
[0092] For example, electronic devices will identify this collision risk as a collision event and save 90 seconds before and 90 seconds after the collision risk is detected, and send this data to the terminal device or server.
[0093] After introducing the application scenarios and implementation environment of the embodiments of this application, the collision risk detection method provided by the embodiments of this application will be described in detail below in conjunction with the above implementation environment.
[0094] The following collision risk detection method will be explained using electronic equipment in vehicle 101 as an example.
[0095] Figure 6 This is a flowchart illustrating a collision risk detection method according to an exemplary embodiment, designed to save computational resources. Figure 6 As shown, this method is applied to vehicles and may include S201-S203.
[0096] S201. When a target environment image including the target object is acquired, determine the target bounding box and alarm area corresponding to the target object.
[0097] The target area is the area where the target object is located. The alarm area and the target object are located on the same side of the vehicle. The alarm area consists of the vehicle's edge line and the alarm line. The distance between the alarm line and the vehicle is less than or equal to a first preset distance.
[0098] In some embodiments, when the electronic device acquires an image of the target environment including the target object, it obtains the identifier of the target camera that acquired the image and determines the warning line corresponding to the target object based on the identifier of the target camera. The target camera can be any one of multiple cameras. Further, the electronic device determines the warning area based on the target edge line of the vehicle and the warning line corresponding to the target object. Additionally, when acquiring the image of the target environment, the electronic device determines the target area corresponding to the target object within the image of the target environment.
[0099] For example, consider a vehicle with four cameras, where the target environment image is captured by camera 1. The electronic device determines that camera 1 captures the image in front of the vehicle and identifies the warning line corresponding to the target object as warning line 1.
[0100] In some embodiments, when the electronic device acquires an image of the target environment including the target object, it determines the location of the target object and, based on the location of the target object, determines the alarm line and the target edge line corresponding to the target object.
[0101] For example, if the target object is located on the left side of the vehicle, the warning line corresponding to the target object is determined as the left warning line, and the target edge line corresponding to the target object is determined as the left edge line of the vehicle.
[0102] Understandably, four warning lines are set for the vehicle: front warning line, rear warning line, left warning line, and right warning line. Based on the position of the target object relative to the vehicle, the corresponding target warning line and target edge line are determined. Furthermore, based on the target warning line and target edge line, the warning area of the target object is determined.
[0103] The specific implementation method for determining the target bounding box corresponding to the target object will be detailed in subsequent steps and will not be repeated here.
[0104] In some embodiments, the target bounding box is a convex polygon.
[0105] It should be noted that the alarm lines can be pre-set in the electronic equipment by maintenance personnel. Maintenance personnel set four alarm lines for the vehicle, one alarm line corresponding to each side of the vehicle. The first preset distance is a fixed distance pre-set by the maintenance personnel, or it can be a variable distance calculated according to a preset formula; this embodiment does not limit the specific distance.
[0106] For example, taking the first preset distance as a fixed distance, the first preset distance can be 30 cm or 35 cm. This application does not limit the specific distance.
[0107] For example, taking a first preset distance as the variable distance, the electronic device determines the first preset distance based on the vehicle's current speed. The first preset distance is positively correlated with the current speed.
[0108] As one possible approach, before determining the target area and alarm line corresponding to the target object, the electronic device periodically or in real time collects images of the vehicle's surroundings through a camera and determines whether the collected images include the target object.
[0109] In some embodiments, the electronic device determines the current vehicle's motion state based on the current vehicle speed and identifies the target object based on the vehicle's motion state. Further, the electronic device determines whether the captured image includes the target object. For example, if the current vehicle speed is greater than a preset speed, the electronic device determines that the vehicle is in motion and that the target object includes vehicles, pedestrians, buildings, and roadblocks. Further, the electronic device determines whether the captured image includes the target object. As another example, if the current vehicle speed is less than or equal to a preset speed, the electronic device determines that the vehicle is stationary and that the target object is a vehicle. Further, the electronic device determines whether the captured image includes the vehicle.
[0110] In some embodiments, when the camera is a fisheye camera, the electronic device acquires the initial image captured by the fisheye camera and performs operations such as correction, distortion correction, and perspective correction on the initial image to obtain a corrected image.
[0111] S202. When the target area and the alarm area intersect, calculate the distance between the target object and the vehicle.
[0112] As one possible approach, the electronic device, upon acquiring the target area and the alarm area, determines whether the target area and the alarm area intersect, and if they do intersect, calculates the distance between the target object and the vehicle.
[0113] In some embodiments, the electronic device determines the coordinates in the preset coordinate system of the target area and the alarm area respectively, and determines whether the target frame intersects with the alarm line based on the coordinates of the target area and the alarm area.
[0114] In some embodiments, the electronic device determines the coordinates of the vehicle edge line and the target area in a target coordinate system, and determines the distance between the vehicle and the target object based on the coordinates of the vehicle edge line and the target area in the target coordinate system. The vehicle edge line represents the edge of the vehicle, and the edge line and the target bounding box are located on the same surface of the vehicle.
[0115] In other embodiments, the electronic device calculates the center point of the vehicle and the coordinates of the target area in the target coordinate system, and determines the distance between the vehicle and the target object based on the coordinates of the vehicle's center point and the coordinates of the target bounding box.
[0116] This step is detailed below and will not be repeated here.
[0117] It should be noted that the target coordinate system can be a geodetic coordinate system or a rectangular space coordinate system; however, this application does not limit the specific coordinate system used.
[0118] S203. If the distance between the target object and the vehicle is less than or equal to the second preset distance, it is determined that there is a risk of collision between the target object and the vehicle.
[0119] The first preset distance is greater than the second preset distance.
[0120] In some embodiments, when determining the distance between a target object and a vehicle, the electronic device determines whether the distance between the target object and the vehicle is less than or equal to a second preset distance. If the distance between the target object and the vehicle is less than or equal to the second preset distance, it determines that there is a risk of collision between the target object and the vehicle. If the distance between the target object and the vehicle is greater than the second preset distance, it determines that there is no risk of collision between the target object and the vehicle.
[0121] It should be noted that the second preset distance can be pre-set by maintenance personnel in the electronic device, or it can be calculated by the electronic device based on the vehicle's driving parameters. This application embodiment does not limit this.
[0122] For example, taking the second preset distance as a fixed distance, the second preset distance can be 15 cm or 18 cm. This application does not limit the specific distance.
[0123] For another example, taking a second preset distance as the variable distance, the electronic device determines the second preset distance based on the vehicle's current speed. The second preset distance is positively correlated with the current speed.
[0124] The collision risk detection method provided in this application provides at least the following advantages: When a target object (such as a vehicle, pedestrian, or object) is detected, the target area of the target object and the warning area on the same side as the target frame are determined. Furthermore, when the target area and the warning area intersect, it is determined that the target object and the vehicle are close in position. The distance between the target area and the vehicle is then calculated. If the distance between the target object and the vehicle is less than or equal to a second preset distance, a collision risk between the target object and the vehicle is determined. Thus, the distance between the vehicle and the target frame is calculated only when the target object and the vehicle are close, eliminating the need to calculate the distance between the vehicle and each obstacle, thereby saving computational resources.
[0125] In one possible design, to avoid missing crucial driving video, the determination method provided in this application embodiment further includes: S204-S206.
[0126] S204. After determining that the target area intersects with the alarm area, obtain an environmental image for a preset duration.
[0127] As one possible approach, after determining that the target area intersects with the alarm area, the electronic device acquires environmental images captured by the camera for a preset duration.
[0128] In some embodiments, the electronic device acquires environmental images for a preset duration captured by a target camera. The target camera is a camera that captures target images.
[0129] For example, taking camera 1 as the target camera, the electronic device acquires a 100-second environmental image captured by camera 1 when it determines that the distance between the target object captured by camera 1 and the vehicle is less than or equal to a second preset distance.
[0130] In some embodiments, the electronic device acquires environmental images for a preset duration captured by multiple cameras.
[0131] For example, consider a vehicle that includes four cameras. The electronic device acquires 100 seconds of environmental images captured by the four cameras.
[0132] It should be noted that the preset duration is set in the electronic device by the maintenance personnel. The preset duration can be 90 seconds or 70 seconds. This application embodiment does not limit this.
[0133] S205. Generate collision detection video based on environmental images of a preset duration.
[0134] In some embodiments, the electronic device generates a collision detection video based on environmental images of a preset duration, provided that such images have been acquired.
[0135] For example, taking the acquisition of an environmental image captured by camera 1 as an example, the electronic device generates a collision detection video based on the environmental image captured by camera 1.
[0136] For another example, consider acquiring environmental images from four cameras. The electronic device generates a collision detection video based on the environmental images captured by the four cameras. Thus, when a collision risk is detected, a surround-view video of the vehicle is generated based on the environmental images around the vehicle.
[0137] S206, Store collision detection video.
[0138] As one possible approach, if an electronic device generates a collision detection video, it can store the collision detection video.
[0139] In some embodiments, the electronic device stores the collision detection video in a first storage space.
[0140] Specifically, the electronic device marks the collision detection video and stores the marked collision detection video in the first storage space.
[0141] For example, the collision detection video is labeled as "the video after the collision" and stored in the first storage space.
[0142] Understandably, after detecting a collision risk, a driving video of a preset duration is generated. This ensures timely recording of driving videos with high collision risk, avoiding the loss of crucial driving footage.
[0143] In one possible design, to avoid the loss of critical video, the vehicle includes a first storage space, which is in a dormant state. The determination method provided in this application embodiment further includes: S207-S208.
[0144] S207. Wake up the first storage space from hibernation state to working state.
[0145] In some embodiments, when an electronic device determines that there is a risk of collision between a target object and a vehicle, it wakes up the first storage space from a dormant state to a working state (or an activated state).
[0146] S208. Store the historical driving video generated by the vehicle in the first storage space.
[0147] In some embodiments, the electronic device acquires a first duration of historical driving video prior to the current moment and stores the first duration of historical driving video in a first storage space.
[0148] For example, the electronic device acquires historical driving video from 100 seconds prior to the current moment and stores the historical driving video from 100 seconds prior to the current moment in the first storage space.
[0149] The aforementioned S206 specifically includes: S2061.
[0150] S2061. Store the collision detection video in the first storage space.
[0151] In some embodiments, when an electronic device generates a collision detection video, it stores the collision detection video in a first storage space.
[0152] In one possible design, to avoid the loss of critical video footage, the vehicle also includes a second storage space, which is in a dormant state. The determination method provided in this application embodiment further includes: S209-S210.
[0153] S209. Upon detecting a collision signal, wake up the second storage space from hibernation to working state.
[0154] The collision signal includes at least one of the following: deceleration signal, hazard light signal, and braking signal.
[0155] In some embodiments, the electronic device stores the detected collision video in the first storage space, collects vehicle signals in real time or periodically, and wakes up the second storage space from a dormant state to a working state when a collision signal is detected.
[0156] In other embodiments, when the electronic device determines that there is a risk of collision between the target object and the vehicle, it acquires a series of multiple frames of images captured by the target camera, and when the distance between the target object and the vehicle in each of the multiple frames is less than or equal to a second preset distance and a collision signal is detected, it wakes up the second storage space from the dormant state to the working state.
[0157] S210. Store the data in the first storage space into the second storage space.
[0158] As one possible approach, the electronic device stores data from the first storage space into the second storage space while the second storage space is in an active state.
[0159] In some embodiments, the electronic device copies data from the first storage space to the second storage space.
[0160] In other embodiments, the electronic device stores data from the first storage space into the second storage space and deletes data from the first storage space.
[0161] In some embodiments, when an electronic device stores data from a first storage space into a second storage space, it controls the second storage space to output data, or sends data from the second storage space to a terminal device or a server.
[0162] In one possible design, in order to determine the target region of the target object from the target image, the above-mentioned S201 specifically includes: S2011-S2013.
[0163] S2011. Determine the grayscale threshold of the target environment image based on the grayscale histogram of the target environment image.
[0164] In some embodiments, when an electronic device acquires a target environment image, it generates a grayscale histogram of the target environment image and determines a grayscale threshold for the target environment image based on the grayscale histogram.
[0165] Specifically, such as Figure 7 As shown in Figure 'a', the forward-looking environment image of the vehicle is displayed. The gray-level histogram of the forward-looking environment image is statistically analyzed, which involves counting the frequency of occurrence of pixels in the forward-looking environment image according to their gray-level values. A gray-level distribution function P(k) can be established for the gray-level histogram, expressed as Equation 1 and Equation 2 below.
[0166]
[0167] Where P(k) represents the gray level distribution function, k represents the k-th gray level value of the image, and n k The number of pixels with a gray value of k in the image is represented by k, where n represents the total number of pixels in the image, and L is the number of gray levels.
[0168] like Figure 7 As shown in b, this represents the grayscale histogram statistics of the forward-looking environment image. A grayscale threshold (segmentation threshold) is determined based on the grayscale histogram statistics. Specifically, a grayscale threshold based on the peaks and valleys of the curve is selected, and the image is segmented according to this threshold.
[0169] S2012. Based on the grayscale threshold, segment the target environment image to obtain the corresponding binary image of the target environment image.
[0170] In this binary image, the grayscale value of each pixel is either a first value or a second value, where the first value is greater than the second value.
[0171] In some embodiments, when an electronic device determines a grayscale threshold for a target environment image, it segments the target environment image according to the grayscale threshold to obtain a binary image corresponding to the target environment image.
[0172] For example, such as Figure 7 As shown in c, the target environment image is segmented according to the grayscale threshold to obtain the corresponding binary image. The pixel values in the background region are set to 0, and the pixel values in the target region are set to 1.
[0173] S2013. Determine the target area.
[0174] The target region is the connected region of the first value pixel in the binary image.
[0175] In some embodiments, the electronic device determines the connected regions of pixels with a first value in a binary image as the target region.
[0176] For example, such as Figure 7 As shown in d, region 2 is determined as the target region, and region 1 is determined as the background region.
[0177] Specifically, the target region is marked. Taking the label value as area_label as an example, the initial value of a_label is set to 1. A binary image copy is created, and the following operations are performed on the copied image:
[0178] Loop through the image's height;
[0179] Loop through the width of the image;
[0180] If the value of the pixel changes from 0 to 1;
[0181] The value of area_label is increased by 1.
[0182] Among them, the search connected regions are arranged according to Figure 8 In the indicated direction, the relevant pixel coordinate values are marked as area_lab el;
[0183] End the iteration over width;
[0184] End the iteration of height.
[0185] Image width and height, image coordinate system as follows Figure 9 As shown.
[0186] In one design, to improve the accuracy of the distance between the target object and the vehicle, the above S202 includes: S2021-S2023.
[0187] S2021. Determine the coordinates of the vehicle's target edge line and the target area in the target coordinate system.
[0188] In this case, the target edge line and the target object are located on the same side of the vehicle.
[0189] In some embodiments, the electronic device establishes a target coordinate system with the midpoint of the rear axle of the vehicle as the origin, and determines the coordinates of the target edge line and the target area of the vehicle in the target coordinate system.
[0190] For example, if the target area is located in front of the vehicle, the edge line in front of the vehicle is determined as the target edge line.
[0191] It should be noted that maintenance personnel can pre-configure four side lines for the vehicle: front side line, left side line, right side line, and rear side line.
[0192] S2022. Determine the coordinates of the target vertex in the target region.
[0193] Among them, the target vertex is the point in the target region that is closest to the target edge.
[0194] As one possible approach, the electronic device determines the coordinates of the target vertex within the target region, given the coordinates of the target region itself.
[0195] In some embodiments, the electronic device determines the coordinates of each vertex in the target region, obtains the coordinates of multiple vertices, and determines the coordinates of the target vertex among the multiple vertices based on the coordinates of the target edge.
[0196] Specifically, such as Figure 10 As shown, the electronic device calculates the vertices of the target area, including calculating the values of the top, bottom, left, and right vertices of the target area, represented as Left, Right, Up, and Down respectively. First, initial values are assigned to the four vertex variables: Left = 10000, Right = 0, Up = 10000, and Down = 0. Further, the pixel coordinates (m, n) of each area_label target area are iterated through:
[0197] if m > Right; Right = m;
[0198] if m <Left Left=m;
[0199] if n>Down Down=n;
[0200] if n <Up Up=n;
[0201] End the traversal of the target region.
[0202] Where m represents the horizontal coordinate of the image, n represents the vertical coordinate of the image, Width represents the horizontal axis of the image, and height represents the vertical axis of the image.
[0203] Furthermore, after calculating the left side of the four vertices of the target region, the coordinates of the target vertices are determined based on the coordinates of the target edge lines.
[0204] S2023. Calculate the distance between the target object and the vehicle based on the coordinates of the target vertex and the target edge.
[0205] In some embodiments, the electronic device calculates the vertical distance from the target vertex to the target edge based on the coordinates of the target vertex and the target edge, and uses the vertical distance as the distance between the target object and the vehicle.
[0206] To better understand the collision risk determination method provided in the embodiments of this application, such as Figure 11 , Figure 12 , Figure 13 , Figure 14 , Figure 15 , Figure 16 as well as Figure 17 As shown, schematic diagrams of the detection of target objects located at different positions on the vehicle are presented.
[0207] like Figure 11 The image shows a front view of a vehicle undergoing collision detection. Figure 11 The target region M1 and the alarm region N1 are located in the target coordinate system. The target region M1 includes the upper vertex u1 and the lower vertex d1. The alarm region N1 includes the alarm line C1E1 and the target edge line D1F1.
[0208] Before determining whether alarm region N1 intersects with target region M1, the intersection condition of target region M and alarm region N must satisfy the following formula three.
[0209]
[0210] in, This represents the projection of the vertices of region M onto the X / Y axes. This represents the projection of the vertices of region N onto the X / Y axes.
[0211] Specifically, such as Figure 11 As shown, the upper vertex u1 and lower vertex d1 of the target area M1, and their projections on the Y-axis are A1 and B1, respectively. The rectangle formed by the alarm line C1E1 and the bottom edge D1F1 of the target is projected onto the Y-axis as C1 and D1. Since B1∈[C1,D1], the following formula four is satisfied, and the target area M1 intersects with the alarm area N1.
[0212]
[0213] in, Let U1 be the projection of the upper vertex U1 of the target region M1 onto the Y-axis. Let D1 be the projection of the lower vertex D1 of the target region M1 onto the Y-axis. as well as Let N1 be the projection of the target region N1 onto Y.
[0214] Furthermore, the distance between the target area M1 and the vehicle is calculated, and based on the distance between the target area M1 and the vehicle and the second preset distance, it is determined whether there is a risk of collision between the target object and the vehicle.
[0215] Specifically, in combination Figure 11 As shown, the risk of collision between the target object and the vehicle satisfies the following formula five.
[0216] (Distance D1 -Distance B1 )*S pix <Thr Collision Formula 5
[0217] Among them, Distance D1 Distance represents the pixel coordinates of point D1. B1 This represents the pixel coordinates of point B1. pix This represents the actual distance represented by one pixel, in pixels per centimeter. collision This indicates the second preset distance, in cm.
[0218] like Figure 12 The image shows a rear view of a vehicle after collision detection. Figure 12 The target region M2 and the alarm region N2 are located in the target coordinate system. The target region M2 includes the upper vertex u2 and the lower vertex d2. The alarm region N2 includes the alarm line C2E2 and the target edge line O2F2.
[0219] like Figure 12 As shown, the upper vertex u2 and lower vertex d2 of the target area M2, and their projections on the Y-axis are A2 and B2, respectively. The rectangle formed by the alarm line C2E2 and the bottom edge O2F2 of the target is projected onto the Y-axis as O2 and D2. Since A2∈[O,D2], it satisfies the following formula six, and the target area M1 intersects with the alarm area N1.
[0220]
[0221] in, Let u2 be the projection of the upper vertex u2 of the target region M2 onto the Y-axis. Let d2 be the projection of the lower vertex d2 of the target region M2 onto the Y-axis. as well as Let N2 be the projection of the target region N2 onto Y.
[0222] Furthermore, the distance between the target area M2 and the vehicle is calculated, and based on the distance between the target area M2 and the vehicle and the second preset distance, it is determined whether there is a risk of collision between the target object and the vehicle.
[0223] Specifically, in combination Figure 12 As shown, the risk of collision between the target object and the vehicle satisfies the following formula seven.
[0224] (Distance A2 )*S pix <Thr Collison Formula 7
[0225] Among them, Distance A2 S represents the pixel coordinates of point A2. pix This represents the actual distance represented by one pixel, in pixels per centimeter. collision This indicates the second preset distance, in cm.
[0226] It needs to be explained that, in Figure 12 Since the target edge O2F2 is located on the X-axis, we only need to calculate the distance between the pixel coordinates of point A2 and the origin on the left. If the target edge O2F2 is not located on the X-axis, we need to calculate the actual distance between the pixel coordinates of point A2 and the pixel coordinates of the target edge O2F2 projected onto the X-axis.
[0227] like Figure 13 As shown, a rear view of another vehicle after collision detection is displayed. Figure 13 The target region M3 and the alarm region N3 are located in the target coordinate system. The target region M3 includes the upper vertex U3 and the lower vertex D3. The alarm region N3 includes the alarm line C3E3 and the target edge line O3F3. Since A3 and B3 do not belong to [O,C3], they satisfy the following formula eight, and it is determined that the target is not within the warning line.
[0228]
[0229] like Figure 14 The image shows a right view of a vehicle collision detection system. Figure 14 The target region M4 and the alarm region N4 are located in the target coordinate system. The target region M4 includes the left vertex L1 and the right vertex R1. The alarm region N4 includes the alarm line C4E4 and the target edge line O4D4.
[0230] like Figure 14As shown, the left vertex L1 and right vertex R1 of target area M4, and their projections on the Y-axis are A4 and B4, respectively. The rectangle formed by the alarm line C4E4 and the bottom edge of the target A4D4 is projected on the X-axis as C4 and O. Since A4∈[O,C4], the following formula nine is satisfied, and target area M4 intersects with alarm area N4 (determining that the target is within the warning line).
[0231]
[0232] in, Let L1 be the projection of the left vertex L1 of the target region M2 onto the Y-axis. Let X be the projection of the right vertex R1 of the target region M4. as well as Let X be the projection of the target region N4 onto X.
[0233] Specifically, in combination Figure 14 As shown, the risk of collision between the target object and the vehicle satisfies the following formula ten.
[0234] (Distance A4 )*S pix <Thr Collision Formula 10
[0235] Among them, Distance A4 S represents the pixel coordinates of point A4. pix This represents the actual distance represented by one pixel, in pixels per centimeter. collision This indicates the second preset distance, in cm.
[0236] It needs to be explained that, in Figure 14 Since the target edge O4D4 is located on the X-axis, we only need to calculate the distance between the pixel coordinates of point A4 and the origin on the left. If the target edge O4D4 is not located on the X-axis, we need to calculate the actual distance between the pixel coordinates of point A4 and the pixel coordinates of the target edge O4D4 projected onto the X-axis.
[0237] like Figure 15 The image shows a right-hand view of another vehicle's collision detection system. Figure 15 The target region M5 and the alarm region N5 are located in the target coordinate system. The target region M5 includes the left vertex L2 and the right vertex R2. The alarm region N5 includes the alarm line C5E5 and the target edge line O5D5.
[0238] like Figure 15 As shown, the left vertex L2 and right vertex R2 of the target area M5, and their projections on the X-axis are A5 and B5, respectively. The rectangle formed by the alarm line C5E5 and the bottom edge of the target A5D5 is projected on the X-axis as C5 and O.
[0239] Since neither A4 nor B5 belongs to [O,C5], they satisfy Formula 11, and the target is determined to be outside the warning line.
[0240]
[0241] like Figure 16 The image shows a left view of a vehicle collision detection system. Figure 16 The target region M6 and the alarm region N6 are located in the target coordinate system. The target region M6 includes the left vertex L3 and the right vertex R3. The alarm region N6 includes the alarm line C6E6 and the target edge line F6D6.
[0242] like Figure 16 As shown, the left vertex L3 and right vertex R3 of target area M6, and their projections on the X-axis are A6 and B6, respectively. The rectangle formed by the alarm line C6E6 and the bottom edge F6D6 of the target is projected onto the X-axis as C6 and D6. Since A6∈[C6,D6], the following formula 12 is satisfied, and target area M6 intersects with alarm area N6 (determining that the target is within the warning line).
[0243]
[0244] in, Let X be the projection of the left vertex L3 of the target region M6. Let X be the projection of the right vertex R3 of the target region M6. as well as Let X be the projection of the target region N6 onto X.
[0245] Specifically, in combination Figure 16 As shown, the risk of collision between the target object and the vehicle satisfies the following formula thirteen.
[0246] (Distance D6 -Distance B6 )*S pix <Thr Collision Formula Thirteen
[0247] Among them, Distance B6 Represents the pixel coordinates of point B6, Distance D6 S represents the pixel coordinates of point D6. pix This represents the actual distance represented by one pixel, in units of pixels per centimeter. collision This indicates the second preset distance, in cm.
[0248] like Figure 17 The image shows a left-hand view of a vehicle's collision detection system. Figure 17The target region M7 and the alarm region N7 are located in the target coordinate system. The target region M7 includes the left vertex L4 and the right vertex R4. The alarm region N7 includes the alarm line C7E7 and the target edge line F7D7.
[0249] like Figure 17 As shown, the left vertex L4 and right vertex R4 of the target area M7 are projected onto the X-axis as A7 and B7, respectively. The rectangle formed by the alarm line C7E7 and the bottom edge F7D7 of the target is projected onto the X-axis as C7 and D7.
[0250] Since neither A7 nor B7 belongs to [C7, D7], they satisfy Formula Fourteen, and the target is determined to be outside the warning line.
[0251]
[0252] In some embodiments, the vehicle in this application includes a panoramic monitoring imaging system (AVM), which includes multiple cameras, and the target environment image is an image captured by a target camera among the multiple cameras.
[0253] For example, such as Figure 18 As shown, a surround view of the vehicle is obtained from multiple cameras. Figure 18 In this context, 'a' represents the right view. Figure 18 In this context, 'b' represents the left view. Figure 18 In this context, 'c' represents the rear view. Figure 18 In this context, d represents the front view.
[0254] To better understand the collision risk determination method provided in the embodiments of this application, such as Figure 19 As shown, a flowchart of a method for determining collision risk is illustrated, including: S301-S304.
[0255] S301, Image Segmentation.
[0256] In some embodiments, when an electronic device acquires an image of a target environment, it divides the image region. Specifically, it uses a histogram threshold selection method for image segmentation, determines the relationship between gray values in the target environment image and the histogram threshold, and assigns pixels to the target region and background region, thus dividing the digital image into non-overlapping regions.
[0257] S302, Calculate the vertices of the region.
[0258] In some embodiments, the electronic device calculates the vertex coordinates of the target region and generates a list of vertices with different region IDs.
[0259] S303, Image intersection detection.
[0260] In some embodiments, the electronic device uses the split axis theorem collision detection algorithm to calculate whether the vertex ID region intersects with the rectangle formed by the warning line and the vehicle.
[0261] S304, Calculate whether there is a collision.
[0262] In some embodiments, the electronic device calculates the vertical distance from the vertex of the intersecting region to the target edge. If the vertical distance is less than or equal to a second preset threshold, a collision risk is determined to exist.
[0263] In other embodiments, to better understand the process of recording dashcam video, such as Figure 20 As shown, it includes: S401-S412.
[0264] S401. Determine if there is a risk of collision.
[0265] If so, then execute S402.
[0266] S402, Activate the first storage space.
[0267] S403. Store historical driving videos in the first storage space.
[0268] S404. Has a collision risk been detected in all N consecutive frames of images?
[0269] If yes, then execute S405. If no, then execute S406.
[0270] S405, Has an alarm signal been detected?
[0271] If yes, proceed to step S407. If no, proceed to step S406.
[0272] S406. Generate collision detection video.
[0273] S407, Activate the second storage space.
[0274] S408, Generate collision detection video.
[0275] S409. Store the data in the first storage space into the second storage space.
[0276] In some embodiments, where the first storage space stores historical driving videos and collision detection videos, the first storage space also stores information such as the vehicle's view, speed, and steering angle.
[0277] S410, Input data into the second storage space.
[0278] S411. Is the collision detection video complete?
[0279] If so, then execute S412.
[0280] S412. Store the collision detection video in the first storage space.
[0281] The foregoing primarily describes the solutions provided by the embodiments of this application from a methodological perspective. To achieve the aforementioned functions, the collision risk determination device or electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0282] This application embodiment can, based on the above method, exemplarily divide the collision risk determination device or electronic device into functional modules. For example, the collision risk determination device or electronic device may include functional modules corresponding to each functional division, or two or more functions may be integrated into one processing module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division; in actual implementation, there may be other division methods.
[0283] For example, embodiments of this application also provide a device for determining collision risk.
[0284] This application provides a collision risk determination device 50, applied to vehicles, such as... Figure 21 As shown, the collision risk determination device 50 includes a determination unit 501 and a processing unit 502.
[0285] The determining unit 501 is used to determine the target area corresponding to the target object and the alarm area when a target environment image including the target object is acquired. The target area is the area where the target object is located, and the alarm area is located on the same side of the vehicle as the target object. The alarm area consists of the edge line of the vehicle and the alarm line, and the distance between the alarm line and the vehicle is less than or equal to a first preset distance.
[0286] The processing unit 502 is used to calculate the distance between the target object and the vehicle when the target area and the alarm area intersect.
[0287] The determining unit 501 is further configured to determine that there is a risk of collision between the target object and the vehicle when the distance between the target object and the vehicle is less than or equal to a second preset distance. The first preset distance is greater than the second preset distance.
[0288] In one possible implementation, such as Figure 21 As shown, the determining device 50 further includes an acquisition unit 503, a generation unit 504, and a storage unit 505. The acquisition unit 503 is used to acquire an environmental image of a preset duration after determining that the target area intersects with the alarm area. The generation unit 504 is used to generate a collision detection video based on the environmental image of the preset duration. The storage unit 505 is used to store the collision detection video.
[0289] In one possible implementation, the vehicle includes a first storage space in a dormant state. The processing unit 502 is further configured to wake the first storage space from the dormant state to an active state. The storage unit 505 is further configured to store historical driving videos generated by the vehicle in the first storage space.
[0290] Storage unit 505 is specifically used to store collision detection video in the first storage space.
[0291] In one possible implementation, the vehicle further includes a second storage space in a dormant state, and the processing unit 502 is further configured to wake the second storage space from the dormant state to the working state upon detecting a collision signal.
[0292] Storage unit 503 is also used to store data from the first storage space into the second storage space. The collision signal includes at least one of a deceleration signal, a hazard light signal, and a braking signal.
[0293] In one possible implementation, the determining unit 501 is specifically configured to: determine a grayscale threshold for the target environment image based on its grayscale histogram, and segment the target environment image according to the grayscale threshold to obtain a binary image corresponding to the target environment image. The grayscale value of each pixel in the binary image is either a first value or a second value, where the first value is greater than the second value. A target region is determined. The target region is a connected region of pixels with the first value in the binary image.
[0294] In one possible implementation, the processing unit 502 is specifically configured to: determine the coordinates of the target edge line of the vehicle and the target area in the target coordinate system. The target edge line and the target object are located on the same face of the vehicle. Determine the coordinates of the target vertex in the target area. The target vertex is the point in the target area that is closest to the target edge line. Calculate the distance between the target object and the vehicle based on the coordinates of the target vertex and the coordinates of the target edge line.
[0295] In one possible implementation, the vehicle includes a panoramic monitoring imaging system (AVM) comprising multiple cameras, wherein the target environment image is an image captured by any one of the multiple cameras.
[0296] In the case where the functions of the integrated modules described above are implemented in hardware, this application provides a possible structural schematic diagram of the electronic device involved in the above embodiments. For example... Figure 22 As shown, the electronic device 60 includes a processor 601, a memory 602, and a bus 603. The processor 601 and the memory 602 can be connected via the bus 603.
[0297] Processor 601 is the control center of the communication device. It can be a single processor or a collective term for multiple processing elements. For example, processor 601 can be a general-purpose central processing unit (CPU) or other general-purpose processors. The general-purpose processor can be a microprocessor or any conventional processor.
[0298] As one embodiment, processor 601 may include one or more CPUs, for example Figure 22 CPU 0 and CPU 1 are shown in the diagram.
[0299] The memory 602 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEP ROM), disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.
[0300] As one possible implementation, the memory 602 can exist independently of the processor 601. The memory 602 can be connected to the processor 601 via a bus 603 and is used to store instructions or program code. When the processor 601 calls and executes the instructions or program code stored in the memory 602, it can implement the sensor determination method provided in the embodiments of this application.
[0301] In another possible implementation, the memory 602 can also be integrated with the processor 601.
[0302] Bus 603 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 22 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0303] It should be pointed out that, Figure 22 The structure shown does not constitute a limitation on the electronic device 60. Except... Figure 22 In addition to the components shown, the electronic device 60 may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0304] Optionally, the electronic device 60 provided in this application embodiment may also include a communication interface 604.
[0305] Communication interface 604 is used to connect with other devices via a communication network. This communication network can be Ethernet, a wireless access network, a wireless local area network (WLAN), etc. Communication interface 604 may include a receiving unit for receiving data and a transmitting unit for transmitting data.
[0306] In one design, the communication interface in the electronic device provided in this application embodiment can also be integrated into the processor.
[0307] In another hardware structure of the electronic device provided in this application embodiment, the electronic device may include a processor and a communication interface. The processor is coupled to the communication interface.
[0308] The functions of the processor can be found in the processor description above. In addition, the processor also has storage functions, which can be found in the memory function description above.
[0309] The communication interface is used to provide data to the processor. This communication interface can be an internal interface of the communication device or an external interface of the communication device.
[0310] It should be noted that the above-mentioned alternative hardware structure does not constitute a limitation on the electronic device. In addition to the above-mentioned alternative hardware component, the electronic device may include more or fewer components, or combine certain components, or have different component arrangements.
[0311] When the functions of the integrated modules described above are implemented in hardware, the present application provides a structural diagram of the middleware involved in the above embodiments, which can be referred to as the structural diagram of the execution machine described above.
[0312] When the functions of the integrated modules described above are implemented in hardware, the present application provides a schematic diagram of the electronic device involved in the above embodiments, which can be referred to in the description of electronic device 60, and will not be repeated here.
[0313] This application also provides a vehicle including the aforementioned electronic device 60.
[0314] This application also provides a computer-readable storage medium storing instructions. When a computer executes these instructions, the computer performs each step of the collision risk determination method flow shown in the above-described method embodiments.
[0315] This application also provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the collision risk determination method described in the above method embodiments.
[0316] The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), registers, hard disks, optical fibers, compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing, or any other form of computer-readable storage medium in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium may also be a component of the processor. The processor and the storage medium may reside in an application-specific integrated circuit (ASIC). In the embodiments of this application, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0317] Since the server, user equipment, computer-readable storage medium, and computer program product in the embodiments of this application can be applied to the above methods, the technical effects that can be obtained can also be referred to the above method embodiments. The embodiments of this application will not be repeated here.
[0318] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be covered within the scope of protection of this application.
Claims
1. A method of determining a risk of collision, characterized in that, The application is applied to a vehicle, comprising: In the case of collecting a target environment image including a target object, determining a target region corresponding to the target object and an alarm region; the target region is a region where the target object is located, and the alarm region is on the same side of the vehicle as the target object; the alarm region is composed of a side line of the vehicle and an alarm line, and the distance between the alarm line and the vehicle is less than or equal to a first preset distance; In the case of intersection between the target region and the alarm region, calculating the distance between the target object and the vehicle, and in the case of the distance between the target object and the vehicle being less than or equal to a second preset distance, determining that the target object has a collision risk with the vehicle; the first preset distance is greater than the second preset distance.
2. The determination method according to claim 1, characterized in that, The method further comprises: After determining that the target region intersects with the alarm region, obtaining an environment image of a preset time length, and generating a detection collision video according to the environment image of the preset time length; Storing the detection collision video.
3. The determination method according to claim 2, characterized in that, The vehicle comprises a first storage space in a dormant state, and the method further comprises: Waking up the first storage space from the dormant state to the working state, and storing the historical driving video generated by the vehicle in the first storage space; The storage of the detection collision video comprises: Storing the detection collision video in the first storage space.
4. The determination method according to claim 3, characterized in that, The vehicle further comprises a second storage space in a dormant state, and the method further comprises: In the case of detecting a collision signal, waking up the second storage space from the dormant state to the working state, and storing the data in the first storage space into the second storage space; the collision signal comprises at least one of a deceleration signal, a double flash signal and a brake signal.
5. The determination method according to any one of claims 1-4, characterized in that, The determination of the target region corresponding to the target object comprises: According to the gray histogram of the target environment image, determining the gray threshold of the target environment image, and according to the gray threshold, segmenting the target environment image to obtain a binary image corresponding to the target environment image; each pixel point in the binary image has a gray value of a first value or a second value, and the first value is greater than the second value; Determining the target region; the target region is a connected region of the pixel points with the first value in the binary image.
6. The determination method according to any one of claims 1-4, characterized in that, The calculation of the distance between the target object and the vehicle comprises: Determining the coordinates of the target side line of the vehicle and the target region in a target coordinate system; the target side line is on the same side of the vehicle as the target object; Determining the coordinates of a target vertex in the target region; the target vertex is the point closest to the target side line in the target region; According to the coordinates of the target vertex and the coordinates of the target side line, calculating the distance between the target object and the vehicle.
7. The determination method according to any one of claims 1-4, characterized in that, The vehicle comprises an all-around monitoring image system AVM, the AVM comprises a plurality of cameras, and the target environment image is an image captured by any one of the plurality of cameras.
8. A collision risk determination apparatus characterized by comprising: The application is applied to a vehicle, comprising a determination unit and a processing unit; The determination unit is configured to, when a target environment image including a target object is collected, determine a target region corresponding to the target object and an alarm region; the target region is a region where the target object is located, the alarm region is located on the same side of the vehicle as the target object, and the alarm region is composed of a side line of the vehicle and an alarm line, the alarm line being less than or equal to a first preset distance from the vehicle. The processing unit is configured to, when the target region intersects with the alarm region, calculate a distance between the target object and the vehicle. The determination unit is further configured to, when the distance between the target object and the vehicle is less than or equal to a second preset distance, determine that the target object has a collision risk with the vehicle; the first preset distance is greater than the second preset distance.
9. An electronic device, comprising: A processor and a communication interface; the communication interface and the processor are coupled, and the processor is configured to run a computer program or instructions to implement the determination method according to any one of claims 1-7.
10. A computer-readable storage medium having stored therein instructions, the computer-readable storage medium comprising: When a computer executes the instructions, the computer executes the determination method according to any one of claims 1-7.