Traffic sign identification method and system

By employing dark channel prior algorithm for defogging enhancement and improved morphological segmentation, combined with template matching using absolute difference and normalized cross-correlation (NCC) algorithms, the accuracy problem of traffic sign recognition in foggy weather was solved, achieving efficient recognition under complex lighting conditions.

CN120852810APending Publication Date: 2025-10-28JINING UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511238016.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-01
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

Existing technologies have difficulty in accurately identifying traffic signs under complex weather conditions, especially foggy weather conditions, and the influence of lighting changes and haze leads to poor recognition results.

Method used

The dark channel prior algorithm is used for dehazing image enhancement. Combined with the RGB color model and improved morphological segmentation, the absolute difference and normalized cross correlation (NCC) algorithms are used for template matching to achieve accurate positioning and recognition of traffic signs.

Benefits of technology

It significantly improves the recognition accuracy of traffic signs in foggy weather, and can accurately identify traffic signs under complex lighting conditions, thus enhancing the robustness and accuracy of the recognition system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120852810A_ABST
    Figure CN120852810A_ABST
Patent Text Reader

Abstract

The invention discloses a traffic sign recognition method and system, and relates to the technical field of traffic sign recognition, and the method comprises the steps: carrying out the defogging image enhancement of a traffic sign image under the influence of heavy fog weather through a dark channel prior algorithm, and obtaining an enhanced image; segmenting the enhanced image by using an RGB (Red, Green and Blue) color model to obtain a preliminary segmentation region; performing morphological analysis on the preliminary segmentation region by using improved morphology to obtain a target region; pre-processing the target area, and performing primary matching on the pre-processed target area and the template library by using an absolute difference value and an SAD algorithm to obtain a matching result; and performing secondary matching on the matching result and the template library by using a normalized cross-correlation NCC algorithm to obtain an identification result. According to the invention, the traffic sign can be accurately identified under complex weather conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of traffic sign recognition technology, and in particular to a method and system for recognizing traffic signs. Background Technology

[0002] Achieving accurate detection and recognition of traffic signs faces multiple challenges. This is mainly because road environments and traffic signs are complex and diverse. The detection and recognition effect can be affected by complex weather conditions, physical obstruction, aging and fading of signs, etc. Changes in lighting are a key factor. Direct sunlight or shadows may cause the loss of color and details of traffic signs. At night or in low light conditions, the recognition system may not be able to effectively recognize signs. Complex weather conditions will also affect the recognition effect.

[0003] Currently, Method 1 proposes a ground traffic sign detection algorithm that combines HSL and Lab color spaces. This algorithm outperforms traditional detection algorithms in both ordinary and complex scenes, demonstrating stronger resistance to noise interference and improved ability to locate true edges. Method 2 proposes a dehazing network containing multi-scale residual blocks, which significantly impacts traffic sign recognition in hazy weather. Method 3 employs a Convolutional Neural Network (CNN) method, specifically Mask R-CNN, to solve the entire detection and recognition process through end-to-end automatic learning. Method 4 primarily explores deep multimodal object detection and semantic segmentation in autonomous driving. Method 5 proposes a method based on Histogram of Oriented Gradients (HOG) and Support Vector Machine (SVM) networks for small-sample training. However, all of the above methods require specific lighting conditions for detection. In complex weather conditions with insufficient light or low visibility, existing technologies cannot accurately identify traffic signs due to changes in lighting. Summary of the Invention

[0004] This invention provides a method and system for recognizing traffic signs, which can accurately identify traffic signs under complex weather conditions.

[0005] This invention provides a method for recognizing traffic signs, comprising the following steps: Obtain a template library containing historical traffic sign images, and collect traffic sign images affected by heavy fog. The dark channel prior algorithm is used to enhance traffic sign images affected by heavy fog to obtain enhanced images. The enhanced images are then segmented using the RGB color model to obtain preliminary segmented regions. Finally, improved morphology is used to perform morphological screening analysis on the pixels in the preliminary segmented regions to obtain the target regions composed of the screened pixels. The target region is preprocessed by using absolute difference to obtain the absolute difference matrix between each template image pixel and the target region pixel, summing and normalizing all elements in the matrix to construct a candidate list containing multiple normalized summation results. The SAD algorithm is used to replace the maximum SAD value in the candidate list to obtain the first matching result. Based on the first matching result, the normalized cross-correlation NCC algorithm is used to obtain the NCC value of each matching result and the template library, and the template image corresponding to the largest NCC value is retained to obtain the recognition result.

