Two-dimensional code recognition method and device based on image preprocessing

Through image preprocessing technology, including morphological operation, contour detection and local feature matching, the difficulty of identifying traditional QR code recognition in occlusion environment is solved, and the stability and accuracy of QR code recognition under complex conditions is achieved. promote.

CN119323225APending Publication Date: 2025-01-17苏州旗开得电子科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411433404.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2025-01-17

AI Technical Summary

Technical Problem

The traditional DataMatrix code recognition method is difficult to accurately detect and decode under occlusion of solder joints, patch components, etc., resulting in a decrease in production efficiency and traceability impact. It is urgently needed to accurately identify QR codes in an occlusion environment.

Method used

Using an image preprocessing method, image morphological operations, contour detection and texture difference analysis are carried out by scanning and positioning the QR code area, effective and abnormal areas are extracted, local feature matching and repair, and finally the QR code identification and decoding.

Benefits of technology

In noise and occlusion environments, the robustness and accuracy of QR code recognition are significantly improved, and the read stability and accuracy in production environments are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119323225A_ABST
    Figure CN119323225A_ABST
Patent Text Reader

Abstract

The invention relates to a two-dimensional code recognition method and device based on image preprocessing. The method comprises the steps that after a target image is acquired, some fine edge noise is removed through morphological operation, then an effective area and an abnormal area are extracted by using a contour detection technology in combination with texture difference, local feature matching is performed on the effective area and the abnormal area, the abnormal area is repaired based on a matching result, and the target image is obtained. And finally, identifying and decoding the repaired image to obtain unique identification information corresponding to the two-dimensional code to be identified. According to the invention, before the two-dimensional code is identified, the image processing technology is utilized to carry out abnormity repair on the damaged two-dimensional code, so that the content of the two-dimensional code can still be accurately identified under the complicated conditions of noise, shielding and damage, the robustness of two-dimensional code identification is improved, and the reading accuracy and stability of the two-dimensional code in a production environment are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of image processing and pattern recognition, and in particular to a two-dimensional code recognition method and device based on image preprocessing. Background Art

[0002] In the manufacturing process of electronic products, DataMatrix codes are usually printed on PCB (Printed Circuit Board) to identify the unique number of each product. DataMatrix code is a matrix two-dimensional barcode. Its biggest feature is its high density. Its minimum size is the smallest code among all barcodes, so it is particularly suitable for small parts identification, product anti-counterfeiting, circuit identification, etc.

[0003] However, in the production process, DataMatrix codes on PCBs are often blocked by objects such as solder joints and surface mount components, making it difficult for traditional DataMatrix code recognition methods to accurately detect and decode these marks. Traditional methods rely on complete, interference-free images and usually cannot work effectively in the case of occlusion or noise interference. This limitation not only affects product traceability, but may also lead to reduced production efficiency. Therefore, there is an urgent need to develop a new recognition method that can accurately identify dot-shaped DataMatrix codes on objects with QR codes in an occluded environment. Summary of the invention

[0004] Based on this, it is necessary to provide a two-dimensional code recognition method and device based on image preprocessing that can improve the stability of two-dimensional code recognition in order to address the above technical problems.

[0005] In a first aspect, the present application provides a two-dimensional code recognition method based on image preprocessing. The method comprises:

[0006] Scan the object with the QR code and locate the area where the QR code to be identified is located to obtain the target image;

[0007] Performing image morphological operation on the target image to obtain a first image;

[0008] Performing contour detection on the first image, and extracting valid areas and abnormal areas in combination with texture differences;

[0009] Performing local feature matching on the valid area and the abnormal area, repairing the abnormal area based on the local feature matching result of the valid area and the abnormal area, and acquiring a second image;

[0010] The second image is identified and decoded to obtain unique identification information corresponding to the two-dimensional code to be identified.

[0011] In one embodiment, scanning and locating the area where the to-be-recognized two-dimensional code is located and acquiring the target image includes:

[0012] Select a standard template corresponding to the QR code to be identified, use a normalized cross-correlation matching algorithm to search for an area matching the standard template on the scanned object image with the QR code, and obtain the area where the QR code to be identified is located;

