A lightweight QR code anti-counterfeiting verification method based on surrounding visual features

CN122675451APending Publication Date: 2026-09-01CHINA WUZHOU ENG GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610797301.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-04
Publication Date
2026-09-01

AI Technical Summary

Technical Problem

[0011]本发明的目的在于提供一种基于周边视觉特征的轻量化二维码防伪校验方法,以解决现有技术中普通二维码被复制、重新打印、转贴或替换后,仅依赖二维码编码内容校验或服务器查询难以识别二维码是否仍处于原登记载体、原登记位置或预设使用场景的问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122675451A_ABST
    Figure CN122675451A_ABST
Patent Text Reader

Abstract

This invention relates to the field of QR code anti-counterfeiting verification technology, and discloses a lightweight QR code anti-counterfeiting verification method based on surrounding visual features. In the QR code registration stage, the method acquires images of the QR code and its surrounding preset area, parses the QR code encoding content, extracts surrounding visual features and the relative positional relationship between the QR code and surrounding visual elements, and generates baseline verification information. In the scanning verification stage, QR code decoding and surrounding image acquisition are performed simultaneously, extracting on-site visual features and on-site positional relationships, and comparing them with the baseline verification information. A risk score is generated based on the QR code encoding verification result, and the anti-counterfeiting verification result is output according to the risk score. This invention utilizes surrounding visual elements and spatial positional relationships in ordinary scanned images to achieve anti-counterfeiting verification, improving the ability to identify QR code copying, re-pasting, shifting, and replacement anomalies. It is suitable for lightweight deployment at the edge in weak network or offline environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of QR code anti-counterfeiting verification technology, and in particular to a lightweight QR code anti-counterfeiting verification method, system, electronic device, and computer-readable storage medium based on peripheral visual features. Background Technology

[0002] QR codes are a type of automatic identification identifier that uses a two-dimensional matrix graphic to carry information. They typically represent coded data using black and white or varying shades of graphic units and are widely used in product identification, batch management, warehousing and outbound processes, equipment inspection, anti-counterfeiting verification, and information traceability. A standard QR code can carry information such as product number, batch number, process number, query link, or encrypted data. Scanning devices can obtain the corresponding coded content by reading the QR code graphic. Due to their low generation cost, fast reading speed, flexible deployment, and high compatibility, QR codes have been widely used in industrial manufacturing, logistics and warehousing, commodity circulation, equipment management, and digital traceability.

[0003] Existing QR code anti-counterfeiting technologies typically employ methods such as QR code encoding verification, server query, digital signature verification, or backend database verification to achieve anti-counterfeiting identification. Specifically, a unique product number, serial number, encrypted information, or query address can be written into the QR code. After a user scans the code, the terminal or server determines whether the QR code number exists, whether the signature is valid, and whether the query record is abnormal, thereby completing the authenticity verification. This type of solution has the advantages of simple deployment, wide applicability, and ease of promotion.

[0004] To further enhance the anti-counterfeiting capabilities of QR codes, some existing technologies employ anti-counterfeiting textures, subtle features, random patterns, microscopic printing structures, or hidden security features as auxiliary anti-counterfeiting methods. For example, random texture areas, subtle anti-counterfeiting parts, special printing dots, or hidden security patterns are added near the QR code, and image comparison and artificial intelligence recognition are performed via mobile terminals or servers to increase the difficulty of recognizing copied QR codes. In addition, some solutions use secondary printing, anti-copying QR code structures, or embedding anti-counterfeiting features into the QR code image to improve the QR code's inherent uncopyability.

[0005] However, existing technologies still have the following shortcomings: First, existing anti-counterfeiting solutions based on QR code encoding content or server queries primarily verify the QR code encoding itself. When a QR code image is photographed, copied, reprinted, or the original QR code label is transferred to other carriers, as long as the QR code encoding content remains valid, ordinary scanning and backend queries may still return normal results. Therefore, it is difficult to identify whether the QR code has been removed from its original registration carrier, original location, or intended use scenario.

[0006] Secondly, existing solutions based on anti-counterfeiting textures, microscopic features, or hidden security features typically require specialized anti-counterfeiting materials, special printing processes, high-quality image acquisition equipment, or complex image comparison on the server side. They are highly dependent on hardware conditions, production processes, and deployment costs, making them unsuitable for lightweight deployment on ordinary QR code labels, existing packaging carriers, or industrial scanning equipment.

[0007] Furthermore, some anti-copying QR code solutions require special design during the QR code generation or printing stage, such as secondary printing, embedding hidden information, or designing special anti-counterfeiting structures. These solutions have poor compatibility with existing QR code systems and are difficult to directly adapt to the large number of common QR code application scenarios that have already been deployed.

[0008] Furthermore, most existing image-based anti-counterfeiting solutions focus on the image features of the anti-counterfeiting area itself, while paying insufficient attention to the relative positional relationships between the QR code and surrounding visual elements such as label boundaries, packaging edges, fixed text areas, background patterns, and facility outlines. Therefore, when a QR code is re-attached, moved, or replaced on other carriers, even if the QR code content remains valid, existing technologies often struggle to promptly identify whether the context in which the QR code is located has changed.

[0009] Meanwhile, some solutions rely on server-side image uploading and online comparison. In on-site environments such as production lines, workshops / warehouses, transportation handover, and warehouse inspections, they are easily affected by network bandwidth, network stability, and server response speed, resulting in reduced on-site barcode scanning and verification efficiency, or even failure to complete anti-counterfeiting judgment normally in weak network or network outage environments.

[0010] Therefore, to address the aforementioned problems in existing technologies, it is necessary to propose a lightweight QR code anti-counterfeiting verification method based on peripheral visual features. Without relying on random textures, microscopic anti-counterfeiting materials, complex printing processes, or dedicated security features, this method utilizes the peripheral visual elements of the QR code and their relative positional relationships that can be stably acquired from ordinary scanned images. At the edge, it simultaneously completes QR code encoding verification, peripheral visual feature consistency comparison, positional relationship consistency judgment, and risk scoring, thereby improving the anti-counterfeiting recognition capability of ordinary QR codes in scenarios such as copying, reposting, shifting, and replacement. Summary of the Invention

[0011] The purpose of this invention is to provide a lightweight QR code anti-counterfeiting verification method based on surrounding visual features, so as to solve the problem in the prior art that after ordinary QR codes are copied, reprinted, reposted or replaced, it is difficult to identify whether the QR code is still in the original registration carrier, original registration location or preset use scenario by relying solely on QR code encoding content verification or server query.

[0012] To achieve the above objectives, the present invention adopts the following technical solution: In one possible implementation, a lightweight QR code anti-counterfeiting verification method based on surrounding visual features is provided, including: During the QR code registration phase, images of the QR code and its surrounding preset area are collected, the QR code encoding content is parsed, surrounding visual features and the relative positional relationship between the QR code and surrounding visual elements are extracted, and benchmark verification information is generated. During the QR code verification phase, QR code decoding and surrounding image acquisition are performed simultaneously to extract on-site visual features and on-site location relationships. The on-site visual features and on-site location relationships are compared with the benchmark verification information for consistency, and a risk score is generated by combining the QR code encoding verification results. The anti-counterfeiting verification result is output based on the risk score.

[0013] In one possible implementation, the surrounding preset area is an area extended outward from the QR code area, or it is the area above, below, to the left, to the right of the QR code, the entire label area, or a local area including the packaging edge, fixed text, and facility outline, selected according to business rules.

[0014] In one possible implementation, before extracting the surrounding visual features and the on-site visual features, the image is located using a QR code, the corner points of the QR code are obtained, and a local coordinate system for the QR code is established based on the corner points, the center of the QR code, or the side length of the QR code. Perspective correction, scale normalization, and region cropping are then performed on the QR code and its surrounding preset area.

[0015] In one possible implementation, the peripheral visual features include one or more of the following: label boundary features, packaging edge features, fixed text area features, background pattern features, graphic logo features, facility outline features, printing edge features, frame line features, or structural line features.

[0016] In one possible implementation, the peripheral visual features and the scene visual features are represented by one or more of the following: edge contours, line segments, corner points, keypoint descriptors, HOG features, template matching features, feature hashes, quantization vectors, or lightweight neural network image embedding vectors.