[0006] Furthermore, the pixels in the initially segmented region are subjected to morphological screening analysis using improved morphology to obtain the target region composed of the screened pixels. Specific steps include: Create a circular structural element and perform morphological operations on it. The image of the region initially segmented by the circular structuring element is closed, and the bwareaopen function is used to remove noise in regions with an area of ​​less than 2000 pixels. The noise-removed regions are labeled with an 8-connectivity standard, and the connected regions are sorted in descending order. Obtain the boundary coordinates and aspect ratio of each connected region; For connected regions sorted in descending order, check their aspect ratios from largest to smallest, select the first region with an aspect ratio less than 1.5, and if no such region exists, select the largest region in the sorted list. Apply a 15% border expansion to the yellow markers in the selection results to ensure complete inclusion of the black border and obtain the target area.

[0007] Further, the steps of obtaining the absolute difference matrix between each template image pixel and the target region pixel using absolute difference, summing and normalizing all elements in the matrix to construct a candidate list containing multiple normalized sums, and replacing the maximum SAD value in the candidate list with the SAD algorithm to obtain the first matching result include: Each template image in the template library is converted to grayscale and binarized, and its size is uniformly set to 80×80. Obtain the absolute difference matrix between each template image and the target region; Sum all elements in the absolute difference matrix and then normalize them; Create a candidate list containing 5 templates; Get the SAD value of each template. If the SAD value of a template is less than the largest SAD value in the candidate list, then replace the largest SAD value with the SAD value of that template. Obtain the template corresponding to the SAD value that is ultimately retained in the candidate list, and use it as the matching result.

[0008] Further, based on the first matching result, the normalized cross-correlation NCC algorithm is used to obtain the NCC value of each matching result and the template library, and the template image corresponding to the largest NCC value is retained to obtain the recognition result. Specific steps include: Convert the matching results and each template in the template library to double type, and obtain the mean and standard deviation between the converted matching results and each converted template; Based on the mean and standard deviation, the NCC value is obtained using the NCC algorithm, and the template corresponding to the largest NCC value is retained as the matching result.

[0009] Furthermore, the preprocessing of the target region includes the following specific steps: The target area undergoes preprocessing steps including grayscale conversion, binarization, and scale normalization.

[0010] Furthermore, the specific steps for obtaining the template library containing historical traffic sign images include: Acquire historical traffic sign images with a resolution of 80×80; perform grayscale and binarization processing on the historical traffic sign images.

[0011] This invention provides a traffic sign recognition system, comprising: The image acquisition module is used to acquire a template library containing historical traffic sign images and to collect traffic sign images affected by heavy fog. The target region detection module is used to perform defogging image enhancement on traffic sign images affected by heavy fog using a dark channel prior algorithm to obtain an enhanced image; the enhanced image is segmented using an RGB color model to obtain preliminary segmented regions; and the pixels in the preliminary segmented regions are subjected to morphological screening analysis using improved morphology to obtain the target region composed of the screened pixels. The traffic sign recognition module is used to preprocess the target area. It uses absolute difference to obtain the absolute difference matrix between each template image pixel and the target area pixel, sums and normalizes all elements in the matrix, and constructs a candidate list containing multiple normalized sums. The SAD algorithm is used to replace the maximum SAD value in the candidate list to obtain the first matching result. Based on the first matching result, the normalized cross-correlation NCC algorithm is used to obtain the NCC value of each matching result and the template library, and the template image corresponding to the largest NCC value is retained to obtain the recognition result.

[0012] This invention provides a method and system for recognizing traffic signs, which have the following advantages compared with the prior art: For traffic sign images affected by heavy fog, a dark channel prior algorithm is used for defogging image enhancement, RGB color modeling, and improved morphology to detect the target region. The target region is preprocessed by using absolute difference to obtain the absolute difference matrix between each template image pixel and the target region pixel, summing and normalizing all elements in the matrix to construct a candidate list containing multiple normalized sums. The SAD algorithm is used to replace the maximum SAD value in the candidate list to obtain the first matching result. Based on the first matching result, a normalized cross-correlation (NCC) algorithm is used to obtain the NCC value of each matching result and the template library, retaining the template image corresponding to the largest NCC value to obtain the recognition result. A preliminary matching is used for coarse screening, and then a second matching is performed using an NCC algorithm that adapts to changes in lighting conditions to obtain accurate matching results and accurately identify the traffic sign images affected by heavy fog. Attached Figure Description