[0013] Crop the area where the QR code to be identified is located to obtain the target image.

[0014] In one embodiment, a normalized cross-correlation matching algorithm is used to search for an area matching a standard template on a scanned object image with a two-dimensional code, and the area where the two-dimensional code to be identified is located includes:

[0015] A multi-scale matching algorithm combined with a normalized cross-correlation matching algorithm is introduced to search for the area matching the standard template on the scanned object image with a QR code to obtain the area where the QR code to be identified is located.

[0016] In one embodiment, after acquiring the first image, the method further comprises:

[0017] The first image is denoised using Gaussian filtering.

[0018] In one embodiment, identifying and decoding the second image to obtain unique identification information corresponding to the to-be-identified two-dimensional code includes:

[0019] Extract the ROI region of the second image to obtain the ROI region corresponding to the QR code to be identified;

[0020] The ROI area is decoded using a decoding algorithm corresponding to the two-dimensional code to be identified, and unique identification information corresponding to the two-dimensional code to be identified is obtained.

[0021] In one embodiment, after obtaining the ROI area, the method further includes:

[0022] Perform geometric correction on the extracted ROI area.

[0023] In a second aspect, the present application also provides a two-dimensional code recognition device based on image preprocessing. The device comprises:

[0024] A positioning module is used to scan an object with a QR code and locate the area where the QR code to be identified is located to obtain a target image;

[0025] A first processing module, used for performing image morphological operation on the target image to obtain a first image;

[0026] A second processing module is used to perform contour detection on the first image and extract valid areas and abnormal areas in combination with texture differences;

[0027] A third processing module is used to perform local feature matching on the valid area and the abnormal area, and repair the abnormal area based on the local feature matching result of the valid area and the abnormal area to obtain a second image;

[0028] The decoding module is used to identify and decode the second image to obtain unique identification information corresponding to the two-dimensional code to be identified.

[0029] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned two-dimensional code recognition method based on image preprocessing when executing the computer program.

[0030] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps in the above-mentioned two-dimensional code recognition method based on image preprocessing when executed by a processor.

[0031] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned two-dimensional code recognition method based on image preprocessing are implemented.

[0032] The above-mentioned two-dimensional code recognition method and device based on image preprocessing, after acquiring the target image, first removes some fine edge noise through morphological operations, then uses contour detection technology combined with texture differences to extract valid areas and abnormal areas, then performs local feature matching on the valid areas and abnormal areas, repairs the abnormal areas based on the matching results, and finally recognizes and decodes the repaired image to obtain the unique identification information corresponding to the two-dimensional code to be recognized. The present invention uses image processing technology to perform abnormal repair on damaged two-dimensional codes before recognizing the two-dimensional code, so that the content of the two-dimensional code can still be accurately recognized in complex situations with noise, occlusion and damage, thereby improving the robustness of two-dimensional code recognition and significantly improving the reading accuracy and stability of two-dimensional codes in production environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of a flow chart of a two-dimensional code recognition method based on image preprocessing in one embodiment;

[0034] Figure 2 A schematic diagram of a flow chart of a two-dimensional code recognition method based on image preprocessing in another embodiment;

[0035] Figure 3 It is a structural block diagram of a two-dimensional code recognition device based on image preprocessing in one embodiment. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0037] The present application embodiment provides a two-dimensional code recognition method based on image preprocessing, such as Figure 1 As shown, the following steps are included:

[0038] Step 102 , scan an object with a QR code and locate the area where the QR code to be identified is located to obtain a target image.

[0039] Among them, objects with QR codes include physical objects, images, etc. Taking the DataMatrix code on the PCB as an example, the PCB can be scanned directly, or the image of the PCB with the DataMatrix code can be scanned. Use a camera, scanner or other device to scan the object with the QR code, locate the area where the QR code to be identified is located, cut out the area, and obtain the target image.

[0040] Step 104: Perform image morphological operations on the target image to obtain a first image.

[0041] Morphological operation is a processing technique based on image shape, which can extract the basic shape features of the image and is very important for image understanding. Morphological operations include erosion, dilation, opening operation, closing operation, morphological gradient, top hat and black hat, etc. Erosion and dilation are the most basic morphological operations, which are usually combined to achieve more complex image morphological operations.

