Signal lamp control method and electronic equipment
By performing brightness enhancement and target detection on road images collected by intersection cameras, combined with difference analysis of reference images, flexible control of signal lights is achieved, which solves the problem of low vehicle traffic efficiency in the existing technology and improves the safety and security of traffic flow. efficiency.
Patent Information
- Application Number
- CN202310875917.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-17
- Publication Date
- 2025-01-17
AI Technical Summary
Existing signal light control methods can lead to reduced vehicle traffic efficiency at night because vehicles need to stop and wait even if no pedestrians pass through the zebra crossing.
By acquiring road images collected by cameras at intersections, brightness enhancement processing and target object detection are performed. If pedestrians are detected, the signal lights are controlled. If pedestrians are not detected, reference images are used for further detection to ensure traffic safety.
It improves the accuracy and safety of signal light control, reduces unnecessary vehicle parking and waiting, and improves the efficiency of traffic flow.
Smart Images

Figure CN119323894A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of intelligent transportation technology, and in particular to a signal light control method and electronic equipment. Background Art
[0002] With economic development, the number of motor vehicles in cities has increased significantly, and urban traffic congestion and jams often occur. Intersections, as key nodes for traffic convergence and evacuation, greatly affect the safety and efficiency of urban transportation system operations.
[0003] At night, the traffic road system is generally in a low-load operation state, and the signal light control system generally uses the minimum phase operation to ensure the pedestrian passage time on the zebra crossing. However, this signal light control method will cause vehicles to stop and wait at the intersection when there are no pedestrians on the zebra crossing, reducing vehicle traffic efficiency. Summary of the invention
[0004] The purpose of the present application is to provide a signal light control method and electronic equipment for detecting pedestrians on the road and flexibly controlling the signal light.
[0005] In a first aspect, the present application provides a signal light control method, the method comprising:
[0006] Acquire a road image captured by at least one camera at an intersection, wherein the road image includes a pedestrian driving area at the intersection;
[0007] For a set of road images collected by the at least one camera at the same time, brightness enhancement processing is performed on a pedestrian driving area in each frame of the road image in the set of road images; and target object detection is performed on each frame of the road image in the set of road images after the brightness enhancement processing;
[0008] If a target object is detected in a pedestrian driving area of at least one road image in the road image set, controlling a traffic light at the intersection;
[0009] If no target object is detected in the pedestrian driving area of each frame of road image in the road image set, obtain a reference image corresponding to each frame of road image in the road image set, wherein the reference image and the corresponding road image are images captured by the same camera at different times; for any frame of road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic light at the intersection according to the detection result.
[0010] In a second aspect, the present application provides a signal light control device, comprising:
[0011] An acquisition module, used to acquire a road image captured by at least one camera at an intersection, wherein the road image includes a pedestrian driving area at the intersection;
[0012] an enhancement module, for performing brightness enhancement processing on a pedestrian driving area in each frame of road image in the road image set collected by the at least one camera at the same time; and performing target object detection on each frame of road image in the road image set after the brightness enhancement processing;
[0013] a control module, configured to control the traffic light at the intersection if a target object is detected in a pedestrian driving area of at least one road image in the road image set;
[0014] The detection module is used to obtain a reference image corresponding to each frame of the road image in the road image set if no target object is detected in the pedestrian driving area of each frame of the road image in the road image set, wherein the reference image and the corresponding road image are images collected by the same camera at different times; for any frame of the road image in the road image set, target object detection is performed on the road image according to the reference image corresponding to the road image, and the traffic light at the intersection is controlled according to the detection result.
[0015] In an optional implementation manner, the enhancement module is specifically used for:
[0016] For any frame of road image in the road image set, the following operations are performed respectively:
[0017] Determine the brightness value of each pixel point in the pedestrian driving area in the road image, and the brightness value of each pixel point in the lane area in the road image; wherein the brightness value of each pixel point in the pedestrian driving area and the brightness value of each pixel point in the lane area are the brightness values of the pixel points of the road image in the HSV color space;
[0018] According to the brightness value of each pixel point in the lane area, brightness enhancement processing is performed on the brightness value of each pixel point in the pedestrian driving area.
[0019] In an optional implementation manner, the enhancement module is specifically used for:
[0020] Dividing the pedestrian driving area and the lane area in the road image into a plurality of sub-areas respectively;
[0021] For any sub-region, determine brightness distribution information corresponding to the sub-region according to the brightness value of each pixel in the sub-region, wherein the brightness distribution information includes a brightness cumulative probability distribution value corresponding to each pixel in the sub-region;
[0022] Determining an adjustment ratio for adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area according to the brightness cumulative probability distribution value corresponding to each pixel point in the lane area;
[0023] According to the adjustment ratio, the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is adjusted to obtain the target brightness cumulative probability distribution value corresponding to each pixel point;
[0024] According to the target brightness cumulative probability distribution value corresponding to each pixel point, the brightness value after brightness enhancement processing corresponding to each pixel point is determined respectively.
[0025] In an optional implementation manner, the enhancement module is specifically used for:
[0026] Determine a first maximum value and a first minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the pedestrian driving area; and determine a second maximum value and a second minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the lane area;
[0027] The ratio of the difference between the first maximum value and the second maximum value to the difference between the first minimum value and the second minimum value is used as the adjustment ratio.
[0028] In an optional implementation manner, the enhancement module is specifically used for:
[0029] Determine the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area; and determine the difference between the fourth maximum value and the fourth minimum value in the brightness value corresponding to each pixel point in the pedestrian driving area;
[0030] The ratio of the difference between the third maximum value and the third minimum value to the difference between the fourth maximum value and the fourth minimum value is used as a conversion ratio between the target brightness cumulative probability distribution value and the brightness value;
[0031] According to the conversion ratio, the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is converted respectively to determine the brightness value after brightness enhancement processing corresponding to each pixel point.
[0032] In an optional implementation manner, the detection module is specifically used for:
[0033] Acquire at least one frame of reference image corresponding to the road image and captured by a camera corresponding to the road image, wherein the reference image is captured later than the road image;
[0034] Performing difference analysis on each frame reference image and the road image to generate a foreground image between the road image and each frame reference image;
[0035] Determine a connected area in a foreground image corresponding to each frame of the reference image, wherein the pixel value between adjacent pixels in the connected area is not greater than a preset threshold;
[0036] Whether the road image contains the target object is determined according to the area of the connected region in the foreground image corresponding to each frame of the reference image.
[0037] In an optional implementation manner, the detection module is specifically used for:
[0038] For a first reference image whose acquisition time is ranked earlier in the at least one frame of reference images, if an area of a connected region in a foreground image corresponding to the first reference image is not greater than a first area threshold, determining that no target object is detected in the road image;
[0039] If the area of the connected region in the first reference image is greater than the first area threshold, obtaining the number of connected regions in the foreground image corresponding to the second reference image, the second reference image being the next frame reference image of the first reference image;
[0040] When there are multiple connected areas in the foreground image corresponding to the second reference image, obtain a previous frame of road image of the second reference image, and when it is determined that the area of the connected area in the foreground image between the previous frame of road image and the road image is within a preset range, determine that the road image contains the target object; when the number of connected areas in the foreground image corresponding to the second reference image is one, and the area of the connected area in the foreground image corresponding to the second reference image is larger than the area of the connected area in the target reference image, update the next frame of reference image of the second reference image to the second reference image, and return to the step of obtaining the number of connected areas in the foreground image corresponding to the second reference image; otherwise, determine that the target object is not detected in the road image.
[0041] In an optional implementation manner, the enhancement module is specifically used for:
[0042] Input each frame of the road image in the road image set after the brightness enhancement processing into the trained YOLOX target detection model; perform target object detection on each frame of the road image in the road image set after the brightness enhancement processing by the trained YOLOX target detection model, and obtain the detection result output by the trained YOLOX target detection model.
[0043] In an optional implementation manner, the detection module is specifically used for:
[0044] If the detection result is that the target object is included in the pedestrian driving area of at least one frame of the road image in the road image set, control the traffic light in the traffic direction corresponding to the pedestrian driving area to be in a pass state, and control the traffic light in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area to be in a no-pass state;
[0045] If the detection result is that the target object is not included in the pedestrian driving area of each road image in the road image set, the traffic lights in the traffic direction corresponding to the pedestrian driving area are controlled to be in a prohibited traffic state, and the traffic lights in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area are controlled to be in a traffic state.
[0046] In a third aspect, an embodiment of the present application provides an electronic device, which includes a transceiver unit and a processor;
[0047] The transceiver unit is used to obtain a road image collected by at least one camera at the intersection, wherein the road image includes a pedestrian driving area and a lane area at the intersection;
[0048] The processor is used to perform brightness enhancement processing on the pedestrian driving area in each frame of road image in the road image set collected by the at least one camera at the same time; and perform target object detection on each frame of road image in the road image set after the brightness enhancement processing; if the target object is detected in the pedestrian driving area of at least one road image in the road image set, control the traffic light at the intersection; if the target object is not detected in the pedestrian driving area of each frame of road image in the road image set, obtain the reference image corresponding to each frame of road image in the road image set, the reference image and the corresponding road image are images collected by the same camera at different times; for any frame of road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic light at the intersection according to the detection result.
[0049] In a fourth aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer executes the steps of any method described in the first aspect.
[0050] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of any method described in the first aspect.
[0051] The embodiment of the present application is a signal light control method, device and electronic device, which relate to the field of intelligent transportation technology. The present application obtains a road image including a pedestrian driving area and a lane area of an intersection, which is acquired by at least one camera at an intersection. For a set of road images acquired by at least one camera at the same time, the present application performs brightness enhancement processing on the pedestrian driving area in each frame of the road image in the road image set, so as to improve the brightness of the pedestrian driving area in the road image in a targeted manner. Compared with the enhancement method that improves the brightness of all areas in the road image, the present application can ensure the contrast between the pedestrian driving area and other areas in the road, and enhance the display effect of the pedestrian driving area in the road image; and performs target object detection on each frame of the road image in the road image set after the brightness enhancement processing, based on the brightness enhancement The road image after strong processing can improve the accuracy of target object detection and improve safety; if the target object is detected in the pedestrian driving area of at least one road image in the road image set, the traffic light at the intersection is controlled; if the target object is not detected in the pedestrian driving area of each frame of the road image in the road image set, the reference image corresponding to each frame of the road image in the road image set is obtained, and the reference image and the corresponding road image are images collected by the same camera at different times; for any frame of the road image in the road image set, the road image is detected for the target object according to the reference image corresponding to the road image, the traffic light at the intersection is controlled according to the detection result, and the pedestrian status of the road is further detected based on the reference image corresponding to the road image, so as to effectively ensure the safety of the traffic intersection. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0053] Figure 1 This is an optional application scenario of the embodiment of the present application;
[0054] Figure 2 This is a flow chart of a signal light control method according to an embodiment of the present application;
[0055] Figure 3 A road image according to an embodiment of the present application;
[0056] Figure 4 This is a brightness enhancement process flow chart of an embodiment of the present application;
[0057] Figure 5 This is a flow chart of performing brightness enhancement processing on the brightness value of a pixel point according to an embodiment of the present application;
[0058] Figure 6 This is a flow chart of determining an adjustment ratio according to an embodiment of the present application;
[0059] Figure 7 This is a flow chart of determining a brightness value after brightness enhancement processing according to an embodiment of the present application;
[0060] Figure 8 A schematic diagram of a road image after brightness enhancement processing according to an embodiment of the present application;
[0061] Fig. 9 This is a flow chart of target object detection according to an embodiment of the present application;
[0062] Fig.10 A schematic diagram of a connected region in a foreground image according to an embodiment of the present application;
[0063] Fig.11 A flowchart of determining whether a road image contains a target object according to an embodiment of the present application;
[0064] Fig.12 A schematic diagram of a connected area corresponding to a foreground image according to an embodiment of the present application;
[0065] Fig.13 A schematic diagram of a signal light control according to an embodiment of the present application;
[0066] Fig.14 This is an overall flow chart of road image detection according to an embodiment of the present application;
[0067] Fig.15 This is a flowchart of a specific implementation of local brightness enhancement in an embodiment of the present application;
[0068] Fig.16 This is a specific flow chart of an adaptive frame difference algorithm for judging pedestrians in an embodiment of the present application;
[0069] Fig.17 A schematic diagram of a connected area corresponding to a foreground image according to an embodiment of the present application;
[0070] Fig.18 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;
[0071] Fig.19 This is a schematic diagram of the structure of a signal light control device according to an embodiment of the present application. DETAILED DESCRIPTION
[0072] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Among them, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0073] Furthermore, in the description of the embodiments of the present application, unless otherwise specified, “and” means or. For example, A / B can mean A or B. The “and / or” in the text 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, in the description of the embodiments of the present application, “plurality” means two or more than two.
[0074] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, "multiple" means two or more.
[0075] In order to facilitate understanding of the image processing method, device and apparatus for endoscopic images provided in the embodiments of the present application, some terms in the embodiments of the present application are explained below to facilitate understanding by those skilled in the art.
[0076] Cumulative Distribution Function: In statistics and probability theory, the cumulative distribution function is a function that describes the probability distribution of a random variable. It gives the probability that the random variable will be less than or equal to a given value. The cumulative distribution function can be used to calculate the probability that a random variable falls within a certain interval.
[0077] In order to make the purpose, technical solution and beneficial effects of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0078] like Figure 1 As shown, an optional application scenario of an embodiment of the present application includes multiple cameras 10 and an edge computing unit 11 set up on a road.
[0079] The camera 10 is used to collect a road image collected by at least one camera at the intersection, wherein the road image includes a pedestrian driving area at the intersection;
[0080] The edge computing unit 11 is used to obtain a road image captured by at least one camera at an intersection, and for a set of road images captured by at least one camera at the same time, perform brightness enhancement processing on the pedestrian driving area in each frame of the road image in the road image set; and perform target object detection on each frame of the road image in the road image set after the brightness enhancement processing; if the target object is detected in the pedestrian driving area of at least one road image in the road image set, the traffic light at the intersection is controlled; if the target object is not detected in the pedestrian driving area of each frame of the road image in the road image set, obtain a reference image corresponding to each frame of the road image in the road image set, the reference image and the corresponding road image are images captured by the same camera at different times; for any frame of the road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic light at the intersection according to the detection result.
[0081] Among them, the camera can use the electric police.
[0082] It should be noted that the pedestrian driving area in the embodiment of the present application can be a zebra crossing area, and can also be set according to the actual road environment. The present application does not impose any restrictions on this.
[0083] It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principle of the present application, and the implementation of the present application is not limited in this respect. On the contrary, the implementation of the present application can be applied to any applicable scenario.
[0084] like Figure 2 As shown, a flowchart of a signal light control method according to an embodiment of the present application is shown, and the specific steps are as follows:
[0085] Step S201, obtaining a road image captured by at least one camera at an intersection;
[0086] The road image includes the pedestrian driving area and lane area of the intersection.
[0087] Optionally, the embodiment of the present application delineates the pedestrian driving area in the road images captured by each camera.
[0088] In the implementation, a road image captured by one of the cameras is as follows: Figure 3 As shown, the pedestrian driving area can be Figure 3 The area in the rectangular box.
[0089] It should be noted that the embodiment of the present application defines the zebra crossing as a pedestrian driving area.
[0090] Optionally, based on multiple cameras at an intersection, at least one pedestrian driving area captured by each camera is marked with an id, and a pedestrian driving area in the intersection corresponds to an id, ensuring that the ids marked for a pedestrian driving area in each camera are the same.
[0091] For example, if there are three cameras capturing lanes in different directions at an intersection, then for a zebra crossing area at the intersection, in the road images containing the zebra crossing area captured by the three cameras, the ID corresponding to the zebra crossing area is the same.
[0092] Optionally, the embodiment of the present application calibrates the time of each camera through an edge computing unit to unify the time of each camera.
[0093] Step S202: for a set of road images collected by at least one camera at the same time, perform brightness enhancement processing on a pedestrian driving area in each frame of the road image in the set of road images; and perform target object detection on each frame of the road image in the set of road images after the brightness enhancement processing;
[0094] For any frame of road image in the road image set, an embodiment of the present application is as follows Figure 4 The brightness enhancement process flow chart shown in the figure has the following specific steps:
[0095] Step S401, determining the brightness value of each pixel point in the pedestrian driving area in the road image, and the brightness value of each pixel point in the lane area in the road image;
[0096] Among them, the brightness value of each pixel point in the pedestrian driving area and the brightness value of each pixel point in the lane area are the brightness values of the pixel points of the road image in the HSV color space;
[0097] Step S402: performing brightness enhancement processing on the brightness values of the pixels in the pedestrian driving area according to the brightness values of the pixels in the lane area;
[0098] Specifically, the present application implements, for example Figure 5 The flowchart of a brightness enhancement process for the brightness value of a pixel is shown, and the specific steps are as follows:
[0099] Step S501, dividing the pedestrian driving area and the lane area in the road image into a plurality of sub-areas respectively;
[0100] The road image may be evenly divided into sub-regions of 8*8 size, to obtain a plurality of sub-regions including pedestrian driving regions and a plurality of sub-regions including lane regions.
[0101] Step S502: for any sub-region, determine the brightness distribution information corresponding to the sub-region according to the brightness value of each pixel in the sub-region;
[0102] The brightness distribution information includes the brightness cumulative probability distribution value corresponding to each pixel point in the sub-area.
[0103] In an optional implementation, after performing histogram statistics on the brightness values of each pixel in each sub-region, the brightness distribution information corresponding to each sub-region is obtained by performing cumulative distribution function (CDF) calculation on the brightness values of each pixel in each sub-region.
[0104] Among them, the embodiment of the present application performs histogram statistics on the brightness value of each pixel in any sub-region in the road image, and determines the number of pixels corresponding to different pixel values in the sub-region.
[0105] Exemplarily, for each pixel in a sub-region, the brightness value corresponding to each pixel in the V channel is counted to obtain the number of pixels corresponding to each brightness value in the sub-region. For example, the number of pixels with a pixel value of 100 in the sub-region is 2500, and the number of pixels with a pixel value of 140 is 2600.
[0106] In an embodiment of the present application, the number of pixel points corresponding to each brightness value counted in the sub-region is processed by a cumulative distribution function to obtain brightness distribution information corresponding to the sub-region; wherein the brightness distribution information of the sub-region includes the brightness cumulative probability distribution value corresponding to the brightness value of each pixel point.
[0107] It should be noted that the brightness distribution information in the embodiment of the present application is determined by a cumulative distribution function.
[0108] The obtained brightness distribution information corresponding to the sub-region may be a vector, which includes brightness cumulative probability distribution values corresponding to different pixel values.
[0109] It should be noted that the embodiment of the present application can perform cumulative distribution function calculation on the brightness value of each pixel point in each sub-area in the pedestrian driving area, and perform cumulative distribution function calculation on the brightness value of each pixel point in each sub-area in the lane area, to obtain the brightness distribution information corresponding to each sub-area in the pedestrian driving area, and the brightness distribution information corresponding to each sub-area in the lane area.
[0110] Step S503, determining an adjustment ratio for adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area according to the brightness cumulative probability distribution value corresponding to each pixel point in the lane area;
[0111] like Figure 6 As shown, a flow chart of determining an adjustment ratio according to an embodiment of the present application, the specific steps are as follows:
[0112] Step S601, determining a first maximum value and a first minimum value in the cumulative probability distribution value of brightness corresponding to each pixel point in the pedestrian driving area; and determining a second maximum value and a second minimum value in the cumulative probability distribution value of brightness corresponding to each pixel point in the lane area;
[0113] During implementation, before determining the first maximum value and the first minimum value in the cumulative probability distribution value of brightness corresponding to each pixel point in the pedestrian driving area, the maximum cumulative probability distribution value of brightness and the minimum cumulative probability distribution value of brightness corresponding to each sub-area are determined; based on the maximum cumulative probability distribution value of brightness and the minimum cumulative probability distribution value of brightness corresponding to each sub-area containing the pedestrian driving area, the first maximum value and the first minimum value in the cumulative probability distribution value of brightness corresponding to each pixel point in the pedestrian driving area are determined.
[0114] Among them, for a sub-region, the embodiment of the present application determines the maximum brightness cumulative probability distribution value and the minimum brightness cumulative probability distribution value corresponding to the sub-region according to the brightness cumulative probability distribution value corresponding to each pixel point in the sub-region.
[0115] During implementation, based on the maximum brightness cumulative probability distribution value and the minimum brightness cumulative probability distribution value corresponding to each sub-area including the pedestrian driving area, among the maximum brightness cumulative probability distribution values and the minimum brightness cumulative probability distribution values corresponding to the pedestrian driving area, the maximum value of each maximum brightness cumulative probability distribution value is taken as the first maximum value, and the minimum value of each minimum brightness cumulative probability distribution value is taken as the first minimum value.
[0116] It should be noted that the principle of determining the second maximum and second minimum values in the cumulative probability distribution of brightness corresponding to each pixel point in the lane area can refer to the principle of determining the first maximum and first minimum values in the cumulative probability distribution of brightness corresponding to each pixel point in the pedestrian driving area. This application will not repeat them here.
[0117] Step S602: taking the ratio of the difference between the first maximum value and the second maximum value to the difference between the first minimum value and the second minimum value as an adjustment ratio.
[0118] In the embodiment of the present application, the adjustment ratio may be delta_max / delta_min;
[0119] Wherein, delta_max represents the difference between the first maximum value and the second maximum value, and delta_min represents the difference between the first minimum value and the second minimum value;
[0120] delta_max=max_value_B-max_value_A, max_value_B represents the second maximum value of the cumulative probability distribution of brightness corresponding to each pixel in the lane area, and max_value_A represents the first maximum value of the cumulative probability distribution of brightness corresponding to each pixel in the pedestrian driving area;
[0121] delta_min=min_value_B-min_value_A, min_value_B represents the second minimum value in the cumulative probability distribution value of brightness corresponding to each pixel point in the lane area, and min_value_A represents the first minimum value in the cumulative probability distribution value of brightness corresponding to each pixel point in the pedestrian driving area.
[0122] Step S504: adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area according to the adjustment ratio to obtain the target brightness cumulative probability distribution value corresponding to each pixel point;
[0123] Optionally, the embodiment of the present application obtains the target brightness cumulative probability distribution value corresponding to each pixel point according to steps C1 to C3:
[0124] Step C1, taking the difference between the brightness cumulative probability distribution value corresponding to each pixel point and the first minimum value of the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area as the brightness cumulative probability distribution value increment corresponding to each pixel point;
[0125] Among them, for a pixel point, the embodiment of the present application calculates the difference between the brightness cumulative probability distribution value and the first minimum value based on the brightness cumulative probability distribution value corresponding to the pixel point, and uses the difference as the brightness cumulative probability distribution value increment corresponding to the pixel point.
[0126] In the embodiment of the present application, the increment of the cumulative probability distribution value of brightness corresponding to the pixel point can be expressed as: (prob_A-min_value_A).
[0127] Among them, prob_A represents the brightness cumulative probability distribution value corresponding to the pixel point, and min_value_A represents the first minimum value among the brightness cumulative probability distribution values corresponding to each pixel point in the pedestrian driving area.
[0128] Step C2, adjusting the brightness cumulative probability distribution value increment corresponding to each pixel point according to the adjustment ratio to obtain the adjusted brightness cumulative probability distribution value increment corresponding to each pixel point;
[0129] Optionally, the adjusted brightness cumulative probability distribution value increment corresponding to each pixel point is obtained by (prob_A-min_value_A)*(delta_max / delta_min);
[0130] Among them, (prob_A-min_value_A) represents the increment of the cumulative probability distribution value of brightness corresponding to each pixel point; (delta_max / delta_min) represents the adjustment ratio.
[0131] Step C3, respectively summing up the adjusted brightness cumulative probability distribution value increment corresponding to each pixel point and the second minimum value of the brightness cumulative probability distribution value corresponding to each pixel point in the lane area to determine the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area.
[0132] Optionally, for a pixel point in the pedestrian driving area, the embodiment of the present application determines the target brightness cumulative probability distribution value corresponding to the pixel point through Formula 1.
[0133] prob_B=(prob_A-min_value_A)*(delta_max / delta_min)+min_value_B
[0134] ——Formula 1
[0135] Wherein, prob_B represents the cumulative probability distribution value of target brightness; min_value_B represents the second minimum value of the cumulative probability distribution value of brightness corresponding to each pixel point in the lane area;
[0136] (prob_A-min_value_A)*(delta_max / delta_min) represents the increment of the cumulative probability distribution value of brightness after adjustment; wherein, (prob_A-min_value_A) represents the increment of the cumulative probability distribution value of brightness corresponding to the pixel point; (delta_max / delta_min) represents the adjustment ratio; prob_A represents the cumulative probability distribution value of brightness corresponding to the pixel point, and min_value_A represents the first minimum value among the cumulative probability distribution values of brightness corresponding to each pixel point in the pedestrian driving area.
[0137] Step S505 : Determine the brightness value after brightness enhancement processing corresponding to each pixel point according to the target brightness cumulative probability distribution value corresponding to each pixel point.
[0138] like Figure 7 As shown, the embodiment of the present application provides a flowchart for determining the brightness value after brightness enhancement processing, and the specific steps are as follows:
[0139] Step S701, determining the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area; and determining the difference between the fourth maximum value and the fourth minimum value in the brightness value corresponding to each pixel point in the pedestrian driving area;
[0140] Step S702: taking the ratio of the difference between the third maximum value and the third minimum value to the difference between the fourth maximum value and the fourth minimum value as the conversion ratio between the target brightness cumulative probability distribution value and the brightness value;
[0141] Optionally, the embodiment of the present application determines the conversion ratio between the target brightness cumulative probability distribution value and the brightness value according to Formula 2:
[0142]
[0143] Among them, slope represents the conversion ratio between the target brightness cumulative probability distribution value and the brightness value;
[0144] max_value_target-min_value_target represents the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area; max_value_target represents the third maximum value, and min_value_target represents the third minimum value;
[0145] max_value_original-min_value_original represents the difference between the fourth maximum value and the fourth minimum value in the brightness values corresponding to each pixel point in the pedestrian driving area; max_value_original represents the fourth maximum value, and min_value_original represents the fourth minimum value.
[0146] Step S703: According to the conversion ratio, the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is converted respectively to determine the brightness value after brightness enhancement processing corresponding to each pixel point.
[0147] Optionally, the embodiment of the present application normalizes the target brightness cumulative probability distribution value corresponding to each pixel point in any sub-area corresponding to the pedestrian driving area according to steps D1 to D3 to obtain the normalized target brightness cumulative probability distribution value.
[0148] Step D1, sorting the target brightness cumulative probability distribution values corresponding to each pixel point in the sub-region, and determining the target brightness cumulative probability distribution value corresponding to each pixel point in the sub-region and the reference proportion of each target brightness cumulative probability distribution value corresponding to the pixel value of each pixel point in the sub-region;
[0149] The reference ratio is used to indicate, in the sorted target brightness cumulative probability distribution values, the relative position of the sorted position of the target brightness cumulative probability distribution value corresponding to the pixel point in all target brightness cumulative probability distribution values corresponding to the sub-region.
[0150] Optionally, in the embodiment of the present application, the target brightness cumulative probability distribution values are sorted according to their numerical values to obtain a sequence of target brightness cumulative probability distribution values arranged from small to large.
[0151] For example, if the target brightness cumulative probability distribution value corresponding to a pixel point is 0.7, the ranking position of the target brightness cumulative probability distribution value corresponding to the sub-region is 40, and if the number of target brightness cumulative probability distribution values corresponding to the sub-region is 50, then the ranking position of the target brightness cumulative probability distribution value corresponding to the pixel point and the relative position in the ranking of all target brightness cumulative probability distribution values corresponding to the sub-region is 0.8.
[0152] Step D2, multiplying the difference between the third maximum value and the third minimum value by the reference proportion of the target brightness cumulative probability distribution value corresponding to each pixel point, to determine the relative cumulative probability distribution value increment corresponding to each target brightness cumulative probability distribution value;
[0153] Optionally, for a target brightness cumulative probability distribution value corresponding to a pixel point, the embodiment of the present application may determine the corresponding relative cumulative probability distribution value increment according to (index_target / (len(CDF_target)-1))*(max_value_target-min_value_target);
[0154] Among them, (index_target / (len(CDF_target)-1)) represents the reference proportion of the target brightness cumulative probability distribution value corresponding to the pixel point in the target brightness cumulative probability distribution values corresponding to the sub-region; index_target represents the sorting position of the target brightness cumulative probability distribution value corresponding to the pixel point in the sorted target brightness cumulative probability distribution values corresponding to the sub-region to which it belongs, and len(CDF_target)-1) represents the number of target brightness cumulative probability distribution values corresponding to each pixel point in the sub-region;
[0155] (max_value_target-min_value_target) represents the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution values corresponding to each pixel point in the pedestrian driving area.
[0156] Step D3, respectively summing the relative cumulative probability distribution value increment corresponding to each target brightness cumulative probability distribution value and the third minimum value to determine the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the sub-area.
[0157] Optionally, the embodiment of the present application determines the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the sub-area corresponding to the pedestrian driving area according to Formula 3:
[0158]
[0159] Among them, normalized_index_target represents the normalized target brightness cumulative probability distribution value corresponding to the pixel point; represents the reference proportion; min_value_target represents the third minimum value; μ=(max_value_target-min_value_target) represents the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area.
[0160] Step S505 : Determine the brightness value after brightness enhancement processing corresponding to each pixel point according to the target brightness cumulative probability distribution value corresponding to each pixel point.
[0161] Optionally, the embodiment of the present application determines the brightness value after brightness enhancement processing corresponding to each pixel point according to Formula 4:
[0162] mapped_value=(normalized_index_target-intercept) / slope
[0163] ——Formula 4
[0164] Among them, mapped_value represents the brightness value after brightness enhancement processing; slope represents the conversion ratio between the target brightness cumulative probability distribution value and the brightness value; normalized_index_target represents the target brightness cumulative probability distribution value after normalization processing corresponding to the pixel point;
[0165] intercept=min_value_target-slope*min_value_original; slope represents the conversion ratio between the target brightness cumulative probability distribution value and the brightness value; min_value_target represents the third minimum value among the target brightness cumulative probability distribution values corresponding to each pixel point in the pedestrian driving area; min_value_original represents the fourth minimum value among the brightness values corresponding to each pixel point in the pedestrian driving area.
[0166] During implementation, the embodiment of the present application converts the enhanced road image in the HSV color space into the RGB color space according to the brightness value after brightness enhancement processing corresponding to each pixel point in the pedestrian driving area in the determined road image, so as to obtain the enhanced road image of the pedestrian driving area.
[0167] like Figure 8 As shown, the road image including the enhanced pedestrian driving area according to the embodiment of the present application.
[0168] Among them, the embodiments of the present application are only for Figure 8 Take the zebra crossing area in the middle dotted box for example for enhancement.
[0169] Step S203: If a target object is detected in a pedestrian driving area of at least one road image in the road image set, a traffic light at the intersection is controlled;
[0170] Optionally, the embodiment of the present application may perform target detection on at least one road image in the road image set by using a trained YOLOX target detection algorithm.
[0171] Among them, each frame of road image in the road image set after brightness enhancement processing is input into the trained YOLOX target detection model; target object detection is performed on each frame of road image in the road image set after brightness enhancement processing by the trained YOLOX target detection model, and the detection result output by the trained YOLOX target detection model is obtained.
[0172] During implementation, the trained YOLOX object detection algorithm can detect pedestrians and motor vehicles in at least one road image.
[0173] Among them, for the training process of the YOLOX target detection algorithm, the embodiment of the present application can train the YOLOX target detection algorithm based on labeled sample images.
[0174] Optionally, the road images collected historically at the intersection can be annotated and used as annotated sample images for training the YOLOX target detection algorithm.
[0175] The sample images include annotations for pedestrians and vehicles.
[0176] For example, taking the traffic light controlling the north-south lane at the intersection as an example, the current traffic light is red, and by performing target detection on at least one road image currently captured by multiple cameras at the intersection, for each target detection result corresponding to the zebra crossing located in the north-south lane in the road image captured by multiple cameras, it is determined whether there is a pedestrian at the zebra crossing in the north-south lane. If there is, the red light of the traffic light is maintained. If there is no pedestrian, the process proceeds to step S204 for further detection.
[0177] Among them, for each target detection result corresponding to the zebra crossing on the north-south lane in the road images captured by multiple cameras, if there is a road image in which the target detection result for the zebra crossing on the north-south lane is that there are pedestrians, it is determined that there are pedestrians on the zebra crossing on the north-south lane.
[0178] Step S204: If no target object is detected in the pedestrian driving area of each frame of the road image in the road image set, obtain a reference image corresponding to each frame of the road image in the road image set, where the reference image and the corresponding road image are images captured by the same camera at different times; for any frame of the road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic lights at the intersection according to the detection results.
[0179] Optionally, the embodiment of the present application may perform step S204 by an adaptive inter-frame difference algorithm.
[0180] like Fig. 9 As shown, a target object detection flow chart of an embodiment of the present application, the specific steps are as follows:
[0181] Step S901, obtaining at least one frame of reference image corresponding to the road image and acquired by a camera corresponding to the road image, wherein the acquisition time of the reference image is later than the acquisition time of the road image;
[0182] In this embodiment of the present application, after the road image is acquired, a reference image may be acquired at a first time interval.
[0183] Exemplarily, the first time interval may be 100 ms.
[0184] Step S902, performing difference analysis processing on each frame reference image and the road image, and generating a foreground image between the road image and each frame reference image;
[0185] Optionally, the embodiment of the present application may pre-process each frame of the reference image and the road image before performing the difference analysis process.
[0186] Exemplarily, the pre-processing process may include steps E1 and E2:
[0187] Step E1: convert each frame of reference image and road image into a grayscale image.
[0188] Step E2: Perform Gaussian blur processing on the grayscale image to remove background noise of each frame of reference image and road image.
[0189] Optionally, the embodiment of the present application may use differential calculation to perform difference analysis processing on each frame reference image and the road image, and respectively generate a foreground image between the road image and each frame reference image.
[0190] After the foreground image between the road image and each frame reference image is generated, morphological processing may be performed on the generated foreground image.
[0191] Illustratively, when performing morphological processing on a foreground image in an embodiment of the present application, an erosion operation may be first performed on the foreground image, and then a dilation operation may be performed on the foreground image.
[0192] Step S903, determining the connected areas in the foreground image corresponding to each frame of the reference image;
[0193] Optionally, the embodiment of the present application determines the connected area by judging that the pixel value between adjacent pixel points in the connected area is not greater than a preset threshold;
[0194] Optionally, the embodiment of the present application can determine the connected area in the foreground image corresponding to each frame reference image through an opencv algorithm.
[0195] In the embodiment of the present application, the connected area in the foreground image is as follows: Fig.10 As shown in the white area in the figure.
[0196] Among them, Fig.10 As shown, the number of connected regions is two.
[0197] Step S904: Determine whether the road image contains a target object based on the area of the connected region in the foreground image corresponding to each frame of the reference image.
[0198] like Fig.11 As shown, a flowchart of an embodiment of the present application for determining whether a road image contains a target object is shown below:
[0199] Step S1101: for a first reference image whose acquisition time is ranked earlier in at least one frame of reference images, if the area of a connected region in a foreground image corresponding to the first reference image is not greater than a first area threshold, it is determined that no target object is detected in the road image;
[0200] In the embodiment of the present application, the first area threshold is determined according to the following steps F1-F2:
[0201] Step F1, selecting two frames of training images separated by a first time interval from the pedestrian training data set, and performing the following steps for each pair of training images separated by the first time interval: performing difference analysis on the two frames of training images, generating foreground images for the pedestrian annotation data between the two frames of training images for the pedestrian annotation data contained in the two frames of training images, and determining the area of the connected region corresponding to the pedestrian annotation data in the foreground image;
[0202] Optionally, the pedestrian training dataset may include images with pedestrian annotations.
[0203] Among them, the road images collected historically at the intersection can be processed by pedestrian annotation to form a pedestrian training data set.
[0204] Step F2: determine the minimum value of the areas of the connected regions corresponding to the pedestrian annotation data in the foreground image corresponding to each pair of training images separated by a first time interval, and determine the first area threshold by multiplying the minimum value by a preset ratio.
[0205] For example, if the areas of the connected regions corresponding to the pedestrian annotation data in the foreground image corresponding to each pair of training images separated by the first time interval are respectively: S1, S2, S3, and the minimum value is S1, then the first area threshold is determined according to the minimum value S1. If the preset ratio is 0.8, the first area threshold obtained is 0.8S1.
[0206] Based on the example, the first area threshold is 0.8S1. After determining that the area of the connected region in the foreground image corresponding to the first reference image is not greater than 0.8S1, it is determined that no target object is detected in the road image.
[0207] It should be noted that, since the resolutions of road images collected by different cameras are different, different cameras will also affect the value of the first area threshold.
[0208] Step S1102: if the area of the connected region in the first reference image is greater than the first area threshold, obtaining the number of connected regions in the foreground image corresponding to the second reference image, the second reference image being the next frame reference image of the first reference image;
[0209] In implementation, after determining that the area of the connected region in the first reference image is greater than the first area threshold, the embodiment of the present application determines the area of the connected region in the foreground image corresponding to the second reference image with reference to the principle of the process of determining the area of the connected region in the foreground image corresponding to the first reference image. This application will not repeat it here.
[0210] Optionally, the embodiment of the present application may use an image that is separated from the road image by a second time interval as the second reference image.
[0211] The second time interval may be 150 ms.
[0212] Optionally, when determining the number of connected regions in the foreground image corresponding to the second reference image, the embodiment of the present application may determine the areas of the connected regions and count the number of connected regions that meet the area condition.
[0213] Exemplarily, the area of each connected region in the foreground image corresponding to the second reference image is compared with the second area threshold, and the number of connected regions whose area is greater than the second area threshold is counted.
[0214] It should be noted that the reference image includes at least one connected region.
[0215] Step S1103: when the number of connected areas in the foreground image corresponding to the second reference image is multiple, obtain a previous frame of the road image of the second reference image, and when it is determined that the area of the connected area in the foreground image between the previous frame of the road image and the road image is within a preset range, determine that the road image contains the target object; when the number of connected areas in the foreground image corresponding to the second reference image is one, and the area of the connected area in the foreground image corresponding to the second reference image is larger than the area of the connected area in the target reference image, update the next frame of the second reference image to the second reference image, and return to the step of obtaining the number of connected areas in the foreground image corresponding to the second reference image; otherwise, determine that the target object is not detected in the road image.
[0216] Optionally, before acquiring a frame of road image preceding the second reference image, in addition to determining that there are multiple connected areas in the foreground image corresponding to the second reference image, the number of connected areas in the foreground image may also be judged in combination with the width of the connected areas in the foreground image.
[0217] It should be noted that, if the road image and the second reference image include multiple connected regions, the connected regions whose distances between the connected regions satisfy the preset distance are determined as the connected regions corresponding to one object.
[0218] The embodiment of the present application determines the distance between at least one connected area corresponding to an object, and if it is less than a first preset distance, a previous frame of road image of the second reference image is acquired.
[0219] Optionally, when calculating the distance between at least one connected region corresponding to an object, the embodiment of the present application may ignore the connected regions in the foreground image whose area is not greater than the second area threshold, and only calculate the distance between the connected regions whose area is greater than the second area threshold.
[0220] Optionally, in the embodiment of the present application, the minimum width of a connected area in the foreground image can be used as the first preset distance.
[0221] Exemplarily, the following operations are performed for the connected areas corresponding to any object: based on the area of the connected area corresponding to any object, the number of connected areas whose area is greater than a second area threshold is determined; when it is determined that there are multiple connected areas whose area is greater than the second area threshold, the distances between the connected areas whose area is greater than the second area threshold are calculated; if they are all less than the first preset distance, the previous frame of the road image of the second reference image is obtained.
[0222] In implementation, after acquiring the previous frame of the road image of the second reference image, the connected area between the previous frame of the road image and the road image is determined, and it is judged whether the area of the connected area is within a first preset range. If it is within the first preset range, it is determined that the road image contains the target object;
[0223] The first preset range is larger than the second area threshold and smaller than the third area threshold.
[0224] like Fig.12 As shown, the embodiments of the present application are based on Fig.12 The connected areas corresponding to the multiple frames of foreground images shown are judged, and when it is determined that the number of connected areas in the last frame of the foreground image is multiple, and when it is determined that the area of the connected area in the foreground image between the previous frame of the road image and the road image is within a preset range, it is determined that the road image contains the target object.
[0225] In the embodiment of the present application, the second area threshold is determined according to the following steps G1-G2:
[0226] Step G1, selecting two frames of training images with a time interval of a first time interval in the pedestrian training data set, and performing the following steps for each pair of training images separated by the first time interval: performing difference analysis processing on the two frames of training images, generating foreground images for the pedestrian annotation data between the two frames of training images for the pedestrian annotation data contained in the two frames of training images, and determining the number of connected areas corresponding to the pedestrian annotation data in the foreground image;
[0227] Step G2, determine the training image corresponding to the foreground image before the number of connected areas changes, obtain the areas of the connected areas corresponding to the training image and all the training images before the training image, determine the minimum area value among the areas, and determine the second area threshold according to the minimum area value.
[0228] Exemplarily, the change in the number of connected regions may be that, for a connected region corresponding to an object, the number of connected regions changes from one connected region to two connected regions.
[0229] Optionally, in the embodiment of the present application, the minimum area value may be multiplied by a preset ratio to determine the second area threshold. For example, the preset ratio may be 0.8.
[0230] In the embodiment of the present application, the principle of the method for determining the third area threshold may refer to the principle of the method for determining the second area threshold. The third area threshold is determined according to a vehicle training data set. The vehicle training data set includes images with vehicle annotations.
[0231] Among them, the road images collected historically at the intersection can be processed by vehicle annotation to form a vehicle training data set.
[0232] Optionally, after determining the detection result corresponding to each frame of the road image in the road image set, the embodiment of the present application controls the traffic lights at the intersection according to the following different situations:
[0233] Case 1: The detection result is that the target object is included in the pedestrian driving area of at least one frame of road image in the road image set.
[0234] Control the traffic lights in the traffic direction corresponding to the pedestrian driving area to be in the traffic state, and control the traffic lights in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area to be in the prohibition state;
[0235] Case 2: The detection result is that the target object is not included in the pedestrian driving area of each road image in the road image set.
[0236] The traffic lights in the traffic direction corresponding to the pedestrian driving area are controlled to be in a prohibited traffic state, and the traffic lights in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area are controlled to be in a traffic state.
[0237] like Fig.13 As shown, if there is a target object on the zebra crossing area 1, the traffic light in the passing direction corresponding to the zebra crossing area 1 is controlled to be in the passing state, and the traffic light on the traffic light corresponding to the lane direction where the zebra crossing area 1 is located is controlled to be in the prohibition state.
[0238] like Fig.14 As shown, an overall flow chart of road image detection in an embodiment of the present application is shown, and the specific steps are as follows:
[0239] Step S1401, configuring the zebra crossing area at the intersection, and ensuring that the id of the same zebra crossing area is unique;
[0240] Step S1402: performing time synchronization of multiple cameras based on the edge computing unit;
[0241] Step S1403: The edge computing unit reads a frame of road image data collected by all cameras at the intersection;
[0242] Step S1404, calculating a road image after brightness enhancement processing based on a local brightness enhancement algorithm;
[0243] Step S1405: input the road image after brightness enhancement processing into the YOLOX target detection algorithm for target detection;
[0244] Step S1406: for a zebra crossing area in the road image, determine whether a pedestrian is detected in the zebra crossing area in all road images including the zebra crossing area; if so, execute step S1410; if not, execute step S1407;
[0245] Step S1407, performing an adaptive frame difference method to detect pedestrians in the zebra crossing area in the road image;
[0246] It should be noted that in order to ensure road traffic safety, after the target detection algorithm fails to detect pedestrians in the road image, the embodiment of the present application performs pedestrian detection on the road image again through an adaptive frame difference method, thereby improving the reliability of pedestrian detection and ensuring traffic safety.
[0247] Step S1408: for a zebra crossing area in the road image, determine whether a pedestrian is detected in the zebra crossing area in all road images including the zebra crossing area; if so, execute step S1410; if not, execute step S1407;
[0248] Step S1409, outputting a detection result that there are pedestrians in the road image, and determining that there are pedestrians in the zebra crossing area in the road image;
[0249] Step S1410, outputting a detection result that there are no pedestrians in the zebra crossing area in the road image;
[0250] Step S1411, end the processing of the road image of the current frame, and execute step S1403.
[0251] Optionally, in an embodiment of the present application, after acquiring a previous frame of road image of the second reference image, a connected area between the previous frame of road image and the road image is determined. If the area of the connected area is greater than the maximum value of the first preset range, it is determined that the road image contains a vehicle.
[0252] Among them, for the local brightness enhancement algorithm in step S1404, this application implements, for example Fig.15 A flowchart of a specific implementation of local brightness enhancement is shown, and the specific steps are as follows:
[0253] Step S1501: for the original image captured by the camera, the original image is converted into the HSV color space.
[0254] The original image includes a zebra crossing area and a lane area.
[0255] Step S1502, segment the original image according to the 8*8 window, perform histogram statistics on the pixel values corresponding to each pixel point in the brightness V channel, and calculate the cumulative distribution function CDF corresponding to the zebra crossing area and the cumulative distribution function CDF corresponding to the lane area respectively.
[0256] Among them, the pixel value corresponding to each pixel point in the brightness V channel is referred to as the brightness value in this application.
[0257] Step S1503, normalizing the CDF corresponding to each window in the zebra crossing area, and normalizing the CDF corresponding to each window in the lane area, calculating the maximum and minimum values in each CDF corresponding to the lane area; determining the target brightness reference value corresponding to each pixel point in the zebra crossing area;
[0258] Step S1504: Determine the pixel value corresponding to each pixel point in the V channel of the zebra crossing area according to the determined target brightness reference value corresponding to each pixel point, and convert the image into an image corresponding to the RGB color gamut space.
[0259] It should be noted that the converted image includes the zebra crossing area after brightness enhancement.
[0260] Among them, for the adaptive frame difference method in step S1307, the present application implements, for example Fig.16 A specific flow chart of judging pedestrians based on an adaptive inter-frame difference algorithm is shown, and the specific steps are as follows:
[0261] Step 1601: for a frame of road image, after an interval of 100ms, obtain a first reference image, convert the two images into grayscale images, and remove background noise through Gaussian blur.
[0262] Step 1602: perform a difference calculation between the road image and the first reference image to obtain a foreground image, and then perform morphological processing, perform an erosion and dilation operation through a 3*3 convolution kernel, and form a first judgment image containing a difference area.
[0263] The first judgment image may also be a differential image.
[0264] Step 1603: Calculate the maximum area corresponding to at least one difference region in the first judgment image.
[0265] The maximum area corresponding to at least one difference region is the maximum area among the areas corresponding to the target regions in the difference regions.
[0266] Step 1604: determine whether the maximum area is greater than a first threshold; if so, execute step 1605; if not, execute step 1601;
[0267] Step 1605, set the time interval to t=150ms;
[0268] Step 1606, obtaining a second reference image with an interval of 150 ms from the road image;
[0269] Step 1607, calculating a differential image between the road image and the second reference image, and calculating the number of all connected regions whose areas are greater than the second area threshold;
[0270] Step 1608: If the number of target areas is 1 and the area is greater than the maximum area value, then t+=50; and execute step 1606;
[0271] Step 1609: if the number of target regions is 2, and the minimum distance of the target regions is less than the minimum width of the target regions, then acquiring the previous frame image of the second reference image;
[0272] Step 1610: If the area of the target area is greater than the second area threshold and less than the third area threshold, it is determined to be a pedestrian; if the area of the target area is greater than the third area threshold, it is determined to be a motor vehicle;
[0273] like Fig.17 As shown, the embodiments of the present application are based on Fig.17The connected areas corresponding to the multiple frames of foreground images shown are judged. When it is determined that the number of connected areas in the last frame of the foreground image is multiple, and when it is determined that the area of the connected area in the foreground image between the previous frame of the road image and the road image is greater than the third area threshold, it is determined that the road image includes a motor vehicle.
[0274] Step 1611: For situations other than step 1608 and step 1609, execute step 1601.
[0275] Based on the same inventive concept, the embodiment of the present application provides an electronic device; Fig.18 As shown, the electronic device 1800 includes at least one transceiver unit 1801 and at least one processor 1802;
[0276] In an optional implementation manner, the processor 1802 is specifically configured to:
[0277] For any frame of road image in the road image set, the following operations are performed respectively:
[0278] Determine the brightness value of each pixel point in the pedestrian driving area in the road image, and the brightness value of each pixel point in the lane area in the road image; wherein the brightness value of each pixel point in the pedestrian driving area and the brightness value of each pixel point in the lane area are the brightness values of the pixel points of the road image in the HSV color space;
[0279] According to the brightness value of each pixel point in the lane area, brightness enhancement processing is performed on the brightness value of each pixel point in the pedestrian driving area.
[0280] In an optional implementation manner, the processor 1802 is specifically configured to:
[0281] Dividing the pedestrian driving area and the lane area in the road image into a plurality of sub-areas respectively;
[0282] For any sub-region, determine brightness distribution information corresponding to the sub-region according to the brightness value of each pixel in the sub-region, wherein the brightness distribution information includes a brightness cumulative probability distribution value corresponding to each pixel in the sub-region;
[0283] Determining an adjustment ratio for adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area according to the brightness cumulative probability distribution value corresponding to each pixel point in the lane area;
[0284] According to the adjustment ratio, the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is adjusted to obtain the target brightness cumulative probability distribution value corresponding to each pixel point;
[0285] According to the target brightness cumulative probability distribution value corresponding to each pixel point, the brightness value after brightness enhancement processing corresponding to each pixel point is determined respectively.
[0286] In an optional implementation manner, the processor 1802 is specifically configured to:
[0287] Determine a first maximum value and a first minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the pedestrian driving area; and determine a second maximum value and a second minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the lane area;
[0288] The ratio of the difference between the first maximum value and the second maximum value to the difference between the first minimum value and the second minimum value is used as the adjustment ratio.
[0289] In an optional implementation manner, the processor 1802 is specifically configured to:
[0290] Determine the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area; and determine the difference between the fourth maximum value and the fourth minimum value in the brightness value corresponding to each pixel point in the pedestrian driving area;
[0291] The ratio of the difference between the third maximum value and the third minimum value to the difference between the fourth maximum value and the fourth minimum value is used as a conversion ratio between the target brightness cumulative probability distribution value and the brightness value;
[0292] According to the conversion ratio, the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is converted respectively to determine the brightness value after brightness enhancement processing corresponding to each pixel point.
[0293] In an optional implementation manner, the processor 1802 is specifically configured to:
[0294] Acquire at least one frame of reference image corresponding to the road image and captured by a camera corresponding to the road image, wherein the reference image is captured later than the road image;
[0295] Performing difference analysis on each frame reference image and the road image to generate a foreground image between the road image and each frame reference image;
[0296] Determine a connected area in a foreground image corresponding to each frame of the reference image, wherein the pixel value between adjacent pixels in the connected area is not greater than a preset threshold;
[0297] Whether the road image contains the target object is determined according to the area of the connected region in the foreground image corresponding to each frame of the reference image.
[0298] In an optional implementation manner, the processor 1802 is specifically configured to:
[0299] For a first reference image whose acquisition time is ranked earlier in the at least one frame of reference images, if an area of a connected region in a foreground image corresponding to the first reference image is not greater than a first area threshold, determining that no target object is detected in the road image;
[0300] If the area of the connected region in the first reference image is greater than the first area threshold, obtaining the number of connected regions in the foreground image corresponding to the second reference image, the second reference image being the next frame reference image of the first reference image;
[0301] When there are multiple connected areas in the foreground image corresponding to the second reference image, obtain a previous frame of road image of the second reference image, and when it is determined that the area of the connected area in the foreground image between the previous frame of road image and the road image is within a preset range, determine that the road image contains the target object; when the number of connected areas in the foreground image corresponding to the second reference image is one, and the area of the connected area in the foreground image corresponding to the second reference image is larger than the area of the connected area in the target reference image, update the next frame of reference image of the second reference image to the second reference image, and return to the step of obtaining the number of connected areas in the foreground image corresponding to the second reference image; otherwise, determine that the target object is not detected in the road image.
[0302] In an optional implementation manner, the processor 1802 is specifically configured to:
[0303] Input each frame of the road image in the road image set after the brightness enhancement processing into the trained YOLOX target detection model; perform target object detection on each frame of the road image in the road image set after the brightness enhancement processing by the trained YOLOX target detection model, and obtain the detection result output by the trained YOLOX target detection model.
[0304] In an optional implementation manner, the processor 1802 is specifically configured to:
[0305] If the detection result is that the target object is included in the pedestrian driving area of at least one frame of the road image in the road image set, control the traffic light in the traffic direction corresponding to the pedestrian driving area to be in a pass state, and control the traffic light in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area to be in a no-pass state;
[0306] If the detection result is that the target object is not included in the pedestrian driving area of each road image in the road image set, the traffic lights in the traffic direction corresponding to the pedestrian driving area are controlled to be in a prohibited traffic state, and the traffic lights in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area are controlled to be in a traffic state.
[0307] like Fig.19 As shown, a signal light control device 1900 according to an embodiment of the present application includes:
[0308] An acquisition module 1901 is used to acquire a road image collected by at least one camera at an intersection, wherein the road image includes a pedestrian driving area and a lane area at the intersection;
[0309] The enhancement module 1902 is used to perform brightness enhancement processing on the pedestrian driving area in each frame of the road image in the road image set collected by the at least one camera at the same time; and perform target object detection on each frame of the road image in the road image set after the brightness enhancement processing;
[0310] A control module 1903, configured to control a traffic light at the intersection if a target object is detected in at least one road image in the road image set;
[0311] The detection module 1904 is used to obtain a reference image corresponding to each frame of the road image in the road image set if no target object is detected in each frame of the road image in the road image set, wherein the reference image and the corresponding road image are images collected by the same camera at different times; for any frame of the road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic lights at the intersection according to the detection result.
[0312] In an optional implementation manner, the enhancement module 1902 is specifically configured to:
[0313] For any frame of road image in the road image set, the following operations are performed respectively:
[0314] Determine the brightness value of each pixel point in the pedestrian driving area in the road image, and the brightness value of each pixel point in the lane area in the road image; wherein the brightness value of each pixel point in the pedestrian driving area and the brightness value of each pixel point in the lane area are the brightness values of the pixel points of the road image in the HSV color space;
[0315] According to the brightness value of each pixel point in the lane area, brightness enhancement processing is performed on the brightness value of each pixel point in the pedestrian driving area.
[0316] In an optional implementation manner, the enhancement module 1902 is specifically configured to:
[0317] Dividing the pedestrian driving area and the lane area in the road image into a plurality of sub-areas respectively;
[0318] For any sub-region, determine brightness distribution information corresponding to the sub-region according to the brightness value of each pixel in the sub-region, wherein the brightness distribution information includes a brightness cumulative probability distribution value corresponding to each pixel in the sub-region;
[0319] Determining an adjustment ratio for adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area according to the brightness cumulative probability distribution value corresponding to each pixel point in the lane area;
[0320] According to the adjustment ratio, the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is adjusted to obtain the target brightness cumulative probability distribution value corresponding to each pixel point;
[0321] According to the target brightness cumulative probability distribution value corresponding to each pixel point, the brightness value after brightness enhancement processing corresponding to each pixel point is determined respectively.
[0322] In an optional implementation manner, the enhancement module 1902 is specifically configured to:
[0323] Determine a first maximum value and a first minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the pedestrian driving area; and determine a second maximum value and a second minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the lane area;
[0324] The ratio of the difference between the first maximum value and the second maximum value to the difference between the first minimum value and the second minimum value is used as the adjustment ratio.
[0325] In an optional implementation manner, the enhancement module 1902 is specifically configured to:
[0326] Determine the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area; and determine the difference between the fourth maximum value and the fourth minimum value in the brightness value corresponding to each pixel point in the pedestrian driving area;
[0327] The ratio of the difference between the third maximum value and the third minimum value to the difference between the fourth maximum value and the fourth minimum value is used as a conversion ratio between the target brightness cumulative probability distribution value and the brightness value;
[0328] According to the conversion ratio, the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is converted respectively to determine the brightness value after brightness enhancement processing corresponding to each pixel point.
[0329] In an optional implementation manner, the detection module 1904 is specifically configured to:
[0330] Acquire at least one frame of reference image corresponding to the road image and captured by a camera corresponding to the road image, wherein the reference image is captured later than the road image;
[0331] Performing difference analysis on each frame reference image and the road image to generate a foreground image between the road image and each frame reference image;
[0332] Determine a connected area in a foreground image corresponding to each frame of the reference image, wherein the pixel value between adjacent pixels in the connected area is not greater than a preset threshold;
[0333] Whether the road image contains the target object is determined according to the area of the connected region in the foreground image corresponding to each frame of the reference image.
[0334] In an optional implementation manner, the detection module 1904 is specifically configured to:
[0335] For a first reference image whose acquisition time is ranked earlier in the at least one frame of reference images, if an area of a connected region in a foreground image corresponding to the first reference image is not greater than a first area threshold, determining that no target object is detected in the road image;
[0336] If the area of the connected region in the first reference image is greater than the first area threshold, obtaining the number of connected regions in the foreground image corresponding to the second reference image, the second reference image being the next frame reference image of the first reference image;
[0337] When there are multiple connected areas in the foreground image corresponding to the second reference image, obtain a previous frame of road image of the second reference image, and when it is determined that the area of the connected area in the foreground image between the previous frame of road image and the road image is within a preset range, determine that the road image contains the target object; when the number of connected areas in the foreground image corresponding to the second reference image is one, and the area of the connected area in the foreground image corresponding to the second reference image is larger than the area of the connected area in the target reference image, update the next frame of reference image of the second reference image to the second reference image, and return to the step of obtaining the number of connected areas in the foreground image corresponding to the second reference image; otherwise, determine that the target object is not detected in the road image.
[0338] In an optional implementation manner, the enhancement module 1902 is specifically configured to:
[0339] Input each frame of the road image in the road image set after the brightness enhancement processing into the trained YOLOX target detection model; perform target object detection on each frame of the road image in the road image set after the brightness enhancement processing by the trained YOLOX target detection model, and obtain the detection result output by the trained YOLOX target detection model.
[0340] In an optional implementation manner, the detection module 1904 is specifically configured to:
[0341] If the detection result is that the target object is included in the pedestrian driving area of at least one frame of the road image in the road image set, control the traffic light in the traffic direction corresponding to the pedestrian driving area to be in a pass state, and control the traffic light in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area to be in a no-pass state;
[0342] If the detection result is that the target object is not included in the pedestrian driving area of each road image in the road image set, the traffic lights in the traffic direction corresponding to the pedestrian driving area are controlled to be in a prohibited traffic state, and the traffic lights in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area are controlled to be in a traffic state.
[0343] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0344] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0345] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0346] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0347] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A signal light control method, characterized in that: include: Acquire a road image captured by at least one camera at an intersection, wherein the road image includes a pedestrian driving area at the intersection; For a set of road images collected by the at least one camera at the same time, performing brightness enhancement processing on a pedestrian driving area in each frame of the road image in the set of road images; and performing target object detection on each frame of the road image in the road image set after brightness enhancement processing; If a target object is detected in a pedestrian driving area of at least one road image in the road image set, controlling a traffic light at the intersection; If no target object is detected in the pedestrian driving area of each frame of road image in the road image set, obtain a reference image corresponding to each frame of road image in the road image set, wherein the reference image and the corresponding road image are images captured by the same camera at different times; for any frame of road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic light at the intersection according to the detection result.
2. The method according to claim 1, characterized in that The performing brightness enhancement processing on the pedestrian driving area in each frame of the road image in the road image set includes: For any frame of road image in the road image set, the following operations are performed respectively: Determine the brightness value of each pixel point in the pedestrian driving area in the road image, and the brightness value of each pixel point in the lane area in the road image; wherein the brightness value of each pixel point in the pedestrian driving area and the brightness value of each pixel point in the lane area are the brightness values of the pixel points of the road image in the HSV color space; According to the brightness value of each pixel point in the lane area, brightness enhancement processing is performed on the brightness value of each pixel point in the pedestrian driving area.
3. The method according to claim 2, characterized in that The step of performing brightness enhancement processing on the brightness values of the pixels in the pedestrian driving area according to the brightness values of the pixels in the lane area includes: Dividing the pedestrian driving area and the lane area in the road image into a plurality of sub-areas respectively; For any sub-region, determine brightness distribution information corresponding to the sub-region according to the brightness value of each pixel in the sub-region, wherein the brightness distribution information includes a brightness cumulative probability distribution value corresponding to each pixel in the sub-region; Determining an adjustment ratio for adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area according to the brightness cumulative probability distribution value corresponding to each pixel point in the lane area; According to the adjustment ratio, the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is adjusted to obtain the target brightness cumulative probability distribution value corresponding to each pixel point; According to the target brightness cumulative probability distribution value corresponding to each pixel point, the brightness value after brightness enhancement processing corresponding to each pixel point is determined respectively.
4. The method according to claim 3, characterized in that The step of determining, based on the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area and the brightness cumulative probability distribution value corresponding to each pixel point in the lane area, an adjustment ratio for adjusting the brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area includes: Determine a first maximum value and a first minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the pedestrian driving area; and determine a second maximum value and a second minimum value in the cumulative probability distribution values of brightness corresponding to each pixel point in the lane area; The ratio of the difference between the first maximum value and the second maximum value to the difference between the first minimum value and the second minimum value is used as the adjustment ratio.
5. The method according to claim 3, characterized in that The step of determining the brightness value after brightness enhancement processing corresponding to each pixel point according to the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area comprises: Determine the difference between the third maximum value and the third minimum value in the target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area; and determine the difference between the fourth maximum value and the fourth minimum value in the brightness value corresponding to each pixel point in the pedestrian driving area; The ratio of the difference between the third maximum value and the third minimum value to the difference between the fourth maximum value and the fourth minimum value is used as a conversion ratio between the target brightness cumulative probability distribution value and the brightness value; According to the conversion ratio, the normalized target brightness cumulative probability distribution value corresponding to each pixel point in the pedestrian driving area is converted respectively to determine the brightness value after brightness enhancement processing corresponding to each pixel point.
6. The method according to claim 1, characterized in that The step of performing target object detection on any one road image in the road image set according to a reference image corresponding to the road image comprises: Acquire at least one frame of reference image corresponding to the road image and captured by a camera corresponding to the road image, wherein the reference image is captured later than the road image; Performing difference analysis on each frame reference image and the road image to generate a foreground image between the road image and each frame reference image; Determine a connected area in a foreground image corresponding to each frame of the reference image, wherein the pixel value between adjacent pixels in the connected area is not greater than a preset threshold; Whether the road image contains the target object is determined according to the area of the connected region in the foreground image corresponding to each frame of the reference image.
7. The method according to claim 6, characterized in that The detecting whether the road image contains the target object according to the area of the connected region in the foreground image corresponding to each reference image comprises: For a first reference image whose acquisition time is ranked earlier in the at least one frame of reference images, if an area of a connected region in a foreground image corresponding to the first reference image is not greater than a first area threshold, determining that no target object is detected in the road image; If the area of the connected region in the first reference image is greater than the first area threshold, obtaining the number of connected regions in the foreground image corresponding to the second reference image, the second reference image being the next frame reference image of the first reference image; When there are multiple connected areas in the foreground image corresponding to the second reference image, obtain a previous frame of road image of the second reference image, and when it is determined that the area of the connected area in the foreground image between the previous frame of road image and the road image is within a preset range, determine that the road image contains the target object; when the number of connected areas in the foreground image corresponding to the second reference image is one, and the area of the connected area in the foreground image corresponding to the second reference image is larger than the area of the connected area in the target reference image, update the next frame of reference image of the second reference image to the second reference image, and return to the step of obtaining the number of connected areas in the foreground image corresponding to the second reference image; otherwise, determine that the target object is not detected in the road image.
8. The method according to claim 1, characterized in that The performing target object detection on each frame of the road image in the road image set after the brightness enhancement processing comprises: Input each frame of the road image in the road image set after the brightness enhancement processing into the trained YOLOX target detection model; perform target object detection on each frame of the road image in the road image set after the brightness enhancement processing by the trained YOLOX target detection model, and obtain the detection result output by the trained YOLOX target detection model.
9. The method according to claim 1, characterized in that The controlling of the traffic light at the intersection according to the detection result corresponding to each frame of the road image in the road image set includes: If the detection result is that the target object is included in the pedestrian driving area of at least one frame of the road image in the road image set, control the traffic light in the traffic direction corresponding to the pedestrian driving area to be in a pass state, and control the traffic light in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area to be in a no-pass state; If the detection result is that the target object is not included in the pedestrian driving area of each road image in the road image set, the traffic lights in the traffic direction corresponding to the pedestrian driving area are controlled to be in a prohibited traffic state, and the traffic lights in the road direction intersecting with the traffic direction corresponding to the pedestrian driving area are controlled to be in a traffic state.
10. An electronic device, characterized in that: including a transceiver unit and a processor; The transceiver unit is used to obtain a road image collected by at least one camera at the intersection, wherein the road image includes a pedestrian driving area at the intersection; The processor is used to perform brightness enhancement processing on the pedestrian driving area in each frame of the road image in the road image set for the road image set collected by the at least one camera at the same time; And perform target object detection on each frame of road image in the road image set after brightness enhancement processing; if the target object is detected in the pedestrian driving area of at least one road image in the road image set, control the traffic light at the intersection; if the target object is not detected in the pedestrian driving area of each frame of road image in the road image set, obtain the reference image corresponding to each frame of road image in the road image set, the reference image and the corresponding road image are images collected by the same camera at different times; for any frame of road image in the road image set, perform target object detection on the road image according to the reference image corresponding to the road image, and control the traffic light at the intersection according to the detection result.