Road fog detection method and device, electronic equipment and storage medium
By segmenting and sharpness detection of images captured by target inspection vehicles, combined with lane line and off-road area analysis, the problem of low accuracy in road fog detection in existing technologies has been solved, improving the accuracy and safety of detection.
Patent Information
- Application Number
- CN202011530057.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-22
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2040-12-22
AI Technical Summary
Existing methods for detecting road fog have low accuracy, leading to potential traffic safety hazards on highways.
By acquiring the first image of the front of the target inspection vehicle, identifying the road surface area image and segmenting it in a preset direction, and using sharpness detection to determine the presence of fog, including identifying lane lines and vanishing points to determine the road surface area, and combining grayscale analysis of non-road surface areas, the detection accuracy is improved.
It improves the accuracy of road fog detection, reduces system load, decreases false alarms, and enhances highway traffic safety.
Smart Images

Figure CN114663843B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of fog detection technology, specifically to a method, apparatus, electronic device, and storage medium for detecting fog on roads. Background Technology
[0002] "Patch fog," also known as clump fog, is essentially fog, but it is a denser, lower-visibility fog that appears within a localized microclimate, ranging from tens to hundreds of meters in a larger fog. Visibility is good outside patch fog, but completely obscured inside. Patch fog is highly regional and difficult to predict, especially on highways, where it can cause sudden changes in visibility, posing a significant threat to highway traffic safety and easily leading to serious traffic accidents.
[0003] Currently, fog detection and early warning methods are mainly divided into two categories: traditional satellite remote sensing, atmospheric visibility detectors, and image processing-based fog detection. However, the accuracy of existing methods for detecting road fog is relatively low.
[0004] In other words, the accuracy of existing methods for detecting road fog is relatively low. Summary of the Invention
[0005] This application aims to provide a method, apparatus, electronic device, and storage medium for detecting road fog, in order to solve the problem of low accuracy in existing methods for detecting road fog.
[0006] On the one hand, this application provides a method for detecting road fog, the method comprising:
[0007] Acquire the first image of the front of the target inspection vehicle taken by the vehicle in front of it;
[0008] Identify the road surface area image in the image ahead of the first vehicle;
[0009] The road surface area image is segmented in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image;
[0010] Sharpness detection is performed on the at least two segmented images to obtain the sharpness of each segmented image;
[0011] When there are two adjacent segmented images whose sharpness difference is greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle.
[0012] The preset direction is the vertical direction from bottom to top on the road surface area image.
[0013] The step of determining that fog was detected in the first vehicle's front image when there are two adjacent segmented images with a sharpness difference greater than a preset difference includes:
[0014] Determine whether the sharpness of each segmented image decreases monotonically in the preset direction;
[0015] When the sharpness of each segmented image decreases monotonically in the preset direction, the sharpness difference between two adjacent segmented images is calculated.
[0016] The step of determining whether the sharpness of each segmented image decreases monotonically in the preset direction includes:
[0017] Obtain the non-road area in the first image of the front of the vehicle, wherein the non-road area refers to the area outside the road surface area image in the first image of the front of the vehicle;
[0018] The non-road surface area is converted to grayscale to obtain a non-road surface grayscale image;
[0019] Determine whether the proportion of the first target pixel in the non-road grayscale image exceeds a first preset proportion, wherein the first target pixel is a pixel in the non-road grayscale image whose grayscale value is greater than the first preset grayscale value;
[0020] When the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, it is determined whether the sharpness of each segmented image decreases monotonically in the preset direction.
[0021] The step of identifying the road surface area image in the first vehicle front image includes:
[0022] Identify multiple lane lines in the image ahead of the first vehicle;
[0023] Obtain the vanishing points of the multiple lane lines;
[0024] The area enclosed by the multiple lane lines and the vanishing point in the image ahead of the first vehicle is defined as the road surface area image.
[0025] The identification of multiple lane lines in the image ahead of the first vehicle includes:
[0026] The image of the front of the first vehicle is converted to grayscale to obtain a grayscale image of the front of the vehicle;
[0027] Determine whether the proportion of the second target pixel in the grayscale image in front of the vehicle exceeds the second preset proportion, wherein the second target pixel is a pixel in the grayscale image in front of the vehicle whose grayscale value is less than the second preset grayscale value;
[0028] If the proportion of the second target pixel in the grayscale image in front of the vehicle does not exceed the second preset proportion, then multiple lane lines in the image in front of the first vehicle are identified.
[0029] The acquisition of the first vehicle front image captured by the target inspection vehicle includes:
[0030] Obtain the current location of the target inspection vehicle;
[0031] Based on the current location of the target inspection vehicle, determine whether the target inspection vehicle is located in the preset road area;
[0032] When the target inspection vehicle is located in a preset road area, a first image of the front of the vehicle taken by the target inspection vehicle is acquired.
[0033] Wherein, when there are two adjacent segmented images in each of the segmented images whose sharpness difference is greater than a preset difference, it is determined that fog has been detected in the first image in front of the vehicle, and then the process includes:
[0034] Acquire at least one image of the front of a second vehicle taken by the target inspection vehicle within a preset time period after taking the image of the front of the first vehicle;
[0035] Perform road fog detection on the front image of the at least one second vehicle;
[0036] When the proportion of vehicles in front of the first vehicle and the first vehicle front image that detects fog reaches a third preset percentage, it is determined that fog occurred on the road where the target inspection vehicle was taking the first vehicle front image.
[0037] On one hand, this application provides a detection device for road fog, the detection device comprising:
[0038] The acquisition unit is used to acquire the first image of the front of the target inspection vehicle captured by the vehicle.
[0039] The recognition unit is used to recognize the road surface area image in the first vehicle front image;
[0040] A segmentation unit is used to segment the road surface area image in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image;
[0041] A sharpness detection unit is used to perform sharpness detection on the at least two segmented images to obtain the sharpness of each segmented image;
[0042] The determining unit is used to determine that fog is detected in the first vehicle front image when there are two adjacent segmented images with a sharpness difference greater than a preset difference.
[0043] The preset direction is the vertical direction from bottom to top on the road surface area image.
[0044] The segmentation unit is also used to determine whether the sharpness of each segmented image decreases monotonically in the preset direction;
[0045] When the sharpness of each segmented image decreases monotonically in the preset direction, the sharpness difference between two adjacent segmented images is calculated.
[0046] The segmentation unit is further configured to acquire non-road areas in the first vehicle front image, wherein the non-road areas refer to areas outside the road surface area image in the first vehicle front image;
[0047] The non-road surface area is converted to grayscale to obtain a non-road surface grayscale image;
[0048] Determine whether the proportion of the first target pixel in the non-road grayscale image exceeds a first preset proportion, wherein the first target pixel is a pixel in the non-road grayscale image whose grayscale value is greater than the first preset grayscale value;
[0049] When the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, it is determined whether the sharpness of each segmented image decreases monotonically in the preset direction.
[0050] The recognition unit is also used to recognize multiple lane lines in the image ahead of the first vehicle;
[0051] Obtain the vanishing points of the multiple lane lines;
[0052] The area enclosed by the multiple lane lines and the vanishing point in the image ahead of the first vehicle is defined as the road surface area image.
[0053] The recognition unit is also used to convert the first vehicle front image to grayscale to obtain a vehicle front grayscale image.
[0054] Determine whether the proportion of the second target pixel in the grayscale image in front of the vehicle exceeds the second preset proportion, wherein the second target pixel is a pixel in the grayscale image in front of the vehicle whose grayscale value is less than the second preset grayscale value;
[0055] If the proportion of the second target pixel in the grayscale image in front of the vehicle does not exceed the second preset proportion, then multiple lane lines in the image in front of the first vehicle are identified.
[0056] The acquisition unit is also used to acquire the current location of the target inspection vehicle;
[0057] Based on the current location of the target inspection vehicle, determine whether the target inspection vehicle is located in the preset road area;
[0058] When the target inspection vehicle is located in a preset road area, a first image of the front of the vehicle taken by the target inspection vehicle is acquired.
[0059] The determining unit is further configured to acquire at least one image of the front of a second vehicle taken by the target inspection vehicle within a preset time period after taking the image of the front of the first vehicle.
[0060] Perform road fog detection on the front image of the at least one second vehicle;
[0061] When the proportion of vehicles in front of the first vehicle and the first vehicle front image that detects fog reaches a third preset percentage, it is determined that fog occurred on the road where the target inspection vehicle was taking the first vehicle front image.
[0062] On the one hand, this application also provides an electronic device, the electronic device comprising:
[0063] one or more processors;
[0064] Memory; and
[0065] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the method for detecting road fog as described in any one of the first aspects.
[0066] In one aspect, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to perform the steps in the method for detecting road fog as described in any of the first aspects.
[0067] This application provides a method for detecting road fog. The method identifies a road surface area image in a first image taken by a target inspection vehicle, then vertically segments the road surface area image, and performs sharpness detection on multiple segmented images to obtain the sharpness of each segmented image. When there are two adjacent segmented images whose sharpness difference is greater than a preset difference, it indicates a significant change in the sharpness of the road surface area image, indicating the presence of road fog. By vertically segmenting the road surface area image and performing sharpness detection, the presence of road fog can be determined when a significant change in sharpness occurs vertically, thus improving the accuracy of road fog detection. Attached Figure Description
[0068] 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.
[0069] Figure 1 A schematic diagram of a road fog detection system provided in an embodiment of this application;
[0070] Figure 2 This is a schematic flowchart of an embodiment of the road fog detection method provided in this application;
[0071] Figure 3 This is a schematic diagram of the image in front of the first vehicle in one embodiment of the road fog detection method provided in this application;
[0072] Figure 4 This is a schematic diagram of an embodiment of the road fog detection device provided in this application.
[0073] Figure 5 This is a schematic diagram of an embodiment of the electronic device provided in this application. Detailed Implementation
[0074] 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.
[0075] In the description of this application, it should be understood that the terms "center," "longitudinal," "lateral," "length," "width," "thickness," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships based on the orientation or positional relationships shown in the accompanying drawings, are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this application. Furthermore, 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 indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more features. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0076] In this application, the term "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes are not described in detail to avoid obscuring the description of this application with unnecessary detail. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0077] It should be noted that since the method in this application embodiment is executed in an electronic device, the processing objects of each electronic device exist in the form of data or information, such as time, which is essentially time information. It can be understood that if size, quantity, position, etc. are mentioned in subsequent embodiments, they are all corresponding data that exist so that the electronic device can process them. Specific details will not be elaborated here.
[0078] This application provides a method, apparatus, electronic device, and storage medium for detecting road fog, which will be described in detail below.
[0079] Please see Figure 1 , Figure 1 This is a schematic diagram of a road fog detection system provided in an embodiment of this application. The road fog detection system may include an electronic device 100, which integrates a road fog detection device, such as... Figure 1 Electronic devices in the system.
[0080] Furthermore, the road fog detection system connects to a network of multiple patrol vehicles to acquire information sent by this network. Information collected by the patrol vehicles, such as video, images, GPS coordinates, camera heading angles, and timestamps, is transmitted back to the road fog detection system in the form of messages. Each patrol vehicle has a unique patrol number, and the road fog detection system tracks the target patrol vehicle based on these numbers.
[0081] Specifically, inspection vehicles are equipped with video acquisition devices, such as cameras. These devices are responsible for collecting data and performing preliminary processing of the perceived data. The main parameters for these devices are global exposure, pixel size of 3μm or larger, maximum aperture of F1.2 or larger, and exposure time of 1 / 200s or smaller. Of course, appropriate video acquisition devices can be selected based on specific circumstances.
[0082] In this embodiment, the electronic device 100 can be a standalone server, a server network, or a server cluster. For example, the electronic device 100 described in this embodiment includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0083] Those skilled in the art will understand that Figure 1 The application environment shown is merely one application scenario of the solution in this application and does not constitute a limitation on the application scenario of the solution in this application. Other application environments may include more than one application scenario. Figure 1 The number of more or fewer electronic devices shown, for example Figure 1 Only one electronic device is shown in the image. It is understood that the road fog detection system may also include one or more other servers, which are not specified here.
[0084] In addition, such as Figure 1 As shown, the road fog detection system may also include a memory 200 for storing data.
[0085] It should be noted that, Figure 1 The schematic diagram of the road fog detection system shown is merely an example. The road fog detection system and scenario described in this application are for the purpose of more clearly illustrating the technical solutions of this application, and do not constitute a limitation on the technical solutions provided in this application. As those skilled in the art will know, with the evolution of road fog detection systems and the emergence of new business scenarios, the technical solutions provided in this application are also applicable to similar technical problems.
[0086] First, this application provides a method for detecting road fog. The execution subject of this method is a road fog detection device, which is applied to an electronic device. The method for detecting road fog includes:
[0087] Acquire the first image of the front of the target inspection vehicle taken by the vehicle in front of it;
[0088] Identify the road surface area image in the image in front of the first vehicle;
[0089] The road surface area image is segmented in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image.
[0090] Sharpness detection is performed on at least two segmented images to obtain the sharpness of each segmented image;
[0091] When there are two adjacent segmented images with a sharpness difference greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle.
[0092] See Figure 2 , Figure 2 This is a schematic flowchart of an embodiment of the road fog detection method provided in this application. Figure 2 As shown, the detection method for road fog includes:
[0093] S201. Acquire the first image of the front of the target inspection vehicle taken by the target inspection vehicle.
[0094] Since the road fog detection device is connected to multiple inspection vehicles, when the road fog detection device acquires accident vehicle images sent by multiple inspection vehicles simultaneously or sequentially, it can process the accident vehicle images sent by multiple inspection vehicles one by one, simultaneously or in a predetermined order. This application does not limit this.
[0095] In this embodiment, acquiring the first image of the front of the vehicle captured by the target inspection vehicle may include: acquiring the current position of the target inspection vehicle; determining whether the target inspection vehicle is located in a preset road area based on its current position; and acquiring the first image of the front of the vehicle captured by the target inspection vehicle when it is located in the preset road area. Recognition is only performed when the shooting location is within the preset road area, which reduces unnecessary detection and avoids increasing the system load. Furthermore, the road conditions in highway areas are relatively uniform, and the solution proposed in this application has higher accuracy in this scenario.
[0096] S202. Identify the road surface area image in the image in front of the first vehicle.
[0097] In this embodiment, after acquiring the first vehicle-front image captured by the target inspection vehicle, before identifying the road surface area image in the first vehicle-front image, the process may include: acquiring the shooting position of the target inspection vehicle when capturing the first vehicle-front image, and determining whether there are any historical vehicle-front images with detected fog transmitted from the shooting position by other inspection vehicles within a preset historical time period. The preset historical time period can be 1 hour, 2 hours, etc., set according to specific circumstances. If there are historical vehicle-front images transmitted from the shooting position by other inspection vehicles within the preset historical time period, then the shooting heading angle of the target inspection vehicle when capturing the first vehicle-front image and the historical heading angles of other inspection vehicles when capturing historical vehicle-front images are acquired. If the historical heading angle is different from the shooting heading angle, then the road surface area image in the first vehicle-front image is identified; if the historical heading angle is the same as the shooting heading angle, then the process ends. For two-way lanes, since the image of the first vehicle at the same location may be taken by an inspection vehicle in the same driving direction, determining the specific lane where the accident occurred based on the heading angle of the inspection vehicle can avoid inspection vehicles in the same driving direction from repeatedly reporting the same fog event, and can also identify fog patches at the same location in different driving directions, improving the accuracy of fog detection and reducing the system load.
[0098] In this embodiment of the application, identifying the road surface area image in the first vehicle front image may include:
[0099] (1) Identify multiple lane lines in the image in front of the first vehicle.
[0100] In this embodiment of the application, before identifying multiple lane lines in the image in front of the first vehicle, the process may include: converting the image in front of the first vehicle to grayscale to obtain a grayscale image of the front of the vehicle; determining whether the proportion of a second target pixel in the grayscale image of the front of the vehicle exceeds a second preset proportion, wherein the second target pixel is a pixel in the grayscale image of the front of the vehicle whose grayscale value is less than the second preset grayscale value; if the proportion of the second target pixel in the grayscale image of the front of the vehicle exceeds the second preset proportion, then identifying multiple lane lines in the image in front of the first vehicle. Generally, pixel values are represented by one byte (8 bits) after quantization. For example, grayscale values with continuous black-gray-white variations are quantized into 256 grayscale levels, with a grayscale value range of 0 to 255, representing brightness from dark to light, corresponding to colors in the image from black to white. Black and white photographs contain all grayscale tones between black and white, and each pixel value is one of the 256 grayscale values between black and white. The second preset proportion and the second preset grayscale value are set according to specific circumstances, for example, the second preset grayscale value is 20, and the second preset proportion is 80%. When the proportion of the second target pixel in the grayscale image in front of the vehicle does not exceed the second preset proportion, and it is neither nighttime nor passing through a tunnel, fog detection can improve accuracy.
[0101] In this embodiment, a lane detection model is used to identify multiple lane lines in the image ahead of the first vehicle. The lane detection model can be a trained LanNet model, H-Net model, DABNet model, cgnet (ContextGuided Network), bisenet (Bilatel Segmentation Network), etc.
[0102] LanNet is a multi-task model that combines semantic segmentation and pixel vector representation, ultimately using clustering to segment lane lines. H-Net is a small network structure responsible for predicting the transformation matrix H, which is used to remodel all pixels belonging to the same lane line. DABNet (Depth-wise Asymmetric Bottleneck DAB module) efficiently utilizes depthwise asymmetric convolutions and dilated convolutions to build a bottleneck structure. DABNet, built using the DAB module, can construct a sufficient receptive field and densely utilize contextual information, achieving high accuracy without any pre-training or post-processing. The network first uses three 3x3 convolutions to extract initial features. The initial downsampling strategy is a 3x3 convolution with a stride of 2 and a 2x2 max-pooling concatenation. Subsequent downsampling stages use 3x3 convolutions with a stride of 2 to keep the downsampling rate relatively low. During downsampling, the original image is concatenated into the downsampling module to promote feature reuse and compensate for information loss. To better enhance spatial relationships and feature propagation, inter-block concatenation is introduced to combine high-level features with low-level features. This means stacking the first and last DAB modules within each DAB block. For dilated convolutions, all DAB modules in DAB block 1 include asymmetric dilated convolutions with a depth of 2 dilation, and the dilation rates in DAB block 2 are 4, 4, 8, 8, 16, and 16, respectively.
[0103] Specifically, the captured lane line images are used as basic training data for lane lines. The lane line detection model is then trained using this basic training data to obtain the trained lane line detection model.
[0104] (2) Obtain the vanishing points of multiple lane lines.
[0105] In linear perspective, the vanishing point is the point where two or more parallel lines converge towards the horizon. The principle that parallel lines converge at the vanishing point in reality is also based on what we observe with the naked eye; for example, the two tracks of a railway do indeed appear to meet at the horizon. A picture can have one or more vanishing points, depending on the coordinates and orientation of the composition; all vanishing points may fall on the horizon or on lines extending beyond the drawing plane. In oblique perspective, a cuboid drawn using a bird's-eye view or a worm's-eye view has three vanishing points, one of which is not on the horizon but below (bird's-eye view) or above (worm's-eye view). This is also called the "vanishing point."
[0106] See Figure 3 , Figure 3 This is a schematic diagram of the image in front of the first vehicle in one embodiment of the road fog detection method provided in this application. For example, the fog is TW, and the identified lane lines are EG, XY and HF, and the intersection of the lane lines is the vanishing point M.
[0107] (3) The area enclosed by multiple lane lines and vanishing points on the image in front of the first vehicle is defined as the road surface area image.
[0108] Specifically, multiple intersection points of the extended lines of multiple lanes with the bottom edge of the image in front of the first vehicle are obtained. The intersection point with the smallest x-coordinate and the intersection point with the largest x-coordinate are obtained. The triangular area enclosed by the intersection point with the smallest x-coordinate, the intersection point with the largest x-coordinate, and the vanishing point is determined as the road surface area image.
[0109] Continue reading Figure 3 The area enclosed by multiple lane lines and vanishing point M is called MEF, and the road surface area image is MEF.
[0110] S203. The road surface area image is segmented in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image.
[0111] In this embodiment, the preset direction F1 is the direction perpendicular to the road surface area image from bottom to top. In other embodiments, the preset direction F1 may also be inclined to the horizontal direction of the road surface area image. For example, the preset direction F1 is inclined to the horizontal direction at 30 degrees from bottom to top. This application does not limit this.
[0112] In one specific embodiment, the road surface area image is divided into equal-length segments along a preset direction F1 to obtain at least two segmented images arranged sequentially along the preset direction F1, wherein the at least two segmented images have the same length along the preset direction F1. Of course, in other embodiments, unequal-distance segmentation or equal-area segmentation can also be performed, and this application does not limit this.
[0113] See Figure 3 The road surface area image MEF is divided into equal length segments along the preset direction F1 to obtain at least two segmented images arranged sequentially along the preset direction F1, which are 3 in total: segmented image CDEF, segmented image ABCD, and segmented image MAB.
[0114] S204. Perform sharpness detection on at least two segmented images to obtain the sharpness of each segmented image.
[0115] In quality assessment without a reference image, image sharpness is an important indicator for measuring the quality of an image. It corresponds well to human subjective perception, and low image sharpness manifests as blurriness.
[0116] In this embodiment, the Tenengrad gradient function can be used to perform sharpness detection on at least two segmented images to obtain the sharpness of each segmented image. The Tenengrad gradient function uses the Sobel operator to extract gradient values in the horizontal and vertical directions respectively.
[0117] In other embodiments, the sharpness of at least two segmented images can be detected using the Brenner gradient function, Laplacian gradient function, etc., to obtain the sharpness of each segmented image. This application does not limit this to any particular method.
[0118] For example, if the sharpness of segmented image CDEF is 5, the sharpness of segmented image ABCD is 2, and the sharpness of segmented image MAB is 1, then segmented image MAB is the most blurry of the three segmented images.
[0119] S205. When there are two adjacent segmented images with a sharpness difference greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle.
[0120] In this embodiment, after sharpness detection of at least two segmented images to obtain the sharpness of each segmented image, it is determined whether the sharpness of each segmented image monotonically decreases in a preset direction F1. When the sharpness of each segmented image monotonically decreases in the preset direction F1, the sharpness difference between two adjacent segmented images is calculated. When the sharpness of each segmented image does not monotonically decrease in the preset direction F1, the blur may be caused by problems with the camera itself (focusing, acquisition unit failure, etc.). When the sharpness of each segmented image monotonically decreases in the preset direction F1, fog detection is performed to avoid the system misjudging fog due to blur caused by problems with the camera itself, thereby improving the accuracy of fog detection.
[0121] For example, if the sharpness of segmented image CDEF is 5, the sharpness of segmented image ABCD is 2, and the sharpness of segmented image MAB is 1, then the sharpness of each segmented image decreases monotonically in the preset direction F1. The sharpness difference between any two adjacent segmented images is calculated, and is 3 and 1 respectively.
[0122] Furthermore, determining whether the sharpness of each segmented image monotonically decreases in the preset direction F1 includes: acquiring the non-road area in the first vehicle's front image, where the non-road area refers to the area outside the road surface area in the first vehicle's front image; converting the non-road area to grayscale to obtain a non-road grayscale image; determining whether the proportion of the first target pixel in the non-road grayscale image exceeds a first preset proportion, where the first target pixel is a pixel in the non-road grayscale image with a grayscale value greater than the first preset grayscale value; when the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, determining whether the sharpness of each segmented image monotonically decreases in the preset direction F1. The first preset proportion and the first preset grayscale value are set according to specific circumstances; for example, the first preset grayscale value is 200, and the first preset proportion is 70%. When the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, it indicates that the non-road grayscale image is mostly white, and the non-road area mainly consists of sky and trees, which is highly likely to be a foggy day. Further performing fog detection in this case can improve the accuracy of fog detection.
[0123] The preset difference value can be set according to specific circumstances, such as 1, 2, etc. When there are two adjacent segmented images in each segmented image whose sharpness difference is greater than the preset difference value, it is determined that fog has been detected in the image in front of the first vehicle. For example, if the preset difference value is 2, and the sharpness difference values of two adjacent segmented images in each segmented image are calculated to be 3 and 1 respectively, then it is determined that fog has been detected in the image in front of the first vehicle.
[0124] Furthermore, when there are two adjacent segmented images with a sharpness difference greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle. Afterwards, the following can be included:
[0125] (1) Acquire at least one image of the front of the second vehicle taken by the target inspection vehicle within a preset time period after taking the image of the front of the first vehicle.
[0126] The preset time period can be 3 seconds, 5 seconds, etc., and can be set according to the specific situation. Specifically, it can extract suspected fog videos within a preset time period after the target inspection vehicle takes the first image in front of the vehicle, extract at least one keyframe from the fog video, and obtain at least one second image in front of the vehicle.
[0127] (2) Perform road fog detection on at least one second vehicle front image.
[0128] Specifically, the step of detecting road fog in at least one second vehicle forward image can be found in steps S201-S205 for detecting road fog in the first vehicle forward image. It can be determined whether fog is detected in each of the second vehicle forward images. The number of second vehicle forward images can be set according to specific circumstances, and this application does not limit this.
[0129] (3) When the proportion of vehicles in front of the second vehicle and the first vehicle front image that detects fog reaches a third preset percentage, it is determined that fog occurred on the road where the target inspection vehicle was taking the first vehicle front image.
[0130] The third preset percentage can be set according to specific circumstances, such as 80% or 100%. Detecting fog patches using multiple images of the vehicle's front can improve detection accuracy. Alternatively, when fog patches are detected in the first image of the vehicle's front, the location of the fog patch when the target inspection vehicle took the first image can be directly determined. The location of the fog patch is defined as the location of the road where the target inspection vehicle took the first image, and the time when the target inspection vehicle took the first image is defined as the time of the fog patch occurrence.
[0131] Furthermore, the location and time of occurrence of the fog will be displayed on the real-scene display platform.
[0132] To better implement the road fog detection method in the embodiments of this application, based on the road fog detection method, the embodiments of this application also provide a road fog detection device, such as... Figure 4 As shown, Figure 4 This is a schematic diagram of an embodiment of the road fog detection device provided in this application. The road fog detection device includes:
[0133] Acquisition unit 401 is used to acquire the first vehicle front image captured by the target inspection vehicle;
[0134] The recognition unit 402 is used to recognize the road surface area image in the image in front of the first vehicle;
[0135] The segmentation unit 403 is used to segment the road surface area image in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image.
[0136] The sharpness detection unit 404 is used to perform sharpness detection on at least two segmented images to obtain the sharpness of each segmented image;
[0137] The determining unit 405 is used to determine that fog has been detected in the image in front of the first vehicle when there are two adjacent segmented images in each segmented image whose sharpness difference is greater than a preset difference.
[0138] The preset direction is the vertical direction from bottom to top on the road surface area image.
[0139] The segmentation unit 403 is also used to determine whether the sharpness of each segmented image decreases monotonically in a preset direction;
[0140] When the sharpness of each segmented image decreases monotonically in a preset direction, the sharpness difference between two adjacent segmented images in each segmented image is calculated.
[0141] The segmentation unit 403 is also used to obtain non-road areas in the first vehicle front image, wherein the non-road areas refer to areas outside the road area image in the first vehicle front image.
[0142] Convert the non-road surface area to grayscale to obtain a non-road surface grayscale image;
[0143] Determine whether the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, wherein the first target pixel is a pixel in the non-road grayscale image whose grayscale value is greater than the first preset grayscale value;
[0144] When the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, it is determined whether the sharpness of each segmented image decreases monotonically in the preset direction.
[0145] The recognition unit 402 is also used to recognize multiple lane lines in the image ahead of the first vehicle;
[0146] Obtain the vanishing points of multiple lane lines;
[0147] The area enclosed by multiple lane lines and vanishing points in the image in front of the first vehicle is defined as the road surface area image.
[0148] The recognition unit 402 is also used to convert the first vehicle front image to grayscale to obtain a vehicle front grayscale image;
[0149] Determine whether the proportion of the second target pixel in the grayscale image in front of the vehicle exceeds the second preset proportion, wherein the second target pixel is the pixel in the grayscale image in front of the vehicle whose grayscale value is less than the second preset grayscale value;
[0150] If the proportion of the second target pixel in the grayscale image in front of the vehicle does not exceed the second preset proportion, then multiple lane lines in the image in front of the first vehicle are identified.
[0151] The acquisition unit 401 is also used to acquire the current location of the target inspection vehicle;
[0152] Determine whether the target inspection vehicle is located in the preset road area based on its current location;
[0153] When the target inspection vehicle is located in the preset road area, acquire the first image of the front of the vehicle taken by the target inspection vehicle.
[0154] The determining unit 405 is also used to acquire at least one image of the front of a second vehicle taken by the target inspection vehicle within a preset time period after taking the image of the front of the first vehicle.
[0155] Perform road fog detection on at least one second vehicle's frontal image;
[0156] When the proportion of vehicles in front of at least one second vehicle front image and one first vehicle front image that detects fog reaches a third preset percentage, it is determined that fog occurred on the road where the target inspection vehicle was taking the first vehicle front image.
[0157] This application also provides an electronic device that integrates any of the road fog detection devices provided in this application. For example... Figure 5 As shown, it illustrates a structural schematic diagram of the electronic device involved in the embodiments of this application, specifically:
[0158] The electronic device may include components such as a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a power supply 503, and an input unit 504. Those skilled in the art will understand that the electronic device structure shown in the figures does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0159] The processor 501 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 502, and by calling data stored in the memory 502, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. Optionally, the processor 501 may include one or more processing cores; preferably, the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 501.
[0160] The memory 502 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing by running the software programs and modules stored in the memory 502. The memory 502 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 502 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 502 may also include a memory controller to provide the processor 501 with access to the memory 502.
[0161] The electronic device also includes a power supply 503 that supplies power to various components. Preferably, the power supply 503 can be logically connected to the processor 501 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 503 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0162] The electronic device may also include an input unit 504, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0163] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 501 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 502 according to the following instructions, and the processor 501 runs the applications stored in the memory 502 to realize various functions, as follows:
[0164] Acquire the first image of the front of the target inspection vehicle taken by the vehicle in front of it;
[0165] Identify the road surface area image in the image in front of the first vehicle;
[0166] The road surface area image is segmented in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image.
[0167] Sharpness detection is performed on at least two segmented images to obtain the sharpness of each segmented image;
[0168] When there are two adjacent segmented images with a sharpness difference greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle.
[0169] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0170] Therefore, embodiments of this application provide a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), a disk, or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any of the road fog detection methods provided in embodiments of this application. For example, the computer program loaded by the processor can execute the following steps:
[0171] Acquire the first image of the front of the target inspection vehicle taken by the vehicle in front of it;
[0172] Identify the road surface area image in the image in front of the first vehicle;
[0173] The road surface area image is segmented in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image.
[0174] Sharpness detection is performed on at least two segmented images to obtain the sharpness of each segmented image;
[0175] When there are two adjacent segmented images with a sharpness difference greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle.
[0176] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the detailed descriptions of other embodiments above, which will not be repeated here.
[0177] In practice, each of the above units or structures can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units or structures, please refer to the previous method embodiments, which will not be repeated here.
[0178] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0179] The foregoing has provided a detailed description of a method, apparatus, electronic device, and storage medium for detecting road fog according to embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for detecting road fog, characterized in that, The method for detecting road fog includes: Acquire the first image of the front of the target inspection vehicle taken by the vehicle in front of it; Identify the road surface area image in the image ahead of the first vehicle; The road surface area image is segmented in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image; Sharpness detection is performed on the at least two segmented images to obtain the sharpness of each segmented image; Determine whether the sharpness of each segmented image decreases monotonically in the preset direction; When the sharpness of each segmented image decreases monotonically in the preset direction, the sharpness difference between two adjacent segmented images in each segmented image is calculated. When there are two adjacent segmented images whose sharpness difference is greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle.
2. The method for detecting road fog according to claim 1, characterized in that, The preset direction is the vertical direction from bottom to top on the road surface area image.
3. The method for detecting road fog according to claim 2, characterized in that, The step of determining whether the sharpness of each segmented image decreases monotonically in the preset direction includes: Obtain the non-road area in the first image of the front of the vehicle, wherein the non-road area refers to the area outside the road surface area image in the first image of the front of the vehicle; The non-road surface area is converted to grayscale to obtain a non-road surface grayscale image; Determine whether the proportion of the first target pixel in the non-road grayscale image exceeds a first preset proportion, wherein the first target pixel is a pixel in the non-road grayscale image whose grayscale value is greater than the first preset grayscale value; When the proportion of the first target pixel in the non-road grayscale image exceeds the first preset proportion, it is determined whether the sharpness of each segmented image decreases monotonically in the preset direction.
4. The method for detecting road fog according to claim 1, characterized in that, The identification of the road surface area image in the image ahead of the first vehicle includes: Identify multiple lane lines in the image ahead of the first vehicle; Obtain the vanishing points of the multiple lane lines; The area enclosed by the multiple lane lines and the vanishing point in the image ahead of the first vehicle is defined as the road surface area image.
5. The method for detecting road fog according to claim 4, characterized in that, The identification of multiple lane lines in the image ahead of the first vehicle includes: The image of the front of the first vehicle is converted to grayscale to obtain a grayscale image of the front of the vehicle; Determine whether the proportion of the second target pixel in the grayscale image in front of the vehicle exceeds the second preset proportion, wherein the second target pixel is a pixel in the grayscale image in front of the vehicle whose grayscale value is less than the second preset grayscale value; If the proportion of the second target pixel in the grayscale image in front of the vehicle does not exceed the second preset proportion, then multiple lane lines in the image in front of the first vehicle are identified.
6. The method for detecting road fog according to claim 1, characterized in that, The acquisition of the first vehicle front image captured by the target inspection vehicle includes: Obtain the current location of the target inspection vehicle; Based on the current location of the target inspection vehicle, determine whether the target inspection vehicle is located in the preset road area; When the target inspection vehicle is located in a preset road area, a first image of the front of the vehicle taken by the target inspection vehicle is acquired.
7. The method for detecting road fog according to claim 1, characterized in that, When there are two adjacent segmented images whose sharpness difference is greater than a preset difference, it is determined that fog has been detected in the image in front of the first vehicle. Then, the process includes: Acquire at least one image of the front of a second vehicle taken by the target inspection vehicle within a preset time period after taking the image of the front of the first vehicle; Perform road fog detection on the front image of the at least one second vehicle; When the proportion of vehicles in front of the first vehicle and the first vehicle front image that detects fog reaches a third preset percentage, it is determined that fog occurred on the road where the target inspection vehicle was taking the first vehicle front image.
8. A detection device for road fog, characterized in that, The road fog detection device includes: The acquisition unit is used to acquire the first image of the front of the target inspection vehicle captured by the vehicle. The recognition unit is used to recognize the road surface area image in the first vehicle front image; A segmentation unit is used to segment the road surface area image in a preset direction to obtain at least two segmented images arranged sequentially along the preset direction, wherein the preset direction is different from the horizontal direction of the road surface area image; A sharpness detection unit is used to perform sharpness detection on the at least two segmented images to obtain the sharpness of each segmented image; The segmentation unit is also used to determine whether the sharpness of each segmented image decreases monotonically in the preset direction. When the sharpness of each segmented image decreases monotonically in the preset direction, the unit calculates the sharpness difference between two adjacent segmented images in each segmented image. The determining unit is used to determine that fog is detected in the first vehicle front image when there are two adjacent segmented images with a sharpness difference greater than a preset difference.
9. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the method for detecting road fog as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It contains a computer program that is loaded by a processor to perform the steps of the method for detecting road fog as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Intelligent radiation fog identifying and early warning method and apparatus
CN106254827A
Image processing method and related product
CN110136091A