[0013] Figure 1 A system flowchart provided for embodiments of the present invention; Figure 2 This is an image enhancement result provided in an embodiment of the present invention; Figure 3 This is a target extraction result diagram provided in an embodiment of the present invention; Figure 4 The original image of the segmented traffic sign provided in an embodiment of the present invention; Figure 5 The grayscale image provided in the embodiments of the present invention; Figure 6 The binarized image provided in the embodiments of the present invention; Figure 7 The red prohibition sign recognition provided in the embodiments of the present invention; Figure 8 The blue indicator mark is used for identification in the embodiments of the present invention; Figure 9 The yellow warning sign recognition provided in the embodiments of the present invention. Detailed Implementation

[0014] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0015] This invention provides a method for recognizing traffic signs, comprising the following steps: Step 1: Obtain a template library containing historical traffic sign images and collect traffic sign images affected by heavy fog.

[0016] Step 2: Use the dark channel prior algorithm to enhance the traffic sign image under the influence of foggy weather to obtain the enhanced image; use the RGB color model to segment the enhanced image to obtain the preliminary segmented region; use the improved morphology to perform morphological screening analysis on the pixels of the preliminary segmented region to obtain the target region composed of the screened pixels.

[0017] Step 3: Preprocess the target region. Use absolute difference to obtain the absolute difference matrix between each template image pixel and the target region pixel, sum and normalize all elements in the matrix, constructing a candidate list containing multiple normalized summation results. Replace the maximum SAD value in the candidate list with the SAD (Sum of Absolute Difference) algorithm to obtain the first matching result. Based on the first matching result, use the Normalized Cross-Correlation (NCC) algorithm to obtain the NCC value of each matching result and the template library, retaining the template image corresponding to the largest NCC value to obtain the recognition result.

[0018] The specific processing steps are as follows: 1. Theoretical basis of traffic sign detection and recognition based on machine vision: Machine vision offers many advantages over traditional non-visual methods. This invention focuses on traffic sign detection and recognition in foggy weather. The main content includes an introduction to common defogging algorithms, frequently used traffic sign detection and recognition methods, and a brief analysis to select a suitable method for subsequent research.

[0019] 1.1 Machine Vision: Machine vision technology is a method of simulating human visual functions through computer systems. Simply put, it enables machines to "see" and "understand" like humans, achieving intelligent processing of image and video data. Machine vision can recognize all visible traffic signs, adapt to complex road scenarios, and requires only a camera in terms of hardware. On the hardware side, the system mainly relies on a camera and a data processing unit, requiring no additional road infrastructure deployment. Compared to non-visual methods, machine vision is lower in cost, has stronger generalization capabilities, and better real-time performance, enabling it to better handle sudden traffic situations and unknown road scenarios.

[0020] 1.2 Dehazing Algorithm: Image dehazing is a technique that reduces or removes image blurring and low contrast caused by fog, smoke, and other aerosol particles in the atmosphere. These factors cause loss of detail and color shift in images, resulting in unrealistic colors, overall image quality degradation, and reduced image quality. Commonly used image dehazing algorithms include image enhancement-based dehazing algorithms, image restoration-based dehazing algorithms, and deep learning-based dehazing algorithms.

[0021] 1.2.1 Image Enhancement-Based Dehazing Algorithm: Histogram equalization is a dehazing technique based on image enhancement. By mathematically transforming the grayscale distribution of an image, it can enhance contrast. Depending on the processing range, this technique can be divided into global processing and local processing. Although traditional global histogram equalization has a simple algorithm and good dehazing effect for images with a single depth of field, it cannot adapt to the differences in brightness distribution in different depth regions. Local enhancement methods rely on region segmentation, which can significantly improve contrast, but may cause the scene image to become unnatural due to a lot of noise interference.

[0022] 1.2.2 Dehazing Algorithm Based on Image Restoration: The dark channel prior method is a typical image restoration and dehazing algorithm. This method is based on a dark channel prior in the image, finding a minimum value in a local region to estimate the transmittance, and then performing dehazing based on the transmittance. This algorithm is based on the phenomenon that in a fog-free scene excluding the sky, each color channel has some regions with very low pixel values; these regions are called "dark channels," where pixel values ​​are close to zero. In foggy images, due to atmospheric scattering, object colors become lighter, and details are difficult to discern, but the dark channel characteristics still exist. By extracting the dark channel of the image, the atmospheric light and image transmission map can be estimated, thereby removing the influence of fog and restoring the image's clarity and realism. The dark channel prior method can preserve as many feature details as possible in fog-free areas while dehazing; this invention uses the dark channel prior algorithm for image dehazing.

