A method and device for processing the color of a signal light
By obtaining the tone value distribution information of the signal light area and adjusting the tone value of the signal light area, the color overexposure and color casting problems of the signal light image collection are solved, and the accuracy of judging red light events is improved.
Patent Information
- Application Number
- CN202210303730.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2042-03-24
AI Technical Summary
The prior art is prone to overexposure of color when collecting signal light images, resulting in a high error rate for judging red light run events, and there is color cast problem after image fusion, which affects the accuracy of judgment.
By obtaining the tone value distribution information of the signal light area, determining the red and yellow segmentation threshold, adjusting the tone value of the red and yellow signal light areas, unifying the color of the signal light image, reducing the color casting effect, and improving the accuracy of judgment.
Effectively correct the colors in the signal light image, improve the accuracy of judging red light events, reduce the rate of error judgment, and improve the accuracy of judging the signal light status.
Smart Images

Figure CN114783192B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer image processing, and in particular to a method and device for processing the color of a signal light. Background Art
[0002] Currently, red, green, and yellow traffic lights play an important role in traffic management. In order to ensure traffic safety, cameras are deployed on the road to collect the status of traffic lights and vehicles. Among them, when the three frames of traffic light images collected when the vehicle passes the stop line, passes through the intersection, and reaches the opposite side of the intersection are red, it is judged that the vehicle has run a red light. However, since the traffic light is a very bright self-luminous source, the color is often overexposed during the process of collecting the traffic light image, resulting in a high error rate in judging the red light running event. Summary of the invention
[0003] The embodiments of the present application provide a method and device for processing the color of a traffic light, which are used to unify the colors of collected traffic light images and improve the accuracy of judging red light running events.
[0004] To achieve the above objectives, the present application provides the following technical solutions:
[0005] In a first aspect, a method for processing the color of a traffic light is provided, comprising: obtaining hue value distribution information of multiple target traffic light areas in at least one image, wherein the multiple target traffic light areas are other traffic light areas other than a green traffic light area among the multiple traffic light areas; determining a red-yellow segmentation threshold based on the distribution information; wherein the red-yellow segmentation threshold is used to distinguish between red hue values and yellow hue values; determining a red traffic light area and a yellow traffic light area among the multiple target traffic light areas based on the red-yellow segmentation threshold; adjusting the hue value of the red traffic light area from a first current value to a first target value, and adjusting the hue value of the yellow traffic light area from a second current value to a second target value; wherein the first target value belongs to a red hue value distribution range, and the second target value belongs to a yellow hue value distribution range.
[0006] Currently, the information for judging whether a vehicle has run a red light is collected by collecting traffic light images, but the color is easily overexposed during the collection process, which affects the judgment result. Therefore, the adoption of this technical solution, by statistically analyzing the distribution information of the hue value, achieves the unification of the hue, which helps to correct the color in the traffic light image and improve the accuracy of judging the red light running event; in addition, the current improvement is based on the color overexposure through image fusion technology, but the fused image has a color cast problem, which still affects the judgment result. The adoption of this technical solution helps to solve the problem of being unable to accurately judge the state of the traffic light due to the color cast problem and improve the accuracy of the judgment.
[0007] In one possible implementation, before obtaining the hue value distribution information of multiple target signal light areas in at least one image, the method also includes: obtaining RGB values of multiple signal light areas in at least one image; determining a green signal light area among the multiple signal light areas based on the RGB values of the multiple signal light areas; and determining multiple target signal light areas from the at least one image based on the green signal light area.
[0008] This possible implementation method provides a specific implementation method for determining the green traffic light area based on hue value, which helps to distinguish green from red and yellow with large hue differences, and helps to unify the hue of subsequent green traffic light areas, thereby improving the hue accuracy of the traffic light image.
[0009] In a possible implementation, after determining a green signal light area among the plurality of signal light areas, the method further includes: adjusting a hue value of the green signal light area to a third target value; wherein the third target value belongs to a preset distribution range of green hue values.
[0010] This possible implementation provides a specific implementation method for unifying the hue value of the green signal light area, which helps to improve the hue accuracy of the signal light image including the green signal light area.
[0011] In a possible implementation, the distribution information includes a red hue value distribution range and a yellow hue value distribution range, and determining the red-yellow segmentation threshold based on the distribution information includes: determining a target red hue value distribution range and a target yellow hue value distribution range based on the red hue value distribution range and the yellow hue value distribution range; wherein the maximum value of the target red hue value distribution range is less than or equal to the minimum value of the target yellow hue value distribution range; or, the minimum value of the target red hue value distribution range is greater than or equal to the maximum value of the target yellow hue value distribution range; and determining the red-yellow segmentation threshold based on the target red hue value distribution range and the target yellow hue value distribution range.
[0012] This possible implementation method provides a specific implementation method for determining the red-yellow segmentation threshold, which helps to locate the target red hue value distribution range and the target yellow hue value distribution range on both sides of the red-yellow segmentation threshold respectively, reduces the difficulty of determining the red-yellow segmentation threshold, facilitates the subsequent unification of the hue values of the traffic light area, and improves the efficiency of the solution execution.
[0013] In one possible implementation, the signal lights in multiple target signal light areas are all monochrome signal lights; or, the signal lights in multiple target signal light areas are all multi-color signal lights; or, the signal lights in multiple target signal light areas include monochrome signal lights and multi-color signal lights; wherein, the monochrome light is a signal light presenting a fixed color, and the multi-color light is a signal light presenting different colors.
[0014] In this possible implementation, multiple types of traffic lights are provided, and the distribution ranges of hue values of different types of traffic lights are more comparable, which helps to improve the hue accuracy of the traffic light image.
[0015] In one possible implementation, after adjusting the hue value of the yellow traffic light area from the second current value to the second target value, the method further includes: adjusting the second target value to the second current value when it is determined that the duration of continuous acquisition of the yellow traffic light area is greater than the first threshold; and adjusting the second current value to the first target value starting from the moment when the second target value is adjusted to the second current value and when the duration of continuous acquisition of the yellow traffic light area is greater than the second threshold.
[0016] This possible implementation provides an error correction method for making adjustments through real-time monitoring when a red light is mistakenly judged as a yellow light, which helps to improve the flexibility of the solution for unifying the hue value of the traffic light area.
[0017] In one possible implementation, after adjusting the hue value of the yellow traffic light area from the second current value to the second target value, the method further includes: when it is determined that the duration of continuous acquisition of the yellow traffic light area is greater than the first threshold, adjusting the red-yellow segmentation threshold by M units in the direction of the second target value, where M is an integer greater than 0.
[0018] This possible implementation method provides a specific implementation method for adjusting the red-yellow segmentation threshold, which helps to improve the accuracy of color tone division in combination with the signal light jump sequence.
[0019] In a possible implementation, the method also includes: acquiring multiple images, determining a target signal light unit based on multiple target signal light areas in the multiple images, the target signal light unit including at least a green signal light area and a yellow signal light area; counting a transition rule of the target signal light unit, the transition rule refers to the number of frames and transition sequence of the green signal light area and the yellow signal light area in the target signal light unit; and adjusting the red-yellow segmentation threshold when it is determined based on the red-yellow segmentation threshold that the yellow signal light area does not satisfy the transition rule.
[0020] In this possible implementation, a specific implementation method for adjusting the red-yellow segmentation threshold according to the traffic light jump rule is provided, which helps to further improve the accuracy of the unified traffic light hue value in combination with the changes in the traffic lights.
[0021] In a second aspect, a computer device is provided, comprising: a functional unit for executing any one of the methods provided in the first aspect, wherein the actions executed by each functional unit are implemented by hardware or by executing corresponding software through hardware. For example, the computer device may include: an acquisition unit, a determination unit, and an adjustment unit. The acquisition unit is used to acquire the hue value distribution information of multiple target signal light areas in at least one image, wherein the multiple target signal light areas are other signal light areas other than the green signal light area in the multiple signal light areas. The determination unit is used to determine the red-yellow segmentation threshold based on the distribution information; wherein the red-yellow segmentation threshold is used to distinguish the red hue value from the yellow hue value. The determination unit is also used to determine the red signal light area and the yellow signal light area in the multiple target signal light areas based on the red-yellow segmentation threshold. The adjustment unit is also used to adjust the hue value of the red signal light area from the first current value to the first target value, and adjust the hue value of the yellow signal light area from the second current value to the second target value; wherein the first target value belongs to the red hue value distribution range, and the second target value belongs to the yellow hue value distribution range.
[0022] In a third aspect, a computer device is provided, comprising: a processor and a memory. The processor is connected to the memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect.
[0023] In a fourth aspect, a chip is provided, comprising: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to run the code instructions to execute any one of the methods provided in the first aspect.
[0024] In a fifth aspect, a computer-readable storage medium is provided, comprising computer execution instructions, which, when executed on a computer, enable the computer to execute any one of the methods provided in the first aspect.
[0025] In a sixth aspect, a computer program product is provided, comprising computer execution instructions, which, when executed on a computer, cause the computer to execute any one of the methods provided in the first aspect.
[0026] The technical effects brought about by any implementation method in the second to sixth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0028] Figure 2a A schematic diagram of a traffic light ROI area provided in an embodiment of the present application;
[0029] Figure 2b A schematic diagram of a signal light area provided in an embodiment of the present application;
[0030] Figure 3 A flowchart of a method for processing the color of a signal light provided in an embodiment of the present application;
[0031] Figure 4 A schematic diagram of tone value division provided in an embodiment of the present application;
[0032] Figure 5 A schematic diagram of a hue value distribution range histogram provided in an embodiment of the present application;
[0033] Figure 6 A schematic diagram of a hue value distribution range histogram provided in an embodiment of the present application;
[0034] Figure 7 A schematic diagram of a global hue histogram or a local hue histogram provided in an embodiment of the present application;
[0035] Figure 8 A schematic diagram of a global hue histogram or a local hue histogram provided in an embodiment of the present application;
[0036] Fig. 9 A schematic diagram of a red-yellow segmentation threshold provided in an embodiment of the present application;
[0037] Fig.10 A schematic diagram of the composition of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] In the description of this application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different.
[0039] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0040] The embodiment of the present application provides a method for processing the color of a signal light, which can be applied to a computer device. The embodiment of the present application does not impose any restrictions on the specific form of the computer device. For example, the computer device can specifically be a terminal device. Among them, the terminal device can be referred to as: terminal, user equipment (UE), terminal equipment, access terminal, user unit, user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication equipment, user agent or user device, etc. The terminal device can specifically be a mobile phone, augmented reality (AR) device, virtual reality (VR) device, tablet computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), signal light control device, etc.
[0041] In terms of hardware implementation, the above-mentioned computer device can be implemented as follows: Figure 1 The computer device shown is implemented as shown. Figure 1 FIG. 1 is a schematic diagram of the hardware structure of a computer device 10 provided in an embodiment of the present application. The computer device 10 can be used to implement the functions of the above-mentioned computer devices.
[0042] Figure 1 The computer device 10 shown may include: a processor 101 , a memory 102 , a communication interface 103 , and a bus 104 . The processor 101 , the memory 102 , and the communication interface 103 may be connected via the bus 104 .
[0043] The processor 101 is the control center of the computer device 10, and may be a general-purpose central processing unit (CPU) or other general-purpose processors, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0044] As an example, the processor 101 may include one or more CPUs, such as Figure 1 CPU 0 and CPU 1 are shown in .
[0045] The memory 102 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto.
[0046] In a possible implementation, the memory 102 may exist independently of the processor 101. The memory 102 may be connected to the processor 101 via a bus 104 and used to store data, instructions, or program codes. When the processor 101 calls and executes the instructions or program codes stored in the memory 102, the signal light color processing method provided in the embodiment of the present application can be implemented.
[0047] In another possible implementation, the memory 102 may also be integrated with the processor 101 .
[0048] The communication interface 103 is used for connecting the computer device 10 to other devices through a communication network, which may be Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 103 may include a receiving unit for receiving data and a sending unit for sending data.
[0049] The bus 104 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 1 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0050] It should be pointed out that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device 10, except Figure 1In addition to the components shown, computer device 10 may include more or fewer components than shown, or combine certain components, or arrange components differently.
[0051] In order to make the embodiments of the present application clearer, the concepts and some contents related to the embodiments of the present application are briefly introduced below.
[0052] 1. Traffic light region of interest (ROI)
[0053] The traffic light ROI area refers to the area corresponding to the traffic light in the image, which is generally a rectangular area. Figure 2a FIG. 1 is a schematic diagram of a signal light ROI region. The computer device determines the signal light ROI region by identifying the signal light images of the intersections through multiple images. In actual application, the user can also manually draw the signal light ROI region on the image processing platform. For example, in Figure 2a In the embodiment, the computer device determines a traffic light ROI area 1 and a traffic light ROI area 2.
[0054] It is understandable that the camera that collects the status of traffic lights usually shoots based on a fixed position. Traffic lights are set at intersections as a tool to assist traffic. Therefore, the position of the traffic lights in the multiple images collected does not change. The computer equipment obtains the traffic light ROI area to facilitate image processing of traffic lights at specific locations, which helps to quickly identify the color tone of the traffic light in the traffic light ROI area and improve processing efficiency.
[0055] 2. Traffic light area
[0056] The traffic light area refers to the traffic light area divided according to the light panel in the image based on the traffic light ROI area. Figure 2a The signal light ROI area shown includes a green left arrow signal light area and a right arrow signal light area, a red up arrow signal light area, and a green digital signal light area. The signal light panels with different arrow shapes are used to indicate the traffic status of the intersection in different directions, and the digital signal light panel is used to display the remaining time from the next state change of the intersection traffic status.
[0057] Combination Figure 2a The signal light ROI area 1 and the signal light ROI area 2 are shown as Figure 2b As shown, the signal light ROI area 1 includes signal light areas 1 and 2, and the signal light ROI area 2 includes signal light areas 3, 4, and 5.
[0058] 3. Traffic light fusion technology
[0059] Traffic light fusion technology refers to the technology of image fusion of the traffic light ROI area in the long exposure image and the short exposure image. Traffic light fusion technology helps to obtain an image of the traffic light ROI area with clearer color, brightness and shape contours.
[0060] In the image obtained based on the current traffic light fusion technology, the color of the traffic light presented in the traffic light ROI area may have a color cast problem, for example, the red traffic light area is pink, the yellow traffic light area is orange, and the green traffic light area is blue. The color cast problem will make it impossible to accurately judge the status of the traffic light, especially when the red traffic light area and the yellow traffic light area are close in color and cannot be distinguished by the naked eye, so it cannot be used as a basis for judging whether the vehicle has run a red light.
[0061] In this regard, the present application provides a method for processing the color of a signal light, such as Figure 3 As shown, the method includes:
[0062] S301. A computer device obtains tone value distribution information of multiple target traffic light areas in at least one image.
[0063] The signal light areas include a red signal light area, a yellow signal light area, and a green signal light area. The multiple target signal light areas are other signal light areas except the green signal light area in the multiple signal light areas.
[0064] The hue value is used to represent the hue of the target signal light area. Specifically, HSV (Hue Saturation Value) color model is used to represent hue, S is used to represent saturation, and V is used to represent brightness. If the hue is measured in degrees, such as Figure 4 As shown, the value range is 0°~360°. Exemplarily, the red range is (324°, 36°), including 0°, the yellow range is (36°, 108°), the green range is (108°, 180°), the blue range is (180°, 252°), and the purple range is (252°, 324°). It can be understood that in order to include the colors of commonly used signal lights, the above division method is used as an example. In addition, more or fewer color division methods can also be included, and the present application does not limit this.
[0065] Optionally, before obtaining the hue value distribution information of multiple target signal light areas in at least one image, the computer device obtains RGB (red green blue) values of multiple signal light areas in at least one image, and determines the hue value of the target signal light area according to the RGB value of the target signal light area among the multiple signal light areas.
[0066] Specifically, as described above, the traffic light area is a rectangle or other shapes. It is understandable that the traffic light area contains multiple points, and the pixel values of the multiple pixels can be represented by RGB values. One possible implementation method is to calculate the average of the RGB values of all pixels in the traffic light area, and use the average as the RGB value of the traffic light area. Another possible implementation method is to calculate the saturation S of each pixel point based on the conversion relationship between RGB and HSV, use the saturation S of each pixel point as a weight, accumulate multiple pixels to obtain a weighted value, and use the weighted value as the RGB value of the traffic light area. Determine the hue value of the target traffic light area based on the RGB values of multiple traffic light areas. Among them, based on the conversion relationship between RGB and HSV, the hue value H of multiple traffic light areas is calculated.
[0067] Optionally, based on the RGB values of the plurality of signal light areas, a green signal light area among the plurality of signal light areas is determined. Exemplarily, the computer device uses the signal light area corresponding to the RGB values of G>R and G>B as the green signal light area. Based on the green signal light area, multiple target signal light areas are determined from at least one image, that is, signal light areas corresponding to other RGB values as the target signal light areas. It is understandable that the target signal light area includes a red signal light area and a yellow signal light area.
[0068] It is understandable that the RGB value can better distinguish red and green, but cannot clearly distinguish yellow and orange (red), that is, when the above color cast problem occurs, it may affect the judgment result. Therefore, the above RGB value can be used to determine and distinguish the green signal light area.
[0069] Furthermore, the RGB values are converted into hue values in the above manner to determine the red traffic light area and the yellow traffic light area. Specifically, the computer device counts the hue values obtained after the conversion to obtain the red hue value distribution range and the yellow hue value distribution range. For example, the histogram represents the hue value distribution information. Figure 5 As shown, the horizontal axis is the hue value, and the vertical axis is the number of target signal light areas. The target signal light areas include red signal light areas and yellow signal light areas.
[0070] Optionally, based on the RGB values of multiple signal light areas, corresponding hue values are calculated, and the target signal light area and the green signal light area are determined according to the hue value distribution information. Figure 6 shown.
[0071] It should be noted that there are many ways to determine the hue value of the traffic light area based on the collected image, and the above method of calculating the hue value based on the RGB value is only an example. It is understandable that in the image transmission process, RGB values are usually used for transmission. Other image formats also include YUV formats. Hue values can also be obtained according to the YUV format to execute the above method, and this application does not limit this.
[0072] Optionally, based on the color of the signal light that changes over time, the signal light can be divided into a single-color signal light and a multi-color signal light, hereinafter referred to as a single-color light and a multi-color light. A single-color light is a signal light that presents a fixed color, and a multi-color light is a signal light that presents different colors.
[0073] It is to be understood that the above-mentioned color of the signal light refers to the color presented when the signal light is in the activated state. Figure 2b As shown, the arrow-shaped signal light area is red, green or yellow, and can only show one color in the activated state. The digital signal light area of the signal light change countdown shows multiple colors at different times in the activated state, such as red, green and yellow, which are used for the duration of the state of different colors. In addition, other types of signal lights are also included, such as direction signal light areas that show different colors over time. The signal light areas described in the above examples can be divided into single-color lights and multi-color lights.
[0074] Optionally, based on the above-mentioned division method, the computer device at least counts the monochromatic lights presenting red hue values and the monochromatic lights presenting yellow hue values to obtain hue value distribution information, and the hue value distribution information is called global hue distribution; or, the computer device counts the multi-color lights presenting red hue values and yellow hue values at different times to obtain hue value distribution information, and the hue value distribution information is called local hue distribution; or, the computer device counts the red and yellow hue value distribution information of the monochromatic lights and the multi-color lights, and the hue value distribution information is also called global hue distribution.
[0075] like Figure 7 The figure shows a schematic diagram of a global hue histogram or a local hue histogram.
[0076] It can be understood that, in essence, there is no difference between the global hue histogram and the local hue histogram, and both are cumulative results of counting the hue values of the signal light areas in multiple images.
[0077] It should be noted that the tone value distribution information can also be provided in other ways, such as a line graph, a waveform graph, etc., and this application does not impose any limitation on this.
[0078] The above steps are used to determine the hue value distribution information of the target signal light area, and the distribution of hue values of different signal light areas can be intuitively felt based on the distribution information. For example, Figure 7In the figure, the hue value peaks of the red traffic light area are concentrated at 0° and 360°, the hue value peaks of the yellow traffic light area are concentrated at 60°, and the hue value peaks of the green traffic light area are concentrated at 120°.
[0079] S302. The computer device determines a red-yellow segmentation threshold based on the distribution information; wherein the red-yellow segmentation threshold is used to distinguish between red hue values and yellow hue values.
[0080] Optionally, before executing step S302, the computer device adjusts the hue value reference system. The maximum value of the adjusted red hue value distribution range is less than or equal to the minimum value of the yellow hue value distribution range, or the minimum value of the red hue value distribution range is greater than or equal to the maximum value of the yellow hue value distribution range. Specifically, the hue value distribution range of the red traffic light area and the hue value distribution range of the yellow traffic light area are adjusted to be in an increasing or decreasing relationship.
[0081] It is understandable that if Figures 5 to 7 In the hue value distribution range obtained by statistics shown, since the red hue value distribution range is discontinuous in the histogram, in order to subsequently determine the red-yellow segmentation threshold, the computer device can adjust the overall hue value distribution range so that the red-yellow segmentation threshold is determined without changing the overall distribution range.
[0082] For example, the hue values obtained by statistics are uniformly increased by 60°, and accordingly, the following is obtained: Figure 8 The distribution range of tonal values after translation is shown.
[0083] It should be noted that the present application includes a variety of implementation methods for adjusting the direction and size of the hue value reference system. Increasing or decreasing the hue value can achieve the above purpose, and the present application does not impose any restrictions on this.
[0084] By adjusting the hue value reference system, it is helpful to separately concentrate the data of the red traffic light area and the data of the yellow traffic light area, so as to facilitate the subsequent determination of the red-yellow segmentation threshold.
[0085] Specifically, the computer device uses the OSTU law or other threshold segmentation methods to determine the segmentation threshold, for example, taking the middle value between the peak value of the red signal light area and the peak value of the yellow signal light area as the segmentation threshold.
[0086] Optionally, the computer device determines the red-yellow segmentation thresholds based on the global hue distribution and the local hue distribution. It is understandable that the local hue distribution based on the statistics of the multi-color lamp only includes the different signal light colors presented by the multi-color lamp over time, without obtaining the hue values of other signal lights to complete the color unification of the multi-color lamp, which helps to improve the accuracy of the color unification of the multi-color lamp.
[0087] It should be noted that, considering different business requirements, the global hue distribution may also include hue values of monochromatic lights and multicolor lights to unify the colors of monochromatic lights and multicolor lights based on the same red-yellow segmentation threshold.
[0088] Determining the red-yellow segmentation thresholds of the monochrome light and the multi-color light respectively in the above manner helps the computer device to separate the red signal light area and the yellow signal light area of the monochrome light and the multi-color light respectively, thereby improving the accuracy of color adjustment.
[0089] S303, the computer device determines a red traffic light area and a yellow traffic light area in a plurality of target traffic light areas based on the red-yellow segmentation threshold;
[0090] Optionally, the computer device determines the red signal light area and the yellow signal light area in the plurality of target signal light areas based on the red-yellow segmentation threshold. Fig. 9 As shown, the left side of the segmentation threshold is the red hue value distribution range, and the right side of the segmentation threshold is the yellow hue value distribution range. The traffic light area corresponding to the hue value included in the hue value distribution range is the traffic light area in the corresponding color range.
[0091] S304: The computer device adjusts the hue value of the red traffic light area from the first current value to the first target value, and adjusts the hue value of the yellow traffic light area from the second current value to the second target value.
[0092] The first target value belongs to the red hue value distribution range, and the second target value belongs to the yellow hue value distribution range. The red hue value distribution range and the yellow hue value distribution range refer to: Figure 4 It can be understood that the first target value and the second target value are used to represent the corresponding red hue and yellow hue.
[0093] Optionally, the first target value and the second target value may be a peak value in a red hue value distribution range and a peak value in a yellow hue value distribution range, respectively.
[0094] It can be understood that if in the above optional implementation, the overall distribution range is adjusted by translation, then the corresponding Figure 4 The tonal value range in the image is also adjusted accordingly.
[0095] Optionally, the first target value and the second target value are respectively a preset red hue value and a preset yellow hue value.
[0096] Optionally, the computer device adjusts the RGB value of the red traffic light area from a first current RGB value to a first target RGB value, and adjusts the hue value of the yellow traffic light area from a second current RGB value to a second target RGB value.
[0097] It can be understood that the computer equipment determines the color range to which the traffic light area belongs by judging the hue of the area, and replaces the hue value or RGB value that currently has a color cast problem with a hue value or RGB value that is easy for the human eye to observe, thereby improving the accuracy of judging the color of the traffic light area, thereby resolving the occurrence of misjudgments or disputes caused by color cast problems.
[0098] Optionally, the computer device adjusts the hue value of the green signal light area to a third target value, wherein the third target value belongs to a preset distribution range of green hue values. Alternatively, the computer device adjusts the RGB value of the green signal light area to a third target RGB value.
[0099] Adjusting the hue value of the green signal light area through computer equipment can help solve the color cast problem in the green signal light area.
[0100] Through the above steps S301-S304, the computer device adjusts the color of the traffic light according to the hue value of the image, which helps to solve the current problem of being unable to accurately judge the state of the traffic light due to the color cast problem and improves the accuracy of the judgment.
[0101] Optionally, in the above step S304, after the second target value is adjusted to the second current value, the method further includes: when the computer device determines that the time length of continuously collecting the yellow traffic light area is greater than the first threshold, the second target value is adjusted to the second current value; starting from the moment when the second target value is adjusted to the second current value, and when the time length of continuously collecting the yellow traffic light area is greater than the second threshold, the second current value is adjusted to the first target value.
[0102] Optionally, the first threshold is the maximum continuous display time of the yellow signal light. Exemplarily, the maximum continuous display time is 3 seconds.
[0103] Optionally, the sum of the first threshold and the second threshold is the minimum continuous display time of the red signal light. Exemplarily, the minimum continuous display time is 6 seconds.
[0104] Among them, the duration of continuous acquisition of the yellow signal light area by the computer device means that the images acquired by the computer device within this duration all include the yellow signal light area. It is understandable that if the signal light has different color jumps, for example, from red to green and then to yellow, the display duration of the yellow signal light area is usually shorter than the display duration of other color signal light areas. In the above manner, when the duration of continuous acquisition of the yellow signal light area by the computer device is greater than the maximum continuous display duration of the yellow signal light, it can be considered that the computer device has misjudged the yellow signal light area. If the signal light itself is a yellow signal light indicating slow travel, there is no situation of different color jumps, and usually, the yellow signal light will continue to flash, then the duration of continuous acquisition of the yellow signal light area by the computer device should be less than the maximum continuous display duration of the above-mentioned yellow signal light, so as to avoid the computer device adjusting the color tone of the image of the yellow signal light area in this case.
[0105] Exemplarily, assuming that the first threshold is 3 seconds, the computer device adjusts the second target value to the second current value when it determines that the duration of continuous acquisition of the yellow traffic light area is greater than 3 seconds. This adjustment method helps to adjust the yellow target hue value back to the original hue value when the traffic light area in the image is misjudged as a yellow traffic light area. Assuming that the second threshold is 3 seconds, the computer device continues to acquire images from the moment the second target value is adjusted to the second current value, and when the duration of continuous acquisition of the yellow traffic light area is greater than 3 seconds, the second current value is adjusted to the first target value. Continuously acquiring images helps the computer device further correct the misjudgment results. For example, in the above example, the traffic light area can be adjusted from the original hue value to the red target hue value according to the minimum continuous display duration of the red traffic light.
[0106] Optionally, in the case where the red traffic light is misjudged as a yellow traffic light, that is, in the above step S304, after the second target value is adjusted to the second current value, when it is determined that the time length of continuous acquisition of the yellow traffic light area is greater than the first threshold, the method further includes: the computer device adjusts the red-yellow segmentation threshold by M units in the direction of the second target value, where M is an integer greater than 0.
[0107] It is understandable that the occurrence of the above misjudgment is due to the inaccurate red-yellow segmentation threshold value, so the red-yellow segmentation threshold value can be adaptively adjusted. In the above example, it is necessary to expand the red hue value distribution range, so the red-yellow segmentation threshold value is moved closer to the yellow hue value distribution range. Exemplarily, the M units are 1 or 2 units of hue value.
[0108] Optionally, after the above-mentioned step S304, the method further includes: the computer device acquires multiple images, the computer device determines a target signal light unit based on multiple target signal light areas in the multiple images, the target signal light unit includes at least a green signal light area and a yellow signal light area; counting the transition pattern of the target signal light unit, the transition pattern refers to the number of frames and the transition sequence of the green signal light area and the yellow signal light area in the target signal light unit; when it is determined based on the red-yellow segmentation threshold that the yellow signal light area does not satisfy the transition pattern, adjusting the red-yellow segmentation threshold.
[0109] Specifically, under the traffic light fusion technology, the computer device processes multiple frames of images, each of which includes multiple traffic light areas. The computer device counts the number of frames and the jump order of the green traffic light area and the yellow traffic light area in the multiple frames of images. It can be understood that, under normal circumstances, the green traffic light indicates a passable state and then switches to a yellow traffic light to indicate a slow-moving state, and then switches to a red traffic light to indicate a stopped state. Exemplarily, the computer device determines to jump in the target traffic light area in the order of green, yellow, and red, and determines the corresponding duration based on the number of frames in each state. According to the jump rule, the computer device obtains an image of the green traffic light area and records the number of frames. When the color of the traffic light area in the identified image does not belong to the preset green RGB value, combined with the above-mentioned jump rule, it is considered that the traffic light area of the frame image is a yellow traffic light area. If the calculated hue value of the frame image does not belong to the above Figure 4 When the yellow traffic light hue value range is determined by the red-yellow segmentation threshold in the method shown, the hue value range of the yellow traffic light area is adjusted based on the hue value. Figure 8 In the histogram shown, when the frame image is determined to be an image of the yellow traffic light area based on the jump rule, and its hue value is on the left side of the segmentation threshold, that is, in the hue value range of the red traffic light area, the segmentation threshold is moved left to the hue value, adjusted by x units, where x is an integer greater than 0.
[0110] Through the above method, the computer equipment combines other information to further adjust the red-yellow segmentation threshold in the case of misjudgment, thereby improving the accuracy of adjusting the color of the traffic light, which helps to improve the clarity of the image containing the traffic light area.
[0111] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It is understandable that in order to realize the above functions, the computer device includes at least one of the hardware structure and software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
[0112] The embodiment of the present application can divide the computer device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0113] For example, Fig.10 A possible structural schematic diagram of a computer device (referred to as computer device 100) involved in the above embodiment is shown, and the computer device 100 includes an acquisition unit 1001, a determination unit 1002, and an adjustment unit 1003. The acquisition unit 1001 is used to acquire the hue value distribution information of multiple target signal light areas in at least one image, wherein the multiple target signal light areas are other signal light areas other than the green signal light area in the multiple signal light areas. The determination unit 1002 is used to determine the red-yellow segmentation threshold based on the distribution information; wherein the red-yellow segmentation threshold is used to distinguish the red hue value from the yellow hue value. The determination unit 1002 is also used to determine the red signal light area and the yellow signal light area in the multiple target signal light areas based on the red-yellow segmentation threshold. The adjustment unit 1003 is also used to adjust the hue value of the red signal light area from the first current value to the first target value, and adjust the hue value of the yellow signal light area from the second current value to the second target value; wherein the first target value belongs to the red hue value distribution range, and the second target value belongs to the yellow hue value distribution range.
[0114] Optionally, the acquisition unit 1001 is further used to acquire RGB values of multiple signal light areas in at least one image; determine a green signal light area among the multiple signal light areas based on the RGB values of the multiple signal light areas; and determine multiple target signal light areas from at least one image based on the green signal light area.
[0115] Optionally, the adjustment unit 1003 is further configured to adjust the hue value of the green signal light area to a third target value; wherein the third target value belongs to a preset distribution range of green hue values.
[0116] Optionally, the distribution information includes a red hue value distribution range and a yellow hue value distribution range, and the determination unit 1002 is specifically used to determine a target red hue value distribution range and a target yellow hue value distribution range based on the red hue value distribution range and the yellow hue value distribution range; wherein the maximum value of the target red hue value distribution range is less than or equal to the minimum value of the target yellow hue value distribution range; or, the minimum value of the target red hue value distribution range is greater than or equal to the maximum value of the target yellow hue value distribution range; and determine the red-yellow segmentation threshold based on the target red hue value distribution range and the target yellow hue value distribution range.
[0117] Optionally, the adjustment unit 1003 is further used to adjust the second target value to the second current value when it is determined that the time length of continuously collecting the yellow traffic light area is greater than a first threshold value; the adjustment unit 1003 is also used to adjust the second current value to the first target value starting from the moment when the second target value is adjusted to the second current value and the time length of continuously collecting the yellow traffic light area is greater than the second threshold value.
[0118] Optionally, the adjustment unit 1003 is further configured to adjust the red-yellow segmentation threshold by M units toward the second target value when it is determined that the duration of continuous acquisition of the yellow traffic light area is greater than the first threshold, where M is an integer greater than 0.
[0119] Optionally, the acquisition unit 1001 is further used to acquire multiple images; the determination unit 1002 is further used to determine the target signal light unit based on multiple target signal light areas in the multiple images, the target signal light unit including at least a green signal light area and a yellow signal light area; the computer device 100 also includes a statistical unit 1004, which is used to count the transition rules of the target signal light unit, the transition rule refers to the number of frames and the transition sequence of the green signal light area and the yellow signal light area in the target signal light unit; the adjustment unit is further used to adjust the red-yellow segmentation threshold when it is determined based on the red-yellow segmentation threshold that the yellow signal light area does not satisfy the transition rule.
[0120] Optionally, the computer device 100 further includes a storage unit 1005. The storage unit 1005 is used to store computer-executable instructions, and other units in the computer device can perform corresponding actions according to the computer-executable instructions stored in the storage unit 1005.
[0121] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any of the above computer devices 100 and the description of the beneficial effects can refer to the above corresponding method embodiments, which will not be repeated here.
[0122] As an example, combining Figure 1 , the functions partially or entirely implemented by the acquisition unit 1001, the determination unit 1002, the adjustment unit 1003, the statistics unit 1004 and the storage unit 1005 in the computer device 100 can be realized by Figure 1 Processor 101 in the Figure 1 The acquisition unit 1001 can also be implemented by Figure 1 The receiving unit in the communication interface 103 is implemented.
[0123] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is enabled to execute any of the methods executed by the computer devices provided above.
[0124] For the explanation of the relevant contents and description of the beneficial effects of any of the above-mentioned computer-readable storage media, reference may be made to the above-mentioned corresponding embodiments, which will not be repeated here.
[0125] The embodiment of the present application also provides a chip. The chip integrates a control circuit and one or more ports for implementing the functions of the above-mentioned computer device 100. Optionally, the functions supported by the chip can be referred to above and will not be repeated here. A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned embodiment can be completed by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The above-mentioned processing unit or processor can be a central processing unit, a general-purpose processor, an application specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), a field programmable gate array (field programmable gatearray, FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.
[0126] The embodiment of the present application also provides a computer program product including instructions, when the instructions are run on a computer, the computer executes any one of the methods in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means to another website site, computer, server, or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more servers that can be integrated with the medium. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD), etc.
[0127] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, computer-readable storage media and communication chips, etc., are all non-transitory.
[0128] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0129] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0130] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations 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. A method for processing the color of a signal light, characterized in that: include: Acquire tone value distribution information of a plurality of target signal light areas in at least one image, wherein the plurality of target signal light areas are other signal light areas other than a green signal light area among the plurality of signal light areas; Determine a red-yellow segmentation threshold based on the distribution information; wherein the red-yellow segmentation threshold is used to distinguish between red hue values and yellow hue values; Based on the red-yellow segmentation threshold, determining a red signal light area and a yellow signal light area in the plurality of target signal light areas; Adjusting the hue value of the red traffic light area from a first current value to a first target value, and adjusting the hue value of the yellow traffic light area from a second current value to a second target value; wherein the first target value belongs to a red hue value range, and the second target value belongs to a yellow hue value range; When it is determined that the duration of continuous collection of the yellow traffic light area is greater than the first threshold, the second target value is adjusted to the second current value; starting from the moment when the second target value is adjusted to the second current value, when the duration of continuous collection of the yellow traffic light area is greater than the second threshold, the second current value is adjusted to the first target value; and / or; When it is determined that the duration of continuous acquisition of the yellow traffic light area is greater than the first threshold, the red-yellow segmentation threshold is adjusted by M units toward the second target value, where M is an integer greater than 0.
2. The method according to claim 1, characterized in that Before acquiring the tone value distribution information of a plurality of target signal light regions in at least one image, the method further includes: Obtaining RGB values of a plurality of signal light regions in the at least one image; determining a green signal light area among the plurality of signal light areas based on the RGB values of the plurality of signal light areas; Based on the green signal light area, the plurality of target signal light areas are determined from the at least one image.
3. The method according to claim 2, characterized in that After determining the green signal light area among the plurality of signal light areas, the method further includes: The hue value of the green signal light area is adjusted to a third target value; wherein the third target value belongs to a preset distribution range of green hue values.
4. The method according to any one of claims 1 to 3, characterized in that: The distribution information includes the red hue value distribution range and the yellow hue value distribution range, and determining the red-yellow segmentation threshold based on the distribution information includes: Based on the red hue value distribution range and the yellow hue value distribution range, a target red hue value distribution range and a target yellow hue value distribution range are determined; wherein the maximum value of the target red hue value distribution range is less than or equal to the minimum value of the target yellow hue value distribution range; or the minimum value of the target red hue value distribution range is greater than or equal to the maximum value of the target yellow hue value distribution range; The red-yellow segmentation threshold is determined based on the target red hue value distribution range and the target yellow hue value distribution range.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: Acquire multiple images; Determine a target signal light unit according to a plurality of target signal light areas in the plurality of images, wherein the target signal light unit includes at least a green signal light area and a yellow signal light area; Counting the transition rule of the target signal light unit, wherein the transition rule refers to the number of frames and the transition sequence of the green signal light area and the yellow signal light area in the target signal light unit; When it is determined based on the red-yellow segmentation threshold that the yellow traffic light area does not satisfy the transition rule, the red-yellow segmentation threshold is adjusted.
6. A signal light control device, characterized in that: include: an acquiring unit, configured to acquire tone value distribution information of a plurality of target signal light regions in at least one image, wherein the plurality of target signal light regions are other signal light regions other than a green signal light region among the plurality of signal light regions; A determination unit, configured to determine a red-yellow segmentation threshold based on the distribution information; wherein the red-yellow segmentation threshold is used to distinguish between a red hue value and a yellow hue value; The determining unit is further configured to determine a red signal light area and a yellow signal light area in the plurality of target signal light areas based on the red-yellow segmentation threshold; an adjusting unit, configured to adjust the hue value of the red signal light area from a first current value to a first target value, and adjust the hue value of the yellow signal light area from a second current value to a second target value; wherein the first target value belongs to a red hue value range, and the second target value belongs to a yellow hue value range; The adjustment unit is further configured to, when it is determined that the duration of continuous collection of the yellow traffic light area is greater than a first threshold, adjust the second target value to the second current value; and when the duration of continuous collection of the yellow traffic light area is greater than the second threshold starting from the moment when the second target value is adjusted to the second current value, adjust the second current value to the first target value; and / or; When it is determined that the duration of continuous acquisition of the yellow traffic light area is greater than the first threshold, the red-yellow segmentation threshold is adjusted by M units toward the second target value, where M is an integer greater than 0.
7. A computer device, characterized in that: include: processor; The processor is connected to a memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, so that the computer device implements the method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: Used to store computer instructions, when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 5.
