Signal lamp image generation method and device, electronic equipment and storage medium
By acquiring short-exposure and long-exposure images in low-light environments, analyzing pixel values to determine the fusion ratio, and generating traffic light images, the problems of abnormal traffic light edges and halos were solved, achieving natural transitions and quality improvement in traffic light images.
Patent Information
- Application Number
- CN202411172932.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-03-03
AI Technical Summary
Existing technologies cause traffic light shape distortion and large halo coverage under high exposure conditions, resulting in abnormal edges of the traffic lights and misjudging subsequent traffic light color enhancement. There is a lack of effective repair methods.
In low-light environments, short-exposure and long-exposure images are acquired. By analyzing the pixel values of the region of interest, the target fusion ratio is determined, and a traffic light image is generated, eliminating abnormal edges and weakening halos.
It effectively eliminates abnormal edges of traffic lights, smooths the brightness transition from the traffic light body to the halo area, and improves image quality.
Smart Images

Figure CN121603790A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, apparatus, electronic device, and storage medium for generating traffic light images. Background Technology
[0002] To meet the environmental protection needs at night, electronic police equipment needs to increase the shutter speed and gain to improve the brightness of the captured images. However, high exposure can cause the traffic lights to be severely overexposed, resulting in distorted shapes and large halo coverage areas.
[0003] In related technologies, the main strategy of fusion of long and short exposure frames is to restore the shape of traffic lights and weaken the halo. However, when the long exposure frame is severely overexposed and the difference between the long and short exposures is too large, it will cause abnormalities at the edges of the traffic lights in the fused frame. Figure 1 This is a schematic diagram illustrating abnormal signal light edges in a fused frame under overexposure conditions, as provided in related technologies. Figure 1 As shown, the white ring around the edge of the traffic light indicates an abnormal area. When anomalies appear at the edge of the traffic light in the merged frame, it can easily lead to misjudgment of subsequent traffic light color enhancement. Moreover, there is currently a lack of a simple and effective method to simultaneously repair abnormal white rings at the edge of the traffic light and weaken the halo, thereby ensuring a natural transition in the brightness of the traffic light area within the merged frame. Summary of the Invention
[0004] This invention provides a method, apparatus, electronic device, and storage medium for generating traffic light images. It can not only effectively eliminate abnormal edge areas of traffic lights in images, but also weaken the halo of traffic lights, so that the brightness of the traffic light body to the halo area in the image can transition smoothly and naturally.
[0005] According to one aspect of the present invention, a method for generating a traffic light image is provided, comprising:
[0006] When the light intensity of the environment where the monitoring equipment is located is determined to be less than the preset intensity, the short-exposure image and long-exposure image collected by the monitoring equipment are acquired.
[0007] Based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixels in the long exposure image, the target short exposure fusion ratio of the short exposure image at the pixel and the target long exposure fusion ratio of the long exposure image at the pixel are determined respectively; wherein, the region of interest is the region containing traffic lights;
[0008] The short-exposure image and the long-exposure image are fused according to the target short-exposure fusion ratio and the target long-exposure fusion ratio to generate a traffic light image.
[0009] According to another aspect of the present invention, a traffic light image generation apparatus is provided, comprising:
[0010] The image acquisition module is used to acquire short-exposure images and long-exposure images collected by the monitoring device when the light intensity of the environment where the monitoring device is located is less than a preset intensity.
[0011] The fusion ratio determination module is used to determine the target short exposure fusion ratio of the short exposure image at the pixel and the target long exposure fusion ratio of the long exposure image at the pixel based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixel in the long exposure image; wherein, the region of interest is the region containing traffic lights;
[0012] The traffic light image generation module is used to fuse the short exposure image and the long exposure image according to the target short exposure fusion ratio and the target long exposure fusion ratio to generate a traffic light image.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the traffic light image generation method according to any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the traffic light image generation method according to any embodiment of the present invention.
[0018] The traffic light image generation scheme of this invention, when the light intensity of the environment where the monitoring equipment is located is determined to be less than a preset intensity, acquires short-exposure images and long-exposure images collected by the monitoring equipment; based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short-exposure image and the pixel values of each RGB color channel of the corresponding pixels in the long-exposure image, respectively determine the target short-exposure fusion ratio of the short-exposure image at the pixel and the target long-exposure fusion ratio of the long-exposure image at the pixel; wherein, the region of interest is the region containing the traffic light; the short-exposure image and the long-exposure image are fused according to the target short-exposure fusion ratio and the target long-exposure fusion ratio to generate a traffic light image. The technical solution provided by this invention can not only effectively eliminate abnormal edge areas of the traffic light in the image, but also weaken the halo of the traffic light, so that the brightness of the traffic light body to the halo area in the image can transition smoothly and naturally.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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 the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of abnormal signal light edges in a fused frame under overexposure conditions, provided in related technologies;
[0022] Figure 2 This is a flowchart of a traffic light image generation method according to Embodiment 1 of the present invention;
[0023] Figure 3 This is a flowchart of a traffic light image generation method provided in Embodiment 2 of the present invention;
[0024] Figure 4 This is a schematic diagram illustrating the variation trend of pixel values of each RGB color channel in an image from the geometric center of a traffic light outwards in an embodiment of the present invention.
[0025] Figure 5 This is a schematic diagram of the intensity change trend of the fusion ratio adjustment in an image from the geometric center of a traffic light outwards in an embodiment of the present invention;
[0026] Figure 6 This is a rendering of a generated traffic light image provided by an embodiment of the present invention;
[0027] Figure 7 This is a schematic diagram of the structure of a traffic light image generation device according to Embodiment 3 of the present invention;
[0028] Figure 8 This is a schematic diagram of the structure of an electronic device that implements the traffic light image generation method of this invention. Detailed Implementation
[0029] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0030] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0031] In related technologies, a common approach is to fuse images based on a fusion ratio related to the distance of each pixel from the center of the traffic light, allowing for a natural transition in brightness across the fused frames. However, this method requires obtaining the distances of pixels in real space for standardized program settings. In other words, if cameras of the same model are installed in different locations—for example, at two intersections—the spatial distances between the cameras and their respective traffic lights will differ, resulting in different pixel distances within the traffic light's affected area. According to existing technologies, the parameters for each camera need to be set individually, which is time-consuming and labor-intensive. Furthermore, since traffic lights are actually objects with a shell, the processing method for pixels in the shell area should differ from that for pixels in the air area. Simply using distance mapping often leads to significant deviations in the fused image.
[0032] Example 1
[0033] Figure 2 This is a flowchart illustrating a traffic light image generation method according to Embodiment 1 of the present invention. This embodiment is applicable to situations involving the generation of traffic light images. The method can be executed by a traffic light image generation device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 2 As shown, the method includes:
[0034] S210. When it is determined that the light intensity of the environment where the monitoring equipment is located is less than the preset intensity, the short exposure image and long exposure image collected by the monitoring equipment are acquired.
[0035] In this embodiment of the invention, when the environment is at night or in rainy weather, it is determined that the light intensity of the environment where the monitoring device is located is less than a preset intensity. When the light intensity of the environment where the monitoring device is located is determined to be less than the preset intensity, the monitoring device is controlled to adjust exposure parameters, such as adjusting the exposure time, so that the monitoring device acquires images of traffic lights at different exposure times. The image acquired with the shorter exposure time is designated as the short exposure image, and the image acquired with the longer exposure time is designated as the long exposure image. It is understood that the exposure time of the short exposure image is shorter than the exposure time of the long exposure image. The short exposure image and the long exposure image are images containing the traffic lights; that is, the image of the traffic lights acquired with the shorter exposure time is the short exposure image, and the image of the traffic lights acquired with the longer exposure time is the long exposure image. It should be noted that this embodiment of the invention does not limit the shape and color state of the traffic lights. The traffic lights can be circular, arrow-shaped, or numerical. When acquiring the short exposure and long exposure images of the traffic lights, the traffic lights can be in a red, green, or yellow state.
[0036] S220. Based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixels in the long exposure image, determine the target short exposure fusion ratio of the short exposure image at the pixel and the target long exposure fusion ratio of the long exposure image at the pixel; wherein, the region of interest is the region containing traffic lights.
[0037] In this embodiment of the invention, a region within a specified range is obtained from both the short-exposure frame image and the long-exposure image as a region of interest (ROI), wherein the ROI is a region containing a traffic light. For example, when the traffic light is circular and the ROI is a circular region containing the traffic light with its center as the center, the pixel features within the ROI are likely to be symmetrically distributed. For instance, the pixel features may only be related to their distance from the center. Therefore, based on the pixel values of each RGB color channel of each pixel within any quarter-circle region or any one of the upper, lower, left, or right semicircles of the ROI in the short-exposure image, and the pixel values of each RGB color channel of the corresponding pixel in the long-exposure image, the target short-exposure fusion ratio of the short-exposure image and the target long-exposure fusion ratio of the long-exposure image at the pixel point can be determined respectively. The advantage of this setting is that it can effectively improve the calculation efficiency of the target short-exposure fusion ratio and the target long-exposure fusion ratio. For example, when the traffic light is a digital traffic light, the region of interest containing the traffic light is an asymmetric region. In this case, the target short exposure fusion ratio of the short exposure image and the target long exposure fusion ratio of the long exposure image at the pixel can be determined based on the pixel values of each RGB color channel of each pixel in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixel in the long exposure image.
[0038] Taking the region of interest (ROI) containing traffic lights as an example of an asymmetric region, we iterate through each pixel of the ROI in both the short-exposure and long-exposure images, separating the red, green, and blue (RGB) color channels of the pixels in both images. This determines the pixel value of each RGB color channel in the short-exposure image and the long-exposure image, which in turn determines the pixel value of the R color channel of the pixels in the short-exposure image. short The pixel value of the G color channel. short The pixel value of the B color channel. short And the pixel value R of the R color channel of the long exposure image. long The pixel value of the G color channel. long The pixel value of the B color channel. long Then, based on the pixel values of each RGB color channel of each pixel in the short-exposure image (R... short B short G short ) and the pixel values of each color channel (R) of the corresponding pixel in the long exposure image. long B long G longThe target short exposure fusion ratio of the short exposure image and the target long exposure fusion ratio of the long exposure image at the same pixel are determined respectively.
[0039] For example, for each pixel in the region of interest of a short-exposure image, based on the pixel value of each color channel of the RGB color channel of each pixel in the short-exposure image (R... short B short G short When fusing short-exposure and long-exposure images, determine the initial short-exposure fusion ratio of the short-exposure image and the initial long-exposure fusion ratio of the long-exposure image at that pixel. Then, based on the pixel value (R) of each color channel of the RGB color channel of the corresponding pixel in the long-exposure image... long B long G long The initial short-exposure fusion ratio and the initial long-exposure fusion ratio are adjusted separately to generate the target short-exposure fusion ratio and the target long-exposure fusion ratio. It can be understood that, following the above method, the target short-exposure fusion ratio for each pixel in the region of interest in the short-exposure image, and the target long-exposure fusion ratio for each pixel in the region of interest in the long-exposure image, can be determined when fusing short-exposure and long-exposure images.
[0040] S230. The short exposure image and the long exposure image are fused according to the target short exposure fusion ratio and the target long exposure fusion ratio to generate a traffic light image.
[0041] In this embodiment of the invention, each pixel in the region of interest of the short exposure image and the long exposure image is traversed, and the short exposure image and the long exposure image are fused according to the target short exposure fusion ratio and the target long exposure fusion ratio of the pixel. The fused image is then used as a traffic light image.
[0042] The traffic light image generation method of this invention, when the light intensity of the environment where the monitoring device is located is determined to be less than a preset intensity, acquires a short-exposure image and a long-exposure image collected by the monitoring device; based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short-exposure image and the pixel values of each RGB color channel of the corresponding pixels in the long-exposure image, respectively determine the target short-exposure fusion ratio of the short-exposure image at the pixel and the target long-exposure fusion ratio of the long-exposure image at the pixel; wherein, the region of interest is the region containing the traffic light; the short-exposure image and the long-exposure image are fused according to the target short-exposure fusion ratio and the target long-exposure fusion ratio to generate a traffic light image. The technical solution provided by this invention can not only effectively eliminate abnormal edge areas of the traffic light in the image, but also weaken the halo of the traffic light, so that the brightness of the traffic light body to the halo area in the image can transition smoothly and naturally.
[0043] Example 2
[0044] Figure 3 This is a flowchart of a traffic light image generation method provided in Embodiment 2 of the present invention, as follows: Figure 3 As shown, the method includes:
[0045] S310. When it is determined that the light intensity of the environment where the monitoring equipment is located is less than the preset intensity, the short exposure image and long exposure image collected by the monitoring equipment are acquired.
[0046] S320. Determine the initial long exposure fusion ratio of the long exposure image at the pixel point based on the pixel value of each color channel of the RGB of each pixel point in the region of interest in the short exposure image.
[0047] Optionally, based on the pixel values of each RGB color channel of each pixel in the region of interest in the short-exposure image, the initial long-exposure fusion ratio of the long-exposure image at that pixel is determined. This includes: for each pixel in the region of interest in the short-exposure image, determining the maximum value of the pixel value of each RGB color channel of that pixel; determining the initial short-exposure fusion ratio of the short-exposure image at that pixel based on the maximum value; and determining the initial long-exposure fusion ratio of the long-exposure image at that pixel based on the initial short-exposure fusion ratio. The advantage of this setting is that when fusing the short-exposure image and the long-exposure image, it can adapt to the actual brightness changes of traffic lights in the short-exposure image, effectively preserving the region of interest and reducing the loss of non-regions of interest.
[0048] In this embodiment of the invention, each pixel in the region of interest of the short-exposure image is traversed, and the red, green, and blue (RGB) color channels of the pixels in the short-exposure image are separated to determine the pixel value R of the R color channel of the pixels in the short-exposure image. short The pixel value of the G color channel. short The pixel value of the B color channel. short Then, the pixel value R of the R color channel of that pixel. short The pixel value of the G color channel. short The pixel value of the B color channel. short By comparing the sizes, the maximum pixel value of the RGB three color channels is determined, that is, the Max(R) value is determined. short B short G short According to Max(R) short B short G short This determines the initial short exposure blending ratio for the short exposure image at that pixel. For example, Max(R) short B short G short This is used as the fusion mask for the short exposure image at that pixel, and then the fusion mask is directly used as the initial short exposure fusion ratio for that pixel. That is, the Mask... short =Max(R) short B short G short ), where Mask short This represents the initial short exposure blending ratio of the short exposure image at this pixel. At this time, the initial long exposure blending ratio of the long exposure image at this pixel is...
[0049] Mask long =255-Max(R) short B short G short ).
[0050] Among them, Mask long This indicates the initial long exposure blending ratio for this pixel in the long exposure image. It should be noted that Mask... short and Mask long The values range from 0 to 255. Optionally, the fusion mask of the short exposure image at this pixel can be normalized to the range [0, 1], and the normalized fusion mask can be used as the initial short exposure fusion ratio of the short exposure image at this pixel. Then, based on the initial short exposure fusion ratio, the initial long exposure fusion ratio of the corresponding pixel of the long exposure image is determined. At this time, the sum of the initial short exposure fusion ratio and the initial long exposure fusion ratio is 1.
[0051] S330. Determine the fusion ratio adjustment intensity of the long exposure image at the pixel based on the pixel value of each RGB color channel of the pixel in the long exposure image.
[0052] In this embodiment of the invention, by analyzing abnormal edge regions (such as...) in long-exposure images... Figure 1 An analysis of the pixel value distribution of each RGB color channel in the white ring area, halo area, and the boundary between the two revealed that the pixel value distribution of each RGB color channel in the abnormal edge area is basically consistent with that in the center pixel of the traffic light. The pixel value of each RGB color channel in the abnormal edge area is generally close to 255. Depending on the color state of the traffic light (red, green), the pixel value of the non-primary color channel will decrease accordingly, but the overall average pixel value of each RGB color channel is still close to 255. The non-primary color channels are those whose color state differs from that of the traffic light. For example, if the traffic light is red, the primary color channel is the R color channel, and the non-primary color channels are the G and B color channels; similarly, if the traffic light is green, the primary color channel is the G color channel, and the non-primary color channels are the G and R color channels. The halo area is close to a solid color. Taking the red light status of a traffic light as an example, the pixel value of the primary color channel (i.e., the R color channel) is 255, while the pixel value of the G color channel (a non-primary color channel) is almost 0, and the pixel value of the B color channel is slightly higher than 0. A noticeable brightness jump occurs at the boundary between the abnormal edge area and the halo area. That is, the boundary between the abnormal edge area and the halo area is a high-frequency region. Again, taking the red light status of a traffic light as an example, from the geometric center of the traffic light outwards, the pixel value of the primary color channel (i.e., the R color channel) gradually decreases linearly from 255, while the pixels of non-primary color channels (such as the G color channel) are close to 255 in the traffic light area and the abnormal edge area, but rapidly decrease to around 0 after crossing the high-frequency region. Figure 4 This is a schematic diagram illustrating the variation trend of pixel values for each RGB color channel in an image, emanating from the geometric center of a traffic light in all directions, as provided in an embodiment of the present invention.
[0053] In this embodiment of the invention, in order to weaken abnormal edge regions while ensuring a smooth transition in high-frequency regions, and to naturally and smoothly eliminate halos, and to analyze... Figure 4The graph shows the trend of pixel values for each RGB color channel. Based on the pixel values of each RGB color channel in the long exposure image, the intensity of pixel fusion ratio adjustment in the long exposure image is determined. For example, the intensity of pixel fusion ratio adjustment in the long exposure image is determined based on the maximum value of each RGB color channel in the long exposure image.
[0054] Optionally, determining the blending ratio adjustment intensity of the long exposure image at a pixel based on the pixel values of each RGB color channel of the pixel in the long exposure image includes: determining the brightness value of the pixel in the long exposure image; and determining the blending ratio adjustment intensity of the long exposure image at the pixel based on the brightness value and the pixel values of each RGB color channel of the pixel in the long exposure image. Alternatively, determining the blending ratio adjustment intensity of the long exposure image at a pixel based on the brightness value and the pixel values of each RGB color channel of the pixel in the long exposure image includes: determining whether the brightness value is greater than a preset brightness threshold; if the brightness value is greater than the preset brightness threshold, then determining the blending ratio adjustment intensity of the long exposure image at the pixel based on the maximum value of each RGB color channel of the pixel in the long exposure image; if the brightness value is less than the preset brightness threshold, then determining the blending ratio adjustment intensity of the long exposure image at the pixel based on the maximum and minimum values of each RGB color channel of the pixel in the long exposure image.
[0055] In this embodiment of the invention, the brightness value of a pixel in a long-exposure image is determined. The maximum value among the RGB three color channels of the pixel in the long-exposure image can be used as the brightness value of that pixel, or the average value of the RGB three color channels of the pixel in the long-exposure image can be used as the brightness value of that pixel. It is determined whether the brightness value of the pixel in the long-exposure image is greater than a preset brightness threshold. If so, the fusion ratio adjustment intensity of the long-exposure image at the pixel is determined based on the maximum value of the RGB three color channels of the pixel in the long-exposure image. Otherwise, the fusion ratio adjustment intensity of the long-exposure image at the pixel is determined based on the maximum and minimum values of the RGB three color channels of the pixel in the long-exposure image. For example, the fusion ratio adjustment intensity of the long-exposure image at the pixel is determined according to the following formula:
[0056]
[0057] Where AdjustStr represents the blending ratio adjustment intensity, thresh represents the preset brightness threshold, L represents the brightness value, and Max(R) represents the maximum brightness value. long B long Glong Min(R) represents the maximum value of each RGB color channel of a pixel in a long-exposure image. long B long G long ) represents the minimum pixel value of each RGB color channel of a pixel in a long exposure image.
[0058] It should be noted that the preset brightness threshold thresh can be the average of the maximum and minimum pixel values of the RGB three color channels in overexposed areas such as traffic lights and abnormal edge regions. The preset brightness threshold thresh is approximately 127. This means that when the brightness of a pixel in a long-exposure image exceeds the preset brightness threshold, it indicates that the pixel is located in a traffic light area or an abnormal edge region. In this case, the maximum value of the RGB three color channels of that pixel is divided by 2 (approximately 127) as the subsequent blending ratio adjustment intensity. Conversely, when the brightness of a pixel in a long-exposure image is less than the preset brightness threshold, the average of the maximum and minimum pixel values of the RGB three color channels of that pixel is used as the subsequent blending ratio adjustment intensity. Figure 5 This is a schematic diagram illustrating the trend of fusion scaling intensity variation in an image from the geometric center of a traffic light outwards, as provided in an embodiment of the present invention. At high-frequency transition points, the fusion scaling intensity of the traffic light and abnormal edge regions is approximately 127. According to... Figure 4 It can be seen that the blending ratio adjustment intensity of the halo area is also about 127. Therefore, through the above scheme, the traffic lights can smoothly and naturally transition to the halo area.
[0059] S340. Adjust the initial long exposure fusion ratio according to the fusion ratio adjustment intensity to generate a target long exposure fusion ratio, and determine the target short exposure fusion ratio of the short exposure image at the pixel point according to the target long exposure fusion ratio.
[0060] In this embodiment of the invention, each pixel in the region of interest of a long exposure image is traversed. Based on a preset adjustment strategy, the initial long exposure fusion ratio of the pixel is adjusted according to the fusion ratio adjustment intensity, and the adjusted initial long exposure fusion ratio is used as the target long exposure fusion ratio. Optionally, adjusting the initial long exposure fusion ratio according to the fusion ratio adjustment intensity to generate the target long exposure fusion ratio includes: adjusting the initial long exposure fusion ratio according to the maximum value of the pixel value of each RGB color channel of the pixel in the long exposure image and the fusion ratio adjustment intensity to generate the target long exposure fusion ratio. For example, the maximum value of the pixel value of each pixel in the long exposure image is determined, and the initial long exposure fusion ratio is adjusted according to the maximum value and the fusion ratio adjustment intensity corresponding to the pixel, and the adjusted initial long exposure fusion ratio is used as the target long exposure fusion ratio. Optionally, the initial long exposure fusion ratio is adjusted based on the maximum pixel value of each RGB color channel of the pixel in the long exposure image and the fusion ratio adjustment intensity to generate a target long exposure fusion ratio. This includes adjusting the initial long exposure fusion ratio according to the following formula to generate the target long exposure fusion ratio: Mask′ long =Mask long *AdjustStr / Max(R long B long G long ); where Mask′ long Indicates the target long exposure blending ratio, Mask long Indicates the initial long exposure blending ratio, AdjustStr represents the blending ratio adjustment intensity, and Max(R) represents the blending ratio adjustment intensity. long B long G long ) represents the maximum pixel value of each RGB color channel of the pixel in the long exposure image. After generating the target long exposure fusion ratio in the above manner, the target short exposure fusion ratio of the corresponding pixel in the short exposure image is calculated based on the target long exposure fusion ratio, and the initial short exposure fusion ratio is updated based on the target short exposure fusion ratio.
[0061] By calculating the target long exposure fusion ratio of each pixel in the region of interest in the long exposure image using the above method, it is possible to smoothly suppress brightness jumps near traffic lights and abnormal edge areas (such as white ring areas). At the same time, it ensures that the brightness of the RGB three color channels in areas far from traffic lights (i.e., weak halo, low brightness areas) is basically equal, thus basically maintaining the image effect of the corresponding area in the original long exposure image and achieving the goal of keeping non-regions of interest unaffected.
[0062] S350. The short exposure image and the long exposure image are fused according to the target short exposure fusion ratio and the target long exposure fusion ratio to generate a traffic light image.
[0063] In this embodiment of the invention, Gaussian filtering is applied to the target short-exposure fusion ratio and the target long-exposure fusion ratio to reduce high-frequency jumps caused by nonlinear regions during the fusion process. The short-exposure image and the long-exposure image are then fused using the target short-exposure fusion ratio and the target long-exposure fusion ratio to generate a traffic light image. For example, the short-exposure image and the long-exposure image can be fused according to the following formula: I merge =Mask′ long *I long +Mask′ short *I short , among which, I merge I represents the traffic light image generated by fusion. long Indicates a long exposure image, I short Mask' represents a short exposure image. long Mask′ represents the target long exposure blending ratio. short This indicates the target short-exposure blending ratio. For example, Figure 6 This is a rendering of a generated traffic light image provided in an embodiment of the present invention. Figure 6 As shown, the traffic light image generation method provided by the embodiments of the present invention can eliminate abnormal edge areas (such as white ring areas) of traffic lights, while also weakening the halo, and making the overall effect of traffic lights achieve a natural transition.
[0064] The traffic light image generation method of this invention can not only effectively eliminate abnormal edge areas of traffic lights in the image, but also weaken the halo of the traffic lights, so that the brightness of the traffic light body to the halo area in the image can transition smoothly and naturally.
[0065] Example 3
[0066] Figure 7 This is a schematic diagram of a traffic light image generation device provided in Embodiment 3 of the present invention. Figure 7 As shown, the device includes:
[0067] The image acquisition module 710 is used to acquire short-exposure images and long-exposure images collected by the monitoring device when the light intensity of the environment where the monitoring device is located is less than a preset intensity.
[0068] The fusion ratio determination module 720 is used to determine the target short exposure fusion ratio of the short exposure image at the pixel and the target long exposure fusion ratio of the long exposure image at the pixel based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixel in the long exposure image; wherein, the region of interest is a region containing traffic lights;
[0069] The traffic light image generation module 730 is used to fuse the short exposure image and the long exposure image according to the target short exposure fusion ratio and the target long exposure fusion ratio to generate a traffic light image.
[0070] Optionally, the fusion ratio determination module includes:
[0071] The initial long exposure fusion ratio determination unit is used to determine the initial long exposure fusion ratio of the long exposure image at the pixel point based on the pixel value of each color channel of the RGB of each pixel point in the region of interest in the short exposure image;
[0072] The fusion ratio adjustment intensity determination unit is used to determine the fusion ratio adjustment intensity of the long exposure image at the pixel point based on the pixel value of each color channel of the RGB of the pixel point in the long exposure image;
[0073] The blending ratio determination unit is used to adjust the initial long exposure blending ratio according to the blending ratio adjustment intensity, generate a target long exposure blending ratio, and determine the target short exposure blending ratio of the short exposure image at the pixel point according to the target long exposure blending ratio.
[0074] Optionally, the initial long exposure fusion ratio determination unit is used for:
[0075] For each pixel in the region of interest in the short-exposure image, determine the maximum value of the pixel value for each RGB color channel of the pixel;
[0076] The initial short exposure fusion ratio of the short exposure image at that pixel is determined based on the maximum value.
[0077] The initial long exposure fusion ratio of the long exposure image at each pixel is determined based on the initial short exposure fusion ratio.
[0078] Optionally, the fusion ratio adjustment intensity determination unit includes:
[0079] A brightness value determination subunit is used to determine the brightness value of the pixel in the long exposure image;
[0080] The blending ratio adjustment intensity determination subunit is used to determine the blending ratio adjustment intensity of the long exposure image at the pixel point based on the brightness value and the pixel value of each color channel of the RGB of the pixel point in the long exposure image.
[0081] Optionally, the fusion ratio adjustment intensity determination subunit is used for:
[0082] Determine whether the brightness value is greater than a preset brightness threshold;
[0083] If the brightness value is greater than the preset brightness threshold, then the fusion ratio adjustment intensity of the long exposure image at the pixel is determined based on the maximum value of the pixel value of each color channel of the RGB of the pixel in the long exposure image.
[0084] If the brightness value is less than the preset brightness threshold, the fusion ratio adjustment intensity of the long exposure image at the pixel is determined based on the maximum and minimum values of the pixel values of each RGB color channel of the pixel in the long exposure image.
[0085] Optionally, the fusion ratio determination unit includes:
[0086] The fusion ratio determination subunit is used to adjust the initial long exposure fusion ratio based on the maximum pixel value of each color channel of the pixel in the long exposure image and the fusion ratio adjustment intensity, so as to generate the target long exposure fusion ratio.
[0087] Optionally, the fusion ratio determining subunit is used for:
[0088] The initial long exposure fusion ratio is adjusted according to the following formula to generate the target long exposure fusion ratio:
[0089] Mask′ long =Mask long *AdjustStr / Max(R long B long G long );
[0090] Among them, Mask′ long Indicates the target long exposure blending ratio, Mask long Indicates the initial long exposure blending ratio, AdjustStr represents the blending ratio adjustment intensity, and Max(R) represents the blending ratio adjustment intensity. long B long G long ) represents the maximum pixel value of each RGB color channel of the pixel in the long exposure image.
[0091] The traffic light image generation device provided in this embodiment of the invention can execute the traffic light image generation method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0092] Example 4
[0093] Figure 8 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0094] like Figure 8 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0095] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0096] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the traffic light image generation method.
[0097] In some embodiments, the traffic light image generation method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the traffic light image generation method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the traffic light image generation method by any other suitable means (e.g., by means of firmware).
[0098] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0099] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0100] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0101] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0102] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0103] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0104] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0105] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for generating a traffic light image, characterized in that, include: When the light intensity of the environment where the monitoring equipment is located is determined to be less than the preset intensity, the short-exposure image and long-exposure image collected by the monitoring equipment are acquired. Based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixels in the long exposure image, the target short exposure fusion ratio of the short exposure image at the pixel and the target long exposure fusion ratio of the long exposure image at the pixel are determined respectively; wherein, the region of interest is the region containing traffic lights; The short-exposure image and the long-exposure image are fused according to the target short-exposure fusion ratio and the target long-exposure fusion ratio to generate a traffic light image.
2. The method according to claim 1, characterized in that, Based on the pixel values of the RGB multiple color channels of each pixel in the region of interest of the short-exposure image and the pixel values of the RGB color channels of the corresponding pixel in the long-exposure image, the target short-exposure fusion ratio of the short-exposure image at the pixel and the target long-exposure fusion ratio of the long-exposure image at the pixel are determined, including: Based on the pixel values of each RGB color channel of each pixel in the region of interest in the short exposure image, the initial long exposure fusion ratio of the long exposure image at that pixel is determined; The intensity of the fusion ratio adjustment of the long exposure image at each pixel is determined based on the pixel value of each RGB color channel of the pixel in the long exposure image. The initial long exposure fusion ratio is adjusted according to the fusion ratio adjustment intensity to generate a target long exposure fusion ratio, and the target short exposure fusion ratio of the short exposure image at the pixel is determined according to the target long exposure fusion ratio.
3. The method according to claim 2, characterized in that, Based on the pixel values of each RGB color channel of each pixel in the region of interest of the short exposure image, the initial long exposure fusion ratio of the long exposure image at that pixel is determined, including: For each pixel in the region of interest in the short-exposure image, determine the maximum value of the pixel value for each RGB color channel of the pixel; The initial short exposure fusion ratio of the short exposure image at that pixel is determined based on the maximum value. The initial long exposure fusion ratio of the long exposure image at each pixel is determined based on the initial short exposure fusion ratio.
4. The method according to claim 2, characterized in that, Based on the pixel values of each RGB color channel of the pixel in the long exposure image, the intensity of the blending ratio adjustment of the long exposure image at the pixel is determined, including: Determine the brightness value of the pixel in the long exposure image; The intensity of the fusion ratio adjustment of the long exposure image at the pixel is determined based on the brightness value and the pixel value of each RGB color channel of the pixel in the long exposure image.
5. The method according to claim 4, characterized in that, Based on the brightness value and the pixel value of each RGB color channel of the pixel in the long exposure image, the intensity of the blending ratio adjustment of the long exposure image at the pixel is determined, including: Determine whether the brightness value is greater than a preset brightness threshold; If the brightness value is greater than the preset brightness threshold, then the fusion ratio adjustment intensity of the long exposure image at the pixel is determined based on the maximum value of the pixel value of each color channel of the RGB of the pixel in the long exposure image. If the brightness value is less than the preset brightness threshold, the fusion ratio adjustment intensity of the long exposure image at the pixel is determined based on the maximum and minimum values of the pixel values of each RGB color channel of the pixel in the long exposure image.
6. The method according to claim 2, characterized in that, The initial long exposure fusion ratio is adjusted according to the fusion ratio adjustment intensity to generate a target long exposure fusion ratio, including: The initial long exposure fusion ratio is adjusted based on the maximum pixel value of each RGB color channel of the pixel in the long exposure image and the fusion ratio adjustment intensity to generate the target long exposure fusion ratio.
7. The method according to claim 6, characterized in that, Based on the maximum pixel value of each RGB color channel of the pixel in the long exposure image and the fusion ratio adjustment intensity, the initial long exposure fusion ratio is adjusted to generate a target long exposure fusion ratio, including: The initial long exposure fusion ratio is adjusted according to the following formula to generate the target long exposure fusion ratio: Mask’ long =Mask long *AdjustStr / Max(R long ,B long ,G long ); Among them, Mask' long Indicates the target long exposure blending ratio, Mask long Indicates the initial long exposure blending ratio, AdjustStr represents the blending ratio adjustment intensity, and Max(R) represents the blending ratio adjustment intensity. long B long G long ) represents the maximum pixel value of each RGB color channel of the pixel in the long exposure image.
8. A traffic light image generation device, characterized in that, include: The image acquisition module is used to acquire short-exposure images and long-exposure images collected by the monitoring device when the light intensity of the environment where the monitoring device is located is less than a preset intensity. The fusion ratio determination module is used to determine the target short exposure fusion ratio of the short exposure image at the pixel and the target long exposure fusion ratio of the long exposure image at the pixel based on the pixel values of each RGB color channel of multiple pixels in the region of interest in the short exposure image and the pixel values of each RGB color channel of the corresponding pixel in the long exposure image; wherein, the region of interest is the region containing traffic lights; The traffic light image generation module is used to fuse the short exposure image and the long exposure image according to the target short exposure fusion ratio and the target long exposure fusion ratio to generate a traffic light image.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the traffic light image generation method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the traffic light image generation method according to any one of claims 1-7.
Citation Information
Patent Citations
Wide dynamic fusion method based on single-frame double-pulse exposure mode
CN104639920A
Signal lamp image enhancement processing method
CN105791710A
Traffic signal lamp image processing method and traffic signal lamp image processing device
CN107730481A
Image processing method and device based on wide dynamic and exposure circuit
CN107786814A
Image processing method and device
CN111489320A