[0023] 1.2.3 Deep Learning-Based Dehazing Algorithm: Common algorithms of this type include IRCNN and AOD-Net. The IRCNN model is based on a positive semidefinite segmentation algorithm while incorporating CNN learning methods, enabling it to remove haze quickly and effectively. AOD-Net is an image dehazing model built using a convolutional neural network (CNN), called an all-in-one dehazing network. It is designed based on a redefined atmospheric scattering model and can estimate a transmittance map, which represents the amount of haze in each pixel. This transmittance map is then used to guide the dehazing process.

[0024] 1.3 Traffic sign inspection methods: Existing traffic sign detection methods can be broadly categorized into three types: color-based, shape-based, and deep learning-based methods. These three methods are outlined below.

[0025] 1.3.1 Color-based detection methods: The visual recognition of traffic signs relies primarily on their distinct color characteristics. In my country, traffic signs are mainly divided into three colors: red, blue, and yellow. The colors of traffic signs are relatively easy to distinguish within specific color spaces. Commonly used color spaces include RGB, HSV, HSL, and Lab. The RGB color model is directly compatible with most image acquisition devices (such as cameras and scanners), meaning that no additional color conversion steps are required, reducing processing time and computational resources. Therefore, this invention will adopt the RGB color model. Traffic signs are basically divided into red prohibition signs, yellow warning signs, and blue instruction signs. Common color images are composed of RGB primary colors combined in different proportions. By simply setting the proportions of the RGB primary colors, the areas of the traffic sign can be initially separated, obtaining its binary image.

[0026] 1.3.2 Shape-based detection methods: Traffic signs are mainly categorized into rectangles, triangles, and circles. Therefore, by detecting the edges and contours of traffic signs, they can be quickly segmented from complex environments to obtain regions of interest. Shape-based detection steps mainly consist of edge detection, contour detection, feature extraction, and shape recognition.

[0027] 1.3.3 Deep Learning-Based Detection Methods: Deep learning-based methods automatically learn deep feature representations of traffic signs using neural network models, achieving high-precision classification and recognition. This is an advanced method that utilizes deep learning techniques such as convolutional neural networks (CNNs) to classify and recognize traffic signs. A key step in this method is data preparation, including collecting and labeling diverse traffic sign images to ensure the model can learn sufficient features. While deep learning-based traffic sign detection achieves high accuracy, it also suffers from high computational requirements and long training times.

[0028] 1.4 Traffic sign recognition methods: Traffic sign recognition is a system that relies on computer vision and image processing. This system uses candidate regions of interest (ROIs) output after detection, and employs a series of algorithms and models to process, analyze, and recognize the image, ultimately determining the precise content of the traffic sign within the image. There are three common methods for traffic sign recognition: template matching, machine learning, and deep learning.

[0029] 1.4.1 Template Matching Method: In the field of traffic sign recognition, template matching is advantageous because it is simple to implement and computationally efficient. It is often regarded as a basic recognition method. It requires pre-setting template styles for various traffic signs, comparing and matching the collected images with the pre-defined traffic sign templates in the database, and finding the most matching template as the recognition result. This method is simple and direct, but its robustness is poor when there are changes in lighting or occlusion. Therefore, it is necessary to perform image enhancement processing in the detection stage to eliminate interference factors that affect recognition.

[0030] 1.4.2 Machine Learning Methods: After extracting features from traffic signs using techniques such as color segmentation and shape detection, the acquired features are input into a classifier, such as Support Vector Machine (SVM) or K-Nearest Neighbors (K-NN), for classification and recognition. Training the classifier requires a large number of labeled traffic sign images as data. For example, SVM is an excellent binary classifier that can handle multi-class problems using one-to-many or one-to-one methods. K-NN is an instance-based learning method whose classification decision mainly relies on the distance between samples in the feature space. The algorithm finds the K nearest neighbors in the training set and classifies them based on the majority class of these instances.