[0042] This embodiment uses morphological operations to process the target image, connect or remove some small edge noises, and facilitate subsequent further image processing.

[0043] In this embodiment, the morphological operation is implemented based on the grayscale image. Therefore, before the morphological operation is performed on the target image, grayscale processing must be performed first to convert the color image into a grayscale image, and then the grayscale morphological operation is performed on the grayscale target image.

[0044] Step 106: perform contour detection on the first image, and extract valid areas and abnormal areas in combination with texture differences.

[0045] Contour detection technology is used to detect possible occlusions, damages and other abnormal areas in the first image, and separate them from the DataMatrix code. At the same time, Gabor filtering is used to further accurately locate occlusions, damages and other abnormal areas based on texture differences.

[0046] In this embodiment, the contour detection technology can find the contour information of the target by detecting the area with large gray value changes in the image, and separate the abnormal area from the DataMatrix code. The remaining DataMatrix code part is the valid area. Gabor filtering is a linear filter used for edge extraction. Its frequency and direction expression are similar to the human visual system. It can provide good direction selection and scale selection characteristics, and is insensitive to changes in illumination. Therefore, it is very suitable for texture analysis. The contour detection technology is combined with Gabor filtering to achieve accurate positioning and separation of abnormal areas.

[0047] Step 108: perform local feature matching on the valid area and the abnormal area, and repair the abnormal area based on the local feature matching result of the valid area and the abnormal area to obtain a second image.

[0048] In the process of image restoration, it is very important to understand the characteristics and structure of the valid area around the abnormal area. Through local feature matching, we can find the relationship between the abnormal area and the surrounding valid area. Specifically, the matched features can help us obtain the texture, color and shape information of the valid area, so as to infer how the abnormal area should be filled.

[0049] In image restoration, maintaining the overall consistency of the image is key. By matching the features of the valid and abnormal areas, it can be ensured that the feature information used can be effectively fused together. This method helps to ensure the naturalness of the interpolated image and avoids generating unreasonable or abrupt image content.

[0050] In this embodiment, the local feature matching method can adopt ORB (Oriented FAST and RotatedBRIEF) technology, and the method for repairing the abnormal area can adopt interpolation method to fill or repair the missing or damaged part in the second image.

[0051] After image repair, the integrity of the target image is restored, and interference is removed and reduced, which can improve the success rate of subsequent QR code decoding. At the same time, under production conditions, there are common problems such as uneven lighting and complex backgrounds. The contrast of the QR code may not be obvious enough. The repair operation can enhance the brightness and contrast of the image, making the QR code boundary clearer, thereby helping the decoder to better recognize it. If the image quality is poor, the decoding algorithm needs to perform more calculations and processing, which may slow down the recognition speed. Pre-repairing the image can reduce unnecessary calculations in subsequent processing and increase the decoding speed.

[0052] Step 110: Identify and decode the second image to obtain unique identification information corresponding to the two-dimensional code to be identified.

[0053] In one embodiment, scanning and locating the area where the to-be-recognized two-dimensional code is located and acquiring the target image includes:

[0054] A standard template corresponding to the QR code to be identified is selected, and a normalized cross-correlation matching algorithm is used to search for an area matching the standard template on the scanned object image with the QR code to obtain the area where the QR code to be identified is located; the area where the QR code to be identified is cropped to obtain the target image.

[0055] In this embodiment, the normalized cross-correlation (NCC) is used to achieve feature matching or template matching by calculating the similarity between two image regions. The basic principle of the normalized cross-correlation algorithm is to determine the similarity between two regions by comparing their intensity distributions at different positions. Since the normalized cross-correlation calculates the normalized correlation coefficient, it effectively eliminates the influence of brightness and contrast changes, and when the standard template matches the target image well, it can achieve high-precision position detection.

[0056] In this embodiment, a standard template corresponding to the two-dimensional code to be identified is selected. For example, a standard template corresponding to the DR code is selected for the DR code, and a standard template corresponding to the DataMatrix code is selected for the DataMatrix code.

