Display module two-dimensional code image processing method and device
By segmenting and filtering the ROI area when scanning the code gun to identify the QR code, it can perform noise reduction and segmentation processing, enhance the contrast of the QR code, solve the problem of uneven lighting and blurred image, and improve the recognition success rate.
Patent Information
- Application Number
- CN202411784059.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-28
AI Technical Summary
In the display touch production assembly line, when scanning the code gun to take a photo to identify the QR code, the recognition failure is often caused by unclear location of the QR code, uneven lighting and blurred image.
By taking pictures based on the scan code gun, the ROI area is divided and pre-processed, and the area with high rectangular similarity and area within a predetermined range is selected as the QR code area, median filtering and noise reduction and maximum inter-class variance method OTSU segmentation are performed to enhance the contrast of the QR code area for identification.
It effectively solves the problem of recognition failure caused by uneven lighting and blurred image, and improves the success rate of QR code information recognition.
Smart Images

Figure CN119721087A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a display module two-dimensional code image processing method, equipment, electronic device and storage medium. Background Art
[0002] In the display touch production line, an area array barcode scanner is often installed on the line to identify and record the QR codes on the products on the line, so as to facilitate the traceability of the products later. Since the products on the line are mobile and the products are placed at different positions and angles, when the barcode scanner takes a photo to identify the QR code, it is often unable to determine the position of the QR code, the QR code is unevenly illuminated, and the image is blurred, resulting in unsuccessful recognition. Summary of the invention
[0003] The technical problem to be solved by the embodiments of the present application is to facilitate the determination of the position of a QR code and to perform QR code image processing in the case of uneven illumination of the QR code and blurred image, thereby facilitating subsequent QR code information recognition.
[0004] A first aspect of the present invention provides a display module two-dimensional code image processing method, the method comprising: Acquire images by taking photos with a barcode scanner; segment the ROI area and perform ROI area preprocessing; The ROI area is screened by pixel area, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine the target area; the target area is the QR code area; The target image target_image of the target area is intercepted, and after the median filtering noise reduction process is performed, the maximum inter-class variance method OTSU is performed on it to find the optimal segmentation threshold K of the two-dimensional code information and the white background, and the black information area and the white background area are segmented; Assign the grayscale value of the pixels in the black information area to 0 and the grayscale value of the pixels in the background area to 255 to enhance the contrast of the QR code area; The enhanced image of the QR code area is used to extract the QR code information.
[0005] Furthermore, the segmenting of the ROI region and performing ROI region preprocessing include: Perform the maximum between-class variance method (OTSU) on the image to segment the ROI area; The ROI region is expanded and eroded to make the edge of the ROI region flat and smooth, and then all the ROI regions are filled to fill the internal gaps of the region.
[0006] Furthermore, the ROI region is screened by pixel area, minimum bounding rectangle length and width, and rectangle similarity characteristics to determine the target region, including: Taking advantage of the fact that the QR code of the same product is a rectangle in appearance, the length and width of the pixels, and the pixel area of the QR code remain unchanged, we screen out areas with a rectangle similarity greater than 0.9 and whose pixel length, width, and area are within a predetermined range and determine them as target areas.
[0007] Further, the screening out of the regions whose rectangle similarity is greater than 0.9 and whose pixel length and width and area are within a predetermined range is determined as the target region, including: Set the predetermined area value as Area; filter out the areas whose rectangular similarity is greater than 0.9 and whose area is greater than 0.9*Area and less than 1.1*Area, and determine them as target areas.
[0008] In addition, the second aspect of the present invention provides a two-dimensional code image processing device, the device includes a collection and segmentation module, a screening module, a first processing module, a second processing module and an extraction module, wherein: The acquisition and segmentation module is used to acquire images based on the barcode scanner camera; segment the ROI area and perform ROI area preprocessing; A screening module is used to screen the ROI area by pixel area, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine the target area; the target area is a QR code area; The first processing module is used to intercept the target image target_image of the target area, perform median filtering and noise reduction processing, and then perform the maximum inter-class variance method OTSU to obtain the optimal segmentation threshold K of the two-dimensional code information and the white background, and segment the black information area and the white background area; The second processing module is used to assign the grayscale value of the pixels in the black information area to 0 and the grayscale value of the pixels in the background area to 255, so as to enhance the contrast of the two-dimensional code area; The extraction module is used to extract the QR code information using the enhanced image of the QR code area.
[0009] Furthermore, the acquisition and segmentation module is also used for: Perform the maximum between-class variance method (OTSU) on the image to segment the ROI area; The ROI region is expanded and eroded to make the edge of the ROI region flat and smooth, and then all the ROI regions are filled to fill the internal gaps of the region.
[0010] Furthermore, the screening module is also used for: Taking advantage of the fact that the QR code of the same product is a rectangle in appearance, the length and width of the pixels, and the pixel area of the QR code remain unchanged, we screen out areas with a rectangle similarity greater than 0.9 and whose pixel length, width, and area are within a predetermined range and determine them as target areas.
[0011] Further, the screening out of the regions whose rectangle similarity is greater than 0.9 and whose pixel length and width and area are within a predetermined range is determined as the target region, including: Set the predetermined area value as Area; filter out the areas whose rectangular similarity is greater than 0.9 and whose area is greater than 0.9*Area and less than 1.1*Area, and determine them as target areas.
[0012] In addition, the third aspect of the present invention provides an electronic device, which includes: one or more processors, and a memory, wherein the memory is used to store one or more computer programs; the computer program is configured to be executed by the one or more processors, and the program includes steps for executing the display module two-dimensional code image processing method described in the first aspect.
[0013] In addition, the fourth aspect of the present invention provides a storage medium storing a computer program; the program is loaded and executed by a processor to implement the steps of the display module two-dimensional code image processing method as described in the first aspect above.
[0014] In the scheme of the present invention, an image is obtained by taking a photo based on a barcode scanner; an ROI area is segmented and preprocessed; the ROI area is screened for pixel area size, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine the target area; the target area is a two-dimensional code area; the target image target_image of the target area is intercepted, and after median filtering and noise reduction processing, a black information area and a white background area are segmented; the grayscale value of the pixel in the black information area is assigned to 0, and the grayscale value of the pixel in the background area is assigned to 255, so as to enhance the contrast of the two-dimensional code area; and the image of the enhanced two-dimensional code area is used to extract the two-dimensional code information. Compared with the prior art, the embodiment of the present application has the following beneficial effects: by segmenting the ROI area and screening out the two-dimensional code area of the product, the two-dimensional code information and the white background are binarized to enhance the contrast, which solves the problem of unsuccessful recognition caused by uneven illumination and blurred images. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 It is a flow chart of a display module two-dimensional code image processing method disclosed in an embodiment of the present invention; Figure 2 This is a schematic diagram of an image obtained by taking a photo with a barcode scanner disclosed in an embodiment of the present invention; Figure 3 is a schematic diagram of an image segmenting a ROI region disclosed in an embodiment of the present invention; Figure 4 It is a subjective schematic diagram of filling all ROI areas disclosed in the embodiment of the present invention; Figure 5 is a schematic diagram of image segmentation results in a template creation process disclosed in an embodiment of the present invention; Figure 6 is a schematic diagram of an image of a target area disclosed in an embodiment of the present invention; Figure 7 is a schematic diagram of segmenting a black information area and a white background area disclosed in an embodiment of the present invention; Figure 8 is the QR code image before enhancement disclosed in the embodiment of the present invention; Fig. 9 It is the enhanced two-dimensional code image disclosed in the embodiment of the present invention. DETAILED DESCRIPTION
[0017] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0018] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0019] It should be noted that the “plurality” mentioned in this article refers to two or more.
[0020] The implementation details of the technical solution of the embodiment of the present application are described in detail below: See also Figure 1 , Figure 1 The overall hardware structure diagram of the device structure of this embodiment is shown in FIG. In this embodiment, the device hardware structure includes: A first aspect of this embodiment provides a display module two-dimensional code image processing method, such as Figure 1 The flowchart of the display module two-dimensional code image processing method of this example is shown. The method includes: S101, acquiring an image by taking a photo with a barcode scanner; segmenting the ROI area and performing ROI area preprocessing; Specifically, in this embodiment, when a product passes through the field of view of the area array barcode scanner, the barcode scanner takes a photo. Figure 2 As shown, this is the image obtained by taking a photo with a barcode scanner in this example.
[0021] Further, in S101, segmenting the ROI region and performing ROI region preprocessing includes: Perform the maximum between-class variance method (OTSU) on the image to segment the ROI area; The ROI region is expanded and eroded to make the edge of the ROI region flat and smooth, and then all the ROI regions are filled to fill the internal gaps of the region.
[0022] Furthermore, in this embodiment, the image is segmented into ROI regions (regions of interest) by using the maximum inter-class variance method (OTSU). Figure 3 The image of the ROI area is segmented for this example, where Figure 3 The red area in the image. The gray value of each pixel on the image is obtained by inputting the image, and the maximum inter-class variance method OTSU is used to obtain the optimal foreground segmentation threshold K. The foreground here is the area with high gray brightness of the QR code in the image. The threshold K is used to perform threshold segmentation processing, and finally the high brightness area is segmented, which includes the QR code area and other areas. This area is called the ROI area ( Figure 3The red area in the figure needs to be finely segmented in the next step.
[0023] Furthermore, in this embodiment, the above ROI area ( Figure 3 The red area in the figure is expanded and eroded to make the edge of the ROI area smooth, and then all the ROI areas are filled to fill the gaps inside the area. Figure 4 The figure shows a subjective schematic diagram of filling all ROI areas in this example. The ROI area is processed by the morphological expansion algorithm and the corrosion algorithm. The expansion algorithm fills the missing parts at the edge or inside of the ROI area. The corrosion algorithm cuts the protruding area at the edge of the ROI area. Finally, the gap filling algorithm is processed in the area to make the area processed by the morphological algorithm more complete, which is convenient for subsequent screening of the target area (QR code area). The edge of the red area will be smoother before and after processing.
[0024] S102, screening the ROI region by pixel area, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine a target region; the target region is a QR code region; Further, in S102, the ROI region is screened by pixel area, minimum bounding rectangle length and width, and rectangle similarity characteristics to determine the target region, including: Taking advantage of the fact that the QR code of the same product is a rectangle in appearance, the length and width of the pixels, and the pixel area of the QR code remain unchanged, we screen out areas with a rectangle similarity greater than 0.9 and whose pixel length, width, and area are within a predetermined range and determine them as target areas.
[0025] Further, the filtering out of regions whose rectangular similarity is greater than 0.9 and whose pixel length and width numbers and area numbers are within a predetermined range, and determining them as target regions, includes: setting a predetermined area value as Area; filtering out regions whose rectangular similarity is greater than 0.9 and whose areas are greater than 0.9*Area and less than 1.1*Area, and determining them as target regions.
[0026] Specifically, in this embodiment, the ROI area is screened by pixel area, minimum bounding rectangle length and width, and rectangle similarity characteristics, and finally the target area is selected as the QR code area. Figure 5 Shown is a schematic diagram of the screened target area in this example.
[0027] The principle of target area screening is: since the target of the code scanning test is the QR code, the QR code label of the same product has certain size and shape invariance characteristics. The ROI area in the right figure includes the rectangular QR code area and other areas (the grayscale of other areas is similar to the grayscale value of the QR code area). Here, the rectangular shape characteristics of the QR code are used, the length and width of the pixels and the pixel area of the QR code are unchanged, and the areas with a rectangular similarity greater than 0.9 (maximum 1) and the pixel length and width and area of the area within a certain range are selected. For example, the area setting value is Area. As long as the area of the selected area is greater than 0.9*Area and less than 1.1*Area, it is determined to be a QR code area.
[0028] S103, intercepting the target image target_image of the target area, performing median filtering and noise reduction processing, and performing the maximum between-class variance method OTSU on it, to find the optimal segmentation threshold K of the two-dimensional code information and the white background, and segmenting the black information area and the white background area; Specifically, in this embodiment, the image target_image (such as Figure 6 The image of the target area is shown in Figure 1), after median filtering and noise reduction, the maximum inter-class variance method (OTSU) is used to find the optimal segmentation threshold K between the QR code information and the white background, and the black information area and the white background area are segmented. Figure 7 The figure shows a schematic diagram of segmenting the black information area and the white background area in this example, wherein the red area is the black information area and the green area is the white background area.
[0029] After the final area of the QR code is screened out, the image information in the area is processed. Since the information of the QR code includes a white background and black printed information, the black printed area and the white area are segmented using the above-mentioned OTSU algorithm.
[0030] S104, assigning a grayscale value of pixels in the black information area to 0 and a grayscale value of pixels in the background area to 255, thereby enhancing the contrast of the two-dimensional code area; Specifically, in this embodiment, the grayscale value of the pixels in the black information area is assigned to 0, and the grayscale value of the pixels in the background area is assigned to 255, so as to enhance the contrast of the two-dimensional code. Figure 8 To enhance the front QR code image; Fig. 9 It is the enhanced QR code image.
[0031] S105, extracting the two-dimensional code information using the enhanced image of the two-dimensional code area.
[0032] In this embodiment, the enhanced two-dimensional code image is transmitted to the decoding program through the built-in two-dimensional code decoding program of the barcode scanning camera itself, which can speed up the decoding efficiency and improve the decoding success rate.
[0033] In addition, the first aspect of this example provides a calculation process of the algorithm, as follows: * OTSU algorithm extracts bright ROI area binary_threshold(Image, ROI_Region, 'max_separability', 'light',UsedThreshold) * The expansion and corrosion algorithm fills the uneven edges of the cut and segmented area closing_rectangle1 (ROI_Region, RegionClosing, MaskWidth,MaskHeight,) opening_rectangle1(RegionClosing, RegionOpening, MaskWidth,MaskHeight) connection(RegionOpening, ConnectedRegions) * Filling algorithm fills the gaps inside the region fill_up(ConnectedRegions, RegionFillUp) * The screening algorithm screens the target area (QR code area) select_shape(RegionFillUp, SelectedRegions, ['area', 'rectangularity', 'width', 'height'], 'and', [Area*0.9, 0.9, width*0.9,height*0.9], [Area *1.1, 1.0, Width*1.1, Height*1.1]) * Extract the image of the target area reduce_domain(Image, SelectedRegions, target_image) * OTSU extracts the black area of the target image binary_threshold(target_image, Black_Region, 'max_separability', 'dark', UsedThreshold) * Assign the grayscale value of each pixel in the black area to 0 paint_region(Black_Region, target_image, ImageResult, 0, 'fill') * Segment the white background area and assign the grayscale value of each pixel in the area to 255 difference(SelectedRegions, Black_Region, White_Region) paint_region(White _Region, ImageResult, ImageResult, 255, 'fill').
[0034] In summary, in this embodiment, an image is obtained by taking a photo based on a barcode scanner; the ROI area is segmented and preprocessed; the pixel area size, the length and width of the minimum circumscribed rectangle, and the rectangle similarity characteristics of the ROI area are screened to determine the target area; the target area is the QR code area; the target image target_image of the target area is intercepted, and after median filtering and noise reduction processing, the black information area and the white background area are segmented; the grayscale value of the pixels in the black information area is assigned to 0, and the grayscale value of the pixels in the background area is assigned to 255, so as to enhance the contrast of the QR code area; the image of the enhanced QR code area is used to extract the QR code information. Compared with the prior art, the embodiment of the present application has the following beneficial effects: by segmenting the ROI area and screening out the QR code area of the product, the QR code information and the white background are binarized to enhance the contrast, which solves the problem of unsuccessful recognition caused by uneven lighting and blurred images.
[0035] In addition, a second aspect of this embodiment provides a two-dimensional code image processing device, the device includes a collection and segmentation module, a screening module, a first processing module, a second processing module and an extraction module, wherein: The acquisition and segmentation module is used to acquire images based on the barcode scanner camera; segment the ROI area and perform ROI area preprocessing; A screening module is used to screen the ROI area by pixel area, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine the target area; the target area is a QR code area; The first processing module is used to intercept the target image target_image of the target area, perform median filtering and noise reduction processing, and then perform the maximum inter-class variance method OTSU to obtain the optimal segmentation threshold K of the two-dimensional code information and the white background, and segment the black information area and the white background area; The second processing module is used to assign the grayscale value of the pixels in the black information area to 0 and the grayscale value of the pixels in the background area to 255, so as to enhance the contrast of the two-dimensional code area; The extraction module is used to extract the QR code information using the enhanced image of the QR code area.
[0036] Furthermore, the acquisition and segmentation module is also used for: Perform the maximum between-class variance method (OTSU) on the image to segment the ROI area; The ROI region is expanded and eroded to make the edge of the ROI region flat and smooth, and then all the ROI regions are filled to fill the internal gaps of the region.
[0037] Furthermore, the screening module is also used for: Taking advantage of the fact that the QR code of the same product is a rectangle in appearance, the length and width of the pixels, and the pixel area of the QR code remain unchanged, we screen out areas with a rectangle similarity greater than 0.9 and whose pixel length, width, and area are within a predetermined range and determine them as target areas.
[0038] Further, the screening out of the regions whose rectangle similarity is greater than 0.9 and whose pixel length and width and area are within a predetermined range is determined as the target region, including: Set the predetermined area value as Area; filter out the areas whose rectangular similarity is greater than 0.9 and whose area is greater than 0.9*Area and less than 1.1*Area, and determine them as target areas.
[0039] In addition, an embodiment of the present application also discloses an electronic device, which includes: one or more processors, and a memory, wherein the memory is used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes steps for executing the display module two-dimensional code image processing method described in the first aspect above.
[0040] In addition, an embodiment of the present application further provides a storage medium storing a computer program; the program is loaded and executed by a processor to implement the steps of the display module two-dimensional code image processing method as described in the first aspect above.
[0041] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0042] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0043] The units described as separate components may or may not be physically separated. As a unit, it can be appreciated by those skilled in the art that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0044] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0045] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a grid device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0046] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A display module two-dimensional code image processing method, characterized in that: The method comprises: Acquire images by taking photos with a barcode scanner; segment the ROI area and perform ROI area preprocessing; The ROI area is screened by pixel area, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine the target area; the target area is the QR code area; The target image target_image of the target area is intercepted, and after the median filtering noise reduction process is performed, the maximum inter-class variance method OTSU is performed on it to find the optimal segmentation threshold K of the two-dimensional code information and the white background, and the black information area and the white background area are segmented; Assign the grayscale value of the pixels in the black information area to 0 and the grayscale value of the pixels in the background area to 255 to enhance the contrast of the QR code area; The enhanced image of the QR code area is used to extract the QR code information.
2. The display module two-dimensional code image processing method according to claim 1, characterized in that: The segmenting of the ROI region and performing ROI region preprocessing include: Perform the maximum between-class variance method (OTSU) on the image to segment the ROI area; The ROI region is expanded and eroded to make the edge of the ROI region flat and smooth, and then all the ROI regions are filled to fill the internal gaps of the region.
3. The display module two-dimensional code image processing method according to claim 2, characterized in that: The ROI region is screened by pixel area, minimum bounding rectangle length and width, and rectangle similarity characteristics to determine the target region, including: Taking advantage of the fact that the QR code of the same product is a rectangle in appearance, the length and width of the pixels, and the pixel area of the QR code remain unchanged, we screen out areas with a rectangle similarity greater than 0.9 and whose pixel length, width, and area are within a predetermined range and determine them as target areas.
4. The display module two-dimensional code image processing method according to claim 3, characterized in that: The screening out of the regions whose rectangle similarity is greater than 0.9 and whose pixel length, width and area are within a predetermined range is determined as the target region, including: Set the predetermined area value as Area; filter out the areas whose rectangular similarity is greater than 0.9 and whose area is greater than 0.9*Area and less than 1.1*Area, and determine them as target areas.
5. A two-dimensional code image processing device, characterized in that: The device comprises a collection and segmentation module, a screening module, a first processing module, a second processing module and an extraction module, wherein: The acquisition and segmentation module is used to acquire images based on the barcode scanner camera; segment the ROI area and perform ROI area preprocessing; A screening module is used to screen the ROI area by pixel area, minimum circumscribed rectangle length and width, and rectangle similarity characteristics to determine the target area; the target area is a QR code area; The first processing module is used to intercept the target image target_image of the target area, perform median filtering and noise reduction processing, and then perform the maximum inter-class variance method OTSU to obtain the optimal segmentation threshold K of the two-dimensional code information and the white background, and segment the black information area and the white background area; The second processing module is used to assign the grayscale value of the pixels in the black information area to 0 and the grayscale value of the pixels in the background area to 255, so as to enhance the contrast of the two-dimensional code area; The extraction module is used to extract the QR code information using the enhanced image of the QR code area.
6. The two-dimensional code image processing device according to claim 5, characterized in that: The acquisition and segmentation module is also used for: Perform the maximum between-class variance method (OTSU) on the image to segment the ROI area; The ROI region is expanded and eroded to make the edge of the ROI region flat and smooth, and then all the ROI regions are filled to fill the internal gaps of the region.
7. The two-dimensional code image processing device according to claim 6, characterized in that: The screening module is further used for: Taking advantage of the fact that the QR code of the same product is a rectangle in appearance, the length and width of the pixels, and the pixel area of the QR code remain unchanged, we screen out areas with a rectangle similarity greater than 0.9 and whose pixel length, width, and area are within a predetermined range and determine them as target areas.
8. The two-dimensional code image processing device according to claim 7, characterized in that: The screening out of the regions whose rectangle similarity is greater than 0.9 and whose pixel length, width and area are within a predetermined range is determined as the target region, including: Set the predetermined area value as Area; filter out the areas whose rectangular similarity is greater than 0.9 and whose area is greater than 0.9*Area and less than 1.1*Area, and determine them as target areas.
9. An electronic device, comprising: One or more processors, a memory, wherein the memory is used to store one or more computer programs; characterized in that the computer program is configured to be executed by the one or more processors, and the program includes steps for executing the display module two-dimensional code image processing method as described in any one of claims 1-4.
10. A storage medium storing a computer program; the program is loaded and executed by a processor to implement the steps of the display module two-dimensional code image processing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Rapid two-dimensional barcode image motion deblurring method
CN102708552A
Two-dimensional code recognition method and system under complex environmental condition and medium
CN118396010A
Method and apparatus for recognizing code
US20050194445A1