[0031] 1.4.3 Deep Learning Methods: In recent years, with the continuous development of neural network algorithms, more and more people have participated in and researched them, enabling deep learning technology to play an important role in various fields. Among them, Convolutional Neural Networks (CNNs) are a common algorithm, well-suited for image recognition. This algorithm can directly learn hierarchical feature representations from image pixels, automatically extracting local features of images and abstracting and classifying them through a multi-layered network structure. Deep learning methods can learn more complex features from data. Due to the complex network structure, a large amount of computational resources are required for training, making it widely applicable in tasks requiring high levels of complexity.

[0032] 1.5 System Flowchart: This invention primarily studies traffic sign detection and recognition under foggy weather conditions. First, the input image is sharpened using a dark channel prior algorithm to enhance the image and increase its saturation, resulting in a clearer image and preparing it for the subsequent traffic sign detection stage. In the detection stage, color segmentation and shape feature detection are used to extract the corresponding target regions. Then, an optimized template matching method is applied to compare the detected traffic signs with templates in a template library, finally outputting the meaning of the traffic sign. Figure 1 The diagram shown is a system flowchart.

[0033] 2. Traffic sign detection based on color and shape: Traffic sign detection involves identifying candidate regions containing traffic signs from the input image, which is a prerequisite for traffic sign recognition. Before the detection phase begins, dehazing is performed on the images acquired in foggy weather. Color- and shape-based detection methods are used to ensure accuracy.

[0034] 2.1 Template Preparation: This invention employs an optimized template matching method to identify traffic signs. The main function of the algorithm is to locate similar regions of a specific template in a large-scale image. Template preparation is a crucial step when applying template matching. The template should be representative of the features being sought in the image, typically a small region. In this invention, traffic sign images are used as the template source data. To ensure the effectiveness of the template, an 80*80 resolution is used in this study.

[0035] 2.2 Image sharpening processing: In real-world environments, complex weather conditions often cause image distortion and blurring, leading to a decline in image quality. Foggy weather, with its low visibility, further degrades image quality, necessitating image sharpening. Image dehazing technology can eliminate or reduce the interference of suspended particles on image quality, restore true colors, and enhance contrast, facilitating subsequent analysis and processing. This invention employs a dark channel prior algorithm for image dehazing enhancement, restoring image color and detail, increasing saturation, and resulting in clearer images.

[0036] In a visual GUI interface created in MATLAB, an "Image Enhancement" button is set up. After pressing the button, adaptive histogram equalization is first performed to improve image contrast while avoiding excessive noise enhancement. Then, a custom `quwu()` function is called to perform dehazing. Finally, a parametric unsharpened mask is used to adaptively sharpen the dehazed image. This process generates three key outputs: a dark channel image that visually reflects the fog density distribution; an improved transmittance map that effectively eliminates block artifacts and preserves more complete edges through an edge-preserving filtering algorithm; and finally, a clear image after dark channel enhancement. The entire processing flow significantly improves image quality and provides clearer visual information for subsequent processing. Figure 2 The image shown is the result after image enhancement processing.

[0037] 2.3 Color Segmentation: Traffic signs are mainly categorized by color into red, yellow, and blue. Color segmentation utilizes the specific color characteristics of traffic signs to separate regions of interest from an image. This invention employs the RGB color space. A "Color Selection" option box is added to the visual GUI interface. After inputting an image and completing image enhancement processing, the color of the traffic sign to be detected is selected. Different functions are invoked for subsequent processing depending on the selected color. For example, selecting the blue button extracts the blue channel and calls the custom function `lanse()`. The processed image is then named "Component Image" and output to the visual interface. Dilation and erosion are then performed to increase the size of the highlighted areas in the image, finally outputting an image named "Preliminary Segmentation Image". Figure 3 The image shows the output result after color segmentation, which is also the result of target extraction.

[0038] 2.4 Shape Feature Detection: After color segmentation, improved morphological processing is employed. Circular structuring elements and closing operations (dilation followed by erosion) better preserve the original shape of traffic signs, filling internal holes and smoothing edges. Then, the function `bwareaopen()` is used to remove small white objects from the binary image. After noise removal, the extent and aspect ratio of each connected region are calculated to determine the image type. An early termination strategy is adopted, returning immediately if the conditions are met, and the `Extent` parameter effectively resists contour deformation caused by noise. Special attention is paid to yellow warning signs during precise image segmentation. These signs have a black border, making them different from the other two types during precise segmentation; extraction requires expanding the region outwards. While color segmentation may result in images with minor interference, shape feature detection allows for further precise segmentation, improving the accuracy of the detection process.

