An image recognition method based on Huffman coding
By using Huffman coding to compress and represent image features, the problem of excessive computational and storage requirements in existing technologies is solved. This enables efficient image recognition on embedded devices, is suitable for resource-constrained environments, and has good noise resistance and recognition stability.
Patent Information
- Authority / Receiving Office
- CN Β· China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TOEC (GRP) CO LTD
- Filing Date
- 2026-03-03
- Publication Date
- 2026-07-21
AI Technical Summary
Existing image recognition methods have excessive computational and storage requirements in embedded devices or resource-constrained environments, making them difficult to deploy. Furthermore, the sparse coding process is complex and sensitive to noise.
Huffman coding is used to compress and represent image features. A Huffman code table is generated by constructing a Huffman tree, feature vector encoding is performed, and matching and recognition are performed using Hamming distance or similarity calculation functions. Dynamic feature library updates are supported.
Without significantly sacrificing recognition accuracy, it greatly reduces storage and computational overhead, improves recognition efficiency, is suitable for real-time image recognition and edge computing scenarios, provides stable recognition results, has strong anti-interference capabilities, and is suitable for large-scale feature libraries.
Smart Images

Figure CN122435296A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to an image recognition method based on Huffman coding. Background Technology
[0002] Existing image recognition methods (such as deep learning and traditional machine learning) often require substantial computational resources and storage space, making them difficult to deploy, especially in embedded devices or resource-constrained environments. For example, sparse coding-based image recognition methods achieve dimensionality reduction and feature compression by finding sparse representations of image features, thus enabling image recognition. The steps include: 1. Sparsification: converting image features into sparse vectors; 2. Encoding: encoding the sparse vectors; 3. Decoding and recognition: performing recognition through sparse reconstruction or direct matching. While this method can achieve compression and recognition, the sparse coding process is complex, computationally intensive, and sensitive to noise. Therefore, there is an urgent need to develop a Huffman coding-based image recognition method to address these technical challenges.
[0003] In view of this, the present invention is hereby proposed. Summary of the Invention
[0004] The purpose of this invention is to provide an image recognition method based on Huffman coding. By introducing Huffman coding to compress image features, the method significantly reduces storage and computational overhead and improves recognition efficiency without significantly sacrificing recognition accuracy. It is particularly suitable for real-time image recognition and edge computing scenarios. The recognition results are stable, with strong anti-interference ability, high compression efficiency, and low storage requirements. It is suitable for large-scale feature libraries and has broad application prospects, which is conducive to its widespread application.
[0005] To achieve the above objectives, the present invention provides an image recognition method based on Huffman coding, comprising the following steps: S1: Image preprocessing and feature extraction: SS1: Input the training image set into the system; SS2: Performs preprocessing on the input image, including grayscale conversion, normalization, and noise reduction; SS3: Extract feature vectors from an image; S2: Feature Huffman Coding: SS1: Statistical analysis of the frequency of occurrence of each element in the feature vector; SS2: Construct a Huffman tree and generate a Huffman code table; SS3: Converts feature vectors into Huffman-coded sequences; S3: Construct a feature library: Store image features of multiple known categories and their Huffman codes into the feature library, and label the categories; S4: Image processing to be recognized: SS1: Determine if an image has been imported, wait for the system's recognition request, and if no request is received, end the loop; SS2: If a recognition request is issued, perform the same preprocessing and feature extraction on the image to be recognized. SS3: Use the same code table to perform Huffman coding on features; S5: Feature Matching and Recognition SS1: Compare the encoded sequence of the image to be identified with the encoded sequences in the feature library; SS2: Matching is performed using Hamming distance or similarity calculation functions; SS3: Output the recognition result, which is a category label, and continue to wait for the system's recognition request.
[0006] Preferably, in S1, the feature vector includes edges and textures.
[0007] Preferably, in step S2, when constructing the Huffman tree, a priority queue, i.e., a min-heap, is used to merge frequency nodes to optimize coding efficiency.
[0008] Preferably, in step S3, the feature library supports dynamic updates, allowing the addition of feature codes for new categories during the recognition process.
[0009] Preferably, in step S4, the image processing to be recognized supports batch processing and is suitable for parallel recognition of multiple images.
[0010] Preferably, in step S5, the similarity calculation function used is cosine similarity or edit distance.
[0011] Preferably, in step S5, the identification result is a category label.
[0012] The image recognition method based on Huffman coding provided by this invention has the following beneficial effects.
[0013] 1. The encoding process of this invention is simple, computationally efficient, and fast, making it suitable for real-time image recognition applications. It can be deployed in resource-constrained environments such as embedded devices and IoT devices, thus expanding the application scenarios.
[0014] 2. This invention is highly robust to noise, has high recognition stability, stable recognition results, strong anti-interference ability, high compression efficiency, low storage requirements, and is suitable for large-scale feature libraries. Attached Figure Description
[0015] Figure 1 The flowchart illustrates an image recognition method based on Huffman coding provided by this invention. Detailed Implementation
[0016] The present invention will be further described below with reference to specific embodiments and accompanying drawings to help understand the content of the present invention.
[0017] like Figure 1 The diagram shows a flowchart of an image recognition method based on Huffman coding provided by the present invention. This image recognition method based on Huffman coding includes the following steps: S1: Image preprocessing and feature extraction: SS1: Input the training image set into the system; SS2: Performs preprocessing on the input image, including grayscale conversion, normalization, and noise reduction; SS3: Extract feature vectors from the image; the feature vectors include edges and textures; S2: Feature Huffman Coding: SS1: Statistical analysis of the frequency of occurrence of each element in the feature vector; SS2: Construct a Huffman tree and generate a Huffman code table; when constructing the Huffman tree, a priority queue, i.e. a min-heap, is used to merge frequency nodes to optimize coding efficiency; SS3: Converts feature vectors into Huffman-coded sequences; S3: Construct a feature library: Store image features and their Huffman codes for multiple known categories into the feature library and label them with category tags; the feature library supports dynamic updates and can add feature codes for new categories during the recognition process; S4: Image processing to be recognized: Image processing to be recognized supports batch processing and is suitable for parallel recognition of multiple images; SS1: Determine if an image has been imported, wait for the system's recognition request, and if no request is received, end the loop; SS2: If a recognition request is issued, perform the same preprocessing and feature extraction on the image to be recognized. SS3: Use the same code table to perform Huffman coding on features; S5: Feature Matching and Recognition SS1: Compare the encoded sequence of the image to be identified with the encoded sequences in the feature library; SS2: Matching is performed using Hamming distance or a similarity calculation function; the similarity calculation function is cosine similarity or edit distance; SS3: Output the recognition result, which is a category label, and continue to wait for the system's recognition request; the recognition result is a category label.
[0018] This invention features a simple encoding process, high computational efficiency, and fast encoding speed, making it suitable for real-time image recognition applications. It can be deployed in resource-constrained environments such as embedded devices and IoT devices, expanding its application scenarios. Furthermore, this invention exhibits strong noise robustness, high recognition stability, stable recognition results, strong anti-interference capabilities, high compression efficiency, and low storage requirements, making it suitable for large-scale feature libraries.
[0019] This article uses specific examples to illustrate the inventive concept in detail. The description of the above embodiments is only for the purpose of helping to understand the core idea of ββthe present invention. It should be noted that any obvious modifications, equivalent substitutions or other improvements made by those skilled in the art without departing from the inventive concept should be included within the protection scope of the present invention.
Claims
1. An image recognition method based on Huffman coding, characterized in that, Includes the following steps: S1: Image preprocessing and feature extraction: SS1: Input the training image set into the system; SS2: Performs preprocessing on the input image, including grayscale conversion, normalization, and noise reduction; SS3: Extract feature vectors from an image; S2: Feature Huffman Coding: SS1: Statistical analysis of the frequency of occurrence of each element in the feature vector; SS2: Construct a Huffman tree and generate a Huffman code table; SS3: Converts feature vectors into Huffman-coded sequences; S3: Construct a feature library: Store image features of multiple known categories and their Huffman codes into the feature library, and label the categories; S4: Image processing to be recognized: SS1: Determine if an image has been imported, wait for the system's recognition request, and if no request is received, end the loop; SS2: If a recognition request is issued, perform the same preprocessing and feature extraction on the image to be recognized. SS3: Use the same code table to perform Huffman coding on features; S5: Feature Matching and Recognition SS1: Compare the encoded sequence of the image to be identified with the encoded sequences in the feature library; SS2: Matching is performed using Hamming distance or similarity calculation functions; SS3: Output the recognition result, which is a category label, and continue to wait for the system's recognition request.
2. The image recognition method based on Huffman coding according to claim 1, characterized in that, In S1, the feature vector includes edges and textures.
3. The image recognition method based on Huffman coding according to claim 2, characterized in that, In S2, when constructing the Huffman tree, a priority queue, i.e., a min-heap, is used to merge frequency nodes in order to optimize coding efficiency.
4. The image recognition method based on Huffman coding according to claim 3, characterized in that, In S3, the feature library supports dynamic updates, allowing the addition of feature codes for new categories during the recognition process.
5. The image recognition method based on Huffman coding according to claim 4, characterized in that, In step S4, the image processing to be recognized supports batch processing and is suitable for parallel recognition of multiple images.
6. The image recognition method based on Huffman coding according to claim 5, characterized in that, In S5, the similarity calculation function used is cosine similarity or edit distance.
7. The image recognition method based on Huffman coding according to claim 6, characterized in that, In step S5, the identification result is a category label.