A method for detecting automobile edge contours
Through the combined method of multi-scale image sampling and pixel-related eight-neighborhood polarization processing, the problems of insufficient accuracy and anti-interference ability of automobile edge contour detection in complex scenes in the existing technology are solved, and efficient robust edge detection is achieved with low complexity.
Patent Information
- Application Number
- CN202410099426.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-24
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2044-01-24
AI Technical Summary
Existing vehicle edge contour detection methods lack accuracy and anti-interference capabilities in complex scenes, especially in low time complexity and low spatial complexity, where it is difficult to achieve robust vehicle edge contour detection.
A combined method of multi-scale image sampling, pixel-related eight-neighborhood polarization processing, extreme value information image histogram analysis and difference processing is adopted to improve the accuracy of edge detection through the merging and repeated verification of multi-scale sampling sub-images.
Robust and accurate vehicle edge contour detection is achieved with low time complexity and low space complexity, adapting to complex scenes, reducing the amount of calculation and code load, and improving the robustness and accuracy of detection.
Smart Images

Figure CN118071778B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing applications, and in particular to a method for detecting the edge contour of an automobile. Background Art
[0002] Nowadays, with the continuous increase in urban traffic density, traffic management has become an increasingly critical challenge, and vehicle edge contour detection is very important in traffic management. For example, when conducting real-time traffic flow monitoring and traffic violation monitoring, it is usually necessary to perform image processing based on traditional methods on the images captured by traffic cameras. The following steps are required in the image processing based on traditional methods of captured images. First, the car target in the image must be identified. After determining the presence of a car entity in the image, the edge detection of the car entity in the image must be performed. Edge detection of the vehicle entity can provide the vehicle's contour information and the vehicle's position information on the road. By analyzing this information, the specific situation of the vehicle can be obtained, and information such as whether there is a vehicle violation in the image and the vehicle density in the image can be obtained. This is of great significance for traffic management.
[0003] Similarly, vehicle edge detection plays a key role in accident investigations. By capturing the vehicle's edge contours in accident scene images, detailed information such as the vehicle's location and trajectory can be provided. This helps traffic police accurately reconstruct the scene at the moment of the accident, supporting accident liability determination and legal investigations. Vehicle edge detection can also provide insurance companies with strong evidence to assist in claims settlement and accident liability tracing.
[0004] In intersection optimization, vehicle edge profile detection technology can be used to monitor vehicle flow at intersections in real time. By analyzing vehicle edge profiles, intersection signal control systems can obtain critical information, such as vehicle count and travel direction. This data helps optimize intersection signal control strategies to adapt to varying time periods and traffic flows, improving intersection efficiency, reducing congestion, and improving overall road traffic flow. Therefore, the application of vehicle edge profile detection in accident investigation and intersection optimization can help improve traffic safety and smoother traffic flow.
[0005] Due to the complexity of road conditions and the large differences in shooting conditions (for example, differences between fixed cameras and handheld cameras), errors will occur if only simple vehicle target recognition is performed. Simple target recognition cannot analyze vehicle violations (such as crossing the line, illegal overtaking), so vehicle edge contour detection is necessary. Similarly, vehicle edge contour detection needs to consider the complexity of road conditions, and for diverse and dynamic situations, identify vehicle edge contours in complex road conditions and changing light. In addition, many township-level traffic police teams have problems with outdated equipment and lack of funds. They need a technology based on traditional methods that can still stably identify vehicle edges even when external conditions vary greatly and recognition equipment is old and has poor performance.
[0006] In traditional edge detection algorithms, accuracy in identifying regions is a key factor. Patented edge detection methods published in the past five years have utilized methods such as the Canny algorithm, the Sobel algorithm, and the Scharr algorithm. These methods all suffer from various issues, including poor adaptability to complex scenes and high equipment requirements. Therefore, improving accuracy and anti-interference capabilities remains a key research direction in the field of vehicle edge detection in image processing. Summary of the Invention
[0007] The purpose of the present invention is to address the shortcomings of the existing technology and provide a method for detecting vehicle edge contours. This innovation aims to provide a universal method that can achieve robust and accurate vehicle edge contour detection with low time complexity, low space complexity, and low hardware requirements.
[0008] The technical solution steps adopted by the present invention to solve the technical problem are as follows:
[0009] Step S10: Acquire an image of the vehicle to be tested. Use an image storage module or an embedded image sensor to acquire the vehicle image, and pre-process the acquired vehicle image to obtain the image of the vehicle to be tested.
[0010] In step S20, a multi-scale image sampling operation is performed. The original vehicle image to be tested is segmented into a series of sampling sub-images with different step lengths. The sampled sub-images with different step lengths are sent to a preset smoothing module to remove cluttered information in the sampling sub-images that is not related to the vehicle outline.
[0011] In step S30, the sampled subimages processed by the smoothing module undergo pixel-dependent eight-neighborhood polarization. For the current sampled subimage, each pixel is combined with pixels in its eight-neighborhood to form a 2x2 separable grid sequence. Three-channel (RGB) information points are aggregated to obtain the maximum and minimum information pixels. The corresponding same-polarity information is combined to obtain two epipolar information sampling subimages. The aggregated three channels are then separated to obtain a total of six single-channel extreme value information sampling subimages. Corresponding extreme value information image histograms are then constructed based on these six single-channel extreme value information sampling subimages.
[0012] Step S40: Perform information difference analysis on the extreme value information image histogram: Based on the six single-channel extreme value information sampling subgraphs, reliable epipolar information in the lattice sequence is obtained, and reliable edges in the original vehicle image to be tested are obtained from the epipolar information. The two single-channel extreme value information sampling subgraphs for each channel are subtracted (i.e., the maximum pole minus the minimum pole) to obtain a single-channel extrema difference histogram. Polarity regions are segmented on each single-channel extrema difference histogram using the k-means clustering method to obtain reliable epipolar information in the corresponding lattice sequence. This epipolar information is then reverse-mapped onto the original vehicle image to obtain the basic edge sampling subgraph.
[0013] The basic edge sampling sub-graph is the edge graph obtained after the current sampling sub-graph is processed by the first layer, and is also the edge graph that actually exists in the sampling sub-graph. However, due to the nature of the image, there is a certain degree of edge clutter, and subsequent processing is required to remove redundant edges to make the image edges clear.
[0014] In step S50, the basic edge sampling subgraph is processed: the sizes of all grids in the grid sequence in the sampling subgraph are expanded, and step S40 is processed again with the expanded grid sequence; a single-channel histogram is obtained using the dual-scale grid sequence, and the extreme value histogram is re-analyzed to verify the correctness of the basic edge sampling subgraph obtained previously; the basic edge sampling subgraphs corresponding to the multi-scale sampling subgraphs are then merged to obtain the final edge map of the original vehicle image to be tested; this step can make up for the edge disconnection problem caused by the aging of the image acquisition equipment and the problem of the image itself, and the disconnected edges in the original vehicle image to be tested are normalized by detecting the edges of the sampling subgraphs and then merging them, thereby improving the performance and robustness of the entire system.
[0015] Furthermore, step S20 is specifically implemented as follows:
[0016] In step S21, a certain step size is first determined. The step size can be determined based on the clarity of the original vehicle image to be tested. The maximum step size is pmax. For example, when the step size is p, pixels in the same column with a row interval of (p-1) or pixels in the same row with a column interval of (p-1) are the same sampling sub-image, and the image is divided into a series of sampling sub-image sets. The sampling sub-images are then searched using the step size as an index. In each sampling sub-image set indexed by the step size, it is assumed that under the current step size p, the length of the original vehicle image to be tested is n, the width of the original vehicle image to be tested is m, and the number of sampling sub-images is p*p. All subsequent operations are performed synchronously on all sampling sub-images in the sets pointed to by all step sizes.
[0017] In step S22, further preprocessing is performed to optimize the details of the vehicle image. The values of each pixel's eight neighborhoods and their average are recorded. The difference between each eight-neighborhood pixel and the central pixel is recorded. These differences are then sorted from smallest to largest. The second largest value after sorting is used to replace the central pixel value. The purpose of this step is to obtain the relative difference pixel values around the central point through sorting, thereby better capturing the details of the image.
[0018] Step S23 performs median filtering on the sub-images at each scale after the center pixel value has been replaced. This median filtering uses adaptive median filtering, dynamically adjusting the length l and width w of the rectangular area block, calculating the mean, maximum, and minimum values, and replacing the center pixel value based on certain conditions. This step aims to further reduce image noise and improve image quality.
[0019] Furthermore, step S30 is specifically implemented as follows:
[0020] In step S31, each pixel in the sampling sub-image needs to be combined with the pixels of its eight neighbors, and the original n*m pixel image is combined into a partially overlapping (n-1)*(m-1) RGB three-channel grid sequence composed of 2*2 pixel grids. The original n*m pixel edges are supplemented with a circle of pixels that are the same as the original edges, so that the final RGB three-channel grid sequence size is n*m, which is convenient for subsequent processing.
[0021] In step S32, the obtained grid sequence of the three channels is further processed, and the three channels are aggregated and normalized using the brightness formula (brightness 0.2126*R+0.7152*G+0.0722*B, other aggregation normalization formulas can also be used) to obtain representative extreme value max information pixels (highest brightness) and extreme value min information pixels (lowest brightness). The extreme value max information pixels of each pixel grid in the 2*2 grid sequence are recorded. Each channel of the extreme value max information pixel is Rmax (R channel), Gmax (G channel) and Bmax (B channel); each channel of the extreme value min information pixel is Rmin (R channel), Gmin (G channel) and Bmin (B channel). After that, two single-channel extreme value information sampling sub-images of n*m for the three channels are obtained, a total of six. These six single-channel extreme value information sampling sub-images are then converted into corresponding extreme value information image histograms.
[0022] Furthermore, step S40 is specifically implemented as follows:
[0023] In step S41, each channel is processed separately instead of being directly normalized. This is because if normalization is performed directly, the differential edge map under normalization conditions will be directly highlighted. Such an edge map will have many separated small edges under normalization conditions (which exist in areas with high pixel change frequency in the image, such as uneven ground and lush trees, but are not directly helpful for identifying the main car in the image). The essence of multi-layer processing of the image is to reduce the separated small edges. The specific small edge situation can be seen. Figure 3 Therefore, each channel needs to be processed separately. In the case of single-channel separation, the extreme difference histogram of each channel is obtained. If the extreme difference histogram information of the sampling sub-image corresponding to the three channels meets the difference standard, the pixel is regarded as the edge of the sampling sub-image.
[0024] Taking the R channel as an example, subtract the extrema information histogram within that channel: subtract the min-extrema information histogram from the max-extrema information histogram. This results in a histogram of extrema differences for that channel, named R_diff. The same operation is performed on the other channels to obtain G_diff and B_diff. The extrema difference histogram contains the distribution of extrema difference intensities for each channel within the grid sequence of the original vehicle image.
[0025] Step S42, use the k-means clustering method to perform polarity region segmentation on the extreme value histogram, and segment one to multiple large regions, each of which contains a dense negative value region A, a dense positive value region B, and one or more mixed positive and negative value regions C, where R_diff, G_diff and B_diff are all processed in the same way. The specific analysis can be found in the specific embodiment.
[0026] In step S43, an adaptive screening value of the intensity distribution characteristics is set according to the experimental analysis, and the dense negative area A and the dense positive area B are processed to remove the parts of the original dense negative area A and the dense positive area B whose absolute values are smaller than the screening value, thereby further simplifying the obtained image.
[0027] In step S44, the three processed extrema difference histograms (R_diff, G_diff, and B_diff) are obtained, and the extrema difference histograms of these three channels are reversely mapped back to the grid sequence obtained in step S31 using the same method (described in detail in the specific embodiment), and the n*m 2*2 grid sequence is traversed. For each extrema max information pixel, the dense positive area B of R_diff, G_diff, and B_diff is searched to see whether there is a corresponding RGB single channel value. If the corresponding single channel value can be found in R_diff, G_diff, and B_diff, then the dense negative area A corresponding to the found single channel value is searched to see whether there is a corresponding and paired extrema max information pixel and extrema min information pixel in the current 2*2 grid sequence, and it can be determined that there is a substantial edge from the extrema max information pixel to the extrema min information pixel. The entire grid sequence is traversed to finally obtain the corresponding basic edge sampling subgraph G.
[0028] Furthermore, step S50 is specifically implemented as follows:
[0029] In step S51, the grid sequence of the first layer in step S31 is transformed using the new scale, and the scale is expanded from 2*2 to 3*3. To ensure that the grid sequence remains consistent with the previous one, redundant repeated RGB pixels can be added to the right and bottom sides of the image, and finally an n*m 3*3 grid sequence is obtained.
[0030] Step S52, repeat step S32 again, extract the epipolar min information pixels and the epipolar max information pixels from each 3*3 grid sequence, obtain all the epipolar information pixels in the grid sequence, obtain a sequence composed of epipolar max information pixels, then separate the three channels, and perform histogram formation after separation to obtain the extreme value information image histograms of the three different channels rmaxt, gmaxt and bmaxt; obtain all the epipolar information pixels in the grid sequence, obtain a sequence composed of epipolar min information pixels, then separate the three channels, and perform histogram formation after separation to obtain the extreme value information image histograms of the three different channels rmint, gmint and bmint.
[0031] In step S53, the six histograms (rmax, rmin, gmax, gmin, bmax, and bmin) obtained in step S32 and the six histograms (rmaxt, gmaxt, bmaxt, rmint, gmint, and bmint) obtained in step S52 are processed. First, difference processing is performed on rmax and rmaxt, gmax and gmaxt, and bmax and bmaxt. Then, the homogeneity operations in steps S42, S43, and S44 are performed to obtain a new basic edge sampling subgraph GmaxT. Then, difference subtraction is performed on rmin and rmint, gmin and gmint, and bmin and bmint. The homogeneity operations in steps S42, S43, and S44 are performed to obtain a new basic edge sampling subgraph GminT.
[0032] In step S54, the basic edge sampling subgraph GmaxT, the basic edge sampling subgraph GminT, and the basic edge sampling subgraph G are combined. Since the edges in G are wrapped and overlapped by the edges in GmaxT and GminT, the basic edge sampling subgraph GmaxT and the basic edge sampling subgraph GminT can be used to verify the edges obtained in G, remove the redundant edges in the basic edge sampling subgraph G, and finally obtain the further processed basic edge sampling subgraph GL. Finally, the basic edge sampling subgraphs GL obtained from the processed multi-scale sampling subgraphs are re-merged to obtain a complete edge map.
[0033] Furthermore, the device corresponding to the method of the present invention includes a vehicle image multi-scale sampling unit (201), a continuous feature pixel planning unit (202), a vehicle edge detection unit (203) and a vehicle edge verification unit (204);
[0034] The vehicle multi-scale sampling unit (201) is used to capture a vehicle image. First, the vehicle image is normalized to obtain a vehicle image to be tested. Next, the vehicle image to be tested is multi-scale smoothed, and a preset smoothing module is used to remove information irrelevant to vehicle edge detection, and to process imaging device system errors and image compression noise. Finally, a corrected multi-scale sampling sub-image is obtained.
[0035] The continuous feature pixel point extraction unit (202) is dedicated to processing the modified multi-scale sampling sub-graph and extracting pixels using the nearest neighbor operator. By applying the eight-neighborhood pixel, a separable overlapping grid sequence is established to obtain the sequence extreme value sequence and the corresponding energy histogram.
[0036] The vehicle edge detection unit (203) is used to obtain an object contour map of the vehicle image to be tested, obtain the edges of continuous feature pixel points based on the extremum processing of the continuous grid sequence, and then extract the main edges by eliminating the messy edge parts based on the histogram differentiation processing;
[0037] The vehicle edge verification unit (204) is used for repeatedly verifying the edges of objects in the image, locating the range of the edges that have been obtained, and improving the accuracy of object recognition.
[0038] Furthermore, to achieve the above-mentioned objectives, the third part of the present invention provides a vehicle edge contour detection device, comprising an image acquisition device, a processor, an external interface, and a preset smoothing module and an adaptation module stored in a memory. The processor of the device executes the preset smoothing module, the segmentation module, and the steps of any vehicle edge contour detection method. Taking into account hardware knowledge, the image acquisition device is used to capture object images, the processor executes various image processing algorithms, the external interface is used to communicate with other devices, and the memory is used to store relevant data and the modules required to execute the algorithms. This device integrates advanced hardware technology and provides reliable support for efficient object contour detection.
[0039] It can be seen from the above technical solution that the present invention is a vehicle edge contour detection method, which performs multi-scale sampling on the image of the vehicle to be tested, and uses a preset smoothing module to obtain a corrected multi-scale sampling sub-graph, and then converts the multi-scale sampling sub-graph into a corresponding 2*2 grid sequence, and then collects the extreme values in the grid sequence to obtain the corresponding extreme value graph, subtracts the corresponding extreme value graph to obtain the RBG difference histogram, and obtains the basic edge of the corresponding sampling sub-graph by reverse mapping the RGB difference histogram back to the original sampling sub-graph, and then reorganizes the new grid sequence through a highly repeatable edge verification module to verify the edge, and then improves the edge by combining the edge graphs of each scale together, and finally obtains a complete edge graph.
[0040] Compared with existing technologies, this method does not require image feature conversion of product images. The multi-scale segmentation method retains the features of the original vehicle image to be tested, thus reducing runtime and computational complexity. Furthermore, this method does not require the use of existing complex operators, relying solely on simple neighborhood information. Furthermore, it does not require complex methods to remove noise and small edges from the image, but instead achieves the desired effect through simple histogram subtraction and reverse mapping. Because it uses histograms for information collection, it eliminates the need for edge information thresholding, as is the case with many traditional methods. Furthermore, it achieves excellent results for poor image quality. The filtered data at each scale is then merged to avoid interference from irrelevant image information and noise on vehicle edges. Edge verification is performed using a method with high module repetition, significantly reducing code size and workload. Consequently, this method improves the robustness and accuracy of vehicle edge contour detection, adapting to the complex real-world conditions of modern automotive images. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1Schematic diagram of the hardware structure of the vehicle edge contour detection equipment.
[0042] Figure 2 A schematic flow chart of an embodiment of a vehicle edge contour detection method is shown.
[0043] Figure 3 This is a sample vehicle image.
[0044] Figure 4 This is an example diagram of a small edge (only an example, not the actual situation).
[0045] Figure 5 Smooth example steps for the sampled subgraph.
[0046] Figure 6 This is a sampling example when p=2.
[0047] Figure 7 Comparison between the smoothed example image and the original image of the vehicle to be tested when p=1.
[0048] Figure 8 The six single-channel intensity histograms obtained.
[0049] Figure 9 The obtained example R channel difference histogram R_diff.
[0050] Figure 10 This is the difference histogram R_diff after processing, which only shows a large area X.
[0051] Figure 11 is the basic edge sampling subgraph (when p=1).
[0052] Figure 12 Collect graphs for eight neighborhoods.
[0053] Figure 13 Process description.
[0054] Figure 14 Edge selection instructions.
[0055] Figure 15 Final edge map.
[0056] Figure 16 Canny method edge comparison chart.
[0057] Figure 17 The Sobel method obtains an edge contrast map.
[0058] Figure 18 The Scharr method obtains the edge contrast map. DETAILED DESCRIPTION
[0059] In order to enable those who use this technology to better understand the purpose, technical solutions and advantages of the present invention, the following will further describe specific embodiments with reference to the accompanying drawings. It should be understood that the described examples are merely explanations of one case of the present invention under specific conditions and are not limitations of the present invention. It should also be noted that for ease of description, detailed descriptions of well-known systems, devices, circuits and methods are omitted to avoid unnecessary details that hinder the description of the present invention.
[0060] The present invention relates to a method for detecting vehicle edge contours, primarily for use in traffic monitoring equipment or devices used in traffic management. Such equipment or devices can include single-chip microcomputers, recorders, computers, servers, and other data processing devices. The present invention detects vehicle edges through image edge detection, reducing runtime and computational complexity. It also helps prevent misjudgments in the presence of irrelevant vehicle exterior trim, patterns, or noise. This improves the robustness and accuracy of vehicle edge contour detection, facilitating subsequent processing such as object information extraction.
[0061] Explanation of the meaning of special words used in the content of the invention:
[0062] 1. Pixel-related eight-neighborhood polarization processing: Each pixel in the image is combined with the related pixels in its eight-neighborhood to form a corresponding separable grid sequence, and then the grids in each grid sequence are processed to select the maximum feature pixels and the minimum feature pixels.
[0063] 2. Separable grid sequence: A grid composed of pixels of a certain scale range (n*m). There is overlap between grids, and the grids can be re-divided into basic pixels. The pixels of the entire image are combined into such grids and then combined into a separable grid sequence.
[0064] 3. Homopolar information combination: Extract the maximum feature pixels and minimum feature pixels from each grid in the separable grid sequence. Then combine the maximum feature pixels into a single image, and combine the minimum feature pixels into a single image.
[0065] 4. Epipolar information sampling sub-image: The maximum feature pixels are combined into a maximum information sampling sub-image, and the minimum feature pixels are combined into a minimum information sampling sub-image. The combination of the two images is called the epipolar information sampling sub-image.
[0066] 5. Single channel extreme value information sampling subgraph: an extreme value sampling subgraph in the extreme value information sampling subgraph Figure 3 The channels are separated and converted into a single-channel extreme value information sampling subgraph.
[0067] 6. Extreme information difference analysis: Subtract the histograms of the same channel at different extremes of the single-channel extreme information sampling subgraph to obtain the difference graph, and analyze the difference graph.
[0068] 7. Epipolar intensity distribution of the grid sequence: The intensity histogram of the image composed of the maximum and minimum feature pixels on the grid sequence after three-channel separation represents the intensity distribution of the single channel of the maximum and minimum feature pixel image.
[0069] refer to Figure 1 , which is a hardware structure diagram of a vehicle edge contour detection device provided by an embodiment of the present invention. In the embodiment of the present invention, the vehicle edge contour detection device includes an image collector 101, an image memory 102, a core processor 103 and an external interface 104.
[0070] Image collector 101 is used to capture vehicle traffic on major roads and is responsible for converting optical signals into digital signals. Common types include CMOS (Complementary Metal Oxide Semiconductor) and CCD (Charge Coupled Device). CMOS sensors are generally more common due to their low power consumption, low cost, and high integration, and are widely used in various types of dashcams and traffic monitoring equipment.
[0071] Memory 102 is used to store data generated by vehicle edge contour detection, the sampling sub-image acquisition module, the preset smoothing module, the application data adaptation module, and other functional programs. It can use random access memory (RAM) or direct access memory (DMA). Furthermore, memory 102 can be independent of processor 103. The application data adaptation module can recognize ladder diagrams, function block diagrams, and I / O in languages such as C / C++ and Java used by different industrial equipment and return the preset type of results for the functional program, making it suitable for embedded development. Memory 102 includes a preset smoothing module that smoothes the original vehicle image under test, reduces minor differences unrelated to the image itself, and removes minor edges in the three channels that highlight the main image. Memory 102 also includes embedded functions for intelligent data compression, real-time data encryption, and automatic data backup. The intelligent data compression function implements an efficient compression algorithm when storing data, thereby reducing storage space usage. The real-time data encryption module encrypts sensitive data stored in memory in real time, improving data security. Integrated automatic data backup function, regularly backs up the data in the memory to prevent data loss or damage.
[0072] The processor 103 is used for all calculations and controls of vehicle edge profile detection, and can control the function implementation and data input and output of the sensor 101, the memory 102 and the remaining components of the external interface 104.
[0073] The external interface 104 is a bidirectional interface that can be used to input data and control commands through input devices such as a handwriting tablet, keyboard, and mouse, and can also output intermediate data and vehicle edge contours through a display, server, or external device. Figure 1 The hardware structure shown does not constitute a limitation of the present invention and may include more or fewer components than the hardware structure shown in the figure, or rearrange the components and combine them, or replace different components.
[0074] Based on the above hardware architecture, the present invention proposes an embodiment of a vehicle edge contour detection method. Figure 3 Take the vehicle edge contour detection on the road as an example.
[0075] refer to Figure 2 , is a flow chart of an embodiment of a vehicle edge contour detection method, which is described in detail as follows:
[0076] In step S10, a vehicle image is acquired.
[0077] In the present invention, the detection image can be captured by a device with a CCD or CMOS image sensor, such as a traffic camera or a law enforcement recorder. The collected vehicle image is an RGB three-channel image in a real scene. The specific image scale needs to be determined by the specific acquisition device.
[0078] In step S21, the vehicle image is segmented into multiple scales to collect a series of sampling sub-graphs, which are then corrected using a preset smoothing module to obtain corrected multi-scale sampling sub-graphs (step S21). Figure 5 shown).
[0079] In the example image, the upper limit of the step length pmax is determined according to the image clarity. The height of the example vehicle image is 600 and the width is 900. The upper limit of the step length is set to 20 according to the size of the vehicle image. We need to segment the original vehicle image according to all natural numbers between 1 and 20 as the step length. The sampling sub-graphs are distinguished by the step length as the index. The step length p (1≤p≤20) means that the pixels in the same column with a row interval of (p-1) or the pixels in the same row with a column interval of (p-1) are skipped for sampling the original vehicle image to be tested as the same sampling sub-graph, and the image is segmented into a series of sampling sub-graph sets. Figure 6 As shown, when p=2, the original vehicle image to be tested is divided into four sampling sub-graphs, so there are four sampling sub-graphs in the set with index p of 2, and all subsequent operations need to be performed synchronously on all sampling sub-graphs in all sets.
[0080] In step S22, the difference between the center point and the eight neighborhoods and the mean of the eight neighborhoods is calculated, and the pixel value of the point whose difference value with the center point is ranked n is used to replace the center point pixel.
[0081] In this example, the center point C and the eight neighboring pixel points A are calculated. i (i=1…8) and the average value difference A of the eight neighborhood pixels i (i=9), calculate the difference between them and the center point, sort them from small to large so that |C-A1|<=|C-A2|<=…<=|C-A9|, and use A2 to replace the center point. In step S23, the scale sampling sub-images after the center point value is replaced are subjected to median filtering.
[0082] In step S23, median filtering is performed on the sampling sub-images of each scale after the center point value is replaced.
[0083] In this example, the median filter uses an adaptive median filter. The initial length of the rectangular area block L is set to Min_L, and the maximum length is set to Max_L. The initial width of the rectangular area block W is set to Min_W, and the maximum width is set to Max_W. The rectangular area block is scanned along a Zigzag path, and the multi-scale sampling sub-image corrected in step S22 is calculated. The mean M, maximum value Max_P, and minimum value Min_P of the pixels covered in the rectangular area block are calculated. When the rectangular area block enlargement condition is met, the matrix area block calculates the mean again. When the rectangular area block enlargement condition is no longer met, the mean of the pixels replaces the center pixel of the rectangular area block. The rectangular area block enlargement condition is: M≤Min_p∨M≥Max_p and L≤Max_L∧W≤Max_W.
[0084] Through the above method, a smooth multi-scale sampling subgraph is obtained. Figure 7 , which shows the comparison between the smoothed example image and the original image of the vehicle under test when p is 1. It can be seen that the preset smoothing module can remove irrelevant information compression noise and retain the required information intact.
[0085] In step S30, the corrected multi-scale sampling subimage is processed using the eight-neighborhood information. Pixels in the corrected multi-scale sampling subimage are extracted and combined with the eight-neighborhood pixels to create a separable grid subsequence. The two most representative epipolar information pixels (max and min) in the grid sequence are calculated to obtain two epipolar information sampling subimages. The three channels are then separated to obtain a total of six single-channel extreme value sampling subimages. Corresponding extreme value information histograms are then created based on these six single-channel extreme value images.
[0086] In this example, we first add a circle of repeated pixels to the right and bottom of the selected sampling sub-image to expand the image without generating redundant edges. Each pixel of the selected sampling sub-image is combined with the pixels of its eight neighbors. The combination is as follows: Figure 12 As shown, "upper left, directly above, left", "directly above, upper right, right", "left, lower left, directly below", "right, lower right, directly below", with Figure 12The described form combines the central pixel with the eight neighboring pixels, with "center, upper left, directly above, and left" as a group, "center, directly above, upper right, and right" as a group, "center, left, lower left, and directly below" as a group, and "center, right, lower right, and directly below" as a group. In this way, the original sampling sub-image is changed into a separable overlapping grid sequence with 2*2 grids as atoms. Each atomic grid is processed, and each RGB pixel in the atomic grid is subjected to three-channel aggregation normalization using the brightness formula. Specifically, the R channel pixel value is multiplied by 0.2126, the G channel pixel is multiplied by 0.7152, and the B channel pixel is multiplied by 0.0722. Finally, they are added together to obtain a unique aggregate normalization value. The use of the brightness formula as the aggregation normalization formula here is only an example and does not mean that only the brightness formula can be used. The selection of the three channels can be judged according to the specific situation. The purpose of using the aggregation normalization formula is to perform single-channel selection, and to selectively select the three channels for the purpose of delineating edges. The single-channel pixel value is activated through the selection formula to establish a connection between the three channels. The normalized values in the atomic lattice are compared, and the two RGB pixels with the largest and smallest (most representative) normalized values are selected and named as the antipodal max information pixel and the antipodal min information pixel. This operation is performed on all atomic lattices in the lattice sequence, and finally two RGB information pixel sequences (max pixel sequence, min pixel sequence) are obtained. The use of three channels plus the selection formula for separation processing instead of direct normalization processing is to add more edge screening layers before the final edge map is generated, to filter out smaller edges and obtain the final clear edge. Next, the max pixel sequence and the min pixel sequence are separated into single channels. The max pixel sequence is separated into single-channel extreme value information subgraphs Rmax, Gmax, and Bmax, and the min pixel sequence is separated into single-channel extreme value information subgraphs Rmin, Gmin, and Bmin, for a total of six single-channel extreme value information subgraphs. The six single-channel extreme value information subgraphs are then statistically analyzed based on the single-channel pixel intensities to generate the corresponding extreme value information image histograms: Rmax histogram, Gmax histogram, Bmax histogram, Rmin histogram, Gmin histogram, and Bmin histogram. These extreme value information image histograms are used for subsequent edge calculations.
[0087] In step S40, we need to subtract the max and min of each channel to obtain the corresponding channel extreme difference value histogram. The extreme difference value histogram of each single channel is segmented using the k-means clustering method, and then the processed histogram is reversely mapped back to the original vehicle image to traverse and search for possible edges to obtain the basic edge sampling subgraph (such as Figure 11 shown).
[0088] In this example, according to the six extreme value information image histograms obtained in S30 (such as Figure 8 As shown), the image histograms of the max and min extreme value information corresponding to the same channel are subtracted, and the max and min of the three RGB channels need to be processed. We take the R channel as an example, and after subtracting the min from the max, we get R_diff, as shown Figure 9 As shown in the difference histogram R_diff, we need to perform polarity region segmentation on this extreme difference histogram, as Figure 10 As shown, the image is divided into one or several large areas, and the large areas are further divided into dense negative area A, dense positive area B, and mixed positive and negative area C, as described below.
[0089] according to Figure 10 As shown, in this example, there is only one large area X, but this does not mean that there will be only one large area in all cases. This is only the R channel situation in this example. Figure 10 As we have explained, the displayed histogram is divided into dense negative value area A, dense positive value area B and the discarded mixed positive and negative value area C. Then, according to the set intensity distribution feature adaptive screening value, the parts with intensity values less than the threshold in areas A and B are removed. The R_diff, G_diff and B_diff obtained from the RGB three channels are all processed as follows Figure 10 The three processed extreme difference value histograms R_diff, G_diff and B_diff are obtained.
[0090] Then, these three extreme difference histograms are reversely mapped back to the original vehicle image to be tested. Figure 3In the lattice sequence generated in step S30, traverse each channel of the lattice sequence. We have previously obtained an epipolar max information pixel and an epipolar min information pixel in each atomic lattice. We first search for the epipolar max information pixel in the three epipolar difference value histograms obtained, and search for the pixel value of the epipolar max information pixel in the R channel in the B area of R_diff, and search for the pixel value of the G channel in the epipolar max information pixel in the B area of G_diff. Search for the pixel value of the B channel in the epipolar max pixel in the B area of B_diff. If the corresponding value of the current epipolar max information pixel in the corresponding channel cannot be found in the corresponding area of the processed epipolar difference value histogram of a channel, the search will not continue, and this atomic lattice has no corresponding edge. If all can be found, do the same operation for the epipolar min information pixel, and search for the pixel value of the epipolar information pixel in the corresponding channel in the corresponding A area of R_diff, G_diff and B_diff. If one of the channels cannot find the corresponding value of the current epipolar max information pixel in the corresponding channel in the corresponding area of the processed epipolar difference value histogram of the corresponding channel, then no further search is done. This atomic lattice has no corresponding edge. If all can be found, find a corresponding edge from the min information pixel to the max information pixel in this atomic lattice. After processing all the atomic lattices in the lattice sequence, the basic edge sampling subgraph G ( Figure 11 ).
[0091] In step S50, we perform the homogeneous operation in S30 and establish a grid sequence for the original vehicle image to be tested again. However, the difference from S30 is that we enlarge the size of the grid in the grid sequence, expanding the original 2*2 atomic grid to 3*3 and using the homogeneous method in S30 to establish the grid sequence.
[0092] We perform the homogeneous operation in S30 again, extract the min and max pixel values from each atomic grid in each grid sequence, and then establish the corresponding single-channel energy histograms Rmaxt, Rmint, Gmaxt, Gmint, Bmaxt, and Bmint.
[0093] Process such as Figure 13As shown, we call the Rmax histogram, Gmax histogram, Bmax histogram, Rmin histogram, Gmin histogram and Bmin histogram we obtained previously from the memory. First, process the histogram of the max domain, subtract Rmaxt from Rmax to obtain the difference histogram Rmaxt_diff, subtract Gmaxt from Gmax to obtain the difference histogram Gmaxt_diff, and subtract Bmaxt from Bmaxt to obtain the difference histogram Bmaxt_diff. Use the method in S40 to reversely map Rmaxt_diff, Gmaxt_diff, and Bmaxt_diff back to the grid sequence to obtain the edge map GmaxT. Use the same method to process the square maps Rmint, Gmint, and Bmint. Obtain the edge map GminT (the possible positional relationship between the GminT edge, the GmaxT edge, and the G edge in the same image, and the approximate judgment criteria are as follows Figure 14 shown).
[0094] The basic edge sampling subgraphs GmaxT and GminT are used to verify the basic edge sampling subgraph G obtained previously. They do not play a decisive role in the final basic edge sampling subgraph. They are only used to trim small edges in the basic edge sampling subgraph G. The edges in Gmaxt and GminT will wrap the edges in G. In this way, the small edges that are separated from G are removed to obtain the basic edge sampling subgraph GL. Then, the multi-scale basic edge sampling subgraphs GL are recombined to obtain the final clear edge map, as shown in the figure. Figure 15 shown.
[0095] The advantages of our method lie in its versatility and excellent resistance to interference. By performing a multi-layer analysis based on the intensity distribution of the image's histogram, this method comprehensively considers the pixel intensity distribution of the image, breaking away from the limitations of traditional methods that rely on fixed thresholds. This makes our method superior in versatility and robustness to interference, enabling comprehensive analysis under complex lighting conditions to produce clear and concise vehicle body edges. Below is a comparison of our method with other traditional methods.
[0096] 1. With Figure 16 Compared to the edge map generated by the traditional Canny algorithm, our method produces sharper edges. By performing a multi-layer analysis of the intensity distribution of the image histogram, we avoid the multiple edges and excessive noise around the correct edges that are often seen in traditional Canny algorithms. Furthermore, the edge filtering in step S50 selects the main, high-quality edges of the subject that has been selected multiple times, removing unnecessary, fine edges, resulting in a clean and concise final edge map.
[0097] 2. With Figure 17Compared to the traditional Sobel method's edge map, our method produces a more concise and clear edge map. Compared to the Sobel method's thick, fuzzy vehicle edges, our method produces cleaner, more realistic edges. It also avoids labeling meaningless, small edges within the vehicle's main body and removes complex, dense, and redundant edges, such as those found on the ground. This results in a final edge map that emphasizes the vehicle's main edges.
[0098] 3. With Figure 18 Compared to the edge map generated by the traditional Scharr method, our method produces clearer and more complete edges. This method avoids the problem of unclear edges in shadows, which is often seen in traditional methods. By analyzing the pixel intensity distribution across the entire image, we achieve more complete edges, avoiding interference from light and dark conditions. This method also avoids labeling meaningless, small edges within the vehicle's main body and removes complex, dense, and redundant edges, such as those found on the ground. This results in a final edge map that clearly highlights the main vehicle's edges.
[0099] The above are only preferred embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A method for detecting the edge contour of a car, characterized in that The steps include: Step S10, obtaining an image of the vehicle to be tested; using an image storage module or an embedded image sensor to obtain the vehicle image, and preprocessing the obtained vehicle image to obtain the image of the vehicle to be tested; In step S20, a multi-scale image sampling operation is performed; The original image of the vehicle to be tested is divided into a series of sampling sub-images with different step lengths; the sampling sub-images with different step lengths are sent to a preset smoothing module to remove the cluttered information irrelevant to the vehicle outline in the sampling sub-images; In step S30, the sampling sub-image processed by the smoothing module is subjected to pixel-related eight-neighborhood polarization processing: for the current sampling sub-image, each pixel is combined with the pixels in the eight-neighborhood to form a 2*2 separable grid sequence; the three-channel information points are aggregated to obtain the max information pixel and the min information pixel, and the corresponding same-pole information is combined to obtain two epipolar information sampling sub-images, and then the aggregated three channels are separated to obtain a total of six single-channel extreme value information sampling sub-images; and the corresponding extreme value information image histograms are established according to these six single-channel extreme value information sampling sub-images; Step S40: performing information difference analysis on the extreme value information image histogram: based on the six single-channel extreme value information sampling subgraphs, reliable epipolar information in the lattice sequence is obtained, and then reliable edges in the original vehicle image to be tested are obtained from the epipolar information; the two single-channel extreme value information sampling subgraphs of each channel are subtracted by the maximum pole minus the minimum pole to obtain a single-channel extrema difference histogram; polarity region segmentation is performed on each single-channel extrema difference histogram using the k-means clustering method to obtain reliable epipolar information in the corresponding lattice sequence, and then the epipolar information is reversely mapped on the original vehicle image to obtain a basic edge sampling subgraph; Step S41: Process each channel separately. In the case of single-channel separation, obtain the extreme difference histogram of each channel. If the extreme difference histogram information of the sampling sub-image corresponding to the three channels meets the difference standard, then the pixel is regarded as the edge of the sampling sub-image; Subtract the extreme value information image histograms in this channel, and use the max extreme information histogram to subtract the min extreme information histogram to obtain the extreme difference histograms of this channel, named R_diff, G_diff and B_diff respectively; Step S42, using the k-means clustering method to perform polarity region segmentation on the extreme difference value histogram, segmenting one or more large regions, each of which contains a dense negative region A, a dense positive region B, and one or more mixed positive and negative regions C, wherein R_diff, G_diff and B_diff are all processed in the same way; Step S43: setting an adaptive screening value for the intensity distribution characteristics based on experimental analysis, processing the dense negative region A and the dense positive region B, and removing portions of the dense negative region A and the dense positive region B whose absolute values are smaller than the screening value; Step S44: Obtain three processed extrema difference histograms R_diff, G_diff, and B_diff, and reversely map the extrema difference histograms of these three channels back to the grid sequence obtained in step S31 using the same method. Traverse the n*m 2*2 grid sequence, and for each extrema max information pixel, search in the dense positive area B of R_diff, G_diff, and B_diff to see if there is a corresponding RGB single channel value. If the corresponding single channel value can be found in R_diff, G_diff, and B_diff, then search in the dense negative area A corresponding to the found single channel value to see if there is a corresponding and paired extrema max information pixel and extrema min information pixel in the current 2*2 grid sequence. This determines that there is a substantial edge from the extrema max information pixel to the extrema min information pixel. Traverse the entire grid sequence and finally obtain the corresponding basic edge sampling subgraph G; Step S50, processing the basic edge sampling sub-graph: expanding the sizes of all grids in the grid sequence in the sampling sub-graph, and performing step S40 again with the expanded grid sequence; using the dual-scale grid sequence to derive a single-channel histogram, re-analyzing the extreme value histogram to verify the correctness of the basic edge sampling sub-graph obtained previously; then merging the basic edge sampling sub-graphs corresponding to the multi-scale sampling sub-graphs to obtain the final edge map of the original vehicle image to be tested.
2. A method for detecting an edge profile of a vehicle according to claim 1, characterized in that Step S20 is specifically implemented as follows: Step S21: First, determine the step size. If the step size is p, pixels in the same column with a row interval of (p-1) or pixels in the same row with a column interval of (p-1) are the same sampling sub-image, and the image is divided into a series of sampling sub-image sets. Then, the sampling sub-images are searched using the step size as an index. In each sampling sub-image set indexed by the step size, the current step size is p, the length of the original vehicle image to be tested is n, the width of the original vehicle image to be tested is m, and the number of sampling sub-images is p*p. All subsequent operations are performed synchronously on all sampling sub-images in the sets pointed to by all step sizes. Step S22: Preprocess and optimize the details of the vehicle image. Record the values of the eight neighborhoods of each pixel and the average of the eight neighborhood values. Record the difference between each eight neighborhood pixel and the center pixel. Then, sort these differences from smallest to largest. Replace the pixel value of the center point with the second largest value after sorting. Step S23 , performing median filtering on the sampling sub-images of each scale after the central point pixel value is replaced.
3. A method for detecting an automobile edge contour according to claim 1, characterized in that Step S30 is specifically implemented as follows: In step S31, each pixel in the sampling sub-image is combined with the pixels in its eight neighboring regions, and the original n*m pixel image is combined into a 2*2 pixel grid with a partially overlapping (n–1)*(m–1) RGB three-channel grid sequence; the original n*m pixel edges are supplemented with a circle of pixels that are the same as the original edges, so that the final RGB three-channel grid sequence size is n*m; Step S32: For the obtained three-channel grid sequence, use the brightness formula to aggregate and normalize the three channels to obtain representative antipodal max information pixels and antipodal min information pixels, record the antipodal max information pixels of each pixel grid in the 2*2 grid sequence, and each channel of the antipodal max information pixels is Rmax, Gmax and Bmax respectively; each channel of the antipodal min information pixels is Rmin, Gmin and Bmin respectively; obtain two n*m single-channel extreme value information sampling sub-images for each channel, a total of six, and then convert these six single-channel extreme value information sampling sub-images into corresponding extreme value information image histograms.
4. A method for detecting an automobile edge profile according to claim 3, characterized in that Step S50 is specifically implemented as follows: Step S51: Use the new scale to transform the grid sequence of the first layer in step S31, expanding the scale from 2*2 to 3*3. To ensure that the grid sequence is consistent with the previous one, redundant repeated RGB pixels are added to the right and bottom sides of the image, finally obtaining an m*n 3*3 grid sequence. Step S52: Repeat step S32 again to extract the epipolar min information pixels and the epipolar max information pixels from each 3*3 grid sequence, obtain all the epipolar information pixels in the grid sequence, obtain a sequence of epipolar max information pixels, separate the three channels, and perform histogram formation after separation to obtain extreme value information image histograms of the three different channels rmaxt, gmaxt, and bmaxt; obtain all the epipolar information pixels in the grid sequence, obtain a sequence of epipolar min information pixels, separate the three channels, and perform histogram formation after separation to obtain extreme value information image histograms of the three different channels rmint, gmint, and bmint; Step S53: Process the six histograms of rmax, rmin, gmax, gmin, bmax, and bmin obtained in step S32 and the six histograms of rmaxt, gmaxt, bmaxt, rmint, gmint, and bmint obtained in step S52. First, perform difference processing on rmax and rmaxt, gmax and gmaxt, and bmax and bmaxt, and then perform the homogeneous operations in steps S42, S43, and S44 to obtain a new basic edge sampling subgraph GmaxT; then perform differential subtraction on rmin and rmint, gmin and gmint, and bmin and bmint, and perform the homogeneous operations in steps S42, S43, and S44 to obtain a new basic edge sampling subgraph GminT; Step S54, combining the basic edge sampling subgraph GmaxT, the basic edge sampling subgraph GminT and the basic edge sampling subgraph G. Since the edges in G will be wrapped and overlapped by the edges in GmaxT and GminT, the edges obtained in G can be verified by the basic edge sampling subgraph GmaxT and the basic edge sampling subgraph GminT, and the redundant edges in the basic edge sampling subgraph G can be removed to obtain the further processed basic edge sampling subgraph GL. Finally, the basic edge sampling subgraphs GL obtained from the processed multi-scale sampling subgraphs are re-merged to obtain a complete edge graph.
5. A vehicle edge profile detection device, characterized in that: The device is used to implement the method according to claim 1, comprising a vehicle image multi-scale sampling unit, a continuous feature pixel planning unit, a vehicle edge detection unit and a vehicle edge verification unit; The vehicle multi-scale sampling unit is used to capture vehicle images; first, the vehicle image is normalized to obtain a vehicle image to be tested; then, the vehicle image to be tested is subjected to multi-scale smoothing, and a preset smoothing module is used to remove information irrelevant to vehicle edge detection, as well as to process imaging device system errors and image compression noise; Finally, the corrected multi-scale sampling sub-graph is obtained; The continuous feature pixel point extraction unit is used to correct the multi-scale sampling sub-image and extract pixels using the nearest neighbor operator; by applying the eight-neighborhood pixel, a separable overlapping grid sequence is established to obtain the sequence extreme value sequence and the corresponding energy histogram; The vehicle edge detection unit is used to obtain the object contour map of the vehicle image to be tested, obtain the edges of continuous feature pixels based on the extremum processing of the continuous grid sequence, and then remove the messy edge parts based on the histogram differentiation processing to extract the main edges; The vehicle edge verification unit is used to repeatedly verify the edges of objects in the image, locate the range of the edges that have been obtained, and improve the accuracy of object recognition.
6. A vehicle edge profile detection device, characterized in that: The detection device is used to implement the method as claimed in claim 1, and includes an image acquisition device, a processor, an external interface, and a preset smoothing module and an adaptation module stored in a memory; the processor of the device executes the preset smoothing module, the segmentation module, and the steps of any vehicle edge contour detection method; the image acquisition device is used to capture object images, the processor executes various image processing algorithms, the external interface is used to communicate with other devices, and the memory is used to store relevant data and modules required to execute the algorithms.
Citation Information
Patent Citations
A vehicle feature extraction and matching method based on video
CN109409208A
Vehicle type identification method and system based on video monitoring of vehicle face features
CN115512310A