[0057] In one embodiment, a normalized cross-correlation matching algorithm is used to search for an area that matches a standard template on a scanned image of an object with a two-dimensional code, and obtaining the area where the two-dimensional code to be identified is located includes: introducing a multi-scale matching algorithm combined with a normalized cross-correlation matching algorithm to search for an area that matches a standard template on a scanned image of an object with a two-dimensional code, and obtaining the area where the two-dimensional code to be identified is located.

[0058] The multi-scale matching algorithm is a method for image matching and object detection. Its basic idea is to extract and match image features at different scales (or resolutions) to improve the accuracy and robustness of matching. This method is particularly suitable for scenes where the size of objects changes or there is a scaling transformation.

[0059] In order to deal with the possible scaling and rotation changes of the QR code on the PCB board, this embodiment introduces a multi-scale matching algorithm. By adjusting the size and angle of the template, the position of the QR code is further accurately located. This step ensures that the QR code can still be effectively detected even at various angles and scaling conditions.

[0060] In one embodiment, after acquiring the first image, the method further includes: performing denoising processing on the first image using Gaussian filtering.

[0061] Gaussian filtering reduces high-frequency noise and retains low-frequency information in the first image by convolving the first image with a Gaussian kernel (ie, Gaussian function), that is, retaining the main structure and texture in the image.

[0062] In one embodiment, identifying and decoding the second image to obtain unique identification information corresponding to the two-dimensional code to be identified includes: extracting the ROI area of ​​the second image to obtain the ROI area corresponding to the two-dimensional code to be identified; decoding the ROI area using a decoding algorithm corresponding to the two-dimensional code to be identified to obtain unique identification information corresponding to the two-dimensional code to be identified.

[0063] ROI (Region of Interest) refers to a specific area of ​​interest that users or algorithms focus on in image processing and computer vision. The use of ROI can significantly improve processing efficiency, especially when processing large-size images or when focusing on a specific part of the image. The ROI area can be manually selected by the user according to the needs, or the ROI area can be automatically detected and selected using image processing algorithms (such as edge detection, connected region analysis, classifiers, etc.).

[0064] After obtaining the ROI area corresponding to the two-dimensional code to be identified, the ROI area is decoded using a specific decoding algorithm to obtain unique identification information corresponding to the two-dimensional code to be identified, for example, the DataMatrix code corresponds to the DataMatrix code decoding algorithm.

[0065] In one embodiment, after acquiring the ROI region, the method further includes: performing geometric correction on the extracted ROI region.

[0066] This embodiment corrects the deformation caused by the shooting angle or the bending of the PCB board through geometric correction, ensures that the shape of the DataMatrix code is consistent with the standard code, and improves the decoding calculation speed and calculation accuracy.

[0067] In one embodiment, for DataMatrix code, such as Figure 2 As shown, the two-dimensional code recognition method based on image preprocessing includes the following steps:

[0068] S1. Multi-target matching and DataMatrix code positioning

[0069] (1) Select the standard template of the DataMatrix code on the PCB board and use the normalized cross-correlation template matching algorithm to search in the PCB board image. This algorithm locates the approximate position of the DataMatrix code by calculating the correlation between the image block and the template image.

[0070] (2) To cope with the possible scaling and rotation changes of the DataMatrix code on the PCB board, multi-scale matching technology is used. By adjusting the size and angle of the template, the position of the DataMatrix code can be further accurately located.

[0071] S2. DataMatrix code preprocessing

[0072] (1) Grayscale processing: Grayscale the acquired DataMatrix code image and convert the color image into a grayscale image to simplify the subsequent processing steps.

[0073] (2) Filtering and denoising: Use Gaussian filtering to denoise the image to reduce noise interference in the image and enhance the image quality.

[0074] (3) Occlusion processing: When the DataMatrix code is partially occluded, morphological operations are first performed to connect or remove some fine edge noise. Second, contour detection technology is used to detect possible occluders in the image and separate them from the DataMatrix code itself. Gabor filtering is used to further accurately locate the occluders based on texture differences. Finally, the ORB local feature matching algorithm is used to find the correspondence between the occluded area and the unoccluded area, and interpolation and repair based on the features of the surrounding unoccluded areas are used to obtain the complete DataMatrix code.