[0017] In one possible implementation, the relative positional relationship includes one or more of the following: the distance from the center of the QR code to the label boundary, the angle between the edge of the QR code and the edge of the packaging, the relative orientation between the QR code and the fixed text area, the distance ratio between the QR code and the facility outline or graphic symbol, the normalized coordinates of the QR code in the label or packaging layout, and the relative position between the QR code and the frame line or printing edge.

[0018] In one possible implementation, the benchmark verification information includes one or more of the following: QR code encoded content summary, benchmark surrounding visual feature descriptor, benchmark position relationship vector, similarity threshold, position deviation threshold, registered image quality parameters, registered device number, and registration time.

[0019] In one possible implementation, the risk score is generated based on the QR code encoding verification result, the similarity of surrounding visual features, the consistency of positional relationships, and the image quality score. The similarity of surrounding visual features is calculated by the number of key point matches, the distance between feature descriptors, the template matching score, or the cosine similarity of the image embedding vector. The consistency of positional relationships is calculated by normalized distance error, angle error, scale error, or orientation deviation.

[0020] In one possible implementation, if the QR code encoding verification fails, a failure result is output; if the QR code encoding verification passes but the similarity of surrounding visual features or the consistency of positional relationships is below the threshold, a suspected abnormality or failure result is output; if the QR code encoding verification passes, the similarity of surrounding visual features meets the standard, and the positional relationship is consistent, a pass result is output; if the image quality is insufficient to complete a reliable judgment, a result requiring verification is output.

[0021] In one possible implementation, in a weak network or network outage environment, the edge device performs local anti-counterfeiting verification based on the locally cached QR code encoded content summary, the reference surrounding visual feature descriptor, the reference location relationship vector, and the threshold parameters, and uploads the abnormal verification record, review request, or evidence image after the network is restored.

[0022] In one possible implementation, a lightweight QR code anti-counterfeiting verification system based on surrounding visual features is also provided, comprising: a baseline registration module, used to acquire images of the QR code and its surrounding preset area during the QR code registration stage, parse the QR code encoding content, extract surrounding visual features and the relative positional relationship between the QR code and surrounding visual elements, and generate baseline verification information; a QR code positioning and normalization module, used to locate the QR code in the image, obtain the QR code corner points, establish a local coordinate system for the QR code, and perform perspective correction, scale normalization, and region cropping on the QR code and its surrounding preset area; a surrounding visual feature extraction module, used to extract on-site visual features; a positional relationship calculation module, used to calculate the on-site positional relationship between the QR code and surrounding visual elements; an edge comparison module, used to compare the on-site visual features and on-site positional relationship with the baseline verification information for consistency, and generate a risk score in combination with the QR code encoding verification result; and a result output and review module, used to output the anti-counterfeiting verification result according to the risk score, and trigger server review or manual review when the review conditions are met.

[0023] In one possible implementation, an electronic device is also provided, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the lightweight QR code anti-counterfeiting verification method based on peripheral visual features as described in any of the above embodiments.

[0024] In one possible implementation, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the lightweight QR code anti-counterfeiting verification method based on peripheral visual features as described in any of the above embodiments.

[0025] Compared with the prior art, the present invention has at least the following beneficial effects: This invention does not rely on random textures, microscopic anti-counterfeiting materials, complex printing processes, or special anti-counterfeiting labels. Instead, it uses the visual elements around the QR code and their relative positional relationships that can be stably collected in ordinary scanned images for consistency verification. Therefore, it can achieve a lightweight anti-counterfeiting upgrade for ordinary QR code application scenarios without significantly modifying the existing QR code creation, printing, pasting, and scanning processes.

[0026] This invention not only verifies the encoded content of the QR code, but also combines the surrounding visual features and positional relationships of the QR code for joint judgment. Even if the QR code is copied, reprinted, reposted, moved or replaced, it can still be decoded normally. As long as its surrounding visual environment or positional relationship changes, the system can identify the anomaly, thereby improving the anti-counterfeiting recognition capability of QR codes in field applications.

[0027] This invention reduces reliance on real-time online comparison with servers by completing QR code decoding, image cropping, visual feature extraction, positional relationship calculation, and risk scoring at the edge, thereby improving on-site QR code scanning and verification efficiency. It is suitable for weak or offline network environments such as production lines, workshops / warehouses, transportation handover, and inspections.

[0028] Furthermore, the present invention employs a joint judgment mechanism that combines QR code encoding verification, consistency of surrounding visual features, consistency of positional relationships, and image quality scoring. This helps to improve the accuracy and robustness of anti-counterfeiting verification results and can also meet the needs of rapid on-site verification, anomaly tracking, and subsequent review. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as a limitation on the scope of protection. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.

[0030] Figure 1 Overall flowchart of the lightweight QR code peripheral visual feature consistency anti-counterfeiting verification method provided in the embodiments of the present invention; Figure 2 A schematic diagram of the system module structure provided for an embodiment of the present invention; Figure 3 A flowchart for generating QR code registration and filing and benchmark verification information is provided for embodiments of the present invention; Figure 4 A schematic diagram of peripheral visual feature extraction and region division provided for an embodiment of the present invention; Figure 5 A schematic diagram illustrating the verification of the relative positional relationship between the QR code and surrounding elements provided for an embodiment of the present invention; Figure 6 A flowchart for edge-end joint risk scoring and classification determination provided for embodiments of the present invention. Detailed Implementation

[0031] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.

[0032] This invention provides a lightweight QR code anti-counterfeiting verification method based on surrounding visual features. By establishing the associated benchmark information of QR code encoding content, surrounding stable visual features, and the relative positional relationship between QR code and surrounding elements during the QR code registration stage, the edge device simultaneously completes QR code decoding, surrounding image acquisition, visual feature extraction, positional relationship verification, and risk scoring during the scanning verification stage, thereby achieving rapid on-site identification of abnormal situations such as QR code copying, reposting, displacement, or replacement.

[0033] I. System Overall Structure The following is combined with Figures 1 to 6 This paper provides a detailed description of the lightweight QR code anti-counterfeiting verification method based on peripheral visual features in the embodiments of the present invention.

[0034] like Figure 1 As shown, the present invention provides a lightweight QR code anti-counterfeiting verification method based on surrounding visual features. The method includes QR code registration and filing, QR code positioning and region normalization, surrounding visual feature extraction, positional relationship calculation, benchmark verification information generation, synchronous collection and on-site feature extraction during the scanning stage, edge consistency comparison and risk scoring, and result output and verification.

[0035] The core idea of ​​this invention is to establish a pre-established association between the QR code encoding content and the stable visual elements surrounding the QR code during the QR code registration stage, and to perform consistency verification by using the surrounding visual features and their positional relationships in the on-site acquired images during the QR code verification stage, thereby enabling the identification of abnormal situations such as QR code copying, reposting, shifting or replacement.

[0036] Unlike existing technologies that rely solely on the QR code's encoded content or server query results for anti-counterfeiting verification, this invention not only verifies the QR code's encoded content but also combines the surrounding visual environment and the relative positional relationship between the QR code and surrounding elements for joint judgment. Therefore, even if the QR code itself is copied, it can still be decoded normally. As long as the scene, carrier environment, or relative position of the QR code changes, this invention can still identify abnormal situations.

[0037] like Figure 2 As shown, the anti-counterfeiting verification system in this embodiment of the invention may include a benchmark registration module, a QR code positioning and normalization module, a surrounding visual feature extraction module, a positional relationship calculation module, an edge comparison module, and a result output and verification module.

[0038] The benchmark registration module is used to collect images of the QR code and its surrounding preset area during the QR code generation, printing, pasting, storage, or initial use stages, and to parse the QR code encoding content to establish corresponding benchmark verification information.

[0039] The QR code positioning and normalization module is used to locate the QR code area in the registration image or on-site scanning image, obtain the QR code corner points, establish a local coordinate system based on the QR code, and perform perspective correction, scale normalization and region cropping on the QR code and its surrounding area to reduce the impact of shooting angle, distance, rotation and perspective changes on subsequent comparison results.

[0040] The peripheral visual feature extraction module is used to extract stable visual features from a preset area surrounding the QR code. These stable visual features do not rely on random textures, paper fibers, or microscopic anti-counterfeiting structures, but rather on visible visual elements that can be stably captured using a regular camera, such as label boundaries, packaging edges, fixed text areas, background patterns, facility outlines, frame lines, structural lines, or printing edges.

[0041] The positional relationship calculation module is used to calculate the relative positional relationship between the QR code and surrounding visual elements, including the distance relationship between the QR code and the label boundary, the angular relationship between the QR code and the packaging edge, the relative orientation relationship between the QR code and the fixed text area, and the normalized positional relationship of the QR code in the layout, and generate the corresponding positional relationship vector.

