Image processing method, device, equipment and medium
By performing specific processing and classification model identification of images collected by image acquisition equipment, the problem of inaccurate detection of high beams in complex environments such as rainy nights is solved, and higher detection accuracy is achieved.
Patent Information
- Application Number
- CN202210517329.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-05-12
AI Technical Summary
The problem of inaccurate detection of high beam lights in complex environments such as rainy nights.
By processing the images acquired by the image acquisition device, it includes determining the average value and the second maximum value of the channel value of each pixel point, and performing second-order Laplace filtering, obtaining the reflective component operation value, determining the filtered pixel value, and inputting it into the pre-trained classification model for high beam recognition.
Effectively remove interference from reflected light, improving the accuracy of vehicle high beam detection, especially in complex environments such as rainy nights.
Smart Images

Figure CN114882451B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of intelligent transportation technology, and in particular to an image processing method, device, equipment and medium. Background Art
[0002] With the rapid development of science and technology, vehicles have brought convenience to people's lives, but also caused a series of safety hazards. According to the analysis of traffic accident data over the years, accidents caused by vehicles with high beams on account for a large proportion of nighttime traffic accidents. Turning on high beams at night can cause drivers to be blinded instantly and have reduced perception, which has become a major hidden danger of nighttime road traffic accidents. High beam detection of vehicles at night has become an indispensable part of the intelligent traffic control system.
[0003] The existing technology mainly calculates the binary connected domain of the area where the headlights are located in the collected image containing the vehicle to determine whether the vehicle's high beam is turned on. This method is only suitable for high beam detection in simple scenes. In complex environments such as rainy nights, there will be diffuse emission and reflected light, which will cause inaccurate high beam detection. Summary of the invention
[0004] The present invention provides an image processing method, device, equipment and medium, which are used to solve the problem of inaccurate detection of whether a vehicle's high beam is turned on under complex conditions such as rainy nights.
[0005] The present invention provides an image processing method, the method comprising:
[0006] A first image captured by an image acquisition device is acquired. If it is recognized that a vehicle is included in the first image, for each pixel point in the first image, each pixel point is sequentially used as a pixel point to be processed, and the following operations are performed: an average value and a second maximum value of a pixel value corresponding to each channel of the pixel point are determined, and a second-order Laplace filter is performed on the pixel value of each channel to acquire a reflection component operation value of each channel, and a first maximum value of the reflection component operation value of each channel is determined; based on the pixel value of each channel, the average value, the first maximum value, and the second maximum value, a filtered pixel value corresponding to each channel of the pixel point is determined;
[0007] The first image after pixel value filtering is input into a pre-trained classification model to identify whether the high beam of the vehicle is turned on in the first image after pixel value filtering.
[0008] Furthermore, after determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value and the second maximum value, the method further includes:
[0009] The filtered pixel value corresponding to each channel of the pixel point is processed by using a dark channel algorithm to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each channel of the pixel point;
[0010] According to the filtered pixel value corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance, the processed pixel value corresponding to each channel of the pixel point is determined.
[0011] Further, the acquiring of the first image acquired by the image acquisition device comprises:
[0012] When it is detected that the vehicle passes through a preset high beam detection line, a first image captured by an image capture device is acquired.
[0013] Further, determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value includes:
[0014] Determine a ratio value according to the first maximum value and the average value;
[0015] Determine a difference between the second maximum value and the ratio value to determine a second difference value;
[0016] According to the difference between the pixel value of each channel and the second difference value, the filtered pixel value corresponding to each channel of the pixel point is determined.
[0017] Further, determining the ratio value according to the first maximum value and the average value includes:
[0018] Calculating a sum of the pixel values of each channel, calculating a product of the sum and the first maximum value, and determining a first difference between the product and the average value;
[0019] A ratio value is determined according to the first difference and the first maximum value.
[0020] Furthermore, the method further comprises:
[0021] If it is recognized that the high beam is on, when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, the image acquisition device is controlled to turn on the exposure light, and a second image captured by the image acquisition device is acquired, and the identification information of the vehicle is acquired based on the second image and a pre-trained vehicle attribute recognition module.
[0022] The present invention provides an image processing device, the device comprising:
[0023] An acquisition module, used to acquire a first image acquired by an image acquisition device;
[0024] A determination module, for, if it is recognized that the first image contains a vehicle, for each pixel point in the first image, taking each pixel point in turn as a pixel point to be processed, and performing the following operations: determining an average value and a second maximum value of a pixel value corresponding to the pixel point in each channel, performing a second-order Laplace filter on the pixel value of each channel, obtaining a reflection component operation value of each channel, and determining a first maximum value of the reflection component operation value of each channel; determining a filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value;
[0025] The first recognition module is used to input the first image after pixel value filtering into a pre-trained classification model to identify whether the high beam of the vehicle is turned on in the first image after pixel value filtering.
[0026] Furthermore, the determination module is also used to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each pixel point by using a dark channel algorithm for the filtered pixel values corresponding to each channel of the pixel point; and determine the processed pixel value corresponding to each channel of the pixel point based on the filtered pixel values corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance.
[0027] Furthermore, the device also includes:
[0028] The second recognition module is used to control the image acquisition device to turn on the exposure light if it is recognized that the high beam is on, and to obtain the second image captured by the image acquisition device when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, and to obtain the identification information of the vehicle based on the second image and the pre-trained vehicle attribute recognition module.
[0029] Furthermore, the acquisition module is specifically configured to acquire a first image captured by an image acquisition device when it is detected that a vehicle passes through a preset high beam detection line.
[0030] Further, the determination module is specifically used to calculate the sum of the pixel values of each channel, calculate the product of the sum and the first maximum value, and determine a first difference between the product and the average value;
[0031] Determine a ratio value according to the first difference and the first maximum value;
[0032] Determine a difference between the second maximum value and the ratio value to determine a second difference value;
[0033] According to the difference between the pixel value of each channel and the second difference value, the filtered pixel value corresponding to each channel of the pixel point is determined.
[0034] The present invention provides an electronic device, which comprises at least a processor and a memory, wherein the processor is used to implement the steps of any one of the above-mentioned image processing methods when executing a computer program stored in the memory.
[0035] The present invention provides a computer-readable storage medium storing a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device executes the steps of any one of the above-mentioned image processing methods.
[0036] The embodiment of the present invention provides an image processing method, apparatus, device and medium. In the method, based on the acquired first image, if a vehicle is identified to be contained therein, the average value and the second maximum value of the pixel value corresponding to each channel of the pixel point are determined according to the pixel value corresponding to each channel of each pixel point of the first image, and the pixel value of each channel is subjected to second-order Laplace filtering, the reflection component operation value of each channel is obtained, the first maximum value of the reflection component operation value of each channel is determined, and the filtered pixel value corresponding to each channel of the pixel point is determined according to the pixel value, the average value, the first maximum value and the second maximum value of each channel; the first image after the pixel value filtering is input into a pre-trained classification model to identify whether the high beam of the vehicle in the first image after the pixel value filtering is turned on. In the embodiment of the present invention, the second-order Laplace filtering is performed on the pixel value corresponding to each channel of each pixel point in the first image containing the vehicle, the reflection component operation value of each channel of the pixel point is obtained, and the filtered pixel value corresponding to each channel of the pixel point is determined according to the reflection component operation value of each channel and the pixel value of each channel, so that the interference of the reflected light in the first image can be removed, and the high beam of the vehicle in the first image after the pixel value filtering is accurately identified. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0038] Figure 1 A schematic diagram of an image processing method provided by an embodiment of the present invention;
[0039] Figure 2 A schematic diagram of a target detection process provided by an embodiment of the present invention;
[0040] Figure 3 An example diagram of a complex light source of a vehicle on a rainy night provided by an embodiment of the present invention;
[0041] Figure 4 A schematic diagram of a high beam detection line and a vehicle attribute recognition line provided in an embodiment of the present invention;
[0042] Figure 5 A schematic diagram of the structure of an image processing device provided by an embodiment of the present invention;
[0043] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0045] It should be noted that the brief description of the terms in the present invention is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of the present invention. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0046] The terms "first", "second", "third", etc. in the specification and claims of the present invention and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0047] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0048] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.
[0049] The preferred embodiments of the present invention are described below in conjunction with the drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention. In addition, the embodiments of the present invention and the features in the embodiments may be combined with each other if there is no conflict.
[0050] An embodiment of the present invention provides an image processing method, apparatus, device and medium. In the method, a first image captured by an image acquisition device is obtained. If a vehicle is identified as being included in the first image, for each pixel point in the first image, each pixel point is sequentially used as a pixel point to be processed, and the following operations are performed: the average value and the second maximum value of the pixel value corresponding to each channel of the pixel point are determined, and the pixel value of each channel is subjected to a second-order Laplace filter to obtain a reflection component operation value of each channel, and the first maximum value of the reflection component operation value of each channel is determined; based on the pixel value of each channel, the average value, the first maximum value and the second maximum value, the filtered pixel value corresponding to each channel of the pixel point is determined; the first image after pixel value filtering is input into a pre-trained classification model to identify whether the high beam of the vehicle in the first image after pixel value filtering is turned on.
[0051] Embodiment 1:
[0052] In order to improve the accuracy of detecting whether a high beam is turned on, an embodiment of the present invention provides an image processing method, device, equipment and medium.
[0053] Figure 1 A schematic diagram of an image processing method provided by an embodiment of the present invention, the process includes the following steps:
[0054] S101: Acquire a first image captured by an image acquisition device.
[0055] The image processing method provided by the embodiment of the present invention is applied to an electronic device, which may be an image acquisition device, a PC, a server, or other device.
[0056] The image processing process is described in detail below by taking the electronic device as an image acquisition device as an example.
[0057] In order to solve the problem of inaccurate high beam detection caused by complex reflected light such as rainy nights, and to accurately identify whether the high beam of the vehicle is on, it is first necessary to obtain a first image containing the vehicle. In order to obtain the first image containing the vehicle, after the image is collected, the image can be detected to detect whether the image contains a vehicle. When it is recognized that the image contains a vehicle, the image is used as the first image.
[0058] Specifically, the vehicle target detection model of the deep algorithm can be used to perform target detection on the image captured by the image acquisition device to determine whether the detected target is a vehicle. The vehicle target detection model is not limited to the anchor-based detector algorithm in target detection, for example, it can be a single neural network (You Only Look Once, YOLO), a model that uses a single deep neural network to predict objects in an image (Single Shot MultiBox Detectorz, SSD), a candidate region convolutional network (Region CNN, RCNN), etc., or it can also be detected using another anchor-free detector algorithm, specifically including center point network (CenterNet), corner network (CornerNet) and other algorithms.
[0059] In the embodiment of the present invention, a vehicle target detection model is used to perform target detection based on the CenterNet algorithm. Figure 2 A schematic diagram of a target detection process provided in an embodiment of the present invention, wherein an image captured by an image acquisition device is input into a pre-trained vehicle target detection model, wherein the backbone network is a residual neural network (resnet) + a center pooling network, and the encoding-decoding (encode-decode) is a key point heat map encoding-decoding regression network, the center point position Tc of the vehicle in the image and the width Tw and height Th of the body frame are obtained, and an image marked with a vehicle target frame is output, thereby determining that the image contains a vehicle.
[0060] In order to improve the accuracy of high beam detection, after obtaining a first image containing a vehicle, if the first image is a red, green and blue (RGB) image, subsequent processing is directly performed based on the first image; if the first image is not an RGB image, the first image is converted into an RGB image.
[0061] S102: If it is recognized that the first image contains a vehicle, for each pixel point in the first image, each pixel point is taken as a pixel point to be processed in turn, and the following operations are performed: the average value and the second maximum value of the pixel value corresponding to each channel of the pixel point are determined, and the pixel value of each channel is subjected to a second-order Laplace filter to obtain the reflection component operation value of each channel, and the first maximum value of the reflection component operation value of each channel is determined; based on the pixel value of each channel, the average value, the first maximum value and the second maximum value, the filtered pixel value corresponding to each channel of the pixel point is determined.
[0062] After the first image is converted into an RGB image, sub-images of the three channels R, G, and B will be obtained. For each pixel, the pixel value corresponding to the pixel in the sub-image of each channel can be obtained, and the average pixel value of the pixel can be determined based on each pixel value.
[0063] In addition, after the pixel value corresponding to the pixel point in the sub-image of each channel is obtained, the pixel value of each channel is subjected to a second-order Laplace filter to obtain the reflection component operation value of each channel corresponding to the pixel point. After the reflection component operation value of each channel corresponding to each pixel point is obtained, for each pixel point, according to the reflection component operation value of each channel corresponding to the pixel point, the sum of the reflection component operation values of each channel corresponding to the pixel point can be determined, and the ratio of the maximum value of the reflection component operation values of each channel to the sum is determined as the first maximum value. In addition, for each pixel point, according to the pixel value corresponding to the pixel point in the sub-image of each channel, the largest pixel value is used as the second maximum value of the pixel value of each channel.
[0064] With respect to the pixel value of each channel of each pixel point, the average value of the pixel value of the pixel point, the first maximum value and the second maximum value, a filtered pixel value corresponding to each channel of the pixel point is determined.
[0065] S103: Inputting the first image after pixel value filtering into a pre-trained classification model to identify whether the high beam of the vehicle in the first image after pixel value filtering is turned on.
[0066] After filtering the pixel value of each channel of each pixel point in the RGB image of the first image in the above manner, that is, after processing the pixel value of each channel of the pixel point in the above manner, a processed RGB image can be obtained, and according to the pixel value of each channel of the pixel point in the processed RGB image, the processed first image of each pixel point is obtained.
[0067] The processed first image is input into the pre-trained classification model, and the high beam is recognized through the pre-trained classification model to determine whether the vehicle in the first image is in the high beam on state. If the confidence level of the high beam on state is greater than the set threshold, the high beam state of the motor vehicle is output as on. The confidence level can be a value between 0-100, and the set threshold can be 70. If the confidence level of the high beam on state is greater than 70, the high beam state of the motor vehicle is output as on. Specifically, the classification model can be a deep learning model, such as a CNN classification model. The training process of the classification model can adopt existing technology, which will not be repeated here.
[0068] In an embodiment of the present invention, based on a first image captured by an image acquisition device, a second-order Laplace filter is performed on the pixel values corresponding to the three channels R, G, and B of each pixel point in the first image containing the vehicle, and the reflection component operation value of each channel corresponding to the pixel point is obtained. According to the reflection component operation value of each channel and the pixel value of each channel, the filtered pixel value corresponding to each channel of the pixel point is determined, thereby removing the interference of the reflected light in the first image and accurately identifying whether the high beam of the vehicle is turned on in the first image after the pixel value is filtered.
[0069] Embodiment 2:
[0070] In order to further improve the accuracy of high beam recognition, based on the above embodiment, in an embodiment of the present invention, after determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value and the second maximum value, the method further includes:
[0071] The filtered pixel value corresponding to each channel of the pixel point is processed by using a dark channel algorithm to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each channel of the pixel point;
[0072] According to the filtered pixel value corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance, the processed pixel value corresponding to each channel of the pixel point is determined.
[0073] Because the complex environment of rainy nights will produce a lot of complex reflected light, such as ambient light and atmospheric light, Figure 3 An example diagram of a complex light source of a vehicle on a rainy night provided by an embodiment of the present invention is shown in FIG. Figure 3 As shown, on rainy nights, in addition to diffuse reflection and strong reflection from the road surface, ambient light and atmospheric light will also interfere with high beam detection, resulting in inaccurate high beam detection. Therefore, in order to remove all light other than the high beam as much as possible and improve the accuracy of high beam recognition, in an embodiment of the present invention, the pixel values corresponding to the three channels of R, G, and B of each pixel point in the processed first image are processed to remove ambient light and atmospheric light.
[0074] Specifically, in an embodiment of the present invention, the pixel values corresponding to the three channels R, G, and B of each pixel point in the first image can be processed according to the atmospheric scattering model and the pixel values corresponding to the three channels R, G, and B of each pixel point in the processed first image to obtain the first image after removing ambient light and atmospheric light.
[0075] According to the atmospheric scattering model, the pixel values corresponding to the three channels of R, G, and B of each pixel in the processed first image are subjected to the first atmospheric light and ambient light removal processing, and the following formula can be used:
[0076]
[0077] Wherein, F(x, y) is the pixel value of the pixel point with coordinates (x, y) in the first image after removing the ambient light and atmospheric light, O(x, y) is the pixel value corresponding to the pixel point in the processed first image, and O ∞ (x, y) is the brightness value of the atmospheric light corresponding to the pixel point in the processed first image, A(x, y) is the brightness value of the ambient light corresponding to the pixel point in the processed first image, and τ(x, y) is the atmospheric transmittance corresponding to the pixel point in the processed first image.
[0078] In order to obtain the first image after removing the ambient light and the atmospheric light, it is necessary to calculate the brightness value O of the atmospheric light corresponding to the pixel point. ∞ (x, y), the brightness value A(x, y) of the ambient light, and the atmospheric transmittance τ(x, y) are estimated. According to the dark channel algorithm, the dark channel value O(x, y) corresponding to each channel of the pixel point in the processed first image is calculated. dark (x,y), specifically:
[0079]
[0080]
[0081] Wherein, (x, y) represents the coordinates of the pixel point, Y, that is, Ω(x, y), represents the central neighborhood range of the pixel point in the processed first image, which is set to 7 in this embodiment, and C represents the C channel corresponding to each pixel point in the processed first image, and the C channel specifically includes R, G, and B channels; C (Y) represents the pixel value corresponding to each pixel in the C channel within the central neighborhood of the pixel in the processed first image, O C (Y) specifically includes O r (Y), O g (Y) and O b (Y).
[0082] Count the dark channel value O of each pixel dark (x, y), sort the dark channel values from large to small, and take the average of the top 0.5% of the dark channel values as the brightness value of the atmospheric light O ∞ (x,y). In order to prevent the loss of detailed texture in the distant depth of field area, the atmospheric transmittance τ(x,y) is processed by guided filtering. Specifically:
[0083]
[0084] Among them, ε is the guiding filter processing parameter, and the value is 0.95 according to the experiment. According to the brightness value of the atmospheric light corresponding to the pixel point O ∞ (x, y), the brightness value A(x, y) of the ambient light and the atmospheric transmittance τ(x, y), and the pixel value F(x, y) of each channel corresponding to the pixel point processed by the first processing is obtained.
[0085] In order to suppress the strong halo in the first image after the ambient light and atmospheric light are removed, the pixel value F(x, y) corresponding to the three channels of R, G, and B of each pixel point in the first image after the first processing of removing the ambient light and atmospheric light is subjected to a second atmospheric light and ambient light removal process to obtain the pixel value F′(x, y) corresponding to each channel of the finally processed pixel point.
[0086] Specifically, the following formula is used to perform the second atmospheric light and ambient light removal process:
[0087] F′(x,y)=F(x,y)-(O ∞ (x,y)+A(x,y))
[0088] Among them, F(x, y) is the pixel value of each channel corresponding to the pixel point after the ambient light and atmospheric light are removed for the first time, O ∞ (x, y) is the brightness value of the atmospheric light corresponding to the pixel point in the processed first image, and A(x, y) is the brightness value of the ambient light corresponding to the pixel point in the processed first image.
[0089] The embodiment of the present invention removes ambient light and atmospheric light from the filtered pixel values corresponding to each channel of the pixel point, thereby eliminating the interference of ambient light and atmospheric light on high beam detection on rainy nights, and more accurately identifying whether the high beam of the vehicle is turned on, thereby solving the problem of inaccurate high beam detection caused by complex light such as on rainy nights.
[0090] Embodiment 3:
[0091] In order to further improve the accuracy of high beam recognition, on the basis of the above embodiments, in an embodiment of the present invention, the first image acquired by the image acquisition device includes:
[0092] When it is detected that the vehicle passes through a preset high beam detection line, a first image captured by an image capture device is acquired.
[0093] In a possible implementation, in order to further improve the accuracy of high beam recognition, avoid the image acquisition device from collecting too many useless images, and avoid wasting resources, a high beam detection line can be pre-set on the road according to the installation position of the image acquisition device. Because the installation position of the image acquisition device is fixed, the position of the pre-set high beam detection line on the road is fixed, so the position of the high beam detection line in the image collected by the image acquisition device is also fixed. Therefore, the image collected by the image acquisition device can be obtained, and according to the position of the vehicle in the image and the position of the high beam detection line, it can be detected whether the vehicle passes through the high beam detection line. If it is detected that the vehicle in the image passes through the preset high beam detection line, the image can be used as the first image, or the image acquisition device re-collects the image and the collected image is used as the first image.
[0094] Embodiment 4:
[0095] In order to further improve the accuracy of high beam recognition, on the basis of the above embodiments, in an embodiment of the present invention, determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value and the second maximum value includes:
[0096] Determine a ratio value based on the first maximum value and the average value; determine the difference between the second maximum value and the ratio value to determine a second difference value; and determine the filtered pixel value corresponding to each channel of the pixel point based on the difference between the pixel value of each channel and the second difference value.
[0097] In an embodiment of the present invention, after the first maximum value, the second maximum value and the average value are determined, when determining the pixel value of the pixel point after filtering, a ratio value can be determined based on the first maximum value and the average value; a second difference value can be determined based on the difference between the second maximum value and the ratio value; and then, based on the difference between the pixel value corresponding to the pixel point in the sub-image of each channel and the second difference value, the filtered pixel value corresponding to the pixel point in each channel is determined.
[0098] Specifically, the filtered pixel value corresponding to each channel of the pixel point can be determined by the following formula:
[0099] O(x,y)=I(x,y)-M(x,y)
[0100] Wherein, I(x, y) is the pixel value corresponding to each channel of R, G, and B of the pixel point with coordinates (x, y) of the determined first image, O(x, y) is the filtered pixel value corresponding to each channel of the pixel point, and M(x, y) represents the corresponding second difference value. The second difference value can be determined according to the difference between the second maximum value and the ratio value:
[0101] M(x,y)=I max(x,y)-R(x,y)
[0102] Among them, R(x,y) is the ratio value, I r (x,y),I g (x,y),I b (x, y) are the pixel values of the R, G, and B channels corresponding to the pixel point with coordinates (x, y) in the first image, and I(x, y) represents the average value of the pixel value of each channel corresponding to the pixel point with coordinates (x, y). max (x, y) represents the second maximum pixel value of each channel corresponding to the pixel point with coordinates (x, y), which can be obtained by the following formula:
[0103] I max (x,y)={I r (x,y),I g (x,y),I b (x,y)} max
[0104] In order to further improve the accuracy of high beam recognition, based on the above embodiments, in an embodiment of the present invention, determining the ratio value according to the first maximum value and the average value includes:
[0105] The sum of the pixel values of each channel is calculated, and the product of the sum and the first maximum value is calculated to determine a first difference between the product and the average value; the first difference and the first maximum value are used to determine a ratio.
[0106] In the embodiment of the present invention, after the first maximum value and the average value are determined, when determining the ratio value, the sum of the pixel values of each channel can be calculated according to the pixel value corresponding to the pixel point in the sub-image of each channel, and the product of the sum value and the first maximum value can be calculated to determine the first difference between the product and the average value of the pixel value. Based on the first difference and the first maximum value, the ratio value of the first difference to the first maximum value can be determined.
[0107] Specifically, the ratio value can be determined by the following formula:
[0108]
[0109] Among them, α(x,y) represents the corresponding first maximum value of the pixel point with coordinates (x,y), which can be obtained by the following formula:
[0110]
[0111] Among them, d(x,y) represents the reflection component operation value of each channel corresponding to the pixel point with coordinates (x,y), and the reflection component operation value of each channel is calculated by the following second-order Laplace filter formula:
[0112] d(x,y)=I(x+1,y)+I(x-1,y)+I(x,y+1)+I(x,y-1)-4I(x,y)
[0113] According to the above formula, the reflection component operation value d corresponding to each channel of the pixel point is obtained respectively. r (x,y),d g (x,y),d b (x,y), max{d r (x,y),d g (x,y),d b (x,y)} represents the maximum reflection component operation value.
[0114] In the embodiment of the present invention, by calculating the sum of the pixel values of each channel, and calculating the product of the sum and the first maximum value, determining the first difference between the product and the average value; determining the ratio value according to the first difference and the first maximum value, and determining the second difference between the second maximum value and the ratio value; and determining the filtered pixel value corresponding to each channel of the pixel point according to the difference between the pixel value of each channel and the second difference. In this way, the interference of the reflected light in the first image can be removed, and whether the high beam of the vehicle is turned on in the first image after the pixel value is filtered can be accurately identified.
[0115] Embodiment 5:
[0116] After accurately determining the vehicle with the high beam on, in order to determine which vehicle has violated the rules, based on the above embodiments, in the embodiment of the present invention, the method further includes:
[0117] If it is recognized that the high beam is on, when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, the image acquisition device is controlled to turn on the exposure light, and a second image captured by the image acquisition device is acquired, and the identification information of the vehicle is acquired based on the second image and a pre-trained vehicle attribute recognition module.
[0118] In one possible implementation, after accurately determining the vehicle with the high beam on, in order to determine which vehicle has violated the rules, the vehicle attributes can be identified, and then captured and reported. Because the vehicle has the high beam on, it is difficult for the image acquisition device to obtain a clear image of the vehicle body, and thus it is impossible to accurately identify the vehicle attributes. The embodiment of the present invention uses a flashing light to suppress the vehicle high beam, so that a clear image of the vehicle body can be obtained. Therefore, when it is detected that the vehicle has the high beam on, the image acquisition device is controlled to turn on the exposure light, and the image captured by the image acquisition device is obtained, and the image is used as the second image. In order to identify the attributes of the vehicle, a vehicle attribute recognition model can be pre-set in the image acquisition device.
[0119] Specifically, the vehicle attribute recognition model includes a license plate recognition model and a vehicle model recognition model; wherein, the license plate detection method of the license plate recognition model is not limited to anchor-base including YOLO, SSD, RCNN series, etc., or anchor-free including CenterNet, CornerNet and other methods. The license plate recognition module can recognize the license plate color, license plate type and license plate number respectively, and output the license plate color, license plate type and license plate number, wherein the license plate color can be yellow, gradient green, blue, white, etc. The vehicle model recognition method of the vehicle model recognition model adopts the CNN network classification method, and the vehicle model recognition model can output the vehicle type, and the vehicle type can be taxi, small truck, medium truck, large truck, small passenger car, medium bus, large bus, two-wheeled vehicle, bus, sedan, pickup truck, special vehicle, etc. The specific vehicle attribute recognition process belongs to the prior art and will not be repeated here.
[0120] Figure 4 A schematic diagram of a high beam detection line and a vehicle attribute recognition line provided in an embodiment of the present invention is shown in FIG. Figure 4 As shown, a high beam detection line and a vehicle attribute recognition line are set on the lane line, and the high beam detection line is farther from the image acquisition device, while the vehicle attribute recognition line is closer to the image acquisition device. When a vehicle in the lane line passes through the preset high beam detection line, a front image containing the vehicle's high beam can be obtained, so that the vehicle's high beam can be recognized more accurately.
[0121] Embodiment 6:
[0122] Figure 5 A schematic diagram of the structure of an image processing device provided by an embodiment of the present invention, the device comprising:
[0123] An acquisition module 501 is used to acquire a first image acquired by an image acquisition device;
[0124] The determination module 502 is used for, if it is recognized that the first image contains a vehicle, for each pixel point in the first image, taking each pixel point in turn as a pixel point to be processed, and performing the following operations: determining an average value and a second maximum value of a pixel value corresponding to the pixel point in each channel, performing a second-order Laplace filter on the pixel value of each channel, obtaining a reflection component operation value of each channel, and determining a first maximum value of the reflection component operation value of each channel; determining a filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value;
[0125] The first recognition module 503 is used to input the first image after pixel value filtering into the pre-trained classification model to identify whether the high beam of the vehicle is turned on in the first image after pixel value filtering.
[0126] In a possible implementation, the determination module 502 is also used to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each pixel point by using a dark channel algorithm for the filtered pixel values corresponding to each channel of the pixel point; and determine the processed pixel value corresponding to each channel of the pixel point based on the filtered pixel values corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance.
[0127] In a possible implementation, the device further includes:
[0128] The second recognition module 504 is used to control the image acquisition device to turn on the exposure light if it is recognized that the high beam is on, and to obtain the second image captured by the image acquisition device when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, and to obtain the identification information of the vehicle based on the second image and the pre-trained vehicle attribute recognition module.
[0129] In a possible implementation manner, the acquisition module 501 is specifically configured to acquire a first image captured by an image acquisition device when it is detected that a vehicle passes through a preset high beam detection line.
[0130] In a possible implementation, the determination module 502 is specifically used to calculate the sum of the pixel values of each channel, and calculate the product of the sum and the first maximum value, to determine a first difference between the product and the average value; determine a proportional value based on the first difference and the first maximum value; determine the difference between the second maximum value and the proportional value to determine a second difference; and determine the filtered pixel value corresponding to each channel of the pixel point based on the difference between the pixel value of each channel and the second difference.
[0131] Since the present invention can be based on the first image acquired, if a vehicle is identified in the image, a second-order Laplace filter is performed according to the pixel value corresponding to each channel of each pixel point of the image, and the reflection component operation value corresponding to each channel of each pixel point is obtained, and the first maximum value is determined according to the reflection component operation value, and the filtered pixel value corresponding to each channel of each pixel point is determined according to the reflection component operation value of each channel and the pixel value of each channel; the first image after the pixel value filtering is input into the pre-trained classification model to identify whether the high beam of the vehicle in the first image after the pixel value filtering is turned on. Thereby, the problem of inaccurate detection of whether the high beam of the vehicle is turned on in complex conditions such as rainy nights can be solved.
[0132] Embodiment 7:
[0133] Based on the above embodiments, some embodiments of the present invention further provide an electronic device, Figure 6 FIG. 1 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 6 As shown, it includes: a processor 601 , a communication interface 602 , a memory 603 and a communication bus 604 , wherein the processor 601 , the communication interface 602 , and the memory 603 communicate with each other via the communication bus 604 .
[0134] The memory 603 stores a computer program. When the program is executed by the processor 401, the processor 601 performs the following steps:
[0135] A first image captured by an image acquisition device is obtained. If it is recognized that a vehicle is included in the first image, for each pixel in the first image, each pixel is taken as a pixel to be processed in turn, and the following operations are performed: an average value and a second maximum value of the pixel value corresponding to the pixel in each channel are determined, and the pixel value of each channel is subjected to a second-order Laplace filter to obtain a reflection component operation value of each channel, and a first maximum value of the reflection component operation value of each channel is determined; based on the pixel value of each channel, the average value, the first maximum value, and the second maximum value, a filtered pixel value corresponding to each channel of the pixel is determined; the first image after pixel value filtering is input into a pre-trained classification model to identify whether the high beam of the vehicle in the first image after pixel value filtering is turned on.
[0136] Furthermore, the processor 601 is also used to process the filtered pixel values corresponding to each channel of the pixel point using a dark channel algorithm to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each channel of the pixel point; and determine the processed pixel values corresponding to each channel of the pixel point based on the filtered pixel values corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance.
[0137] Furthermore, the processor 601 is further configured to obtain a first image captured by an image capture device when it is detected that a vehicle passes through a preset high beam detection line.
[0138] Furthermore, the processor 601 is also used to calculate the sum of the pixel values of each channel, and calculate the product of the sum and the first maximum value, to determine a first difference between the product and the average value; determine a proportion value based on the first difference and the first maximum value; determine the difference between the second maximum value and the proportion value to determine a second difference; and determine the filtered pixel value corresponding to each channel of the pixel point based on the difference between the pixel value of each channel and the second difference.
[0139] Furthermore, the processor 601 is also used to control the image acquisition device to turn on the exposure light if it is recognized that the high beam is on, and to obtain a second image captured by the image acquisition device when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, and to obtain the identification information of the vehicle based on the second image and a pre-trained vehicle attribute recognition module.
[0140] The communication bus mentioned in the above server can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0141] The communication interface 602 is used for communication between the electronic device and other devices.
[0142] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0143] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.
[0144] Embodiment 8:
[0145] On the basis of the above embodiments, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program executable by an electronic device, and when the program is run on the electronic device, the electronic device implements the following steps when executing:
[0146] A first image captured by an image acquisition device is acquired. If it is recognized that the first image contains a vehicle, for each pixel point in the first image, each pixel point is sequentially used as a pixel point to be processed, and the following operations are performed: an average value and a second maximum value of a pixel value corresponding to the pixel point in each channel are determined, and a second-order Laplace filter is performed on the pixel value of each channel to acquire a reflection component operation value of each channel, and a first maximum value of the reflection component operation value of each channel is determined; based on the pixel value of each channel, the average value, the first maximum value, and the second maximum value, a filtered pixel value corresponding to each channel of the pixel point is determined;
[0147] The first image after pixel value filtering is input into a pre-trained classification model to identify whether the high beam of the vehicle is turned on in the first image after pixel value filtering.
[0148] Furthermore, after determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value, the method further includes:
[0149] The filtered pixel value corresponding to each channel of the pixel point is processed by using a dark channel algorithm to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each channel of the pixel point; the processed pixel value corresponding to each channel of the pixel point is determined according to the filtered pixel value corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance.
[0150] Further, the acquiring of the first image acquired by the image acquisition device comprises:
[0151] When it is detected that the vehicle passes through a preset high beam detection line, a first image captured by an image capture device is acquired.
[0152] Further, determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value includes:
[0153] Calculate the sum of the pixel values of each channel, and calculate the product of the sum and the first maximum value, determine the first difference between the product and the average value; determine the proportion value according to the first difference and the first maximum value; determine the difference between the second maximum value and the proportion value, and determine the second difference; determine the filtered pixel value corresponding to each channel of the pixel point according to the difference between the pixel value of each channel and the second difference.
[0154] Furthermore, the method further comprises:
[0155] If it is recognized that the high beam is on, when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, the image acquisition device is controlled to turn on the exposure light, and a second image captured by the image acquisition device is acquired, and the identification information of the vehicle is acquired based on the second image and a pre-trained vehicle attribute recognition module.
[0156] In an embodiment of the present invention, based on a first image captured by an image acquisition device, a second-order Laplace filter is performed on the pixel value corresponding to each channel of each pixel point in the first image containing the vehicle to obtain a reflection component operation value of each channel corresponding to each pixel point, and the filtered pixel value corresponding to each channel of each pixel point is determined based on the reflection component operation value of each channel and the pixel value of each channel, thereby removing interference from reflected light in the first image and accurately identifying whether the high beam of the vehicle is turned on in the first image after pixel value filtering.
[0157] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0158] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0159] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0160] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0161] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. An image processing method, characterized in that: The method comprises: A first image captured by an image acquisition device is acquired. If it is recognized that a vehicle is included in the first image, for each pixel point in the first image, each pixel point is sequentially used as a pixel point to be processed, and the following operations are performed: an average value and a second maximum value of a pixel value corresponding to each channel of the pixel point are determined, and a second-order Laplace filter is performed on the pixel value of each channel to acquire a reflection component operation value of each channel, and a first maximum value of the reflection component operation value of each channel is determined; based on the pixel value of each channel, the average value, the first maximum value, and the second maximum value, a filtered pixel value corresponding to each channel of the pixel point is determined; Inputting the first image after pixel value filtering into a pre-trained classification model to identify whether the high beam of the vehicle in the first image after pixel value filtering is turned on; The step of determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value includes: Determine a ratio value according to the first maximum value and the average value; determining a second difference value according to a difference between the second maximum value and the proportional value; Determine the filtered pixel value corresponding to each channel of the pixel point according to the difference between the pixel value of each channel and the second difference value; The determining of the ratio value according to the first maximum value and the average value comprises: Calculating a sum of the pixel values of each channel, calculating a product of the sum and the first maximum value, and determining a first difference between the product and the average value; A ratio value is determined according to the first difference and the first maximum value.
2. The method according to claim 1, characterized in that: After determining the filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value and the second maximum value, the method further includes: The filtered pixel value corresponding to each channel of the pixel point is processed by using a dark channel algorithm to determine the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance corresponding to each channel of the pixel point; According to the filtered pixel value corresponding to each channel of the pixel point, the brightness value of the atmospheric light, the brightness value of the ambient light and the atmospheric transmittance, the processed pixel value corresponding to each channel of the pixel point is determined.
3. The method according to claim 1, characterized in that The acquiring of a first image acquired by an image acquisition device comprises: When it is detected that the vehicle passes through a preset high beam detection line, a first image captured by an image capture device is acquired.
4. The method according to claim 1, characterized in that The method further comprises: If it is recognized that the high beam is on, when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, the image acquisition device is controlled to turn on the exposure light, and a second image captured by the image acquisition device is acquired, and the identification information of the vehicle is acquired based on the second image and a pre-trained vehicle attribute recognition module.
5. An image processing device, characterized in that: The device comprises: An acquisition module, used to acquire a first image acquired by an image acquisition device; A determination module, for, if it is recognized that the first image contains a vehicle, for each pixel point in the first image, taking each pixel point in turn as a pixel point to be processed, and performing the following operations: determining an average value and a second maximum value of a pixel value corresponding to the pixel point in each channel, and performing a second-order Laplace filter on the pixel value of each channel, obtaining a reflection component operation value of each channel, and determining a first maximum value of the reflection component operation value of each channel; determining a filtered pixel value corresponding to each channel of the pixel point according to the pixel value of each channel, the average value, the first maximum value, and the second maximum value; A first recognition module, used to input the first image after pixel value filtering into a pre-trained classification model, and recognize whether the high beam of the vehicle is turned on in the first image after pixel value filtering; The determination module is specifically used to determine a ratio value according to the first maximum value and the average value; determine a second difference value according to a difference between the second maximum value and the ratio value; and determine a filtered pixel value corresponding to each channel of the pixel point according to a difference between the pixel value of each channel and the second difference value; The determination module is specifically used to calculate the sum of the pixel values of each channel, and calculate the product of the sum and the first maximum value, determine the first difference between the product and the average value; and determine the proportion value according to the first difference and the first maximum value.
6. The device according to claim 5, characterized in that The device also includes: The second recognition module is used to control the image acquisition device to turn on the exposure light if it is recognized that the high beam is on, and to obtain the second image captured by the image acquisition device when it is recognized that the vehicle passes through a preset vehicle attribute recognition line, and to obtain the identification information of the vehicle based on the second image and the pre-trained vehicle attribute recognition module.
7. An electronic device, characterized in that: The electronic device comprises at least a processor and a memory, and the processor is used to implement the steps of an image processing method as described in any one of claims 1 to 4 when executing a computer program stored in the memory.
8. A computer-readable storage medium, characterized in that: It stores a computer program executable by an electronic device, and when the program runs on the electronic device, the electronic device executes the steps of an image processing method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
High beam detection method, device and equipment
CN111783573A