A feature image automatic detection comparison method
This paper proposes an automatic feature image detection and comparison method based on cross-scale feature extraction and dynamic feature weighting strategies. This method solves the problems of low efficiency and unstable accuracy of manual feature image comparison and achieves efficient and accurate automatic feature image comparison.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA COMMERCE NETWORKS (SHANGHAI) CO LTD
- Filing Date
- 2025-08-12
- Publication Date
- 2026-07-24
AI Technical Summary
In existing technologies, feature image comparison relies on manual operation, which suffers from low efficiency, unstable accuracy, and susceptibility to human fatigue.
An automatic feature image detection and comparison method employing cross-scale feature extraction and dynamic feature weighting strategies is proposed. This method obtains source feature data of object images through feature detection algorithms, matches the images to be verified using identification information, performs cross-scale feature extraction and dynamic weight adjustment, and achieves feature comparison.
It improves the efficiency and accuracy of feature image comparison, reduces the impact of environmental interference on detection, and ensures the objectivity and consistency of results.
Smart Images

Figure CN120931964B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of image processing and comparison, and in particular to a method for automatic detection and comparison of feature images. Background Technology
[0002] In daily life and industrial production, there are many scenarios that require image comparison, such as identifying the authenticity of goods, tracing the origin of items, and quality inspection.
[0003] Traditionally, these comparisons are usually done manually, requiring the person to compare two or more images one by one to find differences and determine whether the objects in the images match, or whether they are genuine or fake. However, manual comparison has significant drawbacks: On the one hand, manual judgment is slow and cannot meet the needs of large-scale, high-efficiency testing; On the other hand, long working hours can easily lead to fatigue, which can significantly reduce the accuracy of judgment. Furthermore, multiple manual comparisons may affect the product experience due to subjective differences among personnel, making it impossible to guarantee the objectivity and consistency of the results.
[0004] Therefore, there is an urgent need for a technical solution that can replace manual labor to achieve automatic detection and comparison of feature images, so as to improve efficiency and accuracy. Summary of the Invention
[0005] To improve the efficiency and accuracy of feature image comparison, this application provides an automatic feature image detection and comparison method, which adopts the following technical solution: An automatic feature image detection and comparison method, comprising: S1. Obtain an object image containing object features, and use a feature detection algorithm based on the characteristics of the object features to perform feature detection and segmentation on the object image to obtain source feature data and store it; S2. Obtain the image to be verified containing the object to be verified, and match the corresponding source feature image and the source feature data according to the identification information of the object to be verified. S3. Input the image to be verified into the feature detection algorithm corresponding to the source feature data to obtain the feature data to be verified; S4. Based on the source feature data and the feature data to be verified, perform feature comparison using a comparison algorithm and output the comparison result; The feature detection algorithm includes cross-scale feature extraction and dynamic feature weighting strategy. The cross-scale feature extraction simultaneously detects micro and macro features of the image, and the dynamic feature weighting method dynamically adjusts the weight of the feature region according to environmental information.
[0006] Optionally, the cross-scale feature extraction process includes: Preprocess the input image, including standardizing the image size and color. Select sampling kernels of various sizes from the sampling kernel specification pool, and perform sliding block sampling on the input image according to a preset step size; Each sampling kernel corresponds to an image patch extraction at a certain scale. Small-scale sampling kernels are used to capture the microscopic features, while large-scale sampling kernels are used to extract the macroscopic features.
[0007] Optionally, the dynamic feature weighting strategy includes: While acquiring the image of the object, environmental information is simultaneously collected; the environmental information includes ambient light intensity, image blur, and noise density. Based on the feature distribution extracted across scales, the image is divided into multiple feature regions; Based on the environmental information and the corresponding preset threshold, interference assessment is performed on each feature region to identify the interference region affected by environmental interference. The interference region is weighted according to a preset weighting strategy, and the adjusted weight values are applied to the feature data of the corresponding feature region.
[0008] Optionally, step S4 includes: The source feature data and the feature data to be verified are vectorized and converted into feature vectors of a uniform dimension. Integrate feature vectors from different levels to form a more comprehensive integrated feature vector; By compensating for positional offsets and optimizing similarity calculations, accurate matching between the source feature data and the feature data to be verified is achieved.
[0009] Optionally, the process of vectorizing the source feature data and the feature data to be verified into feature vectors of a uniform dimension includes: Based on the feature regions after the dynamic feature weight allocation, the core feature regions that need to be vectorized are determined. Multi-angle, multi-range feature extraction is performed on the core feature regions of the localization. Based on the situation of the interference region, the initial feature vector is adaptively adjusted using gradient weighting. The eigenvectors are subjected to rotation invariance processing.
[0010] Optionally, the method for integrating feature vectors from different levels to form a more comprehensive feature representation includes: The vectorized feature regions are divided into three levels: macroscopic, mesoscopic, and microscopic, according to the spatial pyramid structure. Extract the corresponding layer feature vectors for each layer; Dynamic weights are assigned to feature vectors at different levels based on the importance of features at each level in the comparison. The weighted feature vectors from each level are concatenated and merged to form a comprehensive feature vector.
[0011] Optionally, the process of achieving accurate matching between the source feature data and the feature data to be verified by compensating for positional offset and optimizing similarity calculation includes: Key feature points of the comprehensive feature vector are extracted, and a position jitter compensation mechanism is used to search and match the key feature points of the feature to be verified. The aligned source features and features to be verified are divided into levels according to the multi-level feature fusion hierarchy, and the similarity of each level and each region is calculated separately. Based on the situation of the interference areas, the similarity scores of each area are compensated and adjusted; The median decision mechanism was adopted to perform statistical analysis on the adjusted similarity scores of each region, and the median value of the similarity scores of all regions was taken as the final similarity score.
[0012] Optionally, after performing an interference assessment on each feature region, the sampling kernel size is adjusted once based on the results of the interference assessment. When the detected interference intensity is low and the distribution is uniform, the overall size of the sampling kernel specification pool is increased to improve processing efficiency and capture macroscopic features; When the interference intensity is high and concentrated in a local area, reduce the overall size of the sampling kernel size pool to enhance the extraction of detailed features and the resistance to local interference.
[0013] In summary, this application includes at least one of the following beneficial technical effects: This application simultaneously detects micro and macro features of images through cross-scale feature extraction, comprehensively capturing detailed information and overall distribution patterns of object features. This avoids the problem of missing key features that may occur with single-scale feature extraction. Dynamic feature weight allocation adjusts the weights of feature regions based on environmental information, effectively reducing the impact of environmental interference on feature detection. When ambient light intensity is insufficient, or the image is blurry or noisy, the weight of the affected areas is reduced to minimize interference with feature extraction, improving the accuracy and reliability of the source feature data and laying a solid data foundation for subsequent feature comparison. Identification information, as the key information that uniquely distinguishes different objects, can quickly locate the corresponding source feature data, avoiding blind searching in a large amount of source feature data and greatly improving the matching efficiency of source feature data. The same feature detection algorithm as the source feature data detection is adopted, including cross-scale feature extraction and dynamic feature weight allocation strategies, ensuring that the extraction method and feature parameter dimensions of the feature data to be verified are consistent with the source feature data. The comparison algorithm can comprehensively utilize the effective information in both the source and feature data to be verified, and comprehensively evaluate the similarity between the two through multi-dimensional and multi-level feature analysis and matching. Compared to traditional manual comparison methods, this method avoids the problems of slow manual judgment and susceptibility to fatigue leading to decreased accuracy. It can quickly output comparison results and greatly improve the efficiency of feature comparison. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating the automatic feature image detection and comparison method in this application. Detailed Implementation
[0015] The embodiments of this application are described in detail below, and examples of the embodiments are shown in the accompanying drawings.
[0016] In the description of this specification, the references to "certain embodiments," "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples" refer to specific features, structures, materials, or characteristics described in connection with the described embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0017] This application discloses an automatic feature image detection and comparison method, referring to... Figure 1 ,include: S1. Obtain an object image containing object features, and use a feature detection algorithm based on the characteristics of the object features to perform feature detection and segmentation on the object image to obtain source feature data and store it; S2. Obtain the image to be verified containing the object to be verified, and match the corresponding source feature image and the source feature data according to the identification information of the object to be verified. S3. Input the image to be verified into the feature detection algorithm corresponding to the source feature data to obtain the feature data to be verified; S4. Based on the source feature data and the feature data to be verified, perform feature comparison using a comparison algorithm and output the comparison result; The feature detection algorithm includes cross-scale feature extraction and dynamic feature weighting strategy. The cross-scale feature extraction simultaneously detects micro and macro features of the image, and the dynamic feature weighting method dynamically adjusts the weight of the feature region according to environmental information.
[0018] The following are explanations of some of the terms: Source feature images are obtained by acquiring images of objects containing features through visual acquisition devices. They serve as the starting data for the entire detection and comparison process. For example, in the leaf vein detection embodiment, a high-definition camera is used to acquire images of the tree surface, and the resulting image containing leaf vein features is the source feature image. In the random inkjet coding detection of product surfaces, the image of the product surface with random inkjet coding acquired by an industrial camera is the source feature image. These images contain the original feature information of the object, and subsequent feature detection algorithms will perform feature extraction and segmentation based on these images. Their quality and completeness directly affect the accuracy of the final detection and comparison results. Source feature images can be compared to the original images accessed by digital image editing and compression applications; they are the data foundation of the entire technical process, and all subsequent processing and analysis revolve around them.
[0019] Source feature data refers to the data obtained after feature detection and segmentation of the source feature image using feature detection algorithms. In leaf vein detection, source feature data includes the direction vector of the veins and the coordinates of branch points; in random inkjet printing detection on product surfaces, source feature data includes the dot matrix coordinates and density matrix of the inkjet print. This data is a digital description of the object features in the source feature image, representing the essence of the information after in-depth processing by feature detection algorithms. Source feature data is stored on media such as hard drives, solid-state drives, or cloud storage servers for subsequent rapid matching and retrieval based on the identification information of the object to be verified. Its storage and management method is similar to the processing of source image set feature data in some model functional domain adaptation methods. Effective storage and management ensure that it can be quickly and accurately retrieved when needed, providing a reliable reference for feature detection and feature comparison.
[0020] Verification feature data refers to the data obtained after inputting the image to be verified into the feature detection algorithm corresponding to the source feature data. For example, when verifying whether a leaf is the same as a source leaf, the same high-definition camera is used to capture an image of the leaf's surface. This image is then input into a pre-defined leaf vein feature detection algorithm to obtain verification feature data, including the vein direction vector and branch point coordinates. Similarly, in product verification, a corresponding inkjet coding feature detection algorithm is applied to the surface image of the product to be verified to obtain the dot matrix coordinates and density matrix of the inkjet coding. The acquisition of verification feature data and source feature data based on the same feature detection algorithm ensures consistency in data type and feature dimensions, making subsequent feature comparisons comparable and serving as crucial data for determining whether the object to be verified is identical to the source object.
[0021] Identification information refers to specific information used to uniquely distinguish different objects or different individuals of the same object. Its function is to establish a bridge of association between the object to be verified and the source feature data, ensuring that the corresponding source feature image and source feature data can be accurately located. Identification information comes in various types, and can be specifically divided into the following categories: (a) Physical identification Physical identifiers are tangible marks attached to or associated with an object. Examples include product barcodes and QR codes, which record unique information about an object using specific encoding rules and can be quickly read using optical scanning equipment. Other examples include leaf number tags and product serial number labels; the combination of text, numbers, or symbols on these physical labels constitutes a unique identifier for the object. Physical identifiers are intuitive and easily accessible, and are widely used in industrial production, goods management, and other scenarios.
[0022] (ii) Electronic Identification Electronic tags are digital identification information stored in the built-in electronic devices of objects. For example, radio frequency identification (RFID) tags store a unique electronic code for each object, which can be read non-contactly using an RFID reader. Similarly, smart products with embedded chips store product IDs, production information, etc., which also fall under the category of electronic tags. Electronic tags offer advantages such as large information storage capacity, fast reading speed, and rewritability, making them suitable for scenarios requiring efficient batch identification.
[0023] (iii) Feature-derived identifiers Feature-derived identifiers are unique identifiers generated based on the inherent characteristics of an object. For objects lacking physical or electronic identifiers, identifier information can be generated by extracting and encoding their core features. For example, the unique veins of a leaf can be encoded to generate a unique character sequence as an identifier; a hash value obtained by hashing a special pattern on a product surface can serve as an identifier. Feature-derived identifiers do not require an additional identifier carrier and are suitable for natural objects or scenarios where adding physical identifiers is inconvenient.
[0024] Taking leaf vein feature detection and comparison as an example, a high-definition camera is used to acquire images of the leaf surface, obtaining images containing leaf vein features. Since leaf veins are naturally and randomly generated physical characteristics, their distribution has no fixed area. Therefore, a feature detection algorithm is formulated based on the continuity and branching characteristics of leaf veins.
[0025] This feature detection algorithm is trained based on the multi-dimensional physical characteristics of tree leaf growth (such as vein density, vein thickness, and convexity / concavity). It simultaneously detects microscopic features (such as pixel grayscale changes in a single vein) and macroscopic features (such as the overall vein distribution) through a cross-scale feature extraction engine. A dynamic feature weight allocation module acquires environmental information in real time. When the ambient light intensity is below 50 lux (a preset threshold), the weight of dark areas in the image is reduced by 30%. When the image blur (calculated through edge sharpness) is above 0.6 (a preset threshold), the weight of blurred areas is reduced by 40%. The algorithm performs feature detection and segmentation on the acquired images to obtain source feature data of leaf veins (including vein direction vectors, branch point coordinates, etc.), which is then stored on a solid-state drive. Thus, the detection algorithm, trained on multi-dimensional physical material properties, can accurately capture the essential features of leaf veins. Cross-scale extraction ensures no microscopic details or macroscopic distribution are missed, and dynamic weight allocation effectively reduces the impact of environmental interference on feature detection, improving the accuracy of the source feature data.
[0026] For product surface images with random inkjet printing, an industrial camera can be used for acquisition. Since the inkjet printing consists of an irregularly distributed dot matrix, a feature detection algorithm can be developed based on the dot matrix size and distribution density characteristics. This algorithm is trained based on the physical properties of the inkjet printing ink (such as reflectivity) and includes a cross-scale feature extraction engine (detecting microscopic individual pixels and macroscopic dot matrix distribution) and a dynamic feature weight allocation module (reducing the weight of dark areas by 25% when the ambient light intensity is below 80 lux). After detection and segmentation, the source feature data of the inkjet printing (dot matrix coordinates, density matrix, etc.) is obtained and stored in a cloud storage server.
[0027] Specifically, the cross-scale feature extraction in this embodiment is based on hierarchical image processing. After acquiring the initial input image (such as a leaf vein image or a product coding image), preprocessing is performed first. The main task of this step is to standardize the image, including adjusting the image size to a preset uniform size (e.g., 224×224 pixels) to ensure consistency in subsequent processing; at the same time, grayscale conversion or color space conversion (e.g., from RGB to HSV) is performed to reduce the interference of color channels on feature extraction and highlight the core features of the object, such as texture and coding. For images with obvious noise, preliminary noise reduction processing is also performed, such as using Gaussian filtering to remove high-frequency noise, laying a good foundation for subsequent multi-scale sampling.
[0028] After preprocessing, the multi-scale sampling stage begins. The engine selects various sampling kernels of different sizes based on the type of feature to be detected. For example, 4×4 and 8×8 sampling kernels are used for leaf vein detection; for product coding detection, 2×2, 4×4, 8×8, and 16×16 sampling kernels are used. During sampling, the sampling kernel slides across the preprocessed image at a preset step size (usually the same as the kernel size, e.g., a 4×4 kernel has a step size of 4 pixels) to segment the image. Each sampling kernel corresponds to a specific scale of image patch extraction. Small-scale sampling kernels (e.g., 2×2, 4×4) are mainly used to capture microscopic features, such as the grayscale variation of individual pixels in leaf veins and the shape of individual dots in coding; large-scale sampling kernels (e.g., 8×8, 16×16) are used to extract macroscopic features, such as the overall orientation of leaf veins and the overall distribution shape of the coding area. Multi-scale sampling covers different levels of feature information, avoiding the omission of key features.
[0029] After multi-scale sampling, feature embedding is performed on the image patches obtained at each scale. First, each image patch is unfolded into a one-dimensional vector, and then mapped to a feature space of a predetermined dimension through a linear projection layer (i.e., a linear neural network layer) (e.g., projecting the 16-dimensional pixel value vector of a 4×4 image patch onto a 256-dimensional feature vector). This process transforms the original pixel information into more representative feature vectors, highlighting the essential features of the image patches. Independent feature embedding is performed on image patches of different scales to obtain a set of feature vectors for the corresponding scale. For example, embedding a 4×4 image patch yields a set of micro-feature vectors, and embedding an 8×8 image patch yields a set of macro-feature vectors.
[0030] After feature embedding is complete, the feature fusion stage begins. Feature vector sets at different scales are connected and fused according to their spatial correspondence to form a comprehensive feature vector containing multi-scale information. Specifically, feature vectors of image patches at different scales corresponding to the same spatial location in the image are concatenated into a longer feature vector. For example, concatenating the 4×4 image patch feature vector (256 dimensions) and the 8×8 image patch feature vector (256 dimensions) at a certain location results in a 512-dimensional comprehensive feature vector. Through this fusion method, each comprehensive feature vector simultaneously contains both microscopic and macroscopic feature information of that location, achieving effective integration of cross-scale features. The fused feature vector set constitutes the cross-scale feature representation of the image, comprehensively reflecting the feature distribution of the image.
[0031] Finally, the fused cross-scale feature representations are output as the basis for subsequent feature detection, segmentation, and comparison. These feature data contain both microscopic details and macroscopic distribution information of the image, providing comprehensive and accurate feature basis for subsequent processing and ensuring the reliability of feature detection and comparison results.
[0032] While acquiring feature images (such as images containing leaf vein features), environmental information is simultaneously collected, mainly including ambient light intensity, image blur, and noise density. Ambient light intensity is acquired through the image sensor's built-in light sensor or an external ambient light detector, measured in lux. Image blur is evaluated by calculating the edge gradient change value of the image; the smoother the gradient change, the higher the blur (value range 0-1). Noise density is determined by statistically analyzing the proportion of noise points in the image (value range 0-1). The collected environmental information is transmitted to the processing module in real time as a basis for weight adjustment.
[0033] Based on the feature distribution output by the cross-scale feature extraction engine, the image is divided into multiple feature regions. The division method uses a grid system corresponding to the sampling kernel; for example, a 224×224 image is divided into 28×28 feature regions using an 8×8 grid. Each region corresponds to a local area in the image, facilitating precise localization of interference regions. Each feature region undergoes independent weight evaluation and adjustment to ensure fine-grained weight allocation.
[0034] Based on the collected environmental information and preset thresholds, interference assessment is performed on each feature region to identify areas affected by environmental interference. Specifically: when the ambient light intensity is lower than a preset threshold (e.g., 50 lux), the average brightness value of each feature region is calculated, and regions with brightness values lower than the brightness threshold (e.g., 30) are identified as dark interference regions; when the image blurriness is higher than a preset threshold (e.g., 0.6), the edge sharpness of each feature region is calculated using an edge detection algorithm, and regions with sharpness lower than the sharpness threshold (e.g., 0.3) are identified as blurry interference regions; when the noise density is higher than a preset threshold (e.g., 0.2), noise detection algorithms (e.g., threshold-based noise point identification) are used to mark regions with concentrated noise points, and regions with a noise point ratio higher than the noise threshold (e.g., 0.15) are identified as noise interference regions. Through multi-dimensional interference assessment, various types of interfered feature regions can be accurately identified.
[0035] In this embodiment, a convolutional neural network (CNN) model can be constructed using existing technology for interference assessment. The model input is the image region to be evaluated, and the output is the interference type (such as noise, blur, uneven illumination, etc.) and interference intensity value. During the training phase, a large number of image samples with different types and intensities of interference are collected and labeled. The model parameters are continuously optimized through the backpropagation algorithm to enable it to accurately identify and quantify interference. For example, the model's convolutional layers can capture local features of the image, pooling layers are used to reduce the resolution of the feature map, and fully connected layers map the features to the output space of interference category and intensity. Through training on a large-scale dataset, the model can learn the feature representations of different interference patterns, thereby accurately assessing the interference situation of the input image.
[0036] The sampling kernel size can be adjusted based on the interference assessment results. When the detected interference intensity is low and uniformly distributed, a larger sampling kernel is used to improve processing efficiency and capture macroscopic features; when the interference intensity is high and concentrated in a local area, a smaller sampling kernel is switched to enhance the extraction of detailed features and resistance to local interference. For example, if the noise intensity output by the interference assessment model exceeds a certain threshold, and the noise area is concentrated in a certain sub-region of the image, the sampling kernel size in that sub-region is adjusted from the original 5×5 to 3×3; if the interference from uneven illumination is weak and widely distributed, the sampling kernel can be increased from 3×3 to 7×7.
[0037] For different types of interference regions identified, weights are adjusted according to a preset weight adjustment strategy. For dark interference regions, the weight is reduced by 20%-50% based on the difference between the brightness value and the threshold. For example, a region with a brightness value of 20 (below the threshold of 30) has its weight reduced by 30%. For blurry interference regions, the weight is reduced by 30%-60% based on the difference between the sharpness and the threshold. For example, a region with a sharpness of 0.2 (below the threshold of 0.3) has its weight reduced by 40%. For noisy interference regions, a method similar to an adaptive fine-grained channel attention mechanism is used. After extracting region features through global average pooling and capturing feature relationships through one-dimensional convolution, the weight is reduced by 40%-70%. For example, a region with a noise point ratio of 0.2 (above the threshold of 0.15) has its weight reduced by 50%. The weights of non-interference regions remain unchanged at the initial value of 1.0 to ensure that the weights of effective feature regions are not affected.
[0038] The adjusted weight values are applied to the feature data of the corresponding feature regions. During feature detection and subsequent feature comparison, the feature data of each feature region is multiplied by its corresponding weight value. The feature data of the interference regions have a reduced impact on the overall result due to the reduced weight, while the feature data of the effective feature regions play a full role because the weight is maintained. Through dynamic allocation of weights, effective features can be highlighted and interference features can be suppressed, improving the quality and reliability of feature data and providing a more accurate basis for subsequent feature comparison.
[0039] After matching the corresponding source feature data based on the identification information of the object to be verified, the feature detection algorithm associated with that source feature data is automatically invoked. The feature detection algorithm is pre-stored in the algorithm library and has a unique mapping relationship with the source feature data through the identification information. For example, when matching the source feature data of leaf veins, a cross-scale feature detection algorithm trained based on the material properties of leaf veins is invoked; when matching the source feature data of product inkjet printing, a dedicated detection algorithm for inkjet printing dot matrix is invoked. During the algorithm invocation process, the pre-trained model parameters (such as the weight matrix of the neural network, the threshold parameters of the traditional CV algorithm) and configuration files (such as feature extraction thresholds, scale parameters) of the algorithm can be automatically loaded to ensure that the algorithm running environment is consistent with the source feature data acquisition.
[0040] After the feature detection algorithm is started, the preprocessed image to be verified can first be subjected to feature detection through the cross-scale feature extraction engine. The cross-scale feature extraction engine runs the micro and macro feature detection processes simultaneously: micro feature detection adopts the sliding window technique, which can scan the image with a window unit of 2×2 pixels and identify subtle features (such as pixel-level gray-level changes in leaf veins and edge contours of inkjet coding) through pixel gray-level gradient analysis; macro feature detection extracts global features of the image with a window of 16×16 pixels (such as the overall direction of leaf veins and the distribution range of inkjet coding areas). The dynamic feature weight allocation module can monitor the environmental interference information of the image in real time. If a local area is detected to be blurry (blurrity > 0.5) or insufficiently lit (brightness value < 40), the feature detection weight of that area is automatically reduced (e.g., the weight of the blurry area is reduced by 40%), and the feature information of the clear area is retained first. Simultaneously with feature detection, the algorithm performs feature segmentation on the image, separating feature regions from background regions using existing semantic segmentation networks (such as U-Net) or traditional threshold segmentation algorithms. During segmentation, a segmentation threshold is set based on the feature contour information in the source feature data. For example, when segmenting leaf veins, regions with a gradient change rate > 0.3 are identified as feature regions, and when segmenting inkjet printing, regions with a grayscale value < 100 are identified as inkjet printing dot matrix regions. The segmented feature regions are marked in binary mask form, where "1" represents a feature region and "0" represents a background region, achieving accurate separation of features from the background.
[0041] After feature segmentation, the algorithm extracts feature parameters from the masked feature regions. Different extraction methods are used for different types of features: for texture features (such as leaf veins), geometric parameters such as branch angles, node spacing, and curvature changes of leaf veins are extracted, as well as texture parameters such as energy and entropy in the gray-level co-occurrence matrix; for man-made features (such as inkjet printing), morphological parameters such as the coordinate position, diameter, and distribution density of the dot matrix are extracted. The extracted parameters need to be standardized, mapping the values to the [0,1] interval to eliminate the influence of dimensional differences on subsequent comparisons. Next, the extracted microscopic feature parameters, macroscopic feature parameters, and spatial coordinate information of the feature regions are integrated into structured feature data to be verified. The data is stored in JSON or binary file format and includes feature type labels, feature vector arrays, feature region masks, and feature confidence scores (e.g., a confidence score of 0.92 for a feature detection in a certain region). The integrated feature data to be verified has a unified data structure and parameter dimensions with the source feature data and can be directly input into subsequent feature comparison algorithms for matching calculations.
[0042] Finally, feature comparison is performed using a comparison algorithm, and the comparison results are output. The comparison algorithm includes: Vectorization Process: The source feature data and the feature data to be verified are vectorized into feature vectors of a unified dimension. Specifically, based on the feature distribution output by the cross-scale feature extraction engine and the effective feature regions after dynamic feature weight allocation, the core feature regions that need to be vectorized are determined. For example, in leaf vein comparison, regions with clear leaf veins and dense branching points are selected; in inkjet coding comparison, regions with uniform dot distribution and no obvious interference are selected. By locating the core feature regions, the interference of irrelevant regions on the vectorization results is reduced, ensuring that the extracted features are representative.
[0043] Next, feature extraction is performed on the core feature region of the localization from multiple angles and within multiple intervals. The feature region can be scanned from four angles: 0°, 45°, 90°, and 135°. At each angle, the region is divided into multiple continuous sub-intervals according to a preset size (e.g., 10×10 pixels). For each sub-interval, feature parameters such as pixel grayscale values, gradient changes, and texture density are extracted, and these parameters are then combined into an initial feature vector. For example, for a 4×4 pixel sub-interval, parameters such as 16 pixel grayscale values and gradient values in four directions can be extracted, forming a 20-dimensional initial feature vector. Through multi-dimensional extraction, comprehensive and detailed feature information can be captured.
[0044] The initial feature vector can be adaptively adjusted using gradient weighting by incorporating interference region information output from the dynamic feature weight allocation module. For interference-affected sub-intervals such as noise regions and dark regions, their weights in the feature vector are reduced according to the degree of interference. For example, in a sub-interval where the noise point percentage is 0.2, the weight of its feature parameter is reduced by 40%; in a sub-interval where the dark region brightness value is 20, the weight is reduced by 30%. After adjustment, the proportion of effective features in the vector increases, the influence of interfering features is suppressed, and the accuracy of the feature vector is improved.
[0045] Finally, to address the feature rotation issue caused by the shooting angle, rotation invariance processing is applied to the feature vectors. By calculating the principal direction of the feature region (such as the main direction of leaf veins or the overall arrangement direction of the inkjet printer), the coordinate system of the feature vector to be verified is rotated to the same principal direction as the source feature vector. For example, if the principal direction of the source feature is 0° and the principal direction of the feature to be verified is 30°, the feature vector to be verified is rotated by -30° for correction. After correction, the feature vectors of the same feature remain consistent under different rotation angles, eliminating the interference of rotation factors on subsequent comparisons.
[0046] Multi-level feature fusion process: Integrating feature vectors from different levels to form a more comprehensive integrated feature vector, improving the robustness of comparison; specifically, the vectorized feature region can be divided into three levels—macro, meso, and micro—according to a spatial pyramid structure. The macro level is block-level, dividing the entire feature region into large 4×4 blocks, each covering a large range of features; the meso level is sub-region-level, further dividing each macro block into 2×2 sub-regions, focusing on local feature patterns; the micro level is pixel-level, using 3×3 pixel blocks as units to capture fine pixel changes. Through hierarchical division, comprehensive coverage of features from the overall picture to the details is achieved.
[0047] Feature vectors are extracted for different levels. At the macro level, the overall distribution features within a block are extracted, such as the consistency of vein direction and the overall shape of the inkjet print, forming a macro feature vector. At the meso level, local features within sub-regions are extracted, such as vein branching patterns and dot density variations in the inkjet print, forming a meso feature vector. At the micro level, grayscale gradients and edge details of pixel blocks are extracted, forming a micro feature vector. The dimension of the feature vector at each level is set according to the level size. For example, a 4×4 block at the macro level can form a 16-dimensional feature vector, each sub-region at the meso level forms an 8-dimensional feature vector, and each pixel block at the micro level forms a 9-dimensional feature vector.
[0048] Dynamic weights are assigned to feature vectors at different levels based on their importance in the comparison. Macroscopic features reflect overall consistency and account for 30%-40% of the weight; mesoscopic features reflect local matching degree and account for 30%-40% of the weight; microscopic features determine the accuracy of details and account for 20%-30% of the weight. In practical applications, the weights can be adjusted according to the feature type, such as increasing the weight of microscopic features in leaf vein comparison and increasing the weight of macroscopic features in inkjet coding comparison. By reasonably allocating weights, the role of key level features is highlighted.
[0049] The weighted feature vectors from each level are concatenated and fused to form a comprehensive feature vector. For example, a 16-dimensional macroscopic vector, a 32-dimensional mesoscopic vector (4 sub-regions × 8 dimensions), and a 72-dimensional microscopic vector (8 pixel blocks × 9 dimensions) are weighted and concatenated to form a 120-dimensional comprehensive feature vector. The fused feature vector simultaneously contains macroscopic distribution, mesoscopic pattern, and microscopic detail information, comprehensively reflecting the essential attributes of the features and providing a high-quality feature representation for subsequent anti-interference matching.
[0050] The final step of the comparison algorithm is to achieve accurate matching between the source feature data and the feature data to be verified by compensating for positional offsets and optimizing similarity calculations. Specifically, based on the comprehensive feature vector obtained from multi-level feature fusion, key feature points (such as branch points of leaf veins or the center of a dot matrix in a coding scheme) are extracted. A positional jitter compensation mechanism is used to search and match the key feature points of the feature to be verified. Within ±6 pixels above, below, in front, behind, to the left, and to the right of the key feature points in the source feature, a sliding search is performed in 2-pixel increments to find the most similar feature points in the feature to be verified. By aligning the key feature points, feature misalignment caused by slight shifts in shooting position is compensated for, improving the accuracy of matching.
[0051] The aligned source features and features to be verified are divided into levels according to multi-level feature fusion, and the similarity of each level and each region is calculated separately. At the macro level, the cosine similarity of block feature distributions is calculated; at the meso level, the Euclidean distance similarity of sub-region feature patterns is calculated; and at the micro level, the Pearson correlation coefficient of pixel block detail features is calculated. The similarity value for each region ranges from 0 to 1, with values closer to 1 indicating higher similarity. Through multi-region calculations, the degree of feature matching is comprehensively evaluated.
[0052] By combining dynamic feature weight allocation and interference region information in vectorization processing, the similarity scores of each region are compensated and adjusted. For regions affected by blurring or noise, the weight of their similarity scores is reduced. For example, the similarity score weight of a region with a blurriness of 0.7 is reduced by 50%, and the weight of a region with a noise density of 0.3 is reduced by 60%. Simultaneously, for regions with large feature point alignment errors, the weight is appropriately reduced to minimize the impact of residual positional offsets. Through interference compensation, the reliability of similarity assessment is improved.
[0053] A median decision mechanism is employed to statistically analyze the adjusted similarity scores for each region, taking the median value of all region similarities as the final similarity score. If the score is higher than a preset threshold (e.g., 90% for leaf vein comparison, 85% for inkjet printing comparison), the source feature is considered to match the feature to be verified, and a "match" result is output; otherwise, an "inconsistent" result is output. Median decision-making avoids the influence of extreme values on the final result, ensuring the stability and accuracy of the decision.
[0054] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.
Claims
1. A method for automatic detection and comparison of feature images, characterized in that, include: S1. Obtain an object image containing object features, and use a feature detection algorithm based on the characteristics of the object features to perform feature detection and segmentation on the object image to obtain source feature data and store it; S2. Obtain the image to be verified containing the object to be verified, and match the corresponding source feature image and the source feature data according to the identification information of the object to be verified. S3. Input the image to be verified into the feature detection algorithm corresponding to the source feature data to obtain the feature data to be verified; S4. Based on the source feature data and the feature data to be verified, feature comparison is performed by comparison algorithm: the two types of feature data are vectorized and fused according to the spatial pyramid level to form a comprehensive feature vector. After position offset compensation and interference region similarity weight adjustment, the median decision mechanism is used to output the final comparison result. Step S4 includes: Based on the feature regions after dynamic feature weight allocation, the core feature regions that need to be vectorized are determined. Multi-angle, multi-range feature extraction is performed on the core feature regions of the localization. Based on the situation of the interference region, the initial feature vector is adaptively adjusted using gradient weighting. The eigenvectors are subjected to rotation invariance processing; The vectorized feature regions are divided into three levels: macroscopic, mesoscopic, and microscopic, according to the spatial pyramid structure. Extract the corresponding layer feature vectors for each layer; Dynamic weights are assigned to feature vectors at different levels based on the importance of features at each level in the comparison. The weighted feature vectors from each level are concatenated and merged to form a comprehensive feature vector. Key feature points of the comprehensive feature vector are extracted, and a position jitter compensation mechanism is used to search and match the key feature points of the feature to be verified. The aligned source features and features to be verified are divided into levels according to the multi-level feature fusion hierarchy, and the similarity of each level and each region is calculated separately. Based on the situation of the interference areas, the similarity scores of each area are compensated and adjusted; The median decision mechanism is adopted to perform statistical analysis on the adjusted similarity scores of each region, and the median value of the similarity of all regions is taken as the final similarity score. The feature detection algorithm includes cross-scale feature extraction and dynamic feature weighting strategy. The cross-scale feature extraction simultaneously detects micro and macro features of the image, and the dynamic feature weighting method dynamically adjusts the weight of the feature region according to environmental information. The dynamic feature weighting strategy includes: While acquiring the image of the object, environmental information is simultaneously collected; the environmental information includes ambient light intensity, image blur, and noise density. Based on the feature distribution extracted across scales, the image is divided into multiple feature regions; Based on the environmental information and the corresponding preset threshold, interference assessment is performed on each feature region to identify the interference region affected by environmental interference. The interference region is weighted according to a preset weighting strategy, and the adjusted weight values are applied to the feature data of the corresponding feature region.
2. The automatic feature image detection and comparison method according to claim 1, characterized in that, The process of cross-scale feature extraction includes: Preprocess the input image, including standardizing the image size and color. Select sampling kernels of various sizes from the sampling kernel specification pool, and perform sliding block sampling on the input image according to a preset step size; Each sampling kernel corresponds to an image patch extraction at a certain scale. Small-scale sampling kernels are used to capture the microscopic features, while large-scale sampling kernels are used to extract the macroscopic features.
3. The automatic feature image detection and comparison method according to claim 1, characterized in that, After performing an interference assessment on each feature region, the sampling kernel size is adjusted once based on the results of the interference assessment. When the detected interference intensity is low and the distribution is uniform, the overall size of the sampling kernel specification pool is increased to improve processing efficiency and capture macroscopic features; When the interference intensity is high and concentrated in a local area, reduce the overall size of the sampling kernel size pool to enhance the extraction of detailed features and the resistance to local interference.
Citation Information
Patent Citations
Intelligent identification and analysis method for anti-counterfeiting mark
CN119850230A
Adaptive sensing-based lightweight monitoring method for fine crack in complex background region
WO2025161130A1