[0042] The edge comparison module is used to simultaneously perform QR code decoding, on-site surrounding image acquisition, visual feature extraction, positional relationship calculation, and consistency comparison during the QR code verification stage. It also combines the QR code encoding verification results, visual feature similarity, positional relationship consistency, and image quality score to generate a risk score.

[0043] The result output and verification module is used to output the corresponding anti-counterfeiting verification results based on the risk score. For example, when the QR code encoding content, visual features, and positional relationship all meet the consistency requirements, a verification pass result is output; when the QR code encoding content is valid but there are deviations in visual features or positional relationships, a suspected abnormality or failure result is output; when the image quality is insufficient to make a reliable judgment, a verification result is output, which can further trigger server verification or manual verification processes.

[0044] In this embodiment of the invention, the above modules can be centrally deployed on the server side, or deployed in industrial barcode scanning terminals, edge computing boxes, mobile inspection terminals, fixed industrial vision devices, or embedded devices. To reduce the system's dependence on real-time network connections and improve on-site barcode scanning response speed, this invention preferably deploys core processing procedures such as QR code positioning, visual feature extraction, positional relationship calculation, consistency comparison, and risk scoring at the edge.

[0045] Furthermore, the present invention preferably employs a lightweight processing method. During operation at the edge, the system does not need to store complete high-definition images for extended periods. Instead, it preferably stores lightweight data such as QR code encoding summaries, low-dimensional visual feature descriptors, positional relationship vectors, and threshold parameters. This reduces storage pressure at the edge and improves on-site verification capabilities in weak or offline network environments.

[0046] Therefore, this invention can achieve a lightweight anti-counterfeiting upgrade in ordinary QR code scenarios without relying on special anti-counterfeiting materials, complex printing processes, or real-time online image comparison by servers, thereby improving the anti-counterfeiting recognition capabilities of QR codes in application scenarios such as industrial sites, logistics warehousing, transportation handover, and inspection.

[0047] II. Implementation Method of QR Code Registration and Filing like Figure 3 As shown, the QR code registration and filing process in this embodiment of the invention is used to establish benchmark verification information for the QR code encoding content, stable visual features around the QR code, and the positional relationship between the QR code and surrounding visual elements, providing a comparison basis for subsequent on-site scanning verification.

[0048] In this embodiment, the QR code registration and filing process can be performed during the QR code generation, printing, affixing, product warehousing, equipment installation, process flow, label acceptance, or initial activation stages. Specifically, industrial scanning terminals, fixed industrial cameras, mobile inspection terminals, edge computing devices, or server-side systems can collect images of the QR code and its surrounding area.

[0049] The system first acquires a registered image I_base containing the complete QR code area and stable visual elements surrounding the QR code. Unlike traditional methods that only acquire the QR code itself, this invention not only acquires the QR code area but also simultaneously acquires the surrounding visual area near the QR code that stably reflects the carrier, installation location, or usage scenario of the QR code.

[0050] In one implementation, the system expands outward from the QR code area to form a surrounding preset area. The expansion range can be configured according to the actual business scenario, for example, expanding to 1.5 to 4 times the side length of the QR code, to ensure that stable visual elements near the QR code can be completely captured.

[0051] In another implementation, the surrounding preset area can be configured according to the actual application scenario. For example, in the packaging label scenario, it is preferable to collect the local area formed by the QR code together with the packaging edge, label border and fixed text area; in the equipment nameplate scenario, it is preferable to collect the local area formed by the QR code together with the nameplate edge, structural outline and fixed marking area; in the warehouse or inspection scenario, it is preferable to collect the local area formed by the QR code together with the facility outline, installation boundary or fixed background area.

[0052] Since this invention mainly utilizes stable visual elements in ordinary barcode images to complete secondary verification, the aforementioned peripheral visual elements do not rely on random textures, paper fibers, ink edge jaggedness, or other microscopic non-replicable features. Instead, they are visible image information that can be stably obtained using ordinary cameras, including label boundaries, packaging edges, fixed text areas, background patterns, graphic symbols, facility outlines, printing edges, frame lines, or structural lines, etc.

[0053] After image acquisition, the system parses the QR code to obtain its encoded content, Q_data. This encoded content may include product number, batch number, process number, query address, device number, encrypted data, digital signature, or business identification information.

[0054] To improve subsequent verification efficiency and reduce storage pressure at the edge, this implementation prefers not to directly and permanently store the complete QR code encoding content. Instead, it performs a digest operation on the QR code encoding content to generate a QR code encoding digest. For example, the following method can be used: Hash(Q_data) in: Q_data represents the encoded content of the QR code; Hash(Q_data) represents a summary of the QR code's encoded content.

[0055] In one implementation, the digest operation can be implemented using MD5, SHA series algorithms, or other hash algorithms.

[0056] After completing the QR code encoding and parsing, the system further extracts visual features and calculates positional relationships in the area surrounding the QR code in the registered image.

[0057] Visual feature extraction is primarily used to obtain visual description information of stable visual elements surrounding the QR code. This visual description information can be represented using edge contours, line segments, corner points, keypoint descriptors, template region features, HOG features, feature hashes, quantization vectors, or low-dimensional image embedding vectors output by lightweight neural networks.

[0058] At the same time, the system further calculates the relative positional relationship between the QR code and surrounding visual elements. For example, the system can calculate: The distance from the center of the QR code to the edge of the label; The angle between the QR code and the edge of the packaging; The relative orientation between the QR code and the fixed text area; The normalized position of the QR code in the label layout; The positional ratio between the QR code and the frame lines, structural lines, or graphic symbols.

[0059] Through the above processing, the system can establish a correlation between the QR code encoding content and the surrounding visual environment of the QR code, thereby avoiding the problem of relying solely on the QR code encoding content for authenticity judgment in existing technologies.

[0060] In one implementation, the system further associates the QR code encoding summary, the visual features surrounding the benchmark, the positional relationship vector, and relevant threshold parameters to generate benchmark verification information.

[0061] The benchmark verification information can be represented as: B = {Hash(Q_data), Fv_base, G_base, T, Q_img, DeviceID, Time} in: Fv_base represents the baseline surrounding visual features; G_base represents the reference position relationship vector; T represents the visual feature similarity threshold and the positional deviation threshold; Q_img represents the registered image quality parameters; DeviceID represents the registered device number; Time indicates the registration time.

[0062] In a preferred embodiment, to improve the lightweight deployment capability at the edge, the system preferably saves only the QR code encoding summary, low-dimensional visual feature descriptor, positional relationship vector, and threshold parameters, rather than saving the complete high-definition registration image for a long time.

[0063] Complete registration images can be archived as optional evidence images and only accessed in case of abnormal disputes, manual review, or back-end audit.

[0064] In addition, to prevent the benchmark verification information from being tampered with, this embodiment may further perform digital signature, encrypted storage, or access control processing on the benchmark verification information.

[0065] The generated benchmark verification information can be stored in the server database or synchronously cached to edge devices, so that the system can still complete on-site anti-counterfeiting verification based on local cache in environments with weak network, network outage, or inconvenient real-time access to the server.

[0066] III. Implementation Methods for QR Code Positioning and Region Normalization like Figure 4 As shown, after completing the QR code registration and filing, the embodiments of the present invention further perform QR code positioning and region normalization processing on the registered image or the on-site scanned image to reduce the impact of shooting angle, distance, rotation, perspective changes and local deformation on subsequent visual feature comparison and positional relationship calculation, thereby improving the consistency and stability of on-site anti-counterfeiting verification.

[0067] In this embodiment, whether in the QR code registration stage or the on-site scanning and verification stage, the system first acquires an image containing the QR code and its surrounding area. Subsequently, the QR code positioning and normalization module locates the QR code region in the acquired image to obtain the QR code region ROI and the corner information corresponding to the QR code.

[0068] In one implementation, the QR code positioning process can be based on the positioning pattern of the QR code itself. For example, the position range of the QR code in the image can be determined by detecting positioning corner blocks, edge contours, or matrix structures in the QR code.

[0069] In another implementation, edge detection, contour analysis, morphological processing, or lightweight object detection models can be used to locate the QR code region.

[0070] For example, the image can be first processed by grayscale conversion, binarization and edge enhancement, then the candidate region of the QR code can be determined by contour extraction, and the QR code region can be selected according to the aspect ratio of the QR code, matrix structure or positioning graphic features.