[0039] The specific morphological analysis process is as follows: (1) Structural element definition: A circular structural element with a radius of 5 pixels is created. This structural element will be used for subsequent morphological operations, determining the shape and size of the neighborhood.

[0040] (2) Closing operation: First, dilate the image using the defined structuring element se. Then, erode the dilated image. Fill small holes and cracks; connect adjacent objects; smooth boundaries without significantly changing the area.

[0041] (3) Area filtering: Delete all connected regions with an area less than 2000 pixels. Remove small noise points and spurious targets, and retain larger regions that may be traffic signs.

[0042] (4) Connectivity analysis: Use the 8 connectivity criteria to mark all connected regions and count the total number of connected regions.

[0043] (5) Sorting by region area: Calculate the number of pixels in each connected region and sort all regions by area from largest to smallest.

[0044] (6) Shape filtering: Calculate the boundary coordinates of each connected region, calculate the aspect ratio of the region, and filter out regions that are closer to the shape of standard traffic signs based on the aspect ratio.

[0045] (7) Final area selection: Check the aspect ratio of each area from largest to smallest, select the first area with an aspect ratio less than 1.5, and if there is no area that meets the condition, select the largest area.

[0046] Advantages of improved morphological processing: Multi-step combination: Integrates closing operations, area filtering, and shape analysis, making it more efficient than single morphological operations. Adaptive selection: Automatically selects the most likely target region based on regional features. Robustness: Capable of handling input images of varying sizes, shapes, and noise levels. Preservation of key information: Effectively preserves the key shape features of traffic signs while removing noise.

[0047] 3. Traffic sign recognition based on template matching: In traffic sign recognition, the images captured are taken under natural conditions and are easily affected by many factors, leading to problems such as blurriness and noise. Recognizing these images under these conditions would compromise accuracy, making image preprocessing crucial. The image preprocessing steps used in this invention include grayscale conversion, binarization, and size / scale normalization. Template matching and recognition are then performed after image processing.

[0048] 3.1 Image Preprocessing: Image preprocessing is a crucial step in the detection and recognition of traffic signs, such as... Figure 4 Taking the segmented original image of the traffic sign as an example, the image preprocessing steps are described in detail.

[0049] 3.1.1 Grayscale conversion: Color images typically contain three color channels: red, green, and blue. Each channel is a matrix, meaning that processing color images requires more data. Grayscale images, on the other hand, have only one channel, resulting in less data and making them simpler and faster to process. In MATLAB, to convert an RGB image to grayscale, the `rgb2gray()` function is called. The program execution will then produce the desired result. Figure 5 The grayscale image shown.

[0050] 3.1.2 Binarization: In MATLAB image processing, a grayscale value of 0 represents black and 1 represents white. Converting an image to binary format typically uses a thresholding method, where values ​​below a threshold are set to 0, and all others to 1. In MATLAB, the `imbinarize()` function is used, employing Otsu's method to automatically calculate the optimal threshold. Compared to a fixed threshold method, this approach better adapts to images under different lighting conditions, resulting in a more stable binarization effect. Figure 6 As shown, the final image obtained is after binarization.

[0051] 3.1.3 Scale normalization: After converting the image to grayscale and binarizing it, the imresize() function needs to be used to adjust the binary image to 80*80 pixels to ensure that the images to be compared are of the same size. Normalizing the image size can ensure that the input data have the same dimensions. If the input images are of different sizes, the model may be biased towards the size of the images, affecting the accuracy and generalization ability of the detection.

[0052] 3.2 Template Matching: After obtaining the target region and completing image preprocessing, the images in the template library need to be grayscaled and binarized. Then, the characters cut out after color and shape detection are compared with the characters in the template library. This invention proposes an improved template matching method that combines the advantages of Sum of Absolute Differences (SAD) and Normalized Cross-Correlation (NCC) algorithms to achieve a balance between speed and accuracy. The specific implementation process is divided into two levels: First, the SAD algorithm is used for fast coarse matching. This algorithm is simple to compute and fast, and can quickly filter out possible candidate regions, significantly narrowing the search range for subsequent fine matching. Then, the NCC algorithm is applied to the candidate regions obtained in the first step of coarse matching for precise matching. The NCC algorithm has good robustness to changes in illumination and can provide higher matching accuracy. This hierarchical matching strategy avoids the disadvantage of high computational cost when using the NCC algorithm alone, and overcomes the problem of insufficient accuracy when using the SAD algorithm alone.

