Real-time data acquisition method and system
By setting different mapping intervals in the stretched area of the weak boundary, linear stretching of the traffic monitoring image is solved, and the problem that global stretching cannot handle local lighting differences is improved, and image quality and recognition accuracy are improved.
Patent Information
- Application Number
- CN202510205859.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-25
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2045-02-25
AI Technical Summary
Global stretching cannot effectively handle lighting differences in local areas, resulting in loss of details in the intermediate image, affecting the image quality of traffic monitoring images and the accuracy of recognition processing.
By setting different mapping intervals in the stretched area of the weak boundary and linearly stretching all pixel points in the intermediate image according to these mapping intervals, a traffic monitoring image after uniform light is obtained.
Effectively processing local lighting differences improves the image quality and accuracy of the traffic monitoring image and enhances the local details of the intermediate image.
Smart Images

Figure CN119722446A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image data acquisition, and more specifically, to a real-time data acquisition method and system. Background Art
[0002] The electronic police monitoring system is an important part of the intelligent transportation system. The monitoring probes of the electronic police monitoring system collect traffic monitoring images in real time to monitor the traffic conditions of vehicles on the road. In the process of acquiring traffic monitoring images, due to the influence of lighting conditions, shooting angles, weather conditions and other factors, there will be uneven brightness distribution in the traffic monitoring images, which seriously affects the quality of traffic monitoring images and increases the difficulty of identifying and processing traffic monitoring images. The MASK homogenization algorithm is a commonly used homogenization method.
[0003] In the related technology, for example, the Chinese patent application document with application publication number CN117575967A discloses a method for enhancing underwater crack images of water conveyance tunnels based on MASK. The patent application document analyzes the underwater environmental characteristics of the water conveyance tunnel, takes land concrete cracks as the images to be converted, and the real underwater environmental images of the water conveyance tunnel as the style images, and uses the CycleGAN model for training to generate a large number of underwater style crack images of water conveyance tunnels, and selects images with better quality from them. Then, the commonly used denoising methods are compared, and finally the wavelet transform is used for image denoising. Finally, the MASK uniform light algorithm is improved and experimentally compared. The results show that the improved algorithm has better denoising effect and better picture quality than the original algorithm, and solves the problem of uneven illumination of water conveyance tunnel images.
[0004] Since the subtraction operation in the MASK homogenization algorithm will reduce the grayscale range of the subtracted image and reduce the overall contrast, which will lead to the loss of local detail information and affect the clarity and information content of the intermediate image, it is necessary to stretch the contrast to enhance the local details of the intermediate image and improve the clarity and information content of the intermediate image; linear stretching is a commonly used stretching method. Linear stretching is a global adjustment method that linearly maps the grayscale value of the intermediate image to a new range. However, the uneven illumination in the intermediate image is usually local. Global stretching cannot effectively handle the illumination differences in local areas, resulting in the loss of details in the intermediate image, affecting the image quality of the homogenized traffic monitoring image obtained after the stretching process, and thus affecting the accuracy of recognition and processing of traffic monitoring images. Summary of the invention
[0005] In order to solve the technical problem that the above-mentioned global stretching cannot effectively handle the illumination differences in local areas, resulting in loss of details in the intermediate image, affecting the image quality of the traffic monitoring image after uniform illumination obtained after stretching processing, and further affecting the accuracy of recognition and processing of the traffic monitoring image, the present invention provides solutions in the following multiple aspects.
[0006] In a first aspect, the present invention provides a real-time data acquisition method, comprising: acquiring traffic monitoring images in real time through monitoring probes for monitoring vehicle traffic on roads; performing uniform light processing on the traffic monitoring images through a uniform light algorithm, and for the obtained intermediate image: screening out strong pixels and weak pixels according to the size relationship between the gradient intensity of the pixel points and the upper and lower limits of the threshold; forming all strong pixels into a strong boundary group; screening out weak pixels forming a weak boundary group according to whether there are strong pixels within the 8-neighborhood of the weak pixel points; converting all pixels in the strong boundary group and the weak boundary group into multiple strong boundaries and multiple weak boundaries respectively; calculating the gradient direction continuity of each strong boundary and each weak boundary; obtaining the associated strong boundary of each weak boundary according to the distance between the strong boundary and the weak boundary; and calculating the average value of the gradient intensity of all weak pixels in the weak boundary. And the average value of the gradient strength of all strong pixels in the associated strong boundary of the weak boundary ,Will The normalized result of is the contrast limitation of weak boundaries ; Calculate the stretch parameters of the weak boundary ; , They are respectively the gradient direction continuity of weak boundaries and the associated strong boundaries of weak boundaries, is the distance between the associated strong boundary and the weak boundary of the weak boundary; according to the stretching parameters of each weak boundary, the mapping interval of the pixel points in the stretching area of each weak boundary is set; the mapping interval of other pixel points in the intermediate image is ; Linearly stretch all pixels in the intermediate image according to the mapping interval to obtain the traffic monitoring image after uniform illumination.
[0007] In view of the fact that uneven illumination in an intermediate image is usually local, the present invention sets different mapping intervals for pixel points in a stretching area of each weak boundary and other pixel points in the intermediate image, and linearly stretches all pixel points in the intermediate image according to the mapping interval to obtain a traffic monitoring image after light homogenization, thereby solving the problem that global stretching cannot effectively process illumination differences in local areas, resulting in loss of details in the intermediate image, improving the image quality of the traffic monitoring image after light homogenization obtained after stretching, and further improving the accuracy of recognition and processing of the traffic monitoring image; wherein, according to the contrast limitations of each weak boundary, the gradient direction continuity, the gradient direction continuity of the associated strong boundary of each weak boundary, and the distance between the associated strong boundary of each weak boundary and each weak boundary, the stretching parameters of each weak boundary are calculated, and according to the stretching parameters of each weak boundary, the mapping intervals of the pixel points in the stretching area of each weak boundary are set, and whether the weak boundary is an important detail in the intermediate image is judged according to the characteristics of different weak boundaries, and the mapping intervals of different weak boundaries are adjusted according to the characteristics of different weak boundaries, and the details in the intermediate image can be made more prominent by analyzing and enhancing the weak boundary representing the important details in the intermediate image.
[0008] Preferably, the light homogenization processing of the traffic monitoring image by the light homogenization algorithm includes: filtering the traffic monitoring image by a Gaussian low-pass filter to obtain a background image with simulated brightness distribution; subtracting the traffic monitoring image from the background image to obtain an intermediate image.
[0009] Preferably, the method of screening out strong pixels and weak pixels according to the size relationship between the gradient strength of the pixel and the upper and lower thresholds includes: recording pixels whose gradient strength is greater than or equal to the upper threshold as strong pixels, and recording pixels whose gradient strength is less than the upper threshold and greater than the lower threshold as weak pixels.
[0010] Preferably, the method of screening out weak pixels constituting a weak boundary group according to whether there are strong pixels in the 8-neighborhood of the weak pixel includes: for the weak pixel If the weak pixel There are strong pixels in the 8-neighborhood of Divided into the first group; if the weak pixel There is no strong pixel in the 8-neighborhood of Divide into the second group; for the weak pixels in the second group If the weak pixel There are weak pixels belonging to the first group in the 8-neighborhood of Remove from the second group and add to the first group; record the first group as the weak boundary group.
[0011] Preferably, the converting of all the pixels in the strong boundary group and the weak boundary group into multiple strong boundaries and multiple weak boundaries respectively includes: converting all the strong pixels in the strong boundary group into multiple first chain codes; for any first chain code, forming all the strong pixels constituting the first chain code into a strong boundary; converting all the weak pixels in the weak boundary group into multiple second chain codes; for any second chain code, forming all the weak pixels constituting the second chain code into a weak boundary.
[0012] The present invention converts pixel points in a weak boundary group into multiple weak boundaries through a chain code, which can better capture and represent texture information in an intermediate image.
[0013] Preferably, the calculation of the gradient direction continuity of each strong boundary and each weak boundary includes: calculating the difference in gradient direction of two adjacent strong pixels in the strong boundary, and forming the differences in all gradient directions into a gradient direction difference sequence of the strong boundary; calculating the difference in gradient direction of two adjacent weak pixels in the weak boundary, and forming the differences in all gradient directions into a gradient direction difference sequence of the weak boundary; the difference in gradient direction of the two adjacent strong pixels is equal to the absolute value of the difference in gradient direction of the two adjacent strong pixels, and the difference in gradient direction of the two adjacent weak pixels is equal to the absolute value of the difference in gradient direction of the two adjacent weak pixels; the difference between the maximum value and the minimum value of the gradient direction difference sequence of the strong boundary is added to the difference in gradient direction of the strong boundary. The ratio of is taken as the gradient direction continuity of the strong boundary; the difference between the maximum and minimum values of the gradient direction difference sequence of the weak boundary is compared with The ratio of is taken as the gradient direction continuity of the weak boundary.
[0014] The present invention determines whether the gradient direction on the weak boundary remains consistent through the gradient direction continuity of the weak boundary, and further determines whether the weak pixel points on the weak boundary belong to the same edge structure. The weak boundary with high gradient direction continuity is more likely to be part of the real edge. By retaining these continuous weak boundaries, the detailed structure in the middle can be better reflected.
[0015] Preferably, the step of obtaining the associated strong boundary of each weak boundary according to the distance between the strong boundary and the weak boundary comprises: for any strong boundary and any weak boundary, respectively calculating the first strong pixel point of the strong boundary The first weak pixel with weak boundary And the last weak pixel The Euclidean distance of the position coordinates of and ; Calculate the last strong pixel point of the strong boundary respectively With weak pixels And weak pixels The Euclidean distance of the position coordinates of and ;Will , , , The minimum value among them is taken as the distance between the strong boundary and the weak boundary; for any weak boundary, the strong boundary corresponding to the minimum value of the distance between all strong boundaries and the weak boundary is taken as the associated strong boundary of the weak boundary.
[0016] The present invention selects the associated strong boundary of the weak boundary from all the strong boundaries according to the distance between the strong boundary and the weak boundary, and verifies whether the weak boundary belongs to the real edge structure by associating with the strong boundary.
[0017] Preferably, the step of setting the mapping interval of the pixels in the stretching area of each weak boundary according to the stretching parameters of each weak boundary comprises: the mapping interval of the pixels in the stretching area of the weak boundary is ,in, , are the left and right boundaries of the mapping interval, and , , , are the minimum and maximum grayscale values in the stretched area of the weak boundary, is the stretching parameter of the weak boundary, To obtain the maximum value function, is the minimum value function.
[0018] The present invention improves the image quality of the evenly-lit traffic monitoring image obtained after stretching processing by setting different mapping intervals for pixel points in different weak-boundary stretching regions, thereby improving the accuracy of recognition and processing of the traffic monitoring image.
[0019] Preferably, the method for obtaining the stretching area of each weak boundary is: obtaining the minimum circumscribed rectangular area of each weak boundary, and recording the size of the minimum circumscribed rectangular area as ; Expand the minimum bounding rectangle of the weak boundary to a size of The expanded rectangular area is centered on the center point of the original minimum circumscribed rectangular area; the expanded rectangular area is used as the stretching area of the weak boundary.
[0020] In a second aspect, the present invention provides a real-time data acquisition system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the above-mentioned real-time data acquisition method is implemented.
[0021] By adopting the above technical solution, the above-mentioned real-time data acquisition method is generated into a computer program and stored in a memory so as to be loaded and executed by a processor, thereby making a terminal device based on the memory and the processor for easy use.
[0022] The beneficial effects of the present invention are: In view of the fact that uneven illumination in an intermediate image is usually local, the present invention sets different mapping intervals for pixel points in a stretching area of each weak boundary and other pixel points in the intermediate image, and linearly stretches all pixel points in the intermediate image according to the mapping interval to obtain a traffic monitoring image after light homogenization, thereby solving the problem that global stretching cannot effectively process illumination differences in local areas, resulting in loss of details in the intermediate image, improving the image quality of the traffic monitoring image after light homogenization obtained after stretching, and further improving the accuracy of recognition and processing of the traffic monitoring image; wherein, according to the contrast limitations of each weak boundary, the gradient direction continuity, the gradient direction continuity of the associated strong boundary of each weak boundary, and the distance between the associated strong boundary of each weak boundary and each weak boundary, the stretching parameters of each weak boundary are calculated, and according to the stretching parameters of each weak boundary, the mapping intervals of the pixel points in the stretching area of each weak boundary are set, and whether the weak boundary is an important detail in the intermediate image is judged according to the characteristics of different weak boundaries, and the mapping intervals of different weak boundaries are adjusted according to the characteristics of different weak boundaries, and the details in the intermediate image can be made more prominent by analyzing and enhancing the weak boundary representing the important details in the intermediate image. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] By reading the following detailed description with reference to the accompanying drawings, the above and other objects, features and advantages of the exemplary embodiments of the present invention will become readily understood. In the accompanying drawings, several embodiments of the present invention are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein: Figure 1 is a flow chart schematically illustrating a real-time data collection method in the present invention; Figure 2 is a schematic diagram schematically illustrating an electronic police monitoring system; Figure 3 is a schematic diagram schematically showing a collected traffic monitoring image with uneven brightness distribution; Figure 4 The following is a schematic diagram showing the MASK light uniformity algorithm. Figure 3 A schematic diagram of an intermediate image obtained by performing homogenization processing on a traffic monitoring image shown; Figure 5 is a flow chart schematically illustrating step S2; Figure 6 is a schematic diagram showing the 2% linear stretching method. Figure 4A schematic diagram of a traffic monitoring image after homogenization is obtained after homogenization processing is performed on the intermediate image shown; Figure 7 is a schematic diagram showing the method of the present invention Figure 4 The schematic diagram of the traffic monitoring image after homogenization is obtained after the intermediate image shown is homogenized. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0025] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0026] The embodiment of the present invention discloses a real-time data collection method, referring to Figure 1 , comprising steps S1-S2: S1. Real-time traffic monitoring images are collected through monitoring probes to monitor the traffic conditions of vehicles on the road.
[0027] Intelligent transportation system is the development direction of future transportation system. It will effectively integrate advanced information technology, data communication transmission technology, electronic sensor technology, control technology and computer technology and apply them to the entire ground transportation management system to establish a comprehensive transportation management system that plays a role in a large range and in all aspects, in real time, accurately and effectively.
[0028] The electronic police monitoring system is an important part of the intelligent transportation system, which is mainly responsible for monitoring the traffic conditions of vehicles at various traffic lights on the road: first, the electronic police monitoring system involves multiple monitoring points, each of which is equipped with two monitoring probes, which are high-definition digital cameras; second, one of the monitoring probes is used to automatically capture vehicle violation images, and the other monitoring probe is used to collect monitoring videos in real time. The monitoring videos are composed of multiple frames of monitoring images. The vehicle violation images and monitoring videos are the basis for the Road Traffic Administration to provide vehicle violation records, and are important measures to regulate road safety; finally, the electronic police monitoring system will directly form a ring network with RIS5110 for all monitoring points involved. Considering the transmission bandwidth and future network upgrades, all ring networks will use gigabit ring network transmission, and a full gigabit switch will be used in the central computer room for data aggregation. Vehicle violation images and monitoring videos are transmitted through the ring network and stored in the database of the Road Traffic Administration.
[0029] The schematic diagram of the electronic police monitoring system is as follows Figure 2shown.
[0030] In summary, the monitoring probes of the intelligent transportation system collect traffic monitoring images in real time to monitor the traffic conditions of vehicles on the road. The traffic monitoring images include vehicle violation images and each frame of the monitoring video.
[0031] S2. Performing light homogenization processing on the traffic monitoring image by using a light homogenization algorithm. For the obtained intermediate image, linearly stretching is performed on the stretching area of each weak boundary according to the stretching parameters of each weak boundary to obtain the traffic monitoring image after light homogenization.
[0032] It should be noted that in the process of acquiring traffic monitoring images, due to the influence of factors such as lighting conditions, shooting angles, and weather conditions, uneven brightness distribution will appear in the traffic monitoring images, which seriously affects the quality of the traffic monitoring images and increases the difficulty of identifying and processing the traffic monitoring images. In order to eliminate this problem, it is considered to perform uniform light processing on the traffic monitoring images to obtain traffic monitoring images with uniform brightness, thereby ensuring the accuracy of traffic monitoring image recognition and processing.
[0033] Specifically, the MASK light uniformity algorithm can achieve the purpose of uniform brightness by enhancing high-frequency information and suppressing low-frequency information; the traffic monitoring image is subjected to light uniformity processing by the MASK light uniformity algorithm to obtain an intermediate image, including: filtering the traffic monitoring image by a Gaussian low-pass filter to obtain a background image with simulated brightness distribution; and subtracting the traffic monitoring image from the background image to obtain an intermediate image.
[0034] For example, due to factors such as lighting conditions, shooting angles, and weather conditions, a schematic diagram of a traffic monitoring image with uneven brightness distribution is shown in FIG. Figure 3 As shown; through the MASK uniform light algorithm Figure 3 The traffic monitoring image shown in FIG. 1 is subjected to uniform light processing, and the schematic diagram of the intermediate image obtained is as follows: Figure 4 shown.
[0035] Among them, since the subtraction operation process will reduce the grayscale range of the intermediate image obtained, the overall contrast will be reduced, which will lead to the loss of local detail information and affect the clarity and information content of the intermediate image. Therefore, it is necessary to stretch the contrast to enhance the local details of the intermediate image and improve the clarity and information content of the intermediate image; commonly used stretching methods include linear stretching, which is a global adjustment method that linearly maps the grayscale value of the intermediate image to a new range; however, the uneven illumination in the intermediate image is usually local, and global stretching cannot effectively deal with the illumination differences in local areas, resulting in the loss of details in the intermediate image, affecting the image quality of the evenly illuminated traffic monitoring image obtained after the stretching process, and further affecting the accuracy of recognition and processing of the traffic monitoring image.
[0036] In order to solve the problem that global stretching cannot effectively handle the illumination difference in the local area, and also causes the loss of details in the intermediate image, affecting the image quality of the traffic monitoring image after the stretching process, and further affecting the accuracy of the recognition and processing of the traffic monitoring image, the present invention, in step S2, for the obtained intermediate image: according to the size relationship between the gradient intensity of the pixel point and the upper threshold limit and the lower threshold limit, screen out the strong pixel points and the weak pixel points; form all the strong pixel points into a strong boundary group; according to whether there are strong pixels in the 8-neighborhood of the weak pixel point, screen out the weak pixel points that form the weak boundary group; respectively convert all the pixel points in the strong boundary group and the weak boundary group into multiple strong boundaries and multiple weak boundaries; calculate the gradient direction continuity of each strong boundary and each weak boundary; obtain the associated strong boundary of each weak boundary according to the distance between the strong boundary and the weak boundary; calculate the contrast limitation of each weak boundary; calculate the stretching parameters of the weak boundary; according to the stretching parameters of each weak boundary, set the mapping interval of the pixel points in the stretching area of each weak boundary; set the mapping interval of other pixel points in the intermediate image to ; According to the mapping interval, all pixels in the intermediate image are linearly stretched to obtain a traffic monitoring image after uniform illumination; the flowchart of step S2 refers to Figure 5 , including steps S201 to S206, specifically: S201, screening out strong pixels and weak pixels according to the relationship between the gradient strength of the pixel and the upper and lower thresholds; grouping all strong pixels into a strong boundary group; and screening out weak pixels constituting a weak boundary group according to whether there are strong pixels within the 8-neighborhood of the weak pixel.
[0037] It should be noted that the details in the intermediate image mainly refer to the texture information in the intermediate image, and the pixels on the texture information appear to have a certain gradient strength; therefore, global stretching cannot effectively handle the illumination differences in the local area, resulting in the loss of details in the intermediate image, mainly resulting in the weakening of the contrast of pixels with relatively weak gradient strength. Therefore, the present invention calculates the gradient strength of each pixel, and divides all pixels into strong pixels and weak pixels according to the relationship between the gradient strength of the pixel and the upper and lower limits of the threshold. Subsequently, the weak pixels with relatively weak gradient strength are mainly analyzed.
[0038] Specifically, the Canny operator is used to calculate the gradient strength and gradient direction of each pixel in the intermediate image; an upper threshold and a lower threshold are set; the gradient strength of the pixel is compared with the upper threshold and the lower threshold, and according to the size relationship between the gradient strength of the pixel and the upper threshold and the lower threshold, all pixels are divided into strong pixels and weak pixels, including: pixels with a gradient strength greater than or equal to the upper threshold are recorded as strong pixels, and pixels with a gradient strength less than the upper threshold and greater than the lower threshold are recorded as weak pixels.
[0039] Among them, the specific values of the upper threshold and the lower threshold can be set according to the actual application scenario and requirements, and the value range of the upper threshold is [50,120], and the value range of the lower threshold is [20,50). In the present invention, the upper threshold is set to 80 and the lower threshold is set to 30.
[0040] Further, according to whether there is a strong pixel in the 8-neighborhood of the weak pixel, all weak pixels are divided into the first group and the second group, including: for the weak pixel , determine the weak pixel Is there a strong pixel in the 8-neighborhood? If a weak pixel There are strong pixels in the 8-neighborhood, indicating that weak pixels Directly connected to the strong pixel, the weak pixel Divided into the first group; if the weak pixel There is no strong pixel in the 8-neighborhood of If the weak pixel is not directly connected to the strong pixel, Assigned to the second group.
[0041] Further, according to whether there are weak pixels belonging to the first group in the 8-neighborhood of the weak pixels in the second group, the weak pixels in the second group are updated, including: for the weak pixels in the second group , determine the weak pixel Is there a weak pixel belonging to the first group in the 8-neighborhood of There are weak pixels belonging to the first group in the 8-neighborhood of If the weak pixels are connected to the strong pixels, Remove from the second group and add to the first group.
[0042] Finally, all strong pixels are grouped into strong boundary groups, and the first group is recorded as weak boundary group.
[0043] S202 , converting all pixel points in the strong boundary group and the weak boundary group into a plurality of strong boundaries and a plurality of weak boundaries respectively, and calculating the gradient direction continuity of each strong boundary and each weak boundary.
[0044] It should be noted that the details in the intermediate image mainly refer to the texture information in the intermediate image, and the pixels on the texture information show a certain continuity. The chain code can effectively represent this continuity, making the texture information more complete and coherent. Therefore, the present invention converts all pixels in the weak boundary group into multiple weak boundaries through the chain code, and calculates the gradient direction continuity of each weak boundary. Subsequently, the weak boundaries composed of weak pixels with relatively weak gradient intensity are mainly analyzed.
[0045] Specifically, all strong pixel points in the strong boundary group are converted into multiple first chain codes, and the number of all the obtained first chain codes is greater than or equal to 1; for any first chain code, all the strong pixel points constituting the first chain code are formed into a strong boundary; all weak pixel points in the weak boundary group are converted into multiple second chain codes, and the number of all the obtained second chain codes is greater than or equal to 1; for any second chain code, all the weak pixel points constituting the second chain code are formed into a weak boundary.
[0046] Among them, the Freeman chain code is a coding representation method of the boundary, which describes the boundary by the coordinates of the starting point and the direction of the middle point; the commonly used chain codes are divided into 4-connected chain codes and 8-connected chain codes according to the number of adjacent directions of the central pixel. The 4-connected chain code has 4 adjacent points, which are above, below, left and right of the central pixel. The 8-connected chain code adds 4 oblique directions, because there are 8 adjacent points around any pixel, and the 8-connected chain code just matches the actual situation of the pixel, and can accurately describe the position information of the central pixel and its adjacent points.
[0047] Further, the difference in gradient directions of two adjacent strong pixels in a strong boundary is calculated, and all the differences in gradient directions are combined into a gradient direction difference sequence of the strong boundary; the difference in gradient directions of two adjacent weak pixels in a weak boundary is calculated, and all the differences in gradient directions are combined into a gradient direction difference sequence of the weak boundary; the difference in gradient directions of the two adjacent strong pixels is equal to the absolute value of the difference in gradient directions of the two adjacent strong pixels, and the difference in gradient directions of the two adjacent weak pixels is equal to the absolute value of the difference in gradient directions of the two adjacent weak pixels.
[0048] Furthermore, the difference between the maximum and minimum values of the gradient direction difference sequence of the strong boundary is compared with The ratio of is taken as the gradient direction continuity of the strong boundary; the difference between the maximum and minimum values of the gradient direction difference sequence of the weak boundary is compared with The ratio of is used as the gradient direction continuity of the weak boundary; the value range of the gradient direction is ,therefore, It is used to normalize the difference between the maximum and minimum values of the gradient direction difference sequence so that the value of the gradient direction continuity is within the range.
[0049] It should be noted that the gradient direction continuity of the weak boundary refers to whether the gradient direction remains consistent on the weak boundary; if the gradient direction is continuous and consistent on the weak boundary, it means that the weak pixels on the weak boundary may belong to the same edge structure; the gradient direction continuity of the weak boundary is used to judge whether the gradient direction on the weak boundary is consistent, and then to judge whether the weak pixels on the weak boundary belong to the same edge structure. The weak boundary with high gradient direction continuity is more likely to be part of the real edge. By retaining these continuous weak boundaries, the detailed structure in the middle can be better reflected.
[0050] S203: Obtain associated strong boundaries of each weak boundary according to the distance between the strong boundary and the weak boundary.
[0051] It should be noted that the associated strong boundary of a weak boundary refers to a strong boundary found within a certain distance range near the weak boundary; by associating with the strong boundary, it can be verified whether the weak boundary belongs to a real edge structure.
[0052] Specifically, for any strong boundary and any weak boundary, the distance between the strong boundary and the weak boundary is calculated, including: calculating the first strong pixel point of the strong boundary The first weak pixel with weak boundary The Euclidean distance of the position coordinates is recorded as ; Calculate the first strong pixel point of the strong boundary The last weak pixel with weak boundary The Euclidean distance of the position coordinates is recorded as ; Calculate the last strong pixel point of the strong boundary The first weak pixel with weak boundary The Euclidean distance of the position coordinates is recorded as ; Calculate the last strong pixel point of the strong boundary The last weak pixel with weak boundary The Euclidean distance of the position coordinates is recorded as ;Will , , , The minimum value in is taken as the distance between the strong boundary and the weak boundary.
[0053] For any weak boundary, the associated strong boundary of the weak boundary is obtained according to the distances between all strong boundaries and the weak boundary, including: taking the strong boundary corresponding to the minimum value of the distances between all strong boundaries and the weak boundary as the associated strong boundary of the weak boundary.
[0054] S204, calculating the contrast limitation of each weak boundary according to the ratio of the average value of the gradient strength of all weak pixels in each weak boundary to the average value of the gradient strength of all strong pixels in the strong boundary associated with each weak boundary.
[0055] Specifically, for any weak boundary, the average value of the gradient strength of all weak pixels in the weak boundary is calculated and recorded as , calculate the average value of the gradient strength of all strong pixels in the associated strong boundary of the weak boundary and record it as ,Will The normalized result is the contrast limitation of the weak boundary.
[0056] Said The normalized result is Inversely proportional; in one embodiment, The normalized result is , in another embodiment, The normalized result is ,in, represents an exponential function with a natural constant as base, represents the hyperbolic tangent function.
[0057] It should be noted that the contrast limitation of the weak boundary is evaluated according to the size of the ratio: if the ratio is smaller, it means that the weak boundary is less significant than the strong boundary, and the contrast limitation of the weak boundary is greater; if the ratio is larger, it means that the weak boundary is more significant than the strong boundary and may be part of the real edge. Therefore, the contrast limitation of the weak boundary is smaller.
[0058] S205 , calculating the stretching parameters of each weak boundary according to the contrast limitation of each weak boundary, the gradient direction continuity, the gradient direction continuity of the strong boundary associated with each weak boundary, and the distance between the strong boundary associated with each weak boundary and each weak boundary.
[0059] Specifically, the stretching parameters of each weak boundary are calculated according to the contrast limitation and gradient direction continuity of each weak boundary, the gradient direction continuity of the associated strong boundary of each weak boundary, and the distance between the associated strong boundary of each weak boundary and each weak boundary. The calculation formula of the stretching parameters of each weak boundary is: ; In the formula, is the stretching parameter of the weak boundary, For the contrast limitation of weak boundaries, is the gradient direction continuity of the weak boundary, The gradient direction continuity of the weak boundary association strong boundary, is the distance between the associated strong boundary and the weak boundary of the weak boundary, Represents an exponential function with a natural constant as its base.
[0060] It should be noted that the gradient direction continuity of the weak boundary The larger the value is, the weak pixels on the weak boundary may belong to the same edge structure; the distance between the strong boundary and the weak boundary The smaller it is, the stronger the boundary can be found within the smaller range of the weak boundary, and the weak boundary is more likely to belong to the real edge structure. At the same time, the gradient direction continuity of the weak boundary and the strong boundary is The larger it is, the more information the real edge structure corresponding to the strong boundary can express in the intermediate image, and the more important the strong boundary is. Correspondingly, the weak boundary connected to the strong boundary is more likely to belong to the real edge structure. The weak edge that is more likely to belong to the same real edge structure and has greater contrast limitation has a larger stretching parameter.
[0061] S206. According to the stretching parameters of the weak boundaries, a mapping interval of pixels in the stretching area of each weak boundary is set; the mapping interval of other pixels in the intermediate image is set to [0, 255]; all pixels in the intermediate image are linearly stretched according to the mapping interval to obtain a traffic monitoring image after uniform illumination.
[0062] Specifically, the minimum bounding rectangle area of each weak boundary is obtained, and the size of the minimum bounding rectangle area is recorded as ; Expand the minimum bounding rectangle of the weak boundary to a size of The expanded rectangular area is centered on the center point of the original minimum circumscribed rectangular area; the expanded rectangular area is used as the stretching area of the weak boundary.
[0063] Furthermore, according to the stretching parameters of each weak boundary, a mapping interval for linear stretching of the stretching area of each weak boundary is set. ,in, is the left boundary of the mapping interval, and , is the right boundary of the mapping interval, and , , are the minimum and maximum grayscale values in the stretched area of the weak boundary, is the stretching parameter of the weak boundary, To obtain the maximum value function, is the minimum value function.
[0064] Therefore, for the pixels in the stretching area of each weak boundary, the mapping interval for linear stretching is For the pixels in the intermediate image other than the pixels in the stretching area of each weak boundary, the mapping interval for linear stretching is According to the mapping interval for linear stretching of each pixel point and the 2% linear stretching method, all the pixels in the intermediate image are linearly stretched to obtain the traffic monitoring image after uniform light.
[0065] The 2% linear stretching method is based on the grayscale histogram distribution, and the grayscale value corresponding to the grayscale histogram accumulation at 2% is taken and recorded as , take the gray value corresponding to the gray histogram accumulation at 98%, recorded as ; When the gray value of the pixel Less than When the gray value after mapping , when the gray value of the pixel Greater than When the gray value after mapping , when the gray value of the pixel Greater than or equal to and less than or equal to When the gray value after mapping , , are the left and right boundaries of the mapping interval for linear stretching of pixels, To round down.
[0066] It should be noted that the gray value of the pixel In the interval Location within Gray value after mapping with pixel points In the mapping range Location within The same, that is , therefore, the gray value after mapping .
[0067] Exemplarily, by 2% linear stretching method Figure 4 After the intermediate image shown in FIG. 1 is subjected to light homogenization processing, the obtained traffic monitoring image after light homogenization is shown in FIG. Figure 6 As shown; through the method of the present invention Figure 4 After the intermediate image shown in FIG. 1 is subjected to light homogenization processing, the obtained traffic monitoring image after light homogenization is shown in FIG. Figure 7 shown.
[0068] It should be noted that, in view of the fact that the illumination unevenness in the intermediate image is usually local, the present invention sets different mapping intervals for the pixels in the stretching area of each weak boundary and other pixels in the intermediate image, and linearly stretches all the pixels in the intermediate image according to the mapping interval to obtain a traffic monitoring image after uniform illumination, thereby solving the problem that global stretching cannot effectively process the illumination difference in the local area, resulting in loss of details in the intermediate image, and improving the image quality of the traffic monitoring image after uniform illumination obtained after stretching, thereby improving the accuracy of recognition and processing of the traffic monitoring image; wherein, according to the contrast limitation of each weak boundary, the gradient direction continuity, the gradient direction continuity of the associated strong boundary of each weak boundary, and the distance between the associated strong boundary of each weak boundary and each weak boundary, the stretching parameters of each weak boundary are calculated, and according to the stretching parameters of each weak boundary, the mapping interval of the pixels in the stretching area of each weak boundary is set, and whether the weak boundary is an important detail in the intermediate image is judged by the characteristics of different weak boundaries, and by adjusting the mapping intervals of different weak boundaries according to the characteristics of different weak boundaries, the details in the intermediate image can be made more prominent by analyzing and enhancing the weak boundaries representing the important details in the intermediate image.
[0069] The embodiment of the present invention further discloses a real-time data acquisition system, including a processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a real-time data acquisition method according to the present invention is implemented.
[0070] The above system also includes other components well known to those skilled in the art, such as a communication bus and a communication interface, and their configuration and functions are known in the art, so they will not be described in detail here.
[0071] In the description of this specification, "plurality" or "several" means at least two, such as two, three or more, etc., unless otherwise clearly and specifically defined.
[0072] Although this specification has shown and described a number of embodiments of the present invention, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will conceive of many modifications, changes and alternatives without departing from the ideas and spirit of the present invention. It should be understood that in the practice of the present invention, alternatives to the embodiments of the present invention described herein may be employed.
Claims
1. A real-time data collection method, characterized in that: include: Traffic monitoring images are collected in real time through monitoring probes to monitor the traffic conditions of vehicles on the road; the traffic monitoring images are evened using an even light algorithm, and the intermediate images obtained are: According to the relationship between the gradient strength of the pixel point and the upper and lower limits of the threshold, strong pixels and weak pixels are screened out; all strong pixels are grouped into a strong boundary group; according to whether there are strong pixels in the 8-neighborhood of the weak pixel point, weak pixels forming a weak boundary group are screened out; all pixels in the strong boundary group and the weak boundary group are converted into multiple strong boundaries and multiple weak boundaries respectively; Calculate the gradient direction continuity of each strong boundary and each weak boundary; obtain the associated strong boundary of each weak boundary according to the distance between the strong boundary and the weak boundary; calculate the average value of the gradient strength of all weak pixels in the weak boundary And the average value of the gradient strength of all strong pixels in the associated strong boundary of the weak boundary ,Will The normalized result of is the contrast limitation of weak boundaries ; Calculate the stretch parameters of the weak boundary ; , They are respectively the gradient direction continuity of weak boundaries and the associated strong boundaries of weak boundaries, is the distance between the associated strong and weak boundaries of the weak boundary; According to the stretching parameters of the weak boundaries, the mapping interval of the pixels in the stretching area of each weak boundary is set; the mapping interval of other pixels in the intermediate image is set to ; Linearly stretch all pixels in the intermediate image according to the mapping interval to obtain the traffic monitoring image after uniform illumination.
2. A real-time data collection method according to claim 1, characterized in that: The light homogenization processing of the traffic monitoring image by using the light homogenization algorithm includes: The traffic monitoring image is filtered by a Gaussian low-pass filter to obtain a background image with simulated brightness distribution; the traffic monitoring image is subtracted from the background image to obtain an intermediate image.
3. A real-time data collection method according to claim 1, characterized in that: The method of screening out strong pixels and weak pixels according to the relationship between the gradient strength of the pixel and the upper and lower limits of the threshold value includes: Pixels whose gradient strength is greater than or equal to the upper threshold are recorded as strong pixels, and pixels whose gradient strength is less than the upper threshold and greater than the lower threshold are recorded as weak pixels.
4. A real-time data collection method according to claim 1, characterized in that: The step of screening out weak pixels constituting a weak boundary group according to whether there are strong pixels in the 8-neighborhood of the weak pixel includes: For weak pixels If the weak pixel There are strong pixels in the 8-neighborhood of Divided into the first group; if the weak pixel There is no strong pixel in the 8-neighborhood of Divided into the second group; For the weak pixels in the second group If the weak pixel There are weak pixels belonging to the first group in the 8-neighborhood of removed from the second group and added to the first; The first group is recorded as the weak boundary group.
5. A real-time data collection method according to claim 1, characterized in that: The step of converting all pixel points in the strong boundary group and the weak boundary group into a plurality of strong boundaries and a plurality of weak boundaries respectively comprises: All strong pixel points in the strong boundary group are converted into multiple first chain codes; for any first chain code, all strong pixel points constituting the first chain code are formed into a strong boundary; all weak pixel points in the weak boundary group are converted into multiple second chain codes; for any second chain code, all weak pixel points constituting the second chain code are formed into a weak boundary.
6. A real-time data collection method according to claim 1, characterized in that: The step of calculating the continuity of the gradient direction of each strong boundary and each weak boundary includes: The difference in gradient direction between two adjacent strong pixels in a strong boundary is calculated, and all the differences in gradient direction are combined into a gradient direction difference sequence of the strong boundary; the difference in gradient direction between two adjacent weak pixels in a weak boundary is calculated, and all the differences in gradient direction are combined into a gradient direction difference sequence of the weak boundary; The difference between the maximum and minimum values of the gradient direction difference sequence of the strong boundary is The ratio of is taken as the gradient direction continuity of the strong boundary; the difference between the maximum and minimum values of the gradient direction difference sequence of the weak boundary is compared with The ratio of is taken as the gradient direction continuity of the weak boundary.
7. A real-time data collection method according to claim 1, characterized in that: The step of obtaining the associated strong boundaries of each weak boundary according to the distance between the strong boundary and the weak boundary includes: For any strong boundary and any weak boundary, calculate the first strong pixel point of the strong boundary respectively. The first weak pixel with weak boundary And the last weak pixel The Euclidean distance of the position coordinates of and ; Calculate the last strong pixel point of the strong boundary respectively With weak pixels And weak pixels The Euclidean distance of the position coordinates of and ;Will , , , The minimum value in is taken as the distance between the strong boundary and the weak boundary; For any weak boundary, the strong boundary corresponding to the minimum value of the distances between all strong boundaries and the weak boundary is taken as the associated strong boundary of the weak boundary.
8. A real-time data collection method according to claim 1, characterized in that: The step of setting the mapping interval of the pixel points in the stretching area of each weak boundary according to the stretching parameters of each weak boundary includes: The mapping interval of the pixels in the stretched area of the weak boundary is ,in, , are the left and right boundaries of the mapping interval, and , , , are the minimum and maximum grayscale values in the stretched area of the weak boundary, is the stretching parameter of the weak boundary, To obtain the maximum value function, is the minimum value function.
9. A real-time data collection method according to claim 1, characterized in that: The method for obtaining the stretching area of each weak boundary is: Get the minimum bounding rectangle area of each weak boundary, and record the size of the minimum bounding rectangle area as ; Expand the minimum bounding rectangle of the weak border to a size of The expanded rectangular area is centered on the center point of the original minimum circumscribed rectangular area; the expanded rectangular area is used as the stretching area of the weak boundary.
10. A real-time data acquisition system, characterized in that: include: A processor and a memory, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, a real-time data acquisition method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Mask-based water conveyance tunnel underwater crack image enhancement method
CN117575967A
Image boundary extraction method and system
CN105354843A
Canny edge detection method based on bilateral filtering and adaptive threshold
CN117853510A
Liver cancer pathology image enhancement method based on artificial intelligence
CN118297812A
Bearing defect detection method and system based on computer vision
CN118799706A
Cited By
Smart park real-time data acquisition and processing method and system based on edge computing
CN120145160A