[0071] For complex backgrounds, tilted shooting, or partially occluded scenes, a lightweight object detection network can be combined to further improve the stability of QR code positioning.

[0072] After obtaining the QR code area, the system further obtains the corner information of the QR code.

[0073] In one implementation, the corner points of the QR code include the coordinates of the four vertices of the QR code.

[0074] In another implementation, geometric information such as the center point of the QR code, the side length of the QR code, and the orientation angle of the QR code can be further obtained.

[0075] Subsequently, the system establishes a local coordinate system for the QR code based on the QR code, and performs region normalization processing on the QR code and its surrounding area based on the local coordinate system.

[0076] Specifically, in one implementation, the top left corner of the QR code can be set as the origin of the local coordinate system, and the side length of the QR code can be used as the normalization scale.

[0077] For example: The coordinates of the top-left corner of the QR code are defined as: (0,0) The side length of a QR code is defined as the unit length: L = 1 Therefore, the positions of elements surrounding the QR code can be uniformly mapped to a normalized coordinate system.

[0078] Using the above methods, even if the shooting distance, QR code size, or image resolution are different, the system can still complete the subsequent positional relationship comparison under a uniform scale.

[0079] In another implementation, the center of the QR code can be used as the origin of the local coordinate system, thereby improving the stability of the positional relationship in the scenario of QR code rotation.

[0080] After establishing the local coordinate system of the QR code, the system further performs perspective correction and region cropping on the QR code area and its surrounding preset areas.

[0081] For example, when a QR code becomes trapezoidally distorted due to the tilt of the shooting angle, the system can perform perspective transformation based on the four corner points of the QR code to restore it to a standard rectangular structure.

[0082] For scenes with significant local perspective distortion or where the carrier is curved, the following can be further employed: Affine transformation; Local geometric correction; Correction is achieved through methods such as nonlinear deformation compensation.

[0083] Through the above processing, the images from the registration stage and the on-site QR code scanning images can be compared for visual features and their positional relationships calculated under a unified coordinate system.

[0084] In this embodiment, the area surrounding the QR code is not fixed to the entire image, but rather a limited, pre-defined area is constructed around the QR code's ROI.

[0085] For example, the system can expand outwards by a certain proportion based on the side length of the QR code to obtain the surrounding area.

[0086] In a preferred embodiment, the extension range is 1.5 to 4 times the side length of the QR code.

[0087] In another implementation, the scope of the surrounding area can also be dynamically adjusted according to business rules.

[0088] For example: In a label-based scenario, it is preferable to include label boundaries and fixed text areas; In packaging scenarios, it is preferable to include the packaging edges and layout area; In equipment inspection scenarios, it is preferable to include the equipment outline and installation boundary area.

[0089] Since this invention mainly focuses on normalization and visual analysis of local areas of the QR code, there is no need to perform complex scene recognition or high-precision 3D reconstruction on the entire image.

[0090] Compared with existing complex visual recognition solutions, this invention can effectively reduce the amount of computation at the edge, reduce processing latency, and improve on-site barcode scanning response efficiency.

[0091] In addition, during the on-site scanning stage, the system can further perform illumination compensation, noise suppression, and image enhancement processing.

[0092] For example: Increase image brightness in low-light scenes; Reduce the impact of highlighted areas in overexposed scenes; Perform filtering in noisy environments; Enhance edge information in blurred image scenes.

[0093] The above processing can improve the stability of subsequent visual feature extraction.

[0094] In one implementation, if the system detects that the QR code area is severely occluded, blurry, too dark, overexposed, or has an excessive angle deviation, it generates corresponding image quality parameters and reduces the confidence level of the current image in the subsequent risk scoring stage.

[0095] If necessary, the system can also prompt the user to re-acquire images to improve the accuracy of on-site verification.

[0096] Therefore, through the QR code positioning and region normalization processing in this embodiment, the present invention can maintain the consistent expression of the visual features and positional relationships around the QR code under different shooting distances, different acquisition angles, different device resolutions, and complex on-site environments, providing a unified and reliable data foundation for subsequent visual feature comparison and risk scoring.

[0097] IV. Implementation Methods for Peripheral Visual Feature Extraction After completing the QR code positioning and region normalization processing, the system further extracts features from stable visual elements in the preset area around the QR code to obtain visual description information that reflects the carrier, installation location, and usage scenario of the QR code.

[0098] The visual feature extraction in this embodiment does not rely on random textures, paper fibers, ink serrations, or other microscopic, non-replicable structures. Instead, it utilizes visible image elements that can be stably captured by a regular camera for lightweight visual analysis. Since QR codes are usually not isolated in practical applications, but appear together in the same captured image with label boundaries, packaging edges, fixed text areas, background patterns, facility outlines, frame lines, or printing areas, the aforementioned surrounding visual elements can stably reflect the appearance of the environment in which the QR code is located.

[0099] For example, in label applications, the distance between the QR code and the label border is usually fixed; in packaging, the relative angle between the QR code and the packaging edge is usually consistent; and in equipment inspection, the positional relationship between the QR code and the equipment nameplate, structural outline, or fixed marking area is usually stable. Therefore, when a QR code is copied, reposted, moved, or replaced on other media, even if the QR code's encoded content can still be read normally, its surrounding visual environment will usually change.

[0100] Based on the above characteristics, this embodiment further extracts surrounding visual features within the local normalized area of ​​the QR code to form visual feature description information that can be used for subsequent consistency comparison.

[0101] In practice, the system first performs image preprocessing on the normalized surrounding preset area. The image preprocessing may include grayscale conversion, edge enhancement, noise suppression, brightness compensation, and contrast enhancement.

[0102] For example, in low-light environments, the system can automatically increase image brightness; in high-noise scenes, median filtering, Gaussian filtering, or bilateral filtering can be used to reduce noise interference; in scenes with unclear edges, contour edge information can be further enhanced to improve the stability of subsequent visual feature extraction.

[0103] After completing image preprocessing, the system further extracts stable visual features from the area surrounding the QR code.

[0104] In one implementation, the system preferably uses geometric visual features for representation. For example, information such as edge contours, line segments, corner points, and region contours in the area surrounding the QR code can be extracted.

[0105] Among them, edge contours can be used to describe label boundaries, packaging edges, or structural outlines; straight line segments can be used to describe frame lines, structural lines, and regular boundaries; and corner points can be used to describe fixed text areas, graphic logos, or contour transition areas.

[0106] Because the computational load of the aforementioned geometric visual features is relatively low, they are well-suited for deployment in industrial barcode scanning terminals, edge computing devices, and mobile inspection terminals.

[0107] In another implementation, the system may further employ keypoint descriptors for visual feature representation. For example, ORB features, SIFT features, SURF features, HOG features, or template matching features may be used.

[0108] Among them, ORB features have low computational complexity and are suitable for real-time processing at the edge; SIFT and SURF features have good scale invariance and rotation invariance; HOG features are suitable for describing local texture gradient distribution; and template matching features are suitable for regional consistency comparison in fixed-layout scenes.

[0109] In another preferred embodiment, the system may also employ a lightweight neural network model to encode features of the area surrounding the QR code in order to generate a low-dimensional image embedding vector.

[0110] For example, lightweight convolutional neural network models like MobileNet, small image coding networks, or other low-parameter visual feature extraction networks can be used to map the area surrounding the QR code into a low-dimensional feature vector.

[0111] Since the aforementioned low-dimensional feature vectors can express the visual features of the surrounding area with low storage space and low computational cost, they can further improve the deployment capability at the edge.

[0112] To reduce the processing pressure at the edge, this embodiment preferably does not perform complex visual analysis on the entire image, but only performs feature extraction on the area within a limited range around the QR code.

[0113] For example, the system only performs visual analysis on the local area after the QR code is expanded, without processing the large background area unrelated to the QR code.

[0114] Meanwhile, to further reduce storage and computing overhead at the edge, the system can also perform lightweight compression processing on the extracted visual features.

[0115] For example, an upper limit can be set on the number of key points, the feature dimension can be compressed, or visual features can be represented by feature hashing, quantization vectors, or other methods.

[0116] Through the above processing, the system can complete the extraction of visual features around the QR code and consistency comparison under limited computing power.

[0117] In this embodiment, the surrounding visual features extracted during the registration phase can be represented as: Fv_base Where Fv_base represents the baseline surrounding visual features.