[0075] S3. Identify DataMatrix code

[0076] (1) ROI extraction: Based on the results of target matching and preprocessing, the ROI (Region of Interest) where the DataMatrix code is located is extracted.

[0077] (2) Geometric correction: Perform geometric correction on the extracted ROI area to correct the deformation caused by the shooting angle or the bending of the PCB board, ensuring that the shape of the DataMatrix code is consistent with the standard code.

[0078] (3) Code recognition and decoding: Use the DataMatrix code decoding algorithm to recognize and decode the corrected DataMatrix code and output the decoded unique identification information.

[0079] Traditional QR code recognition methods have the following limitations:

[0080] (1) They usually rely on a complete and undisturbed image environment and cannot effectively handle complex situations such as occlusion, damage, or noise. In addition, traditional methods are prone to unstable or failed recognition when dealing with changes such as scaling and rotation.

[0081] (2) Influence of noise and light: Existing recognition algorithms are prone to misrecognition in environments with noise interference, blurred images, or uneven lighting. They have poor stability and the reliability of recognition results cannot be guaranteed.

[0082] (3) Lack of universality: Existing identification methods are often designed for specific production processes or specific QR codes and cannot adapt to the application of different types of PCB boards. As the production environment becomes more diverse and complex, the universality of traditional methods has great limitations.

[0083] In view of the above problems, the present invention has the following advantages:

[0084] (1) By introducing a method that combines template matching and local feature matching, it is possible to accurately locate and identify the position of the QR code even when the QR code is partially blocked. This method significantly improves the recognition capability in complex environments and is particularly suitable for production environments.

[0085] (2) Multi-scale and multi-angle matching enhances algorithm robustness: Through multi-scale and multi-angle template matching technology, the present invention can accurately detect the position of the two-dimensional code under different scaling and rotation conditions. This processing method adapts to a variety of production environments.

[0086] (3) Geometric correction ensures recognition accuracy: The geometric correction step introduced in the present invention ensures that the shape of the two-dimensional code is consistent with the standard code, further improving the decoding accuracy and reliability.

[0087] (4) Adaptability and versatility: The method of the present invention is not only applicable to different types of PCB boards, but also can adapt to QR codes printed in different environments. It has stronger versatility and can be widely used in various industrial scenarios.

[0088] In summary, compared with the prior art, the present invention has significant advantages in processing obscured two-dimensional codes, improving recognition stability and accuracy, adapting to complex application environments, and simplifying system implementation.

[0089] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0090] Based on the same inventive concept, the embodiment of the present application also provides a two-dimensional code recognition device based on image preprocessing for implementing the two-dimensional code recognition method based on image preprocessing involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more embodiments of the two-dimensional code recognition device based on image preprocessing provided below can refer to the limitations of the two-dimensional code recognition method based on image preprocessing above, and will not be repeated here.

[0091] In one embodiment, Figure 3 As shown, a two-dimensional code recognition device based on image preprocessing is provided, including: a positioning module 302, a first processing module 304, a second processing module 306, a third processing module 308 and a decoding module 310, wherein:

[0092] A positioning module 302 is used to scan an object with a QR code and locate the area where the QR code to be identified is located to obtain a target image;

[0093] A first processing module 304 is used to perform image morphological operations on the target image to obtain a first image;

[0094] The second processing module 306 is used to perform contour detection on the first image and extract valid areas and abnormal areas in combination with texture differences;

[0095] The third processing module 308 is used to perform local feature matching on the valid area and the abnormal area, and repair the abnormal area based on the local feature matching result of the valid area and the abnormal area to obtain a second image;

[0096] The decoding module 310 is used to identify and decode the second image to obtain unique identification information corresponding to the two-dimensional code to be identified.

[0097] In one embodiment, the positioning module 302 is also used to select a standard template corresponding to the QR code to be identified, and use a normalized cross-correlation matching algorithm to search for an area matching the standard template on the scanned object image with the QR code to obtain the area where the QR code to be identified is located; the area where the QR code to be identified is located is cropped to obtain a target image.