[0053] The process of using the SAD algorithm includes: (1) Template preparation: Read each template image from the template library (approximately 80 in total); perform the same preprocessing on each template as on the target image: grayscale conversion → binarization → size unification to 80*80.

[0054] (2) SAD calculation: For each template, calculate its absolute difference matrix with the target image; sum all elements of the difference matrix; normalize by dividing by the total number of pixels (80*80=6400) to obtain the average difference value.

[0055] (3) Candidate screening: Maintain a list of 5 candidates; for each template, if its SAD value is less than the maximum value in the current candidate list, replace the maximum value; finally, retain the 5 templates with the smallest SAD values ​​as candidates.

[0056] The process of using the NCC algorithm includes: (1) Convert the image and template to double type.

[0057] (2) Calculate the mean and standard deviation of the two images.

[0058] (3) Perform NCC calculation: Numerator: Calculates the covariance of the image and the template. Denominator: Calculates the product of the standard deviations of the image and the template.

[0059] (4) The template with the largest NCC value is retained as the final matching result.

[0060] 3.3 Traffic Sign Recognition System Test Results: A traffic sign recognition system platform developed using MATLAB 2022a was designed with a visual GUI interface. The system's main functions include image input, image enhancement, target extraction, target segmentation, and sign recognition. Experimental results show that the algorithm framework exhibits good performance in low-visibility, foggy weather environments for the detection and recognition of various traffic signs. The detection and recognition results of some traffic signs in foggy scenarios are shown below: The recognition results for the red prohibition sign are shown below. Figure 7 The identification results for the blue indicator sign can be found in [link / reference]. Figure 8 The results of the yellow warning sign identification are shown below. Figure 9 .

[0061] 4. Summary: The focus of this invention is on traffic sign detection and recognition under foggy weather conditions. In the process of establishing the template library, traffic sign images under foggy conditions are collected, and after rigorous processing and feature extraction, a representative template library is generated. Images acquired under foggy conditions first undergo dehazing of the dark channel to improve image clarity. For detection, color and shape methods have achieved good results. In traffic sign image preprocessing, grayscale conversion and binarization techniques are used to effectively improve image quality. In the recognition stage, an optimized template matching algorithm compares the acquired target region with templates in the template library for identification.

[0062] This invention improves the recognition accuracy of traffic sign recognition systems under foggy weather conditions, and is of great significance in both theoretical research and practical application.

[0063] This invention provides a traffic sign recognition system, comprising: The image acquisition module is used to acquire a template library containing historical traffic sign images and to collect traffic sign images affected by heavy fog.

[0064] The target region detection module is used to perform defogging image enhancement on traffic sign images affected by heavy fog using a dark channel prior algorithm to obtain an enhanced image; the enhanced image is then segmented using an RGB color model to obtain preliminary segmented regions; and the pixels in the preliminary segmented regions are subjected to morphological screening analysis using improved morphology to obtain the target region composed of the screened pixels.

[0065] The traffic sign recognition module is used to preprocess the target area. It uses absolute difference to obtain the absolute difference matrix between each template image pixel and the target area pixel, sums and normalizes all elements in the matrix, and constructs a candidate list containing multiple normalized sums. The SAD algorithm is used to replace the maximum SAD value in the candidate list to obtain the first matching result. Based on the first matching result, the normalized cross-correlation NCC algorithm is used to obtain the NCC value of each matching result and the template library, and the template image corresponding to the largest NCC value is retained to obtain the recognition result.

[0066] A specific example is as follows: This embodiment discloses a method for recognizing traffic signs, the specific steps of which are as follows: S1. First, a comparative analysis was conducted on existing image dehazing algorithms and general methods for traffic sign detection and recognition. A dark channel prior algorithm was selected to dehaze and enhance foggy images, increasing image contrast. Candidate regions were extracted using color space threshold segmentation, and precise localization was achieved by combining shape features with threshold filtering.

[0067] S2. In the identification stage, a template matching method is proposed that combines absolute difference and SAD with normalized cross-correlation (NCC). SAD is used for fast coarse matching to narrow the search range, and then NCC is used for fine matching, which takes into account the characteristics of the algorithm in terms of speed and accuracy.