[0118] Correspondingly, during the scanning phase, the system extracts on-site visual features from the images captured on-site: Fv_live Here, Fv_live represents the visual features of the surrounding area.

[0119] Subsequent systems can calculate visual feature similarity based on the consistency between Fv_base and Fv_live.

[0120] For example, visual similarity results can be calculated using keypoint matching counts, feature descriptor distances, template matching scores, or cosine similarity of image embedding vectors.

[0121] Since the visual features in this embodiment mainly come from stable scene elements around the QR code, the QR code itself can still be decoded normally even after it is copied. As long as the carrier environment, layout structure or scene layout of the QR code changes, the consistency of visual features will usually deviate, thereby improving the system's ability to identify abnormal situations such as QR code copying, reposting, shifting or replacement.

[0122] Furthermore, the visual feature extraction process in this embodiment does not rely on special anti-counterfeiting materials, complex printing processes, or special anti-counterfeiting textures. Therefore, it can achieve a lightweight anti-counterfeiting upgrade for ordinary QR code application scenarios without changing the existing QR code generation method and label production process.

[0123] V. Implementation Method for Calculating Relative Positional Relationships After extracting the visual features around the QR code, this embodiment further calculates the relative positional relationship between the QR code and the surrounding visual elements to form geometric relationship description information that can reflect the positional state of the QR code and the consistency of the scene.

[0124] like Figure 5 As shown, the positional relationship calculation in the embodiments of the present invention not only focuses on whether the QR code itself can be read normally, but also further uses the spatial relationship between the QR code and surrounding visual elements to determine whether the QR code is still in the original registration position, the original registration carrier, or the preset usage scenario.

[0125] Because QR codes typically maintain a stable relative position with label boundaries, packaging edges, fixed text areas, facility outlines, and layout structures during normal use, their geometric relationship with surrounding visual elements usually changes when they are copied, reposted, moved, or replaced on other carriers, even if the QR code's encoded content can still be parsed normally.

[0126] Based on the above characteristics, after establishing the local coordinate system of the QR code and extracting the surrounding visual elements, this embodiment further calculates the distance relationship, angle relationship, proportional relationship and orientation relationship between the QR code and the surrounding visual elements, and generates a positional relationship vector G.

[0127] In practice, the system first determines the center position of the QR code, the direction of the QR code edge, and the normalization scale of the QR code based on the local coordinate system of the QR code.

[0128] Subsequently, the system further extracts visual elements such as boundary contours, structural lines, text area edges, or graphic logo contours in the area surrounding the QR code, and calculates the relative geometric relationship between the QR code and the aforementioned visual elements.

[0129] For example, in one implementation, the system can calculate the distance relationship between the center of the QR code and the edge of the label.

[0130] Since the QR code is usually attached to a fixed position on the label, the distance from the center of the QR code to the edge of the label is usually within a stable range under normal circumstances.

[0131] If the QR code is re-pasted to another location, the above distance relationship will usually change significantly.

[0132] In another implementation, the system can further calculate the angle between the edge of the QR code and the edge of the packaging.

[0133] For example, in packaging printing, QR codes are usually printed or affixed in a fixed direction, so the edges of the QR codes and the edges of the packaging usually maintain a fixed angle relationship.

[0134] When a QR code is rotated, offset, or replaced, the angle relationship will usually deviate.

[0135] In another implementation, the system can further calculate the relative orientation between the QR code and the fixed text area.

[0136] For example, it can be determined whether the QR code is located above, below, to the left or to the right of a fixed text area, and the normalized distance relationship between the QR code and the text area can be further calculated.

[0137] Since fixed text areas usually have a stable layout, the above-mentioned positional relationship can further improve the ability to identify abnormal QR code positions.

[0138] In addition, in scenarios such as equipment inspection, warehouse location identification, or fixed facilities, the system can further calculate the positional and directional relationships between the QR code and the facility outline, structural boundary, nameplate edge, or fixed graphic identifier.

[0139] Through the above processing, the system is able to establish a spatial relationship between the QR code and its surrounding environment.

[0140] In this embodiment, to improve the consistency of positional relationships under different acquisition distances and resolutions, the system preferably uses a normalized method to represent the above geometric relationships.

[0141] For example, the side length of the QR code can be used as a normalization scale to uniformly convert the distance between the QR code and surrounding visual elements into a normalized distance parameter.

[0142] In one implementation, the positional relationship between the QR code and surrounding visual elements can be represented as: G; Where: G represents the positional relationship vector.

[0143] Furthermore, the baseline position relationship vector generated during the registration phase can be represented as: G_base; Correspondingly, the on-site location relationship vector generated during the scanning stage can be represented as: G_live; Subsequently, the system further calculates the consistency results of the location relationship based on the consistency between G_base and G_live.

[0144] In one implementation, the consistency of positional relationships can be calculated using the following parameters: Normalized distance error; angle error; scale error; azimuth deviation.

[0145] For example, when the distance deviation between the QR code and the label boundary exceeds a preset threshold, the system can determine that the QR code has a risk of abnormal position. When the angle between the QR code and the edge of the packaging deviates significantly from the record during the registration stage, the system can determine that the QR code may have been rotated, shifted, or replaced. When the vertical and horizontal relationship between the QR code and the fixed text area changes, the system can further improve the risk score.

[0146] Since the positional relationship verification in this embodiment focuses not only on the QR code itself, but also on the spatial consistency between the QR code and its surrounding environment, even if the QR code's encoded content is still valid, its positional relationship will usually change as long as the QR code is placed in different labels, different packaging, or different facility environments.

[0147] Therefore, the present invention can effectively improve the ability to identify abnormal situations such as QR code copying, reposting, shifting and replacement.

[0148] Furthermore, the positional relationship calculation in this embodiment is mainly based on the local area around the QR code, without the need for complex scene modeling or high-precision 3D reconstruction of the entire image. Therefore, it can achieve fast positional consistency verification with low computational overhead in industrial scanning terminals, mobile inspection terminals, and edge computing devices.

[0149] VI. Implementation Method for Generating Benchmark Verification Information After completing the parsing of the QR code encoding content, extraction of surrounding visual features, and calculation of the positional relationship between the QR code and surrounding visual elements, the system further integrates the above information to generate benchmark verification information for subsequent on-site scanning verification.

[0150] In this embodiment, the benchmark verification information does not merely store the QR code encoding content itself, but rather uniformly associates the QR code encoding content, the surrounding visual features of the QR code, and the spatial relationship between the QR code and its surrounding environment. Since QR codes typically correspond to specific labels, packaging, equipment, or facilities during normal application, the QR code encoding content, the surrounding visual environment, and the spatial relationship generally exhibit stable consistency. Based on this characteristic, this embodiment establishes benchmark verification information so that subsequent scanning stages can not only verify the validity of the QR code content but also further verify whether the QR code remains in its original registration environment.

[0151] In practice, the system first performs a digest generation process on the QR code encoded content Q_data to reduce storage pressure at the edge and improve subsequent fast retrieval efficiency. For example, the QR code encoded digest can be generated in the following way: Hash(Q_data) Where: Q_data represents the QR code encoded content; Hash(Q_data) represents the QR code encoded content summary.

[0152] In one implementation, the digest generation process can be implemented using the MD5 algorithm, SHA series algorithms, SM3 algorithm, or other hash algorithms. Since the QR code encoding content may contain product number, batch number, device number, query address, signature information, or business identification data, digest processing can reduce the space occupation and data leakage risks associated with long-term storage of the original data.

[0153] Subsequently, the system further performs structured representation of the surrounding visual features extracted during the registration phase and generates corresponding baseline visual feature information. The surrounding visual features generated during the registration phase can be represented as: Fv_base; Where: Fv_base represents the baseline surrounding visual features.

[0154] At the same time, the system further unifies the expression of the relative spatial relationship between the QR code and the surrounding visual elements, and generates the corresponding positional relationship vector: G_base; Where: G_base represents the reference position relationship vector.

[0155] The positional relationship vector may include information such as the normalized distance from the center of the QR code to the label boundary, the angle between the QR code and the edge of the packaging, the relative orientation between the QR code and the fixed text area, the normalized position of the QR code in the layout, and the positional ratio between the QR code and the structural boundary.

[0156] After generating the QR code encoding summary, surrounding visual features, and location relationship vector, the system further integrates and associates the above information to generate corresponding benchmark verification information.