[0098] In one embodiment, the positioning module 302 is further used to introduce a multi-scale matching algorithm combined with a normalized cross-correlation matching algorithm to search for an area matching the standard template on the scanned object image with a QR code to obtain the area where the QR code to be identified is located.

[0099] In one embodiment, the first processing module 304 is further configured to perform denoising processing on the first image by using Gaussian filtering after acquiring the first image.

[0100] In one embodiment, the decoding module 310 is further used to extract the ROI area of ​​the second image to obtain the ROI area corresponding to the two-dimensional code to be identified; decode the ROI area using the decoding algorithm corresponding to the two-dimensional code to be identified to obtain the unique identification information corresponding to the two-dimensional code to be identified.

[0101] In one embodiment, after acquiring the ROI region, the decoding module 310 is further configured to perform geometric correction on the extracted ROI region.

[0102] Each module in the above-mentioned two-dimensional code recognition device based on image preprocessing can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0103] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in all the above method embodiments when executing the computer program.

[0104] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in all the above method embodiments are implemented.

[0105] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in all the above method embodiments when executed by a processor.

[0106] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0107] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processors involved in each embodiment provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., but are not limited thereto.

[0108] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0109] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A two-dimensional code recognition method based on image preprocessing, characterized in that: The method comprises: Scan the object with the QR code and locate the area where the QR code to be identified is located to obtain the target image; Performing an image morphological operation on the target image to obtain a first image; Performing contour detection on the first image, and extracting valid areas and abnormal areas in combination with texture differences; Performing local feature matching on the valid area and the abnormal area, repairing the abnormal area based on the local feature matching result between the valid area and the abnormal area, and acquiring a second image; The second image is identified and decoded to obtain unique identification information corresponding to the two-dimensional code to be identified.

2. The method according to claim 1, characterized in that Scanning and locating the area where the to-be-recognized two-dimensional code is located to obtain the target image includes: Selecting a standard template corresponding to the to-be-recognized two-dimensional code, and using a normalized cross-correlation matching algorithm to search for an area matching the standard template on the scanned image of the object with the two-dimensional code, to obtain an area where the to-be-recognized two-dimensional code is located; The area where the to-be-recognized two-dimensional code is located is cropped to obtain the target image.

3. The method according to claim 2, characterized in that The step of using a normalized cross-correlation matching algorithm to search for an area matching the standard template on the scanned image of the object with the two-dimensional code to obtain the area where the two-dimensional code to be identified is located comprises: A multi-scale matching algorithm is introduced in combination with the normalized cross-correlation matching algorithm to search for an area matching the standard template on the scanned image of the object with the two-dimensional code, so as to obtain the area where the two-dimensional code to be identified is located.

4. The method according to claim 1, characterized in that: After acquiring the first image, the method further includes: The first image is subjected to denoising processing by using Gaussian filtering.

5. The method according to claim 1, characterized in that The identifying and decoding the second image to obtain the unique identification information corresponding to the to-be-identified two-dimensional code includes: Performing ROI region extraction on the second image to obtain the ROI region corresponding to the two-dimensional code to be identified; The ROI area is decoded using a decoding algorithm corresponding to the two-dimensional code to be identified, so as to obtain the unique identification information corresponding to the two-dimensional code to be identified.

6. The method according to claim 5, characterized in that After acquiring the ROI area, the method further includes: The extracted ROI area is geometrically corrected.

7. A two-dimensional code recognition device based on image preprocessing, characterized in that: The device comprises: A positioning module is used to scan an object with a QR code and locate the area where the QR code to be identified is located to obtain a target image; A first processing module, used for performing an image morphological operation on the target image to obtain a first image; A second processing module is used to perform contour detection on the first image and extract valid areas and abnormal areas in combination with texture differences; A third processing module is used to perform local feature matching on the valid area and the abnormal area, and repair the abnormal area based on the local feature matching result between the valid area and the abnormal area to obtain a second image; A decoding module is used to identify and decode the second image to obtain unique identification information corresponding to the two-dimensional code to be identified.

8. 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 according to any one of claims 1 to 6 are implemented.

9. 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 according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.