[0068] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A method for recognizing traffic signs, characterized in that, Includes the following steps: Obtain a template library containing historical traffic sign images, and collect traffic sign images affected by heavy fog. The dark channel prior algorithm is used to enhance traffic sign images affected by heavy fog to obtain enhanced images. The enhanced image is segmented using the RGB color model to obtain preliminary segmented regions; Improved morphology is used to perform morphological screening analysis on the pixels of the initially segmented region to obtain the target region composed of the screened pixels; The target region is preprocessed by using absolute difference to obtain the absolute difference matrix between each template image pixel and the target region pixel, and summing and normalizing all elements in the matrix to construct a candidate list containing multiple normalized summation results. The SAD algorithm is used to replace the maximum SAD value in the candidate list to obtain the first matching result. Based on the first matching result, the normalized cross-correlation NCC algorithm is used to obtain the NCC value of each matching result and the template library, and the template image corresponding to the largest NCC value is retained to obtain the recognition result.

2. The traffic sign recognition method as described in claim 1, characterized in that, The process of performing morphological screening analysis on the pixels of the initially segmented region using improved morphology to obtain the target region composed of the screened pixels includes the following specific steps: Create a circular structural element and perform morphological operations on it. The image of the region initially segmented by the circular structuring element is closed, and the bwareaopen function is used to remove noise in regions with an area of ​​less than 2000 pixels. The noise-removed regions are labeled with an 8-connectivity standard, and the connected regions are sorted in descending order. Obtain the boundary coordinates and aspect ratio of each connected region; For connected regions sorted in descending order, check their aspect ratios from largest to smallest, select the first region with an aspect ratio less than 1.5, and if no such region exists, select the largest region in the sorted list. Apply a 15% border expansion to the yellow markers in the selection results to ensure complete inclusion of the black border and obtain the target area.

3. The traffic sign recognition method as described in claim 1, characterized in that, The steps include: obtaining the absolute difference matrix between each template image pixel and the target region pixel using absolute difference, summing and normalizing all elements in the matrix to construct a candidate list containing multiple normalized sums, and replacing the maximum SAD value in the candidate list with the SAD algorithm to obtain the first matching result. Each template image in the template library is converted to grayscale and binarized, and its size is uniformly set to 80×80. Obtain the absolute difference matrix between each template image and the target region; Sum all elements in the absolute difference matrix and then normalize them; Create a candidate list containing 5 templates; Get the SAD value of each template. If the SAD value of a template is less than the largest SAD value in the candidate list, then replace the largest SAD value with the SAD value of that template. Obtain the template corresponding to the SAD value that is ultimately retained in the candidate list, and use it as the matching result.

4. The traffic sign recognition method as described in claim 1, characterized in that, The step of obtaining the recognition result by using the normalized cross-correlation NCC algorithm to obtain the NCC value of each matching result and the template library based on the first matching result, and retaining the template image corresponding to the largest NCC value, includes the following specific steps: Convert the matching results and each template in the template library to double type, and obtain the mean and standard deviation between the converted matching results and each converted template; Based on the mean and standard deviation, the NCC value is obtained using the NCC algorithm, and the template corresponding to the largest NCC value is retained as the matching result.

5. The traffic sign recognition method as described in claim 1, characterized in that, The preprocessing of the target region includes the following steps: The target area undergoes preprocessing steps including grayscale conversion, binarization, and scale normalization.

6. The traffic sign recognition method as described in claim 1, characterized in that, The steps for obtaining the template library containing historical traffic sign images include: Acquire historical traffic sign images at a resolution of 80×80; Historically collected traffic sign images are processed by grayscale and binarization.

7. A traffic sign recognition system, characterized in that, include: The image acquisition module is used to acquire a template library containing historical traffic sign images and to collect traffic sign images affected by heavy fog. The target region detection module is used to perform defogging image enhancement on traffic sign images affected by heavy fog using the dark channel prior algorithm to obtain enhanced images. The enhanced image is segmented using the RGB color model to obtain preliminary segmented regions; Improved morphology is used to perform morphological screening analysis on the pixels of the initially segmented region to obtain the target region composed of the screened pixels; The traffic sign recognition module is used to preprocess the target area. It uses absolute difference to obtain the absolute difference matrix between each template image pixel and the target area pixel, sums and normalizes all elements in the matrix, constructs a candidate list containing multiple normalized sums, and uses the SAD algorithm to replace the maximum SAD value in the candidate list to obtain the first matching result. Based on the first matching result, the normalized cross-correlation NCC algorithm is used to obtain the NCC value of each matching result and the template library, and the template image corresponding to the largest NCC value is retained to obtain the recognition result.