[0157] In one implementation, the benchmark verification information can be represented as: B = {Hash(Q_data), Fv_base, G_base, T, Q_img, DeviceID, Time} in: B represents the benchmark verification information; Hash(Q_data) represents the QR code encoding digest; Fv_base represents the baseline surrounding visual features; G_base represents the reference position relationship vector; T represents the threshold parameter; Q_img represents the registered image quality parameters; DeviceID represents the registered device number; Time indicates the registration time.

[0158] The threshold parameter T can include parameters such as visual feature similarity threshold, positional deviation threshold, image quality threshold, and risk scoring threshold. The system can dynamically adjust these threshold parameters according to different application scenarios. For example, in fixed layout scenarios, the positional relationship constraint threshold can be increased; in complex background scenarios, the visual feature tolerance range can be appropriately increased; and in mobile device scanning scenarios, the image quality tolerance range can be increased.

[0159] To enhance lightweight deployment capabilities at the edge, this implementation prefers not to permanently store complete high-resolution registration images. Instead, it prioritizes storing lightweight data such as QR code encoding summaries, low-dimensional visual feature descriptors, location relationship vectors, and threshold parameters. Complete registration images can be archived as optional evidence images and only accessed in case of disputes, manual review, or back-end auditing.

[0160] By employing the above methods, the system can effectively reduce storage usage and network transmission pressure at the edge, thereby improving on-site deployment efficiency.

[0161] In one implementation, the generated benchmark verification information can be stored in a server database or synchronously cached in an industrial barcode scanning terminal, mobile inspection terminal, edge computing box, or embedded vision device, so that the system can still complete on-site anti-counterfeiting verification based on local cache in weak network or network outage environments.

[0162] To prevent the benchmark verification information from being tampered with, this embodiment may further perform security processing on the benchmark verification information, such as digital signature, encrypted storage, access control, integrity verification, or version management.

[0163] In addition, the system can further record auxiliary information such as registration time, registered equipment number, registered personnel, workstation number, geographical location or business status, so as to facilitate subsequent anomaly tracing, log auditing and risk analysis.

[0164] Through the benchmark verification information generation process in this embodiment, the present invention achieves a unified association between the QR code encoding content, the surrounding visual features of the QR code, and the spatial position relationship of the QR code. This enables the subsequent scanning stage to not only verify the validity of the QR code itself, but also to further verify whether the QR code is still in its original registration environment. Therefore, even if the QR code is copied, it can still be decoded normally. As long as its environment, surrounding visual structure, or spatial position relationship changes, the present invention can still identify abnormal situations, thereby improving the anti-counterfeiting identification capability of QR codes in field applications.

[0165] VII. Implementation Method for Synchronous Data Collection During the QR Code Scanning Stage After establishing the baseline verification information, this embodiment of the invention further performs on-site scanning verification during the actual use of the QR code. Unlike the traditional method of only decoding and verifying the QR code encoding content, this embodiment simultaneously completes QR code decoding, surrounding image acquisition, visual feature extraction, and positional relationship analysis during the scanning process, thereby achieving integrated joint verification of the QR code content and the environment in which the QR code is located.

[0166] In practice, when a user scans a QR code using an industrial scanning terminal, mobile inspection equipment, fixed industrial camera, edge computing terminal, or mobile smart device, the system first acquires on-site images.

[0167] Since this invention not only needs to identify the QR code encoding content, but also needs to analyze the visual environment around the QR code at the same time, the on-site acquired image not only includes the QR code area, but also preferably includes a preset area around the QR code.

[0168] In one implementation, after recognizing a QR code, the scanning device automatically expands the collection range centered on the QR code, thereby simultaneously obtaining the visual area surrounding the QR code.

[0169] In another implementation, the scanning device can also automatically adjust the surrounding area range according to preset business rules. For example, in a label scenario, it is preferable to include the label boundary area; in a packaging scenario, it is preferable to include the packaging edge area; and in a device inspection scenario, it is preferable to include the device outline area.

[0170] After acquiring the images captured on-site, the system first performs decoding processing on the QR code to obtain the QR code encoding content: Q_live; Where: Q_live represents the QR code encoding content obtained during the on-site scanning stage.

[0171] Subsequently, the system further performs format verification, business rule verification, or signature verification on the QR code encoded content.

[0172] For example, the system can verify whether the QR code number exists, whether the encoding format is correct, whether the digital signature is valid, or whether the QR code is in an allowed usage state.

[0173] After completing the QR code encoding and parsing, the system further locates the QR code area in the on-site image and establishes a local coordinate system for the QR code based on the corner points of the QR code.

[0174] Subsequently, the system performs perspective correction, scale normalization, and region cropping on the QR code and its surrounding area to reduce the impact of changes in shooting angle, distance, and perspective distortion on subsequent visual analysis.

[0175] In one implementation, the system may further perform illumination compensation, image enhancement, and noise suppression processing.

[0176] For example, it can increase image brightness in low-light environments, reduce the impact of bright areas in overexposed scenes, perform filtering in high-noise scenes, and enhance contour information in scenes with blurred edges.

[0177] The above processing can improve the stability of subsequent extraction of surrounding visual features and calculation of positional relationships.

[0178] After completing the regional normalization, the system further extracts on-site visual features from the area surrounding the on-site QR code.

[0179] The visual characteristics of the scene can be represented as: Fv_live; Where: Fv_live represents the visual features of the surrounding area.

[0180] The method for extracting the on-site visual features is consistent with that used in the registration stage, thereby ensuring the stability of the subsequent consistency comparison results.

[0181] For example, on-site visual features can be represented by edge contours, line segments, corner points, key point descriptors, template region features, HOG features, or low-dimensional image embedding vectors output by lightweight neural networks.

[0182] At the same time, the system further calculates the on-site positional relationship between the QR code and surrounding visual elements, and generates an on-site positional relationship vector: G_live; Where: G_live represents the on-site location relationship vector.

[0183] The on-site positional relationships may include the distance relationship between the QR code and the label boundary, the angular relationship between the QR code and the packaging edge, the orientation relationship between the QR code and the fixed text area, and the normalized positional relationship of the QR code in the layout.

[0184] Because the on-site acquisition environment may have changes in lighting, partial occlusion, motion blur, or shooting angle deviation, the system further evaluates the quality of the on-site images.

[0185] In one implementation, the system can detect: Is the image too dark? Is the image overexposed? Is the image blurry? Is the QR code obstructed? Is the angle of the QR code outside the allowed range?

[0186] If the quality of the on-site image is low, the system generates the corresponding image quality parameter: Q_live_img; Where: Q_live_img represents the on-site image quality parameter.

[0187] In the subsequent risk scoring stage, the system can reduce the confidence level of the current verification result based on image quality parameters.

[0188] For example, when the image blurriness exceeds a threshold, the system can reduce the visual feature consistency weight; when the QR code is severely occluded, the system can reduce the reliability of positional relationship consistency.

[0189] If necessary, the system can also prompt the user to re-acquire images to improve the accuracy of on-site verification.

[0190] In this embodiment, since QR code decoding, surrounding area acquisition, visual feature extraction, and positional relationship calculation can all be completed synchronously at the edge, the system can complete on-site anti-counterfeiting verification without relying on real-time online image analysis by the server.

[0191] For example, in industrial production lines, warehouse areas, transportation handover sites, or weak network inspection environments, edge devices can complete QR code anti-counterfeiting judgment based on local cache.

[0192] Therefore, this invention can effectively reduce network transmission pressure, improve on-site barcode scanning response speed, and enhance the availability and stability of the system in complex on-site environments.

[0193] Furthermore, since the scanning stage in this embodiment not only verifies the QR code content itself, but also verifies the surrounding visual environment and spatial position relationship of the QR code, even if the QR code is copied, it can still be decoded normally. As long as its surrounding scene, layout structure or position relationship changes, the present invention can still identify abnormal situations, thereby further improving the on-site anti-counterfeiting recognition capability of QR codes.

[0194] VIII. Implementation Method for Edge Consistency Comparison and Risk Scoring After completing the on-site QR code decoding, surrounding visual feature extraction, and positional relationship calculation, the system further performs consistency comparison and risk scoring at the edge to comprehensively judge whether the current QR code has the risk of being copied, reposted, moved, or replaced.

[0195] like Figure 6 As shown, the consistency comparison in this embodiment is not based solely on whether the QR code encoding content is valid, but rather on a joint analysis that combines the surrounding visual environment of the QR code and the positional relationship between the QR code and surrounding visual elements.

