Barcode recognition method and device based on multi-engine fusion
Patent Information
- Authority / Receiving Office
- HK · HK
- Patent Type
- Patents
- Current Assignee / Owner
- BEIJING QINGSONG YIKANG INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2026-03-04
- Publication Date
- 2026-07-17
AI Technical Summary
Existing barcode recognition technologies have low success rates in many scenarios, making it difficult to meet the needs for efficient and accurate recognition. In particular, the failure rate is high in complex environments such as insufficient light or tilted angles. Furthermore, single-engine recognition solutions cannot provide real-time feedback, affecting business continuity.
A multi-engine fusion recognition method is adopted. The priority ranking of recognition engines is determined according to the features of the target image. Through multi-level retry strategy and engine switching, the image quality is gradually improved and the recognition engine is adjusted to ensure recognition success.
It improves the success rate of barcode recognition, enhances recognition efficiency and accuracy in complex environments, avoids the limitations of single-engine recognition, and ensures the stability and efficiency of the recognition process.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of identification technology, and in particular to a barcode identification method and apparatus based on multi-engine fusion. Background Technology
[0002] With the widespread application of barcode technology in logistics, retail, warehousing and other fields, the efficiency and accuracy of barcode recognition are becoming increasingly important. Currently, some barcode recognition systems employ simple backend recognition solutions, relying entirely on servers. This not only results in long image upload times causing users to wait 10-30 seconds, but also makes servers prone to bottlenecks under high concurrency due to concentrated tasks. Furthermore, barcode repeatability detection cannot provide real-time feedback, impacting business continuity.
[0003] Furthermore, current mainstream barcode recognition technologies rely solely on single engines such as ZXing or Quagga2, which are insufficiently adapted to specific barcode types and special shooting angles, resulting in a success rate of only 60-70%. The failure rate is high in complex environments such as low light or tilted angles, and it struggles to cover diverse barcode formats. Therefore, the core problem with current barcode recognition technology lies in its low success rate, making it difficult to meet the needs for efficient and accurate recognition in various scenarios. Summary of the Invention
[0004] This application provides a barcode recognition method and apparatus based on multi-engine fusion to solve the problem of low barcode recognition success rate.
[0005] In a first aspect, this application provides a barcode recognition method based on multi-engine fusion, the method comprising:
[0006] The priority ranking of multiple recognition engines is determined based on the image features of the target image. Different recognition engines have different performance in recognizing barcodes, and the priority ranking is matched with the image features.
[0007] The target image is barcode recognized according to the first recognition engine in the priority ranking;
[0008] If the recognition result is a recognition failure, the barcode recognition is performed according to the preset multi-level retry strategy and the priority sorting until the barcode in the target image is recognized. The multi-level retry strategy is used to progressively enhance image quality and switch recognition engines to ensure that the barcode is recognized.
[0009] Optionally, determining the priority order of multiple recognition engines based on the image features of the target image includes:
[0010] Image sharpness is evaluated by the image gradient changes of the target image;
[0011] Edge detection is used to analyze the barcode features in the target image to predict the barcode type;
[0012] Determine the image size and pixel density of the target image;
[0013] Based on each recognition engine's ability to adapt to images of different resolutions, its ability to recognize barcode types, and its processing performance for image size and pixel density, the priority ranking of the multiple recognition engines is comprehensively determined.
[0014] Optionally, if the recognition result is a recognition failure, barcode recognition is performed according to a preset multi-level retry strategy and the priority order, including:
[0015] If the first recognition engine fails to recognize the object, then the failure type is determined.
[0016] If the failure type is an image quality defect, then the target image is initially enhanced in quality, and the first recognition engine is used again to perform barcode recognition on the image after the initial quality enhancement.
[0017] If the re-identification result of the first recognition engine still fails, then switch to the next intermediate recognition engine according to the priority order;
[0018] If the failure type of the intermediate recognition engine is an image quality defect, then a more complex quality enhancement operation than the previous quality enhancement operation is performed, and the next intermediate recognition engine is used to re-recognize the image after the complex enhancement operation.
[0019] If each intermediate recognition engine in the priority ranking fails to recognize the code, a fallback operation is performed, and then the final recognition engine is used to perform barcode recognition on the image after the final enhancement operation.
[0020] Optionally, performing quality enhancement operations that are more complex than the previous quality enhancement operation includes:
[0021] Sharpening image edges to improve image clarity, equalizing to improve image contrast to make image brightness uniform, increasing image brightness, rotating the barcode to make the barcode horizontally aligned, or relaxing the format restrictions of the barcode.
[0022] Optionally, if the recognition result of the first recognition engine is a recognition failure, after determining the failure type, the method further includes:
[0023] If the failure type of the first recognition engine and the intermediate recognition engine is an engine performance defect, then the recognition accuracy of the recognition engine is adjusted.
[0024] If recognition still fails after adjusting the recognition accuracy, then the step of switching to the next intermediate recognition engine according to the priority order is executed.
[0025] Optionally, after the fallback operation, the final enhanced image is then subjected to barcode recognition using an end-of-line recognition engine, including:
[0026] Morphological operations are used to enhance the barcode features in the target image;
[0027] All candidate barcode regions in the target image are determined by connected component analysis, and candidate barcode regions that meet the barcode characteristics are selected from the candidate barcode regions.
[0028] Each candidate barcode region is expanded to generate a cropped barcode region suitable for the end recognition engine;
[0029] The end recognition engine performs parallel recognition on each of the cut barcode regions and selects the barcode with the highest recognition confidence as the final recognized barcode.
[0030] Optionally, after identifying the barcode in the target image, the method further includes:
[0031] Based on the confirmation that the identified barcode is valid, the barcode is then processed for format standardization.
[0032] The standardized barcode is compared with the locally cached barcode list;
[0033] If it is determined that the barcode already exists in the local cache list, then the barcode record with higher quality is retained based on the barcode's recognition time and confidence level.
[0034] If the barcode does not appear in the local cache list, the backend server interface is called to perform a global duplicate check on the barcode.
[0035] Secondly, this application provides a barcode recognition device based on multi-engine fusion, the device comprising:
[0036] The determination module is used to determine the priority order of multiple recognition engines based on the image features of the target image, wherein different recognition engines have different performance in recognizing barcodes, and the priority order is matched with the image features;
[0037] The first recognition module is used to perform barcode recognition on the target image according to the first recognition engine in the priority order;
[0038] The second recognition module is used to perform barcode recognition according to a preset multi-level retry strategy and the priority sorting if the recognition result is recognition failure, until the barcode in the target image is recognized. The multi-level retry strategy is used to progressively enhance image quality and switch recognition engines to ensure that the barcode is recognized.
[0039] Thirdly, this application provides an electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus.
[0040] Fourthly, this application also provides a computer storage medium storing computer-executable instructions for executing the barcode recognition method based on multi-engine fusion described in any of the preceding claims of this application.
[0041] Compared with the prior art, the technical solution provided in this application has the following advantages: By determining the priority ranking of recognition engines based on the features of the target image, the engine most suitable for the current image is prioritized, improving the rationality of the recognition starting point. Then, the engine with the highest priority performs recognition first, giving full play to its targeted advantages and increasing the probability of successful recognition on the first attempt. When the first recognition engine fails, a multi-level retry strategy is used to progressively enhance image quality and switch engines, effectively compensating for the limitations of a single engine in dealing with complex situations. These three steps work together to ultimately avoid the problem of inaccurate recognition by a single engine on the terminal, improving the success rate of barcode recognition. Attached Figure Description
[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0043] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0045] Figure 1 A schematic diagram of a barcode recognition system based on multi-engine fusion provided for embodiments of this application;
[0046] Figure 2 A flowchart illustrating a barcode recognition method based on multi-engine fusion, provided for embodiments of this application;
[0047] Figure 3A schematic diagram of the overall process of barcode recognition based on multi-engine fusion provided for embodiments of this application;
[0048] Figure 4 A schematic diagram of the structure of a barcode recognition device based on multi-engine fusion provided in an embodiment of this application;
[0049] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0050] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0051] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of this application. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0052] Optionally, in the embodiments of this application, the above-described barcode recognition method based on multi-engine fusion can be applied to, for example... Figure 1 The hardware environment shown consists of terminal 101 and server 103. Figure 1 As shown, server 103 is connected to terminal 101 via a network. After terminal 101 identifies the barcode in the image based on multiple recognition engines, it performs local repeatability detection and then uploads the barcode to the server for global repeatability detection. Database 105 can be set up on the server or independently of the server to provide data storage services for server 103. The network mentioned above includes, but is not limited to, wide area network, metropolitan area network or local area network. Terminal 101 includes, but is not limited to, PC, mobile phone, tablet computer, etc.
[0053] The following will describe in detail a barcode recognition method based on multi-engine fusion provided in this application embodiment, taking its application to a terminal as an example. Figure 2 As shown, the specific steps are as follows:
[0054] Step 201: Determine the priority ranking of multiple recognition engines based on the image features of the target image. Different recognition engines have different performance in recognizing barcodes, and the priority ranking is matched with the image features.
[0055] Step 202: Perform barcode recognition on the target image according to the first recognition engine in the priority ranking;
[0056] Step 203: If the recognition result is recognition failure, barcode recognition is performed according to the preset multi-level retry strategy and priority sorting until the barcode in the target image is recognized. The multi-level retry strategy is used to progressively enhance image quality and switch recognition engines to ensure that the barcode is recognized.
[0057] In step 201, the terminal first preprocesses the acquired target image to improve image quality. The preprocessing process is as follows: 1. Perform image quality detection: check image resolution (minimum requirement 800*600 pixels to ensure barcode clarity); check file size (limited to 5MB to avoid processing timeout); check format support, including PNG, JPG, JPEG, WebP, etc. 2. Use Compressor.js for intelligent compression: set the quality parameter to 0.6 to optimize processing speed while ensuring recognition accuracy; compress images larger than 2MB while maintaining the aspect ratio. 3. Convert the file to BlobURL format using URL.createObjectURL(). The createObjectURL method creates a URL pointing to a File object or Blob object. This URL can be used directly in the browser, avoiding the memory overhead of converting the entire file content to a base64 string, which is particularly suitable for processing large images. The base64ToBlob function is used to standardize the format, the base64 data header is parsed to obtain the MIME type, the base64 string is decoded using atob(), a Uint8Array is created to store the binary data, and finally a standard Blob object is generated for the recognition engine to use.
[0058] The terminal then determines multiple recognition engines for barcode identification, with at least three engines: a primary recognition engine, at least one intermediate engine, and a final recognition engine. For example, there are three recognition engines: BarcodeDetector, ZXing-C++, and Quagga2. These engines differ in performance. BarcodeDetector is a high-performance WebAssembly-based engine with the highest accuracy for modern barcode formats and high-resolution images. ZXing-C++ is a C-compiled version of WebAssembly, offering the fastest speed for processing high-resolution images and strong fault tolerance for complex barcodes. Quagga2 is a traditional JavaScript-based engine with the widest compatibility, adapting to older devices and blurry images.
[0059] The terminal is also configured with barcode formats for each recognition engine to ensure that most barcode types can be recognized. For example, in the pharmaceutical field, the barcode formats supported by the recognition engine include: drug batch number, medical device identification, high-density data encoding, international commodity barcode, simplified commodity barcode, cross-25 code, and two-dimensional barcode.
[0060] Finally, the terminal performs a comprehensive analysis of the image features of the target image, including image clarity, barcode type, image size, and pixel density. Since different recognition engines have different performance characteristics, the terminal will construct a matching priority ranking based on the analyzed image features. By using feature matching, the recognition engine that is most suitable for the current image will work first, reducing the probability of recognition failure from the source and improving the success rate of the first recognition.
[0061] For example, the priority queue of the recognition engines is: BarcodeDetector > ZXing-C > Quagga2. The priority setting is based on the following considerations: BarcodeDetector has the latest algorithm optimization and the best recognition accuracy; ZXing-C++ has excellent performance when handling complex barcodes; Quagga2 serves as a fallback solution to ensure maximum compatibility.
[0062] In step 202, the terminal prioritizes and calls the top-ranked recognition engine to perform barcode recognition on the target image. This fully leverages the performance advantage of the top-ranked recognition engine under the corresponding image features, enabling recognition to be completed in a short time. Taking a priority order of BarcodeDetector > ZXing-C++ > Quagga2 as an example, if the target image is an EAN-13 product barcode (commonly found on pharmaceutical packaging) with sufficient light and a positive angle, the BarcodeDetector engine will be activated first to recognize the barcode.
[0063] In step 203, if the first-level recognition engine fails to recognize the code, for example, by returning an empty result or failing to locate the barcode, the system will trigger a preset multi-level retry strategy and continue the recognition process based on engine priority: First, the first-level retry is performed: targeted processing is applied to the failure type of the first-level recognition engine. If it is an engine parameter adaptation problem, the recognition accuracy parameters of the engine are adjusted and the recognition is re-recognized; if it is an image quality defect, basic enhancement processing (such as brightness adjustment and slight sharpening) is performed on the image, and the same engine is used for re-recognition. If the first-level retry still fails, the second-level retry is initiated: the system switches to the next intermediate recognition engine according to priority. If this engine fails to recognize the code, its own parameters are adjusted or the image quality is enhanced according to the failure type. The complexity of the image quality enhancement operation (such as adding rotation correction and depth noise reduction) is higher than that of the previous step. If all intermediate recognition engines fail to recognize the code, a fallback strategy is activated: the final recognition engine performs parallel recognition on multiple preset barcode areas, and finally selects the result with the highest confidence as the output.
[0064] This progressive adjustment mechanism can accurately address different failure causes, such as mismatched engine parameters, insufficient image clarity, and interference from complex environments. Even in extreme scenarios such as dim lighting and reflective packaging, it can still maintain a high barcode recognition success rate, effectively avoiding the limitations of a single engine or single recognition.
[0065] In this application, by determining the priority ranking of recognition engines based on the features of the target image, the engine most suitable for the current image is prioritized, improving the rationality of the recognition starting point. Then, the highest-priority engine performs recognition first, fully leveraging its targeted advantages and increasing the probability of successful initial recognition. When the first recognition engine fails, a multi-level retry strategy progressively enhances image quality and switches engines, effectively compensating for the limitations of a single engine in handling complex situations. These three steps work together to ultimately avoid the inaccuracy problem of a single engine on the terminal, improving the success rate of barcode recognition.
[0066] As an optional implementation, in step 201, determining the priority order of multiple recognition engines based on the image features of the target image includes the following:
[0067] Step S11: Evaluate image sharpness by measuring the image gradient changes of the target image;
[0068] Step S12: Use edge detection to analyze the barcode features in the target image and predict the barcode type;
[0069] Step S13: Determine the image size and pixel density of the target image;
[0070] Step S14: Based on the ability of each recognition engine to adapt to images of different resolutions, its ability to recognize barcode types, and its processing performance for image size and pixel density, the priority ranking of multiple recognition engines is determined comprehensively.
[0071] In step S11, the terminal evaluates the image sharpness by measuring the image gradient changes of the target image. Specifically, it uses the Laplacian operator to calculate the gradient variance; a larger value indicates a sharper image. This process categorizes images into three sharpness levels: high, medium, and low. This step provides a basis for priority ranking, allowing the subsequent selection of a recognition engine that is best suited to the current sharpness level. For example, engines that excel at processing high-resolution images are prioritized in images of the corresponding level, improving the initial matching accuracy.
[0072] In step S12, the terminal uses an edge detection algorithm to analyze the barcode features in the target image. By extracting the edge contours of the black and white stripes, calculating the stripe width ratio and arrangement pattern, it predicts the barcode type, such as Code128 or EAN-13. The purpose of this step is to prioritize engines that support the predicted barcode type and have high recognition accuracy, reducing failures caused by engines that do not support or have weak recognition capabilities for that type of barcode, and improving the first-time recognition success rate.
[0073] In step S13, the terminal determines the image size (such as pixel width and height) and pixel density (number of pixels per unit area) of the target image, and judges the amount of data and the richness of detail of the image accordingly. This provides a basis for matching the processing performance of the engines in the priority ranking, so that the engines that are more efficient in processing large-size, high-pixel-density images are ranked first, avoiding recognition delays or failures caused by insufficient engine processing capabilities.
[0074] In step S14, the terminal determines the priority ranking of multiple recognition engines based on their adaptability to images of different resolutions, their ability to recognize predicted barcode types, and their processing performance for the current image size and pixel density. This ranking prioritizes the engine best suited to the current image features, maximizing the probability of successful initial recognition. Simultaneously, it creates an orderly engine switching sequence, allowing for rapid switching to the next best-suited engine when the preferred engine fails, ensuring an efficient and orderly recognition process and avoiding resource waste caused by blind attempts.
[0075] This application prioritizes multiple recognition engines based on the image features of the target image. This prioritization is based on a comprehensive assessment of each engine's adaptability to different image features. After evaluating image clarity through image gradient changes, engines with better recognition efficiency for high-resolution images are given priority. Furthermore, by combining edge detection to predict the barcode type, engines supporting that type of barcode are prioritized. Finally, based on image size and pixel density, engines processing corresponding parameters are placed in the most suitable positions. The effects of this prioritization are: first, it improves the initial recognition success rate by prioritizing the engine best suited to the current image, reducing invalid recognitions; second, it achieves orderly degradation, switching to the next most suitable engine based on the priority when the priority engine fails, avoiding blind attempts; and third, it maximizes the advantages of each engine, allowing engines skilled in processing specific features to perform their respective tasks, thus improving the overall efficiency and reliability of barcode recognition.
[0076] As an optional implementation, in step 203, if the recognition result is a recognition failure, barcode recognition is performed according to a preset multi-level retry strategy and priority order, including the following:
[0077] Step S21: If the recognition result of the first recognition engine is recognition failure, then determine the failure type;
[0078] Step S22: If the failure type is image quality defect, perform preliminary quality enhancement on the target image and re-use the first recognition engine to perform barcode recognition on the image after preliminary quality enhancement;
[0079] Step S23: If the re-identification result of the first recognition engine still fails, switch to the next intermediate recognition engine according to priority.
[0080] Step S24: If the failure type of the intermediate recognition engine is image quality defect, then perform a more complex quality enhancement operation than the previous quality enhancement operation, and use the next intermediate recognition engine to re-recognize the image after the complex enhancement operation.
[0081] Step S25: If each intermediate recognition engine in the priority ranking fails to recognize the code, a fallback operation is performed, and then the final recognition engine is used to perform barcode recognition on the image after the final enhancement operation.
[0082] In step S21, if the recognition result of the first recognition engine is a failure, the failure type is accurately determined through the error classification mechanism, including engine performance defects (such as insufficient parameter adaptation or limited processing capability) and image quality defects (such as blurriness, abnormal brightness, or barcode format not supported).
[0083] In step S22, when the first recognition engine fails, the failure type is first determined through an error diagnosis mechanism. If the failure type is an engine performance defect (such as insufficient ability to parse complex barcodes, response timeout when processing high-resolution images, etc.), the recognition accuracy parameters of that engine are adjusted accordingly. For example, the scanning area is expanded to cover more barcode features, the recognition sensitivity threshold is lowered to reduce false positives, and the number of algorithm iterations is optimized to balance speed and accuracy. This adjustment is based on engine performance monitoring data and aims to compensate for its performance shortcomings through parameter adaptation, so that the engine can perform at its maximum efficiency under the original hardware conditions. After adjustment, the recognition process is restarted. If recognition is successful, the retry is terminated; if it still fails, it is automatically switched to the next intermediate recognition engine according to the preset priority.
[0084] If the failure type is determined to be an image quality defect (such as image blur, abnormal brightness, or reflection), a preliminary quality enhancement operation is performed on the target image. Preliminary quality enhancement may include basic brightness and contrast adjustments, light sharpening to enhance edge details, and simple noise reduction. These operations aim to quickly improve the basic image quality, making it more suitable for the recognition requirements of the first recognition engine. After preliminary enhancement, the first recognition engine is called back to perform barcode recognition on the processed image. The first recognition engine is chosen for reuse because it is the most suitable for the current image features in the priority ranking. If the failure is only due to minor image quality issues, this engine still has a high probability of successful recognition after preliminary enhancement, thus avoiding unnecessary engine switching and improving processing efficiency.
[0085] In step S23, if the first recognition engine still fails to recognize the image after initial image enhancement, it indicates that the image quality issue may exceed the processing range of the initial enhancement, or that the first engine has inherent limitations in the current scene. At this point, the system switches to the next intermediate recognition engine according to a preset priority order. Priority ordering ensures the orderly switching process. Each intermediate recognition engine typically has different advantages in handling specific image defects or barcode types; for example, it may be better at handling barcodes with large tilt angles or have better tolerance for moderately blurred images. By switching in an orderly manner, the characteristics of different engines can be fully utilized, increasing the likelihood of successful recognition.
[0086] In step S24, if the failure type of the intermediate recognition engine is engine performance defect, the same method as in step S22 is used to make targeted adjustments to the recognition accuracy parameters of the intermediate recognition engine. After adjustment, the recognition process is restarted. If the recognition is successful, the retry is terminated; if it still fails, the next intermediate recognition engine is automatically switched according to the preset priority.
[0087] If the failure type of the intermediate recognition engine is image quality defect, it indicates that deeper image optimization is needed. At this point, more complex quality enhancement operations are performed than the previous round, such as image rotation correction to ensure barcode horizontal alignment, histogram equalization to improve overall brightness distribution, and the application of more advanced deblurring algorithms. These operations can more thoroughly resolve the quality problems in the image. Simultaneously, the system switches to the next intermediate recognition engine for re-recognition. The next intermediate recognition engine is chosen because different engines have varying adaptability to images; the image after more complex enhancement may be better suited to the recognition logic of the next engine. Through a dual adjustment of engine characteristics and image optimization, the recognition success rate is further improved.
[0088] In step S25, if all intermediate recognition engines fail, it indicates that the current image is extremely difficult to recognize, and a fallback mechanism needs to be activated. First, a fallback operation is performed, specifying the barcode search area and cropping it to a size suitable for the final recognition engine, providing the best possible image conditions for recognition. Then, the final recognition engine, prioritized in the order of priority, is invoked to recognize the final enhanced image. The final recognition engine typically possesses the broadest compatibility and strongest fault tolerance, capable of handling extreme situations that other engines struggle with. As a last resort, it minimizes recognition failures and ensures that the barcode recognition task can still be completed to the best of its ability even in complex scenarios.
[0089] This application establishes an engine health check mechanism to periodically test the availability of each engine. Engines that fail to load or time out are automatically removed from the candidate engine list to ensure system stability.
[0090] In this application, a multi-level retry strategy with progressive adjustments and priority-based engine feature adaptation works synergistically: First, the first recognition engine is prioritized for retrying to leverage its adaptation advantages. Accurate failure type determination provides precise direction for subsequent processing, avoiding resource waste caused by blind retries. Then, for image quality defects, initial enhancement is performed and the first recognition engine is reused to fully utilize its adaptation advantages. Upon failure, intermediate recognition engines are switched according to priority, leveraging complementary engine features to expand the recognition range and increase the success probability. Next, progressive enhancement is performed on complex image quality issues, combined with intermediate engine switching to form an optimization-recognition loop, gradually resolving image interference. Finally, a fallback operation and the final recognition engine ensure recognition continuity in extreme scenarios. This application, through a synergistic strategy of accurate attribution, hierarchical optimization, orderly switching, and fallback protection, effectively compensates for the limitations of a single engine, improves the barcode recognition success rate in complex environments, and balances processing efficiency and scenario adaptability.
[0091] As an optional implementation, the terminal uses an exponential backoff algorithm during the intelligent retry process. When the barcode recognition fails for the first time, the system does not immediately attempt a second attempt, but sets a 100ms delay. This short interval can avoid instantaneous resource congestion caused by continuous retries, and also provide buffer time for background operations such as engine loading and image preprocessing.
[0092] If the first retry fails, the system will gradually increase the delay by a factor of n. For example, the second retry will have a delay of 200ms, the third 400ms, and the fourth 800ms. This exponentially increasing delay design reflects a precise consideration of the recognition scenario: initial recognition failures may be due to temporary environmental fluctuations (such as insufficient instantaneous computing power), and short-delay retries can quickly verify whether it is an occasional problem; as the number of retries increases, the cause of failure is more likely to involve image quality defects or engine adaptation issues. In this case, extending the interval allows the system more time for in-depth processing (such as switching engines and optimizing image parameters), while reducing the continuous occupation of device performance.
[0093] The algorithm strictly limits the maximum number of retries, a setting that fundamentally avoids the risk of infinite loops. On the one hand, after multiple attempts at different intervals, it can cover most repairable recognition problems (such as temporary network fluctuations or slight image blurring); on the other hand, if multiple retries fail, it often means that there is a core problem that cannot be solved by retries (such as severely damaged barcodes), and continuing to retries will only waste resources. This strategy ensures the effectiveness of retries, improves the recognition success rate in complex scenarios by dynamically adjusting the interval, and also takes into account the stability and resource efficiency of the system, achieving a precise balance between rapid response and reasonable overhead in the recognition process.
[0094] In this application, quality enhancement operations that are more complex than the previous quality enhancement operation include: sharpening image edges to improve image clarity, equalizing to improve image contrast to make image brightness uniform, increasing image brightness, rotating barcodes to make barcodes horizontally aligned, or relaxing barcode format restrictions.
[0095] If the failure type of the intermediate recognition engine is image quality defect, a comprehensive analysis is first performed using an image quality assessment algorithm: calculating the sharpness index (using the Laplacian operator to calculate the gradient variance, the larger the value, the sharper the image), analyzing the brightness distribution (calculating a histogram to determine if it is too dark or too bright), and detecting the proportion of the barcode area (using an edge detection algorithm to locate possible barcode areas). The next intermediate recognition engine performs more complex targeted adaptive enhancement processing than the previous round: applying a sharpening filter to enhance edges in low-resolution images, using histogram equalization to improve contrast in images with uneven brightness, and performing Gamma correction on overly dark images, with the gamma value automatically adjusted between 0.5 and 2.0 according to the brightness, using a value less than 1 to increase brightness when it is too dark. At the same time, Hough transform is used to detect straight lines, calculate tilt angles, and automatically rotate and correct to ensure horizontal alignment of the barcode. After enhancement, the system switches to the next intermediate recognition engine, utilizing its characteristics to re-identify the optimized image. Through the synergy between engine switching and image enhancement, the adaptability of different engines to the processed image is maximized, effectively improving the recognition success rate.
[0096] As an optional implementation, in step S25, after the fallback operation, the end-of-line recognition engine performs barcode recognition on the image after the final enhancement operation, including the following:
[0097] Step S251: Enhance the barcode features in the target image using morphological operations;
[0098] Step S252: Determine all candidate barcode regions in the target image through connected component analysis, and filter out candidate barcode regions that meet the barcode features from the candidate barcode regions;
[0099] Step S253: Expand the edges of each candidate barcode region to generate a cropped barcode region suitable for the end recognition engine;
[0100] Step S254: The end recognition engine performs parallel recognition on each cut barcode area and selects the barcode with the highest recognition confidence as the final recognized barcode.
[0101] In step S251, the terminal uses morphological operations to enhance the barcode features in the target image. Specifically, through a combination of opening and closing operations, the opening operation is first used to remove small noise, isolated pixels, and background interference attached to the barcode edges, avoiding misjudgments caused by these impurities in subsequent area detection. Then, the closing operation is used to fill in the tiny breaks inside the barcode stripes caused by blurry images or printing defects, making the black and white stripe boundaries of the barcode more continuous and the outline clearer, enhancing the contrast between the barcode and the background, and laying a high-quality image foundation for subsequent area localization.
[0102] In step S252, the terminal determines all candidate barcode regions in the target image through connected component analysis, and then filters out candidate barcode regions that meet the barcode characteristics from these regions. First, a connected component labeling algorithm is used to traverse the entire image, clustering pixels with similar pixel values (such as black stripes or white intervals in a barcode) into multiple independent candidate regions, recording the boundary coordinates, area, and pixel distribution characteristics of each region. Then, filtering is performed based on typical barcode characteristics: the aspect ratio of the regions is calculated, retaining regions with ratios between 3:1 and 10:1 (meeting the elongated stripe characteristics of most barcodes). Simultaneously, an edge detection algorithm is used to analyze whether there are obvious alternating black and white stripe patterns within the regions, eliminating solid color blocks or regions with irregular textures. Finally, candidate regions that are truly likely to be barcodes are determined, significantly narrowing the scope of subsequent recognition and reducing invalid calculations.
[0103] In step S253, the terminal expands the edges of each candidate barcode region to generate a cropped barcode region suitable for the edge recognition engine. For the boundary of each candidate region, a safety distance of 10-20 pixels is extended outwards to avoid truncation of the barcode edges due to region positioning deviations, ensuring complete preservation of the barcode's edge information. Simultaneously, based on the characteristics of the edge recognition engine, a cropped version of the appropriate size is generated while maintaining the barcode's aspect ratio, ensuring that the cropped barcode region focuses on the barcode body while also meeting the edge engine's processing requirements for images of corresponding resolutions.
[0104] In step S254, the end-of-line recognition engine performs parallel recognition on each cropped barcode region and selects the barcode with the highest recognition confidence as the final recognized barcode. The end-of-line recognition engine utilizes a multi-threaded parallel processing mechanism to perform recognition operations on all cropped regions simultaneously. It scores the recognition result of each region using a built-in barcode format verification algorithm, generating a confidence score from 0 to 100. After recognition, the system automatically compares the results of all regions, prioritizing the barcode content with the highest confidence. If results with similar confidence exist, its matching degree with the barcode format library is further verified, and finally, the most reliable barcode information is output.
[0105] In this application, morphological operations effectively eliminate background interference and barcode defects, while connected component analysis and feature filtering accurately locate the barcode region. Even in extreme cases with incomplete barcodes and cluttered backgrounds, it can still focus on the effective area, reducing invalid recognition. Edge expansion processing avoids the loss of edge information, and multi-size cropping adapts to the recognition characteristics of the end-point engine, solving the problem of recognition failure caused by region positioning deviation or unsuitable scaling. Parallel recognition fully utilizes the computing power of the end-point engine, shortening processing time.
[0106] As an optional implementation, after identifying the barcode in the target image, the method further includes the following:
[0107] Step S31: After confirming that the identified barcode is valid, perform format standardization processing on the barcode;
[0108] Step S32: Compare the standardized barcode with the locally cached barcode list;
[0109] Step S33: If it is determined that the barcode already exists in the local cache list, then based on the barcode's recognition time and confidence level, retain the barcode record with better quality;
[0110] Step S34: If the barcode does not appear in the local cache list, call the backend server interface to perform a global duplicate check on the barcode.
[0111] In step S31, after confirming the validity of the identified barcode, the terminal performs format standardization processing on the barcode. First, it calls a preset barcode format library, which includes various specifications such as general standard formats, industry-defined formats, and internationally recognized formats. A format recognition algorithm uses regular expressions to match different format patterns, and a check bit algorithm is used to verify the validity of the barcode. Simultaneously, an integrity check is performed: verifying whether the barcode length conforms to the specification, checking the legality of the character set, and calculating and verifying the check bit to ensure data accuracy. Finally, semantic parsing of the barcode is performed to extract structured data such as product category, production batch, and serial number, providing consistent standardized information for subsequent processing.
[0112] In step S32, the terminal compares the standardized barcode with the locally cached barcode list. The local caching mechanism uses localStorage to store the recognized barcode information, including the barcode value, recognition time, associated image, and confidence score, and sets a 24-hour cache expiration time to ensure data timeliness. During the comparison process, the system simultaneously uses both exact string matching and fuzzy matching strategies. Fuzzy matching allows for differences of 1-2 characters to handle minor errors that may occur during recognition.
[0113] In step S33, if it is determined through comparison that the barcode already exists in the local cache list, the conflict resolution mechanism is activated. The terminal will automatically compare the timestamps and confidence scores of the two recognitions, prioritizing the retention of the record with the more recent recognition time and higher confidence score. For cases where the confidence scores are close, a user confirmation interface will be triggered, displaying the images, times, and detailed parameters of the two recognitions for manual selection, and a conflict log will be synchronously recorded to the system to provide a basis for subsequent algorithm optimization.
[0114] In step S34, if the barcode does not appear in the local cache list, the terminal immediately calls the backend server's check Trace Code API to perform a global duplicate check. The local cache only covers the current user's identification records, while the server can retrieve historical data from the entire system, returning detailed information including associated users, timestamps, and related business records for conflicting barcodes. Global verification effectively avoids duplicate submissions across users, providing comprehensive reference for business decisions and ensuring the uniqueness and accuracy of barcode information.
[0115] In this application, to ensure that the system works stably on different devices and operating environments, it is first necessary to accurately identify the current operating environment and formulate corresponding adaptation strategies. The specific steps are as follows.
[0116] 1. Runtime Environment Detection: A dedicated environment detection function was developed to obtain the browser type (such as Chrome, Safari, Firefox, etc.) and specific version through navigator.userAgent to determine the browser's functional support level; window.__wxjs_environment was used to detect whether the current environment is a WeChat Mini Program, because the running restrictions of Mini Programs differ from those of ordinary browsers; at the same time, feature detection was used to determine whether the device supports WebAssembly technology, which is a key dependency for the efficient operation of the ZXing-C++ engine.
[0117] 2. Engine compatibility matrix construction: Clarify the operating conditions of each recognition engine. For example, BarcodeDetector depends on modern browsers and requires Chrome 83 and above, Safari 14 and above, and Firefox 82 and above; ZXing-C++ can only run in an environment that supports WebAssembly; Quagga2 has the widest compatibility and can work on low-version browsers and older devices, but its recognition performance is relatively low.
[0118] 3. Adaptive Engine Selection: Based on the environmental detection results, the system automatically selects the engines available in the current environment. For example, on older devices that do not support WebAssembly, ZXing-C++ will be automatically excluded, and only Quagga2 will be retained as the recognition engine; while on high-performance devices (such as smartphones with modern browsers), the more efficient BarcodeDetector and ZXing-C++ will be prioritized to fully utilize the device's performance.
[0119] 4. Polyfill mechanism: For necessary APIs that are missing in some environments (such as URL.createObjectURL not being supported by some browsers), alternative implementations (polyfills) are provided to ensure that core functions such as image processing and engine calls are not affected by environmental differences, thus ensuring the consistency of the system's basic functions.
[0120] To simplify the calling logic of upper-layer applications and improve the fault tolerance of the system, it is necessary to implement a unified interface specification and a standardized error handling mechanism, including the following:
[0121] 1. Unified Recognition Interface Design: This design encapsulates the underlying differences between various engines, providing a unified calling interface to the upper layers. The interface's input parameters are standardized to image data (e.g., Blob format or base64 string) and recognition options (e.g., target barcode type). The output format is fixed, containing key information such as traceability code content, recognition confidence level, and processing time. This design eliminates the need for upper-layer applications to concern themselves with the specific engine's calling details, reducing development complexity.
[0122] 2. Error Standardization Processing: Convert error messages returned by various engines (such as BarcodeDetector's format not supported, Quagga2's positioning failure) into a unified format, including error codes (such as 1001 representing a format error), error descriptions (such as the current environment not supporting this barcode type), and suggested solutions (such as trying to adjust the shooting angle and then retrying), so that upper-layer applications can use unified logic to provide error prompts or handle them automatically.
[0123] 3. Performance Monitoring and Optimization: The system records key performance indicators for each recognition operation in real time, including processing time, recognition success rate, error type and distribution, etc. It periodically analyzes this data and automatically optimizes parameter configurations. For example, it reduces image preprocessing intensity on devices with excessively long recognition times and increases the number of retries in scenarios with high error rates, ensuring the system maintains high efficiency in various environments.
[0124] 4. Ultimate Degradation Strategy: When all recognition engines fail to complete the recognition (e.g., severely damaged barcodes or extremely harsh environments), the system will trigger a manual input mechanism, guiding the user to manually fill in the traceability code and automatically verifying the format of the input (e.g., checking whether it conforms to the 20-digit alphanumeric drug traceability code specification). This ensures that even in the event of recognition failure, business processes (e.g., drug traceability, claims review) can continue, avoiding process interruption.
[0125] Through the above process, the cross-platform compatibility and adaptation module can adapt to different operating environments and ensure the ease of use and stability of the system through a unified interface and fault tolerance mechanism, providing users with a consistent recognition experience.
[0126] This application provides a schematic diagram of the overall process of barcode recognition based on multi-engine fusion, such as... Figure 3 As shown, the steps include the following.
[0127] Step 301: Initialize the multi-engine recognition architecture and priority sorting.
[0128] A recognition system is constructed, which includes a first recognition engine, multiple intermediate recognition engines, and a final recognition engine. Priority ranking is established for each engine, with the first recognition engine being the optimal adaptation choice, the intermediate recognition engines being ranked in order of their adaptation capabilities, and the final recognition engine serving as a backup guarantee.
[0129] Step 302: Image preprocessing and standardization.
[0130] After receiving the target image, the system detects the image resolution, file size, and format, and optimizes the image through intelligent compression and format conversion to provide standardized input for recognition.
[0131] Step 303: Perform initial identification according to priority.
[0132] The first recognition engine is invoked to recognize the preprocessed image. If successful, the result is output; if it fails, the intelligent retry mechanism is triggered.
[0133] The multi-level intelligent retry process includes steps 304 to 307.
[0134] Step 304: First layer: Retry with the same engine.
[0135] If the failure type is an engine performance defect, the recognition accuracy is adjusted (the scanning area is enlarged, and the sensitivity threshold is adjusted). If the failure type is an image instruction defect, the image is initially enhanced (brightness adjustment, slight sharpening, etc.). After adjustment, the same engine is used to re-recognize the barcode. If the retry fails, the second retry is performed.
[0136] Step 305: Second layer: Engine switching and retry.
[0137] The system switches to the next intermediate recognition engine based on priority. If the failure type of an intermediate recognition engine is engine performance defect, the recognition accuracy of that engine is adjusted. If the failure type is image quality defect, more complex enhancement operations (histogram equalization, rotation correction, etc.) are performed. After adjustment, the same engine is used to re-recognize the barcode. If each intermediate recognition engine fails to retry, the system enters the third layer for retry.
[0138] Step 306: Third layer: End engine bottom-up identification.
[0139] If all intermediate recognition engines fail, the terminal recognition engine is enabled. Morphological operations (opening operation for noise reduction and closing operation for stripe completion) are performed on the image to enhance barcode features, locate all candidate barcode regions and generate adapted cropped versions, and select the result with the highest confidence after parallel recognition.
[0140] Step 307: Result verification and standardization.
[0141] After successful recognition, the barcode is format-verified and check the position. After standardization, it is compared with the local cache to detect duplicates and retain high-quality records. If necessary, the server interface is called to perform a global duplicate check.
[0142] This application maximizes the advantages of each engine by prioritizing them and improves the recognition success rate in complex environments by combining multi-level intelligent retries.
[0143] This application provides a barcode recognition device based on multi-engine fusion, such as... Figure 4 As shown, the device includes:
[0144] The determining module 401 is used to determine the priority order of multiple recognition engines based on the image features of the target image. Different recognition engines have different performance in recognizing barcodes, and the priority order is matched with the image features.
[0145] The first recognition module 402 is used to perform barcode recognition on the target image according to the first recognition engine in the priority order;
[0146] The second recognition module 403 is used to perform barcode recognition according to a preset multi-level retry strategy and priority sorting if the recognition result is recognition failure, until the barcode in the target image is recognized. The multi-level retry strategy is used to progressively enhance image quality and switch recognition engines to ensure that the barcode is recognized.
[0147] Optionally, the determining module 401 is used for:
[0148] Image sharpness is assessed by measuring the image gradient changes of the target image.
[0149] Edge detection is used to analyze barcode features in the target image to predict the barcode type;
[0150] Determine the image size and pixel density of the target image;
[0151] Based on each recognition engine's ability to adapt to images of different resolutions, its ability to recognize barcode types, and its processing performance for image size and pixel density, the priority ranking of multiple recognition engines is determined comprehensively.
[0152] Optionally, the second identification module 403 is used for:
[0153] If the first recognition engine fails to recognize the object, then the failure type is determined.
[0154] If the failure type is image quality defect, then perform preliminary quality enhancement on the target image, and re-use the first recognition engine to perform barcode recognition on the image after preliminary quality enhancement;
[0155] If the re-identification result of the first recognition engine still fails, then switch to the next intermediate recognition engine according to priority.
[0156] If the failure type of the intermediate recognition engine is image quality defect, then a more complex quality enhancement operation than the previous quality enhancement operation is performed, and the next intermediate recognition engine is used to re-recognize the image after the complex enhancement operation.
[0157] If each intermediate recognition engine in the priority ranking fails to recognize the code, a fallback operation is performed, and then the final recognition engine is used to perform barcode recognition on the image after the final enhancement operation.
[0158] Optionally, the device is also used for:
[0159] Sharpening image edges to improve image clarity, equalizing to improve image contrast to make image brightness uniform, increasing image brightness, rotating barcodes to make barcodes horizontally aligned, or relaxing barcode format restrictions.
[0160] Optionally, the device is also used for:
[0161] If the failure type of the first recognition engine and the intermediate recognition engine is engine performance defect, then adjust the recognition accuracy of the recognition engine.
[0162] If recognition still fails after adjusting the recognition accuracy, then proceed with the step of switching to the next intermediate recognition engine based on priority.
[0163] Optionally, the second identification module 403 is specifically used for:
[0164] Morphological operations are used to enhance barcode features in the target image;
[0165] All candidate barcode regions in the target image are determined by connected component analysis, and candidate barcode regions that meet the barcode characteristics are selected from the candidate barcode regions.
[0166] Each candidate barcode region is expanded to generate a cropped barcode region suitable for the end recognition engine;
[0167] The end-of-line recognition engine performs parallel recognition on each cut barcode area and selects the barcode with the highest recognition confidence as the final recognized barcode.
[0168] Optionally, the device is also used for:
[0169] Once the identified barcode is confirmed to be valid, the barcode is standardized in format.
[0170] The standardized barcode is compared with the locally cached barcode list;
[0171] If it is determined that the barcode already exists in the local cache list, then the barcode record with higher quality is retained based on the barcode's recognition time and confidence level.
[0172] If the barcode does not appear in the local cache list, the backend server interface is called to perform a global duplicate check on the barcode.
[0173] like Figure 5 As shown, this application provides an electronic device including a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.
[0174] Memory 503 is used to store computer programs.
[0175] In one embodiment of this application, the processor 501, when executing the program stored in the memory 503, implements the barcode recognition method based on multi-engine fusion provided in any of the foregoing method embodiments.
[0176] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the barcode recognition method based on multi-engine fusion as provided in any of the foregoing method embodiments.
[0177] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0178] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0179] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0180] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A barcode recognition method based on multi-engine fusion, characterized in that, The method includes: The priority ranking of multiple recognition engines is determined based on the image features of the target image. Different recognition engines have different performance in recognizing barcodes, and the priority ranking is matched with the image features. The target image is barcode recognized according to the first recognition engine in the priority ranking; If the recognition result is a recognition failure, the barcode recognition is performed according to the preset multi-level retry strategy and the priority sorting until the barcode in the target image is recognized. The multi-level retry strategy is used to progressively enhance image quality and switch recognition engines to ensure that the barcode is recognized. If the identification result is a failure, the barcode identification is performed according to the preset multi-level retry strategy and the priority sorting, including: If the first recognition engine fails to recognize the object, then the failure type is determined. If the failure type is an image quality defect, then the target image is initially enhanced in quality, and the first recognition engine is used again to perform barcode recognition on the image after the initial quality enhancement. If the re-identification result of the first recognition engine still fails, then switch to the next intermediate recognition engine according to the priority order; If the failure type of the intermediate recognition engine is an image quality defect, then a more complex quality enhancement operation than the previous quality enhancement operation is performed, and the next intermediate recognition engine is used to re-recognize the image after the complex enhancement operation. If each intermediate recognition engine in the priority ranking fails to recognize the code, a fallback operation is performed, and then the final recognition engine is used to perform barcode recognition on the image after the final enhancement operation.
2. The method according to claim 1, characterized in that, Determining the priority ranking of multiple recognition engines based on the image features of the target image includes: Image sharpness is evaluated by the image gradient changes of the target image; Edge detection is used to analyze the barcode features in the target image to predict the barcode type; Determine the image size and pixel density of the target image; Based on each recognition engine's ability to adapt to images of different resolutions, its ability to recognize barcode types, and its processing performance for image size and pixel density, the priority ranking of the multiple recognition engines is comprehensively determined.
3. The method according to claim 1, characterized in that, More complex quality enhancement operations than the previous one include: Sharpening image edges to improve image clarity, equalizing to improve image contrast to make image brightness uniform, increasing image brightness, rotating the barcode to make the barcode horizontally aligned, or relaxing the format restrictions of the barcode.
4. The method according to claim 1, characterized in that, If the recognition result of the first recognition engine is a recognition failure, after determining the failure type, the method further includes: If the failure type of the first recognition engine and the intermediate recognition engine is an engine performance defect, then the recognition accuracy of the recognition engine is adjusted. If recognition still fails after adjusting the recognition accuracy, then the step of switching to the next intermediate recognition engine according to the priority order is executed.
5. The method according to claim 1, characterized in that, After the fallback operation, the final enhanced image is then processed by an end-of-line recognition engine for barcode recognition, including: Morphological operations are used to enhance the barcode features in the target image; All candidate barcode regions in the target image are determined by connected component analysis, and candidate barcode regions that meet the barcode characteristics are selected from the candidate barcode regions. Each candidate barcode region is expanded to generate a cropped barcode region suitable for the end recognition engine; The end recognition engine performs parallel recognition on each of the cut barcode regions and selects the barcode with the highest recognition confidence as the final recognized barcode.
6. The method according to claim 1, characterized in that, After identifying the barcode in the target image, the method further includes: Based on the confirmation that the identified barcode is valid, the barcode is then processed for format standardization. The standardized barcode is compared with the locally cached barcode list; If it is determined that the barcode already exists in the local cache list, then the barcode record with higher quality is retained based on the barcode's recognition time and confidence level. If the barcode does not appear in the local cache list, the backend server interface is called to perform a global duplicate check on the barcode.
7. A barcode recognition device based on multi-engine fusion, characterized in that, The device includes: The determination module is used to determine the priority order of multiple recognition engines based on the image features of the target image, wherein different recognition engines have different performance in recognizing barcodes, and the priority order is matched with the image features; The first recognition module is used to perform barcode recognition on the target image according to the first recognition engine in the priority order; The second recognition module is used to perform barcode recognition according to a preset multi-level retry strategy and the priority sorting if the recognition result is recognition failure, until the barcode in the target image is recognized. The multi-level retry strategy is used to progressively enhance image quality and switch recognition engines to ensure that the barcode is recognized. The second identification module is used for: If the first recognition engine fails to recognize the object, then the failure type is determined. If the failure type is an image quality defect, then the target image is initially enhanced in quality, and the first recognition engine is used again to perform barcode recognition on the image after the initial quality enhancement. If the re-identification result of the first recognition engine still fails, then switch to the next intermediate recognition engine according to the priority order; If the failure type of the intermediate recognition engine is an image quality defect, then a more complex quality enhancement operation than the previous quality enhancement operation is performed, and the next intermediate recognition engine is used to re-recognize the image after the complex enhancement operation. If each intermediate recognition engine in the priority ranking fails to recognize the code, a fallback operation is performed, and then the final recognition engine is used to perform barcode recognition on the image after the final enhancement operation.
8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method of any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-6.