Method and system for identifying digital bar code
By generating fixed-field 8-bit digital codes and combining deep convolutional neural network models with image quality control, the problems of missing character structure information and image blur in digital barcode recognition are solved, achieving barcode recognition with high reliability and accuracy.
Patent Information
- Application Number
- CN202510901199.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-10-17
AI Technical Summary
Existing digital barcode recognition methods have the problems of missing character structure information, weak image fuzzy recognition ability, and no structure verification mechanism in small-size sample label recognition scenarios, making it difficult to achieve high-reliability recognition in complex environments.
By generating an 8-bit digital code with fixed field position and length restrictions, combining image quality control and deep convolutional neural network models, character extraction and structure decoding are performed, and character position prior templates and regional attention mechanisms are introduced to generate structured data results after verification.
It achieves high-reliability digital barcode recognition in complex environments, improves recognition accuracy and anti-interference, and ensures the accuracy and structural integrity of the recognition results.
Smart Images

Figure CN120808355A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image recognition and digital character recognition, in particular to a method and system for recognizing digital barcodes. BACKGROUND
[0002] Traditional one-dimensional barcodes and two-dimensional barcodes rely on graphical form coding, which is easily affected by label size, printing quality and environmental factors, and has limitations in recognition stability. In recent years, to improve recognition efficiency and reliability, a digital pure digital barcode recognition scheme has gradually emerged, which reads digital sequences through image recognition technology, improves the clarity and adaptability of the identification, and becomes a new trend of lightweight barcode recognition.
[0003] Although there are several barcode recognition methods that can recognize graphical codes and digital information, there are still many limitations in small size sample label recognition scenarios. First, most existing digital recognition methods rely on general OCR models and do not optimize the structure for fixed-length digital sequences and arrangement rules in barcodes, resulting in a significant decrease in recognition accuracy under conditions of uneven character spacing or image blur. Second, the traditional image recognition process lacks a guiding mechanism for character spatial distribution and ignores the prior structural knowledge of character position, making the model lack robustness for distorted characters or occluded characters. In actual applications, experimental sample labels often produce complex interference due to problems such as attachment to curved surfaces, low-contrast lighting, or camera offset. In addition, most existing technologies lack real-time quality control mechanisms and cannot judge the degree of image blur during image acquisition and provide timely feedback. SUMMARY
[0004] In view of the above problems, the present application is proposed.
[0005] Therefore, the technical problem solved by the present application is that existing digital barcode recognition methods lack character structure information, have weak image blur recognition ability, lack result structure verification mechanisms, and how to achieve high reliability in complex environments.
[0006] To solve the above technical problems, the present application provides the following technical solutions: a method for recognizing a digital barcode, comprising generating a digital code according to sample identification information, setting layout parameters to generate a barcode image.
[0007] Obtain the barcode image and perform an image quality control-based preprocessing process.
[0008] Perform character recognition and structure decoding, and generate structured data results after verification.
[0009] The character recognition and structure decoding includes character extraction of the target region in the image using a digital character deep recognition model, the character positioning accuracy is improved during the extraction process by combining a character position prior template and a region attention mechanism, and a digital character deep recognition model is used in the recognition process. After the character extraction is completed, the recognition result is parsed according to the eight structured rules, and is divided into a sample number field, a batch field and a type field, and the result is verified.
[0010] As a preferred scheme of the method for identifying a digital barcode, the method comprises the following steps: generating a digital code according to sample identification information, wherein the generating of the digital code comprises: performing structured processing on the sample identification information, and constructing the digital code according to a fixed field order, the digital code being composed of a unique sample number, a batch number and a type mark in sequence, and occupying the first four bits, the fifth to sixth bits and the seventh to eighth bits respectively, and an eight-bit digital string is generated for uniquely identifying a target sample.
[0011] As a preferred scheme of the method for identifying a digital barcode, the method comprises the following steps: setting layout parameters to generate a barcode image, wherein the setting of the layout parameters comprises: obtaining surface area data of an available attachment area of a sample, and automatically assigning a font size, a character spacing and a font arrangement format according to an area interval rule. The arrangement mode of the barcode content is automatically selected by a layout algorithm according to a geometric shape of the sample.
[0012] As a preferred scheme of the method for identifying a digital barcode, the method comprises the following steps: obtaining a barcode image, wherein the obtaining of the barcode image comprises: collecting the barcode image by using an image collection device, the image collection device lens and the barcode image are kept parallel during shooting, the distance between the device and the surface of the sample is controlled within a preset distance range, and the illumination condition satisfies that the contrast is not less than an illumination threshold. The current definition and edge quality are judged according to a real-time image frame, and when it is detected that the image blurriness exceeds a preset upper limit, automatic re-collection is prompted.
[0013] As a preferred scheme of the method for identifying a digital barcode, the method comprises the following steps: performing a preprocessing process based on image quality control, wherein the preprocessing process based on the image quality control comprises: performing gray scale conversion on the collected image, converting three channels of RGB by using a weighted average value algorithm, performing binarization operation after the conversion, and dynamically generating a threshold value by using an Otsu algorithm. Noise filtering processing is performed on the image, a median filter is used to process the image, and a filter window is 3*3 pixels. The image contour is enhanced by using a Canny edge detection method, and a high threshold value and a low threshold value are set. The image quality is reviewed by using an image quality secondary judgment rule, and character recognition is performed after the character contour continuity meets the recognition condition.
[0014] As a preferred scheme of the method for recognizing a digital barcode, the character recognition and structure decoding comprises: based on the effective character area formed by the preprocessing, a digital character deep recognition model is called to perform a character-by-character recognition operation, the digital character deep recognition model is a deep convolutional neural network model trained using a data set covering fuzzy edges, inclined arrangement and multi-font deformation. A character position prior template is introduced in the character recognition process, and the character extraction area is constrained through a position mapping mechanism, and a region attention mechanism is combined to weight multiple candidate character regions in the image. After the character extraction is completed, the recognition result is divided into fields according to an eight-bit structure encoding format, the first four bits are mapped as a sample number field, the fifth to sixth bits are mapped as a batch field, and the seventh to eighth bits are mapped as a type field, and the structured result after the division is taken as a verification input.
[0015] As a preferred scheme of the method for recognizing a digital barcode, the method comprises: after the recognition, a structured data result is generated, the eight-bit structured digital string recognized is subjected to a verification processing, a weighted sum and modulo ten verification method is adopted, each digit is multiplied by a corresponding weight and a modulo ten value of a weighted sum result is taken, and then the modulo ten value is compared with a verification bit to judge the correctness. If the verification is successful, the analysis field is packaged as a standard JSON format data object. The data object is sent to a sample management platform through an interface and is displayed on a front-end terminal. If the verification fails, the data object is marked with an exception and is sent to a re-recognition queue, and a prompt is given to confirm the processing mode after re-recognition.
[0016] Another object of the present application is to provide a digital barcode recognition system which can be used for performing character recognition and structure decoding by a recognition decoding module, generating a structured data result after verification, and solving the problems of existing digital barcode recognition methods, such as missing character structure information, weak image fuzzy recognition ability, no structure verification mechanism of the result, and how to realize high-reliability digital barcode recognition in a complex environment.
[0017] As a preferred scheme of the method for recognizing a digital barcode, the method comprises: a barcode picture generation module, an image preprocessing module and a recognition decoding module.
[0018] The barcode picture generation module is used for generating a digital code according to sample identification information, setting layout parameters and generating a barcode image.
[0019] The image preprocessing module is used for acquiring a barcode image and performing an image quality control-based preprocessing process.
[0020] The recognition decoding module is used for performing character recognition and structure decoding and generating a structured data result after verification.
[0021] A computer device comprises a memory and a processor, the memory stores a computer program, and the processor executes the computer program to implement steps of a method for recognizing a digital barcode.
[0022] A computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement steps of a method for recognizing a digital barcode.
[0023] The method for recognizing a digital barcode provided by the present application generates a digital code according to sample identification information, sets layout parameters to generate a barcode image
[0024] The method for recognizing a digital barcode provided by the present application generates a digital code according to sample identification information, sets layout parameters to generate a barcode image
[0025] The method for recognizing a digital barcode provided by the present application generates a digital code according to sample identification information, sets layout parameters to generate a barcode image
[0026] The method for recognizing a digital barcode provided by the present application generates a digital code according to sample identification information, sets layout parameters to generate a barcode image BRIEF DESCRIPTION OF DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.
[0028] Figure 1 A flowchart of a method for recognizing a digital barcode provided by the first embodiment of the present application.
[0029] Figure 2 A system schematic diagram of a method for recognizing a digital barcode provided by the second embodiment of the present application. DETAILED DESCRIPTION
[0030] To make the above-mentioned objects, features, and advantages of the present invention more clearly understood, the following detailed description of the specific embodiments of the present invention is given in conjunction with the accompanying drawings. It is obvious that the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in this field without creative work should fall within the scope of protection of the present invention.
[0031] Example 1, with reference to Figure 1 , as one embodiment of the present invention, provides a method for identifying a digital barcode, comprising:
[0032] S1: Generate digital code according to sample identification information and set typesetting parameters to generate barcode image.
[0033] Perform structured processing on the sample identification information and construct a digital code based on a fixed field sequence. The digital code consists of a unique sample number, batch number, and type flag in sequence, occupying the first four digits, the fifth to sixth digits, and the seventh to eighth digits respectively, generating an eight-digit string for uniquely identifying the target sample.
[0034] Furthermore, the unique sample number is fixed at four digits (e.g., 0001 to 9999), the batch number is fixed at two digits (e.g., 01 to 99), and the type identifier is also fixed at two digits (e.g., 01 for solid samples, 02 for liquid samples, etc.). The resulting eight-digit code is the unique structured identification number for the sample, which is subsequently used to construct the barcode image.
[0035] Obtain the surface area of the sample's available attachment area and automatically assign font size, character spacing, and font layout based on area interval rules. The barcode content layout is automatically selected by a layout algorithm based on the sample's geometry.
[0036] Furthermore, the layout parameters are automatically set based on the actual space where the barcode needs to be attached. Specifically, by reading the surface area parameter associated with the sample geometry, the area value of the barcode attachment area is calculated in square centimeters. Based on the interval to which the area value belongs, the built-in font size and character spacing adjustment rules are called for dynamic setting:
[0037] If the surface area is less than or equal to 2cm 2 , set the font size to 8pt and the character spacing to 0.5mm.
[0038] If the surface area is 2cm 2 Up to 5cm 2 Set the font size to 10-12pt and the character spacing to 1mm.
[0039] If the surface area is greater than 5cm 2 , set the font size to 14pt and above, and the character spacing to 1.5mm.
[0040] In addition to font size and spacing, the arrangement of barcodes is also automatically determined by the layout control algorithm. Considering the aspect ratio and geometric boundary profile of the sample surface, it is determined whether to use horizontal one-row arrangement, vertical multi-row arrangement or inclined arrangement, and to ensure that the characters do not overlap or exceed the boundary in the generated image. After the above layout parameter setting is completed, the system renders the digital code into an image in the specified font format and outputs it as a standard vector format image file (the format used in this invention is PNG) for subsequent printing and attachment.
[0041] It should be noted that S1 realizes accurate identification and spatial adaptation of different samples through structured coding and adaptive layout strategy. This design ensures uniform coding specification and controllable image generation process, is suitable for various geometric samples, improves the attachability of barcodes and subsequent recognition accuracy, and facilitates automatic management.
[0042] S2: Obtain the barcode image and perform the preprocessing process based on image quality control.
[0043] The barcode image is collected by an image acquisition device. In this invention, an image acquisition device with an imaging capability of 5 million pixels or more is used, preferably a CMOS sensor device with automatic exposure and image stabilization functions. During the device shooting process, the image acquisition device lens and the barcode image are kept parallel, and the distance between the device and the sample surface is controlled within a pre-set distance range, which is set to 10-20 cm in this invention. The lighting condition satisfies the contrast not lower than the lighting threshold, which is set to the overall image gray scale contrast not lower than 30% in this invention. According to the real-time image frame, the current definition and edge quality are judged, and when the image blurriness exceeds the pre-set upper limit, the user is prompted to re-collect the image.
[0044] Further, after collecting the image, its Laplacian variance index is calculated as the definition judgment basis, and if the image Laplacian variance is less than the pre-set threshold (set to 50 in this invention), it is judged as a blurred image, and the user will be prompted to re-shoot the image immediately. This mechanism can effectively filter out blurred images caused by shaking, defocusing or insufficient lighting.
[0045] After the image quality meets the standard, the image preprocessing operation is performed. First, the original color image is converted to grayscale, and the weighted average method is used to linearly combine the RGB three channels. The grayscale image is further binarized by Otsu algorithm to automatically generate the best threshold to divide the foreground and background, and improve the saliency of the character contour boundary.
[0046] Subsequently, the image is filtered for noise, a median filter method is used to smooth the image, and the filter window size is set to 3x3 pixels to reduce isolated noise points in the image generated by high-frequency interference. The contour extraction adopts a Canny edge detection algorithm, and the edge extraction range is controlled by setting a high threshold (set to 200 in the present application) and a low threshold (set to 100 in the present application), to ensure that the character contour is complete and closed, and the edge is smooth and continuous.
[0047] Finally, the processed image is reviewed again for quality. The character structure is judged by a character contour detection algorithm to determine whether it is closed, whether it has a break, and whether it has abnormal phenomena such as blurring and ghosting. If the evaluation result shows that the image can enter the recognition stage, the image is sent to the character recognition module. Otherwise, it is determined that the condition is not met and the user is prompted to re-shoot.
[0048] It should be noted that S2 realizes dynamic control and optimization of the quality of the barcode image by introducing image acquisition specifications, a blur judgment mechanism, and a multi-step image preprocessing process. This design effectively improves the image clarity and character edge integrity, provides stable input for subsequent recognition, and enhances the recognition accuracy and adaptability of the system.
[0049] S3: Perform character recognition and structure decoding to generate structured data results after verification.
[0050] Based on the effective character area formed by preprocessing, a digital character deep recognition model is called to perform character-by-character recognition. The digital character deep recognition model uses a trained deep convolutional neural network model, and the training data set includes situations covering fuzzy edges, inclined arrangement, and multiple font deformations. A character position prior template is introduced during character recognition to constrain the character extraction area through a position mapping mechanism, and a region attention mechanism is used to weight multiple candidate character regions in the image.
[0051] The character position prior template includes, based on the image edge results after preprocessing, the system automatically performs character region positioning operations, constructs a candidate box for suspected character regions, extracts the corresponding image region content, and performs gray scale normalization processing on each character region to unify the tile size (32x32 pixels), denoted as n represents the nth character region, and p and q represent the row and column indices of the tile, both of which are 32 in the present application. Based on the standard arrangement form of the barcode, a position prior template is generated The value distribution is encoded according to the position of the character in the barcode, and the purpose is to model the spatial expected position of the character region. The position prior template is represented as:
[0052]
[0053] wherein x and y represent the row and column index positions of the pixel points in the character tile. and represents the center point position of the nth character region in the standard structure. σ represents a spatial decay parameter, which controls the diffusion degree of the Gaussian distribution, and is set to 0.3 times the character width in the present application.
[0054] A preferred scheme for combining the region attention mechanism to weight multiple candidate character regions in an image specifically includes region weighting in the feature dimension for the normalized character tile. Let the original feature response in the image be represented as f(x,y), and the fusion be represented as:
[0055]
[0056] wherein, represents the weighted and fused feature value at the pixel coordinate (x, y) in the nth character region. α (n) represents the attention weight coefficient of the nth character. represents the original feature response value of the pixel point (x, y) in the nth character region. represents the position prior template value of the pixel point (x, y) in the nth character region.
[0057] A preferred scheme for the digital character depth recognition model specifically includes inputting the fused feature map to the trained digital character depth recognition model, which is composed of multiple layers of convolutional layers, pooling layers, normalization layers, and Softmax output.
[0058] The model output is a probability distribution vector of 0-9:
[0059]
[0060] wherein R (n) represents the ten-dimensional Softmax output result of the nth character region, representing the predicted probability distribution of 0-9 digits. f CNN (·) represents the feature extraction and classification layer structure inside the digital character depth recognition model. Softmax(·) represents the Softmax function for normalizing the network output. The final recognition result of the nth character, i.e., the digital label value corresponding to the maximum predicted probability. represents the predicted probability value of the nth character being a digit d.
[0061] Further, the preliminary positioning of the character region adopts the edge map and the contour map of the preprocessed image, combines projection analysis and connected domain extraction to generate a candidate box, ensuring that the number of character regions is consistent with the number of barcode bits. If the character interval rule is predictable, it is preferred to divide the width into 8 blocks according to the fixed equal division method as the character positioning region, to improve the consistency of the structure and the recognition efficiency.
[0062] After the character extraction is completed, the recognition result According to the eight-bit structure coding format, the field is divided, the first four bits are mapped as the sample number field, the fifth to sixth bits are mapped as the batch field, and the seventh to eighth bits are mapped as the type field. After division, the structured result is obtained as a verification input.
[0063] The eight-bit structured digital string recognized is subjected to verification processing, the verification algorithm adopts the weighted sum modulo ten verification method, each digit is multiplied by the corresponding weight and the modulo ten value of the weighted sum result is taken, and then compared with the check bit to determine its correctness. If the verification is successful, the parsed field is packaged as a standard JSON format data object. The data object is sent to the sample management platform through the interface and displayed on the front-end terminal. If the verification fails, the data object is marked as an exception and sent to the recognition queue for confirmation processing after re-identification.
[0064] One preferred scheme of the weighted sum modulo ten verification method specifically includes that the weighted sum modulo ten verification method is calculated as:
[0065]
[0066] Wherein, V represents the verification value obtained by taking the weighted sum modulo 10, which is used to compare with the verification reference value to determine whether it is valid.d (m) represents the digital value in the mth recognition result, that is, the 8-bit structured digital. (m) represents the weight value corresponding to the mth digit.
[0067] If the verification value meets the comparison standard, the next step is entered. Otherwise, it enters the recognition queue.
[0068] Further, the specific verification method includes:
[0069] If the 9th bit in the original code is an explicit check bit d (9) , it is judged whether there is:
[0070] V=(d (9) )
[0071] If they are equal, it is considered as passing the verification, otherwise it is failed.
[0072] If the code does not contain a check bit, according to the set compliance rule, if V=0, it is compliant. If it does not meet this condition, it is determined that the recognition result is abnormal, and the recognition process is entered.
[0073] It should be noted that the design idea of S3 is to fuse the character region after image preprocessing with the deep recognition model through position prior modeling + region attention mechanism to form a precise recognition path for complex scene digital barcodes. Compared with the existing technology which only relies on OCR or traditional convolutional network direct recognition, the present application introduces a structure-guided prior template which can form a probability weighted guide to the standard spatial distribution of characters, and dynamically adjusts the character region feature response through the attention mechanism to enhance the robustness to fuzzy, distorted and inclined samples. Finally, with the weighted sum and modulo check mechanism, the barcode content correctness verification is effectively realized, and in the complex background interference, weak edge contrast and structural abnormal sample recognition scene, the stability and accuracy double protection which the existing technology cannot achieve are achieved.
[0074] Embodiment 2, refer to Figure 2 For an embodiment of the present application, a digital barcode recognition system is provided, which comprises a barcode image generation module 100, an image preprocessing module 200 and a recognition decoding module 300.
[0075] S4: The barcode image generation module 100 is used to generate digital code according to sample identification information, and set layout parameters to generate barcode image.
[0076] Further, the encoding construction submodule 101 is used for field structuring processing of sample identification information, and constructs eight-bit digital code according to fixed field order, which respectively includes the first four-bit unique sample number field, the fifth to sixth bit batch field and the seventh to eighth bit sample type field, which is used for uniquely identifying the current target sample. The layout rendering submodule 102 is used for obtaining the area of the sample attachment area, setting the font size, character spacing and arrangement mode by calling the area interval built-in rule, generating a digital barcode image adapted to the shape of the sample by using equal division or automatic arrangement algorithm, and outputting the generated image in PNG format for printing or system recognition.
[0077] It should be noted that the encoding construction submodule 101 is a pre-step of the layout rendering submodule 102, and the encoding result provides basic data for image layout. The layout rendering submodule 102 needs to dynamically adjust the arrangement mode according to the area and geometric characteristics to ensure that the barcode image is clear and identifiable. The above-mentioned barcode image generation module 100 constitutes the input source of the system, and provides a standardized image basis for the subsequent recognition process.
[0078] S5: The image preprocessing module 200 is used to obtain the barcode image and execute the preprocessing process based on image quality control.
[0079] Further, the image acquisition sub-module 201 is used to control the image acquisition device to set the distance, angle and parallelism to acquire the barcode image of the attached sample, and set the illumination contrast to be not less than 30% and the distance range to be controlled in 10-20 cm during the acquisition process, and introduce a Laplacian variance threshold (such as less than 50) as a blur judgment standard for judging whether to re-shoot the image. The image enhancement sub-module 202 is used to perform grayscale, binarization, median filtering and Canny edge detection processing on the acquired image, respectively realize image channel compression, background segmentation, noise suppression and character boundary extraction, and re-examine whether the image quality meets the character recognition condition after processing.
[0080] It should be noted that the image acquisition sub-module 201 is the starting point of the image preprocessing module 200, which provides a high-quality input image for the image enhancement sub-module 202, and the two together build a complete image preprocessing path. The image preprocessing module 200 directly affects the recognition accuracy and model stability, and is a crucial intermediate control link in the system.
[0081] S6: The recognition and decoding module 300 is used to perform character recognition and structure decoding to generate structured data results after verification.
[0082] Further, the character recognition sub-module 301 is used to perform character extraction and digital recognition operations based on the preprocessed image, introduce a character position prior template and a region attention mechanism to weight and fuse the candidate character regions, then input into the trained digital character deep recognition model for Softmax prediction, output the class probability of each character and select the maximum value as the final recognition result. The structure verification sub-module 302 is used to structure the recognized 8-digit number into a sample number, batch number and type mark, and perform weighted and modulo ten verification. If the recognized structure meets the verification standard, the fields are packaged into a standard JSON object and uploaded to the system. If the verification fails, the abnormal state is marked and sent to the re-recognition process.
[0083] It should be noted that the performance of the character recognition sub-module 301 depends on the image clarity of the image preprocessing module 200, and the structure verification sub-module 302 provides reliability verification for the recognition result. The recognition and decoding module 300 constitutes the output terminal of the system, completes the conversion task from image to structured data, and is the core part of the recognition link closed loop of the present application.
Claims
1. A method for identifying a digital barcode, characterized in that: include: Generate digital codes based on sample identification information and set typesetting parameters to generate barcode images; Acquire barcode images and perform pre-processing based on image quality control; Perform character recognition and structure decoding, and generate structured data results after verification; Executing character recognition and structural decoding includes using a digital character deep recognition model to extract characters from the target area in the image. During the extraction process, the character position prior template and regional attention mechanism are combined to improve the character positioning accuracy. The recognition process uses a digital character deep recognition model. After the character extraction is completed, the recognition results are parsed according to the eight-bit structured rules, divided into sample number field, batch field and type field, and the results are verified.
2. The method for recognizing a digital barcode according to claim 1, wherein: Generating a digital code according to the sample identification information includes: Perform structured processing on the sample identification information and construct a digital code based on a fixed field sequence. The digital code consists of a unique sample number, batch number, and type flag in sequence, occupying the first four digits, the fifth to sixth digits, and the seventh to eighth digits respectively, generating an eight-digit string for uniquely identifying the target sample.
3. The method for recognizing a digital barcode according to claim 1 or 2, wherein: The setting of typesetting parameters to generate a barcode image includes: Obtain the surface area data of the sample's available attachment area and automatically assign font size, character spacing, and font layout format based on area interval rules; The barcode content arrangement is automatically selected by the typesetting algorithm based on the sample geometry.
4. The method for recognizing a digital barcode according to claim 3, wherein: The acquiring of the barcode image comprises: The barcode image is captured by an image acquisition device. During the shooting process, the lens of the image acquisition device is kept parallel to the barcode image. The distance between the device and the sample surface is controlled within a preset distance range. The lighting conditions meet the contrast requirement of not less than the lighting threshold. The current clarity and edge quality are determined based on the real-time image frame. When the image blur exceeds the preset upper limit, it will automatically prompt you to re-capture.
5. The method for recognizing a digital barcode according to any one of claims 1, 2 or 4, wherein: The execution of the pre-processing process based on image quality control includes: The collected image is converted into grayscale, and the RGB channels are converted using the weighted average algorithm. After the conversion, the binary operation is performed, and the threshold is dynamically generated using the Otsu algorithm. Perform noise filtering on the image and use a median filter to process the image with a filter window of 3×3 pixels; Image contour enhancement uses the Canny edge detection method and sets high and low thresholds; The image quality is reviewed through the secondary image quality judgment rule, and character recognition is performed after retaining the continuity of the character contour and satisfying the recognition conditions.
6. The method for recognizing a digital barcode according to claim 5, wherein: The execution of character recognition and structure decoding includes: Based on the valid character area formed by preprocessing, the digital character deep recognition model is called to perform character-by-character recognition operations. The digital character deep recognition model uses a trained deep convolutional neural network model. The training data set includes cases of covering blurred edges, tilted arrangements, and multiple font deformations. In the character recognition process, a character position prior template is introduced to constrain the character extraction area through the position mapping mechanism, and the regional attention mechanism is combined to weight multiple candidate character areas in the image; After completing the character extraction, the recognition results are divided into fields according to the eight-bit structure coding format. The first four bits are mapped to the sample number field, the fifth to sixth bits are mapped to the batch field, and the seventh to eighth bits are mapped to the type field. After division, the structured results are obtained as verification input.
7. The method for recognizing a digital barcode according to any one of claims 1, 2, 4 or 6, wherein: The structured data generated after verification includes: The recognized eight-digit structured digital string is verified using a weighted sum modulo 10 check algorithm. Each digit is multiplied by its corresponding weight and the modulo 10 value of the weighted sum is taken. The result is then compared with the check digit to determine its correctness. If the verification is successful, the parsed fields are encapsulated into a standard JSON format data object; the data object is sent to the sample management platform through the interface and displayed on the front-end terminal; If the verification fails, the data object will be marked as abnormal and sent to the re-identification queue, prompting re-identification and confirmation of the processing method.
8. A digital barcode recognition system, characterized by: It includes a barcode image generation module (100), an image pre-processing module (200), and a recognition and decoding module (300); The barcode image generation module (100) is used to generate a digital code according to the sample identification information and set typesetting parameters to generate a barcode image; The image preprocessing module (200) is used to obtain a barcode image and execute a preprocessing process based on image quality control; The recognition and decoding module (300) is used to perform character recognition and structure decoding, and generate structured data results after verification.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method for recognizing a digital barcode according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for recognizing a digital barcode according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Logistics express bill automatic identification and bill number extraction method based on rule configuration
CN121354157A
Rule-based logistics label automatic recognition and serial number extraction method
CN121354157B