[0196] Because the encoded content, surrounding visual structure, and spatial relationship of a QR code usually remain stable and consistent during normal use, when a QR code is copied and reattached to other locations, packaging, or device environments, even if the encoded content of the QR code can still be parsed normally, its surrounding visual features and spatial relationship will usually change.

[0197] Based on the above characteristics, this implementation method simultaneously performs QR code encoding verification, visual feature consistency comparison, and positional relationship consistency comparison at the edge, and generates a comprehensive risk score by combining the image quality.

[0198] In practice, the system first reads the QR code encoding content on site: Q_live; And further obtain the corresponding benchmark verification information: B; Subsequently, the system first performs a consistency check on the QR code encoding content.

[0199] For example, the system can verify: Does the QR code number exist? Is the QR code format valid? Has the QR code expired? Is the QR code signature correct? Is the QR code status allowed?

[0200] Correspondingly, the system generates a QR code encoding verification result: C_code; Where: C_code represents the QR code encoding verification result.

[0201] After completing the QR code encoding verification, the system further incorporates the on-site visual features: Fv_live; Perform a consistency comparison with the baseline visual features saved during the registration phase: Fv_base.

[0202] In one implementation, the system can calculate visual feature similarity by the number of keypoint matches, feature descriptor distance, template matching score, or image embedding vector cosine similarity.

[0203] Correspondingly, the system generates a visual feature similarity result S_vis; Here, S_vis represents the similarity of surrounding visual features.

[0204] For example, when the QR code is still in the original label, original packaging, or original device environment, the boundary outline, fixed text area, structural lines, or packaging edge of the QR code's surrounding area can usually maintain a high degree of consistency, so the visual feature similarity is usually high.

[0205] When a QR code is copied and reattached to another location, the visual similarity usually decreases significantly due to changes in the surrounding background structure.

[0206] After completing the visual feature consistency comparison, the system further analyzes the consistency of the positional relationship between the QR code and surrounding visual elements.

[0207] Specifically, the system compares the on-site location relationship vector G_live with the baseline location relationship vector G_base saved during the registration phase.

[0208] In one implementation, the system can calculate the positional relationship consistency result based on parameters such as normalized distance error, angle error, proportional error, and azimuth deviation.

[0209] Correspondingly, the system generates a positional relationship consistency parameter S_geo; where S_geo represents positional relationship consistency.

[0210] For example, when the distance between the center of the QR code and the edge of the label deviates significantly from the record during the registration stage, the system can determine that the QR code is at risk of displacement; when the angle between the QR code and the edge of the packaging changes significantly, the system can determine that the QR code is at risk of rotation, attachment, or replacement; when the vertical and horizontal relationship between the QR code and the fixed text area changes, the system can further increase the risk level.

[0211] Since the on-site scanning environment may be affected by changes in lighting, blurring, occlusion, or deviation in the acquisition angle, the system further combines the on-site image quality parameter Q_live_img to correct the reliability of the current comparison result.

[0212] For example, when the image is highly blurred, the system can reduce the weight of visual feature consistency; when the QR code is partially occluded, the system can reduce the reliability of positional relationship consistency; and in overly dark or overexposed scenes, the system can appropriately increase the tolerance range for anomaly detection.

[0213] After completing QR code encoding verification, visual feature consistency analysis, positional relationship consistency analysis, and image quality assessment, the system further generates a comprehensive risk score.

[0214] In one implementation, the comprehensive risk score can be expressed as: R = α·C_code + β·S_vis + γ·S_geo + δ·S_quality; in: R represents the overall risk score; C_code represents the QR code encoding verification result; S_vis represents the similarity of surrounding visual features; S_geo indicates consistency of positional relationships; S_quality represents the image quality score; α, β, γ, and δ represent weighting parameters.

[0215] The above weight parameters can be dynamically adjusted according to different application scenarios.

[0216] For example, in scenarios that prevent QR code reposting, the weight of positional consistency can be increased; in scenarios with fixed-format packaging, the weight of visual feature consistency can be increased; and in complex on-site environments, the weight of image quality scoring can be increased.

[0217] In one implementation, the system can output the corresponding anti-counterfeiting verification result based on the comprehensive risk score.

[0218] For example, when the QR code encoding verification fails, the system can directly output the failure result; When the QR code encoding verification passes, but the visual feature similarity or positional relationship consistency is lower than the preset threshold, the system can output a suspected abnormality or failure result; When the QR code's encoded content, visual features, and positional relationships all meet the consistency requirements, the system can output a pass result; When the quality of the on-site image is insufficient to make a reliable judgment, the system can output the result that needs to be verified and prompt the user to scan the code again or upload it to the backend for verification.

[0219] Since the consistency comparison and risk scoring processes in this embodiment can be completed locally at the edge, the system can achieve rapid on-site anti-counterfeiting judgment without relying on real-time online analysis by the server.

[0220] For example, in industrial production lines, warehousing and logistics, transportation handover, warehouse inspection, and weak network environments, edge devices can complete QR code anti-counterfeiting verification based on local caching.

[0221] Meanwhile, this implementation method preferably only uploads risk results, abnormal records, or feature summaries, without frequently uploading complete original images, thus effectively reducing network transmission pressure and improving on-site QR code scanning response speed.

[0222] Furthermore, since this implementation method employs a joint verification mechanism that combines QR code encoding content, surrounding visual features, and spatial positional relationships, even if the QR code itself can be copied and decoded normally, the system can still identify abnormal situations as long as the environment, layout structure, or positional relationship of the QR code changes, thereby further improving the anti-counterfeiting recognition capability in ordinary QR code scenarios.

[0223] IX. Implementation methods for weak network or network outage scenarios In actual industrial settings, warehousing and logistics, transportation handover, equipment inspection, and outdoor operations, barcode scanning devices often face issues such as insufficient network bandwidth, high network latency, unstable wireless networks, or complete network outages. Traditional QR code anti-counterfeiting solutions typically rely on real-time online server queries or background image comparisons, which can easily lead to slow scanning responses, query failures, or inability to complete anti-counterfeiting verification in weak or offline network environments.

[0224] To address the aforementioned issues, this embodiment further provides an edge-end local verification mechanism suitable for weak or offline network environments, enabling the system to complete QR code anti-counterfeiting identification even in the absence of a real-time network connection.

[0225] In practice, after generating benchmark verification information during the QR code registration and filing stage, the system not only stores the benchmark verification information in the server database, but also further synchronizes and caches the required lightweight verification data to the edge device.

[0226] The edge device may include: Industrial barcode scanning terminals; mobile inspection terminals; edge computing boxes; embedded vision devices; local cache servers; mobile smart devices, etc.

[0227] Since the benchmark verification information in this invention preferably adopts a lightweight data structure, the edge does not need to store complete high-definition registration images for a long time. Instead, it only needs to cache data such as QR code encoding summary, surrounding visual feature descriptors, positional relationship vectors, and threshold parameters to complete on-site anti-counterfeiting verification.

[0228] For example, in one implementation, the local verification data cached at the edge may include: Hash(Q_data) Fv_base G_base T in: Hash(Q_data) represents the QR code encoding digest; Fv_base represents the baseline surrounding visual features; G_base represents the reference position relationship vector; T represents the comparison threshold parameter.

[0229] Because the above data is all lightweight, it can cache a large amount of QR code verification information even when the storage resources of edge devices are limited.

[0230] During the on-site scanning phase, when the edge device detects that the network is normal, the system can prioritize performing online verification on the server and simultaneously update the local cached data.

[0231] When the system detects excessive network latency, network interruption, or server inaccessibility, it automatically switches to local offline verification mode.

[0232] In local offline verification mode, the system does not need to access a remote server. Instead, it directly performs QR code encoding verification, surrounding visual feature consistency analysis, and location relationship consistency analysis based on the baseline verification information cached at the edge.

[0233] Specifically, the system first decodes the on-site QR code and obtains the QR code's encoded content: Q_live; Subsequently, the system generates a summary of the QR code's encoded content and retrieves the corresponding benchmark verification information from the local cache.

[0234] If a corresponding cached record exists at the edge, the system further performs on-site visual feature extraction and positional relationship calculation, and generates Fv_live and G_live respectively; Subsequently, the system further completes visual feature consistency comparison and positional relationship consistency comparison based on local cache, and generates a comprehensive risk score by combining image quality parameters.

[0235] Since the above processing can all be completed locally at the edge, the system can still complete the QR code anti-counterfeiting judgment even in the event of a complete network outage.

[0236] For example, in industrial production lines, warehouse areas, port loading and unloading, transportation handover, outdoor inspections, and underground facilities, edge devices can still achieve rapid barcode scanning and verification even if they cannot connect to the backend server in real time.

[0237] In addition, in one implementation, the system may further set the local cache validity period and incremental update mechanism.

[0238] For example, once the network is restored, edge devices can automatically synchronize data with the server and update newly added QR code records, threshold parameters, or anomaly rules.

[0239] For QR code data that has not been used for a long time or has expired, the system can also automatically clear the local cache to reduce the storage pressure on the edge.

[0240] In one implementation, when an abnormal risk is detected at the edge device while it is offline, the system can also temporarily store the corresponding abnormal record in a local cache.

[0241] The exception record may include: QR code number; risk score; anomaly type; on-site image summary; time information; equipment number; operation record, etc.

[0242] Once the network is restored, the system will further upload the aforementioned abnormal records to the server for background review, log auditing, or manual confirmation.

[0243] In another implementation, for QR codes with a high risk level or suspected of being counterfeit, the system can further cache on-site evidence images and automatically upload them to the backend server after the network is restored.

[0244] This enables the tracking and subsequent tracing of anomalies in offline scenarios.

[0245] In addition, to prevent local cached data from being illegally tampered with, this embodiment can further perform digital signature verification, encrypted storage, access control, or integrity verification on the edge cached data.

[0246] For example, when loading baseline verification information, the edge device can first verify the validity of the signature, and only allow local anti-counterfeiting judgment after the verification is passed.

[0247] Through the above processing, the system can improve data security and anti-tampering capabilities in weak network and network outage environments.

[0248] Since the anti-counterfeiting judgment in this embodiment mainly relies on lightweight data such as QR code encoding summary, surrounding visual features and positional relationship vectors, without the need to upload complete original images in real time, it can effectively reduce network transmission pressure and improve on-site QR code scanning response efficiency.

[0249] Meanwhile, since the system can complete QR code content verification, surrounding visual environment analysis, and spatial position relationship judgment at the edge, it can still be decoded normally even if the QR code is copied. As long as the environment, label structure, or spatial position relationship of the QR code changes, the present invention can still identify abnormal situations in an offline environment, thereby improving the anti-counterfeiting recognition capability and engineering practicality of the system in complex field environments.

[0250] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. Those skilled in the art should understand that various modifications, substitutions, combinations, and variations can be made to the technical solutions of the present invention without departing from the technical concept and scope of protection of the present invention, and all such modifications, substitutions, combinations, and variations should fall within the scope of protection defined by the claims of the present invention.

[0251] It should be noted that in this specification, terms such as "first," "second," "upper," "lower," "left," "right," "inner," and "outer" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or limiting the number, order, or absolute positional relationship of the indicated technical features. Therefore, a feature defined with the above terms may explicitly or implicitly include one or more of that feature.

[0252] Furthermore, in this specification, unless otherwise expressly specified and limited, the terms "connection," "linked," "coupled," "fixed," etc., should be interpreted broadly. For example, they can refer to a fixed connection or a detachable connection; a mechanical connection or an electrical connection; a direct connection or an indirect connection through an intermediate medium; or the internal connection of two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances.

[0253] It should also be noted that the technical features of the various embodiments described in this specification can be combined with each other to form new embodiments, as long as there is no structural or functional conflict.

[0254] The functional modules in the embodiments of the present invention can be implemented in hardware, software, or a combination of both. The software program can be stored in a computer-readable storage medium and loaded and executed by a processor to achieve the corresponding functions in the embodiments of the present invention.

[0255] The embodiments described in this specification are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any equivalent substitutions, improvements, or modifications made by those skilled in the art without departing from the spirit and substance of the present invention should be included within the scope of protection of the present invention.

Claims

1. A lightweight QR code anti-counterfeiting verification method based on surrounding visual features, characterized in that, include: During the QR code registration phase, images of the QR code and its surrounding preset area are collected, the QR code encoding content is parsed, surrounding visual features and the relative positional relationship between the QR code and surrounding visual elements are extracted, and benchmark verification information is generated. During the QR code verification phase, QR code decoding and surrounding image acquisition are performed simultaneously to extract on-site visual features and on-site location relationships. The on-site visual features and on-site location relationships are compared with the benchmark verification information for consistency, and a risk score is generated by combining the QR code encoding verification results. The anti-counterfeiting verification result is output based on the risk score.

2. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, The surrounding preset area is an area formed by expanding outward from the QR code area, or it is the area above, below, to the left, to the right of the QR code, the entire label area, or a local area including the packaging edge, fixed text, and facility outline, selected according to business rules.

3. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, Before extracting the surrounding visual features and the on-site visual features, the image is located by QR code, the corner points of the QR code are obtained, and a local coordinate system of the QR code is established based on the corner points, center of the QR code or side length of the QR code. Perspective correction, scale normalization and region cropping are performed on the QR code and its surrounding preset area.

4. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, The surrounding visual features include one or more of the following: label boundary features, packaging edge features, fixed text area features, background pattern features, graphic logo features, facility outline features, printing edge features, frame line features, or structural line features.

5. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, The surrounding visual features and the on-site visual features are represented by one or more of the following: edge contours, line segments, corner points, key point descriptors, HOG features, template matching features, feature hashes, quantization vectors, or lightweight neural network image embedding vectors.

6. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, The relative positional relationships include one or more of the following: the distance from the center of the QR code to the label boundary, the angle between the edge of the QR code and the edge of the packaging, the relative orientation between the QR code and the fixed text area, the distance ratio between the QR code and the facility outline or graphic symbol, the normalized coordinates of the QR code in the label or packaging layout, and the relative position between the QR code and the frame line or printing edge.

7. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, The benchmark verification information includes one or more of the following: QR code encoded content summary, benchmark surrounding visual feature descriptor, benchmark position relationship vector, similarity threshold, position deviation threshold, registered image quality parameters, registered device number, and registration time.

8. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, The risk score is generated based on the QR code encoding verification result, the similarity of surrounding visual features, the consistency of positional relationships, and the image quality score. The similarity of surrounding visual features is calculated by the number of key point matches, the distance of feature descriptors, the template matching score, or the cosine similarity of the image embedding vector. The consistency of positional relationships is calculated by normalized distance error, angle error, scale error, or orientation deviation.

9. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to claim 1, characterized in that, If the QR code encoding verification fails, a failure result will be output; if the QR code encoding verification passes but the similarity of surrounding visual features or the consistency of positional relationships is below the threshold, a suspected abnormality or failure result will be output; if the QR code encoding verification passes, the similarity of surrounding visual features meets the standard, and the positional relationship is consistent, a pass result will be output; if the image quality is insufficient to complete a reliable judgment, a result requiring verification will be output.

10. The lightweight QR code anti-counterfeiting verification method based on peripheral visual features according to any one of claims 1 to 9, characterized in that, In weak network or network outage environments, the edge device performs local anti-counterfeiting verification based on the locally cached QR code encoded content summary, reference surrounding visual feature descriptor, reference location relationship vector, and threshold parameters, and uploads abnormal verification records, review requests, or evidence images after the network is restored.

11. A lightweight QR code anti-counterfeiting verification system based on peripheral visual features, characterized in that, include: The benchmark registration module is used to collect images of the QR code and its surrounding preset area during the QR code registration stage, parse the QR code encoding content, extract surrounding visual features and the relative positional relationship between the QR code and surrounding visual elements, and generate benchmark verification information. The QR code positioning and normalization module is used to locate the QR code in the image, obtain the QR code corner points, establish the local coordinate system of the QR code, and perform perspective correction, scale normalization and region cropping on the QR code and its surrounding preset area. The surrounding visual feature extraction module is used to extract on-site visual features; The positional relationship calculation module is used to calculate the on-site positional relationship between the QR code and surrounding visual elements; The edge comparison module is used to compare the on-site visual features and on-site location relationships with the benchmark verification information for consistency, and generate a risk score by combining the QR code encoding verification results; The result output and verification module is used to output anti-counterfeiting verification results based on the risk score, and trigger server verification or manual verification when the verification conditions are met.

12. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the lightweight QR code anti-counterfeiting verification method based on peripheral visual features as described in any one of claims 1 to 10.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the lightweight QR code anti-counterfeiting verification method based on peripheral visual features as described in any one of claims 1 to 10.