Two-dimensional code location degree detection method, electronic equipment, storage medium and product

By acquiring product images and using preset pixel dynamic thresholds and closed-loop operation models to determine the QR code position, the problem of poor accuracy in QR code position detection in existing technologies is solved, achieving higher detection precision.

CN121981964APending Publication Date: 2026-05-05GOERTEK INC
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-29
Publication Date
2026-05-05

AI Technical Summary

Technical Problem

In existing technologies, QR code position detection is affected by human experience, resulting in poor detection accuracy and an inability to effectively identify the position of the QR code on a product.

Method used

By acquiring the product image of the product to be tested, determining the product template that matches the product image, detecting whether the initial QR code area is located within the baseline ROI area and does not overlap with the edge line, and using the preset pixel dynamic threshold and closing operation model to determine the actual coding area and/or the actual QR code area, the QR code position detection result is determined based on the target area.

Benefits of technology

It improves the accuracy of QR code position detection, avoids the instability of manual detection, and ensures the accuracy of QR code position calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121981964A_ABST
    Figure CN121981964A_ABST
Patent Text Reader

Abstract

The invention discloses a two-dimensional code location degree detection method, electronic equipment, a storage medium and a product, and relates to the technical field of image processing, and the method comprises the steps: obtaining a product image of a to-be-detected product, and determining a product template matched with the product image; whether an initial two-dimensional code area representing the two-dimensional code in the product image is located in a reference ROI area of the product template or not is detected, the initial two-dimensional code area does not overlap with a side line of the reference ROI area, and the reference ROI area is an image area representing a code printing area; if the initial two-dimensional code area is located in the reference ROI area and is not overlapped with the sideline, a target area in the product image is determined according to a preset pixel dynamic threshold value and a preset closed operation model, and the target area comprises an actual code printing area and / or an actual two-dimensional code area; and determining a two-dimensional code location degree detection result of the to-be-detected product according to the target area. According to the invention, the accuracy of two-dimensional code location degree detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, and in particular to QR code position detection methods, electronic devices, storage media, and computer program products. Background Technology

[0002] Products and equipment (such as injection molded parts (e.g., plastic shells, components)) need to be tracked throughout their entire lifecycle via QR codes to ensure quality control and anti-counterfeiting. Therefore, it is necessary to effectively control the position of the QR code on the product (hereinafter referred to as the product) within the coding area. Currently, most of the time, experienced users combine QR code detection machines to manually control and detect the QR code and coding area to determine whether the QR code is located in the coding area. However, this method has certain drawbacks. For example, when there are many products, due to the influence of human experience, it is impossible to accurately and effectively identify the position of the QR code on all products, which leads to a decrease in the accuracy of the QR code position detection.

[0003] Therefore, improving the accuracy of QR code position detection has become an urgent problem to be solved.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this application is to provide a QR code position detection method, electronic device, storage medium, and computer program product, aiming to solve the technical problem of how to improve the accuracy of QR code position detection.

[0006] To achieve the above objectives, this application proposes a QR code position detection method, comprising the following steps: Obtain a product image of the product to be tested, and determine a product template that matches the product image; The detection function checks whether the initial QR code region representing the QR code in the product image is located within the reference ROI region of the product template and does not overlap with the edge of the reference ROI region, where the reference ROI region is the image region representing the QR code area. If the initial QR code area is located within the baseline ROI area and does not overlap with the edge line, the target area in the product image is determined based on the preset pixel dynamic threshold and the preset closing operation model. The target area includes the actual coding area and / or the actual QR code area. The location accuracy of the QR code on the product to be tested is determined based on the target area.

[0007] Optionally, the step of determining the target region in the product image based on a preset pixel dynamic threshold and a preset closing operation model includes: Determine the pixel parameters of each pixel in the product image, and based on the pixel parameters and a preset dynamic pixel threshold, determine the first image region representing the coding area and / or the second image region representing the QR code area in the product image. The first image region is processed by a pre-defined closing operation model to obtain the actual coding region, and / or the second image region is processed by a pre-defined closing operation model to obtain the actual QR code region.

[0008] Optionally, the step of determining a first image region representing the coding area and / or a second image region representing the QR code area in the product image based on pixel parameters and a preset pixel dynamic threshold includes: For each pixel in the product image, determine the pixel parameter differences between the pixel parameter and the pixel parameters of the pixel's neighboring pixels; If the difference in pixel parameters is greater than the preset dynamic threshold for pixels, then the pixel is determined to be the target pixel; A third image region containing all target pixels in the product image is determined, and morphological hole filling is performed on the third image region to obtain a fourth image region. If the preset pixel dynamic threshold is the same as the pixel dynamic threshold corresponding to the coding area, then the fourth image region is the first image region. If the preset pixel dynamic threshold is the same as the pixel dynamic threshold corresponding to the QR code area, then the fourth image region is the second image region.

[0009] Optionally, the step of performing a closing operation on the first image region using a preset closing operation model to obtain the actual coding region includes: Using a preset closing operation model, a closing operation is performed on the product image containing the first image region to obtain the fifth image region in the product image, and it is detected whether there is transformation information between the fifth image region and the first image region. If transformation information exists, determine whether the convexity corresponding to the fifth image region meets the preset convexity condition. The preset convexity condition includes the convexity reaching a preset maximum value or the convexity showing a decreasing trend. If the conditions are met, the fifth image region will be used as the actual censoring region.

[0010] Optionally, after the step of detecting whether there is transformation information between the fifth image region and the first image region, the method includes: If there is no transformation information, the parameters of the closing operation model are updated, and the closed operation model with updated parameters is used to perform a closing operation on the product image containing the fifth image region to obtain the sixth image region in the product image. Detect whether the convexity of the sixth image region satisfies the preset convexity condition; If the convexity of the sixth image region does not meet the preset convexity condition, then the parameters of the closed operation model for parameter updating will be updated again. Based on the parameter-updated closing operation model and the sixth image region, the step of performing a closing operation on the product image containing the fifth image region using the parameter-updated closing operation model is executed until the convexity of the latest obtained image region satisfies the preset convexity condition, and the latest obtained image region is used as the actual coding area.

[0011] Optionally, the step of detecting whether the initial QR code region representing the QR code in the product image is located within the reference ROI region of the product template and does not overlap with the edge of the reference ROI region includes: Determine the baseline ROI region of the product template, where the baseline ROI region is a closed area formed by connecting the center lines of multiple rectangular regions at different locations in the product template; Map the initial QR code region and the reference ROI region to the same coordinate system, and determine whether the center coordinates of the initial QR code region are located within the reference ROI region under the same coordinate system, and whether there are any boundary vertex coordinates of the initial QR code region that overlap with the edge of the reference ROI region. If, in the same coordinate system, the center coordinates are located within the reference ROI region, and none of the boundary vertex coordinates overlap with the edge of the reference ROI region, then the initial QR code region is determined to be located within the reference ROI region and does not overlap with the edge of the reference ROI region.

[0012] Optionally, the step of determining the QR code position measurement result of the product to be tested based on the target area includes at least one of the following: In response to the target area only including the actual coding area, if the initial QR code area is located within the actual coding area and does not overlap with the edge of the actual coding area, then the QR code position detection result is determined to include the product under test as a product that has passed the QR code position detection. In response to the target area only including the actual QR code area, if the actual QR code area is located within the baseline ROI area and does not overlap with the edge of the baseline ROI area, then the QR code positional accuracy test result is determined to include the product under test as a product that has passed the QR code positional accuracy test. The response area includes the actual coding area and the actual QR code area. If the actual QR code area is located within the actual coding area and does not overlap with the edge of the actual coding area, then the QR code position detection result is determined to be that the product under test is a product that passes the QR code position detection.

[0013] In addition, to achieve the above objectives, this application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the QR code position detection method described above.

[0014] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the QR code position detection method described above.

[0015] In this application, by acquiring a product image of the product to be tested and determining a matching product template, and when the initial QR code area in the product image is detected to be located in the reference ROI area representing the coding area in the product template, and does not overlap with the edge of the reference ROI area, it can be preliminarily considered that the QR code of the product to be tested is located in the coding area, thus completing one QR code positional detection process for the product to be tested. In order to obtain the QR code positional accuracy of the product to be tested more accurately, the QR code positional accuracy detection of the product to be tested can be continued. The actual coding area and / or the actual QR code area in the product image are determined by using a preset pixel dynamic threshold and a closing operation model. Based on the actual coding area and / or the actual QR code area, the QR code positional accuracy detection of the product to be tested is performed to obtain the corresponding QR code positional accuracy detection result. Then, by utilizing the advantages of the closing operation model, the actual coding area and / or the actual QR code area can be accurately captured to effectively identify the QR code positional accuracy of the product to be tested, thereby improving the accuracy of QR code positional accuracy detection. Attached Figure Description

[0016] 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.

[0017] 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.

[0018] Figure 1 This is a flowchart illustrating the first embodiment of the QR code position detection method in this application; Figure 2 This is a schematic diagram of a scenario in the first embodiment of the QR code position detection method of this application; Figure 3 This is a flowchart illustrating the second embodiment of the QR code position detection method in this application; Figure 4This is another flowchart illustrating the second embodiment of the QR code position detection method in this application; Figure 5 This is a schematic diagram of the device structure of the hardware operating environment involved in the QR code position detection method in the embodiments of this application.

[0019] Explanation of icon numbers 100. Product image; 200. Coding area; 300. QR code; 410. Rectangular area L1; 420. Rectangular area L2; 430. Rectangular area L3; 440. Rectangular area L4.

[0020] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0021] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0022] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0023] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or QR code position detection device capable of performing the above functions. The following description uses an electronic device as an example to illustrate this embodiment and the subsequent embodiments.

[0024] Optionally, when performing QR code position detection on a product, an edge-finding algorithm can be used. This involves capturing the boundary lines of the QR code and the coding area, and calculating the distance between them. However, this method has certain drawbacks. For example, inconsistent surface roughness, material variations, dirt, or lint on products like injection-molded parts can lead to inconsistent surface imaging, resulting in unstable capture of the QR code coding area or unstable edge capture of the QR code outline. This can cause errors in QR code position calculation. Furthermore, edge capture errors can occur when the QR code area coincides with or intersects with the coding boundary.

[0025] Therefore, to avoid these defects, this application also provides a QR code position detection method, which can solve the problem of QR code position calculation errors caused by the intersection of the edges after the QR code and the coding area overlap, based on the center coordinates of the QR code. Furthermore, it can perform image preprocessing on the collected product image (such as closing operation) to avoid the occurrence of unstable coding boundaries. Based on the center point determination scheme of the QR code recognition algorithm, it solves the problem of QR code position capture; thus providing a reliable technical guarantee for QR code position calculation.

[0026] Optionally, embodiments of this application can obtain the optimal contour solution of the QR code marking area through optimal convexity calculation. Then, distance measurement is further performed to calculate the positional accuracy of the QR code. This can avoid large deviations in positional accuracy calculation caused by dirt, fibers, or uneven edges due to the injection molding process.

[0027] Based on this, embodiments of this application provide a QR code position detection method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the QR code position detection method of this application.

[0028] In this embodiment, the QR code position detection method includes steps S10 to S40.

[0029] Step S10: Obtain the product image of the product to be tested and determine the product template that matches the product image; Optionally, the finished product to be tested can be a product for which QR code position measurement is to be performed, such as injection molded parts (e.g., plastic shells, components), electronic products, printed products, etc.

[0030] Optionally, the product image may be an image taken of the product to be tested, and may include features related to the product's QR code.

[0031] Optionally, multiple cameras can be set up in the environment where the product under test is located, and the product under test can be photographed by the multiple cameras to obtain multiple initial product images of the product under test. The initial product image with a QR code and containing all or most of the features of the product under test can be selected as the product image in this application embodiment, such as selecting a front view of the product under test as the product image.

[0032] Optionally, the product template can be a product template image collected from the product model of the product to be tested, and the orientation angle of the collected product template image is consistent with the shooting orientation angle corresponding to the product image, and the size parameters of the product template are consistent with the size parameters of the product image.

[0033] Optionally, the product model can be a three-dimensional model of the product to be tested. Multiple three-dimensional models corresponding to different products can be set in advance. Different product types correspond to different three-dimensional models. A marking area representing the benchmark is set in the three-dimensional model, and it can be used as the theoretical marking area of ​​the corresponding product.

[0034] Optionally, different product models can be set up in advance for different products and stored in a preset knowledge base. Multiple QR code models can be set up, and different QR code models can be set up for different products. The QR code models corresponding to multiple products can be stored in the knowledge base. Optionally, the QR code model can be a three-dimensional model similar to the shape of the product, or it can be a model with a fixed format set in advance. There are no restrictions here.

[0035] Optionally, for the same product to be tested, a product image of the product to be tested can be obtained, and the product type of the product to be tested can be determined (e.g., plastic shell 1 or plastic shell 2). Then, a product model matching the product type of the product to be tested can be queried in the knowledge base, and a corresponding product template can be obtained for the queried product model based on the product image. The size parameters of the product template are consistent with the size parameters of the product image.

[0036] Optionally, a QR code model matching the product type of the product to be tested can be queried in the knowledge base, and the product image can be QR code recognized according to the QR code model to determine whether there is an image area representing a QR code in the product image. If there is, the image area representing a QR code in the product image is taken as the initial QR code area.

[0037] Optionally, if the product image does not contain an image area representing a QR code, the product image of the product under test is re-acquired, and it is determined whether the image area representing a QR code exists in the re-acquired product image. If no image area representing a QR code is detected for a consecutive number of times (e.g., 5 times), an abnormal prompt message for the product under test is output to remind the user.

[0038] Step S20: Detect whether the initial QR code region representing the QR code in the product image is located within the reference ROI region of the product template and does not overlap with the edge of the reference ROI region. It should be noted that the baseline ROI region is the image region that represents the censored area.

[0039] Optionally, an image region representing the coding area in the product template is identified and used as a baseline ROI region. The product image and product template can be aligned before determining whether the initial QR code region is located within the baseline ROI region and does not overlap with the edge of the baseline ROI region.

[0040] Optionally, the coordinate system of the product image (hereinafter referred to as the first coordinate system) can be determined, the coordinate system of the product template (hereinafter referred to as the second coordinate system) can be determined, and coordinate system alignment processing can be performed on the first coordinate system and the second coordinate system (such as transforming both the first coordinate system and the second coordinate system to the world coordinate system, or transforming the first coordinate system to be consistent with the second coordinate system, or transforming the second coordinate system to be consistent with the first coordinate system, etc.), and then determining whether the initial QR code area is located within the reference ROI area and does not overlap with the edge of the reference ROI area.

[0041] Optionally, step S20, which detects whether the initial QR code region representing the QR code in the product image is located within the reference ROI region of the product template and does not overlap with the edge of the reference ROI region, includes steps a10-a30.

[0042] Step a10: Determine the baseline ROI region of the product template, wherein the baseline ROI region is a closed region formed by connecting the center lines of multiple rectangular regions at different locations in the product template; Step a20: Map the initial QR code region and the reference ROI region to the same coordinate system, and determine whether the center coordinates of the initial QR code region are located within the reference ROI region under the same coordinate system, and whether there are any boundary vertex coordinates in the boundary vertex coordinates of the initial QR code region that overlap with the edge of the reference ROI region. Step a30: If, under the same coordinate system, the center coordinates are located within the reference ROI region, and none of the boundary vertex coordinates overlap with the edge of the reference ROI region, then the initial QR code region is determined to be located within the reference ROI region and does not overlap with the edge of the reference ROI region.

[0043] Optionally, the boundary vertex coordinates include the boundary coordinates of the edges of the initial QR code region and the vertex coordinates of the vertices of the initial QR code region.

[0044] Optionally, for a product template, the baseline ROI region in the product template can be identified first, and multiple matrix regions at different positions in the product template can be determined. Then, the closed region formed by connecting the midlines of multiple rectangular regions at different positions in the product template (such as the closed region formed by connecting the midlines of the long sides or the closed region formed by connecting the midlines of the short sides) can be used as the baseline ROI region.

[0045] For example, if a product template contains four matrix regions (hereinafter referred to as L1, L2, L3, and L4) in different locations, with matrix region L1 located in the upper half of the product template, matrix region L3 located in the lower half of the product template, and the longest side (i.e., the longest boundary line) of matrix region L1 parallel to the longest side of matrix region L3; matrix region L2 located in the left half of the product template, and matrix region L4 located in the right half of the product template, with the longest side of matrix region L2 parallel to the longest side of matrix region L4; and the longest side of matrix region L1 not parallel to the longest sides of matrix regions L2 and L4, but intersecting with them, and the longest side of matrix region L3 not parallel to the longest sides of matrix regions L2 and L4, but intersecting with them, then the median lines of the long sides of these four matrix regions L1-L4 can be extended to determine the intersection points between each median line, and these intersection points can be used as the vertices of the baseline ROI region.

[0046] Optionally, a first coordinate system (e.g., a coordinate system with the top left corner of the product image as the origin) and a second coordinate system (e.g., a coordinate system with the top left corner of the product template as the origin) corresponding to the product image can be determined. The initial QR code area representing the QR code in the product image can be transformed and mapped to the second coordinate system. Alternatively, the reference ROI area in the product template can be transformed and mapped to the first coordinate system. Or, both the initial QR code area representing the QR code in the product image and the reference ROI area in the product template can be transformed and mapped to the world coordinate system, so that the initial QR code area and the reference ROI area are in the same coordinate system (e.g., the first coordinate system, the second coordinate system, or the world coordinate system).

[0047] Optionally, taking the world coordinate system as an example, the coordinates of the center point of the initial QR code area in the world coordinate system are determined and used as the center coordinates (e.g., the center of the QR code outline (X0, Y0)). This allows the determination of all boundaries of the initial QR code area and the corresponding coordinates of each vertex in the world coordinate system (e.g., (X1, Y1), (X2, Y2), (X3, Y3), (X4, Y4)), which are then used as boundary vertex coordinates. Furthermore, the coordinates of each pixel in the reference ROI area in the world coordinate system can be determined, resulting in the reference ROI coordinate region in the world coordinate system. The coordinates corresponding to the boundary lines of the reference ROI coordinate region can then be determined. Finally, it can be determined whether the center coordinates of the initial QR code area are located within the reference ROI coordinate region, and whether there are any boundary vertex coordinates in the initial QR code area that overlap with the coordinates corresponding to the boundary lines of the reference ROI coordinate region. If the center coordinates are located within the reference ROI coordinate region, and there are no boundary vertex coordinates that overlap with the boundary lines of the reference ROI coordinate region, it can be determined that, in the same coordinate system, the center coordinates are located within the reference ROI region, and there are no boundary vertex coordinates that overlap with the edge lines of the reference ROI region. Therefore, it can also be determined that the initial QR code region is located within the reference ROI region and does not overlap with the edge lines of the reference ROI region.

[0048] Optionally, if the center coordinates of the initial QR code area are not located in the reference ROI coordinate area, it can be determined that the center coordinates are not located in the reference ROI area under the same coordinate system. This indicates that the QR code position of the product under test exceeds the coding area, and the QR code position detection result can be determined to include the product under test as a product that fails the QR code position detection.

[0049] Optionally, if there are boundary vertex coordinates that overlap with the edge line of the reference ROI region in each boundary vertex coordinate, then the boundary vertex coordinates that overlap with the edge line of the reference ROI region can be determined, and it can be determined that the QR code position degree of the product under test has an overlap phenomenon between the boundary line and the boundary line of the coding area, and it can be determined that the QR code position degree detection result includes the product under test being a product that fails the QR code position degree detection.

[0050] Reference Figure 2In the product image 100, there is a coding area 200 (i.e., the baseline ROI area) determined according to the product template. The coding area 200 can be determined based on rectangular areas L1 410, L2 420, L3 430 and L4 440. For example, the closed area formed by connecting the intersection of the midlines of these four rectangular areas can be used as the coding area 200. It can be seen that the QR code 300 (i.e. the initial QR code area) is located within the coding area 200. At this time, the QR code position of the finished product to be tested can be detected more accurately, such as by executing step S30 and subsequent steps.

[0051] In this embodiment, by transforming the initial QR code area and the reference ROI area in the product image into the same coordinate system, and then determining whether the initial QR code area is located within the reference ROI area and whether it overlaps with the edge of the reference ROI area based on the center coordinates and the coordinates of each boundary vertex of the initial QR code area, the location of the QR code can be effectively identified, avoiding the phenomenon that it is difficult to capture the location of the QR code, and improving the accuracy of QR code position detection of the product under test.

[0052] Step S30: If the initial QR code area is located within the baseline ROI area and does not overlap with the edge line, then the target area in the product image is determined based on the preset pixel dynamic threshold and the preset closing operation model. It should be noted that the target area includes the actual area where the code is printed and / or the actual QR code area. Optionally, the preset pixel dynamic threshold can be a pre-set pixel dynamic threshold, which can be a grayscale value, a brightness value, a chromaticity value, etc. There are no restrictions here, and it can be set according to the actual scenario.

[0053] Optionally, the preset closing operation model can be a closed operation model that has been trained, which can perform closing operation processing on product images.

[0054] Optionally, the actual coding area can be the actual coding area of ​​the product under test, inferred from the product image. The size parameters of the actual coding area may differ from the size parameters of the baseline ROI area.

[0055] Optionally, the actual QR code area can be the actual QR code area of ​​the product under test, which is inferred from the product image. The size parameters of the actual QR code area may differ from the size parameters of the initial QR code area.

[0056] Optionally, if the initial QR code area is located within the baseline ROI area and does not overlap with the edge of the baseline ROI area, then the coarse measurement of the QR code position of the product under test can be determined, and the fine measurement of the QR code position of the product under test can be performed. At this time, the product image can be preprocessed. For example, a preset pixel dynamic threshold and a preset closing operation model can be used to preprocess the product image to determine the actual coding area and / or the actual QR code area in the product image, and use it as the target area.

[0057] Optionally, each pixel in the product image can be filtered according to a preset dynamic pixel threshold to obtain the pixel region formed by the filtered pixels, and then the pixel region can be closed according to a preset closing operation model to obtain the target region.

[0058] Step S40: Determine the QR code position detection result of the product to be tested based on the target area.

[0059] Optionally, after determining the target area, the QR code dimension can be detected in the target area to obtain the QR code position degree detection result of the product under test.

[0060] Optionally, step S40, which involves determining the QR code position detection result of the product to be tested based on the target area, includes steps b10-b30.

[0061] Step b10: In response to the target area only including the actual coding area, if the initial QR code area is located within the actual coding area and does not overlap with the edge of the actual coding area, then the QR code position detection result is determined to include the product under test as a product that has passed the QR code position detection. Optionally, when the target area determined based on the preset pixel dynamic threshold and the preset closing operation model is the actual coding area, the first coordinate system corresponding to the product image can be determined, and the coordinates of each pixel in the actual coding area within the first coordinate system (hereinafter referred to as the first actual coding area coordinates) can be determined, as well as the coordinates of each first actual coding area coordinate belonging to the boundary line of the actual coding area (hereinafter referred to as the first boundary line coordinates), and the center coordinates of the initial QR code area in the first coordinate system (hereinafter referred to as the first center coordinates), and the coordinates of each boundary vertex of the initial QR code area in the first coordinate system (hereinafter referred to as the first boundary vertex coordinates), including the coordinates of the pixels corresponding to the edges of the initial QR code in the first coordinate system, and the coordinates of the pixels corresponding to the vertices of the initial QR code in the first coordinate system.

[0062] Optionally, if the first center coordinates are located within the range of the coordinates of each first actual coding area (for example, there are first actual coding area coordinates that are consistent with the first center coordinates), and the coordinates of each first boundary vertex are inconsistent with the coordinates of each first boundary line, then it is determined that the initial QR code area is located within the actual coding area and does not overlap with the edge line of the actual coding area, and the QR code position detection result is determined to include the product under test as a product that has passed the QR code position detection.

[0063] Optionally, if the first center coordinates are not located within the range of the coordinates of each first actual coding area, and / or, at least one first boundary vertex coordinate among the coordinates of each first boundary vertex is consistent with at least one first boundary line coordinate among the coordinates of each first boundary line (e.g., both are (X1, Y1)), that is, it can be determined that the initial QR code area is not located in the actual coding area, and / or, there is an edge line overlap phenomenon, then it can be determined that the QR code position degree detection result includes the product under test as a product that fails the QR code position degree detection.

[0064] Step b20: In response to the target area only including the actual QR code area, if the actual QR code area is located within the reference ROI area and does not overlap with the edge of the reference ROI area, then the QR code position detection result is determined to include the product under test as a product that has passed the QR code position detection. Optionally, when the target area determined based on the preset pixel dynamic threshold and the preset closing operation model is the actual QR code area, the first coordinate system corresponding to the product image can be determined, and the coordinates of each pixel in the reference ROI area within the first coordinate system (hereinafter referred to as the second actual coding area coordinates) can be determined, as well as the coordinates of each second actual coding area belonging to the boundary line of the reference ROI area (hereinafter referred to as the second boundary line coordinates), and the center coordinates of the actual QR code area in the first coordinate system (hereinafter referred to as the second center coordinates), and the coordinates of each boundary vertex of the actual QR code area in the first coordinate system (hereinafter referred to as the second boundary vertex coordinates), including the coordinates of the pixels corresponding to the edges of the actual QR code area in the first coordinate system, and the coordinates of the pixels corresponding to the vertices of the actual QR code area in the first coordinate system.

[0065] Optionally, if the second center coordinates are within the range of the coordinates of each second actual coding area (for example, there are second actual coding area coordinates that are consistent with the second center coordinates), and the coordinates of each second boundary vertex are inconsistent with the coordinates of each second boundary line, then it is determined that the actual QR code area is located within the reference ROI area and does not overlap with the edge line of the reference ROI area, and the QR code position detection result is determined to include the product under test as a product that has passed the QR code position detection.

[0066] Optionally, if the second center coordinates are not located within the range of the coordinates of each second actual coding area, and / or, at least one second boundary vertex coordinate among the coordinates of each second boundary vertex is consistent with at least one second boundary line coordinate among the coordinates of each second boundary line (e.g., both are (X1, Y1)), that is, it can be determined that the actual QR code area is not located within the baseline ROI area, and / or, there is an edge line overlap phenomenon, then it can be determined that the QR code position degree detection result includes the product under test as a product that fails the QR code position degree detection.

[0067] Step b30: In response to the target area including the actual coding area and the actual QR code area, if the actual QR code area is located within the actual coding area and does not overlap with the edge of the actual coding area, then the QR code position detection result is determined to include the product under test as a product that passes the QR code position detection.

[0068] Optionally, when the target area determined based on a preset pixel dynamic threshold and a preset closing operation model is the actual coding area and the actual QR code area, a first coordinate system corresponding to the product image can be determined, and the area within the first coordinate system can be determined. The coordinates of each pixel in the actual QR code area (hereinafter referred to as the third actual QR code area coordinates), and the coordinates of each third actual QR code area belonging to the boundary line of the actual QR code area (hereinafter referred to as the third boundary line coordinates) are determined. The center coordinates of the actual QR code area in the first coordinate system (hereinafter referred to as the third center coordinates) and the coordinates of each boundary vertex of the actual QR code area in the first coordinate system (hereinafter referred to as the third boundary vertex coordinates) are also determined, including the coordinates of the pixels corresponding to the edges of the actual QR code area in the first coordinate system and the coordinates of the pixels corresponding to the vertices of the actual QR code area in the first coordinate system.

[0069] Optionally, if the coordinates of the third center are within the range of the coordinates of each third actual coding area (for example, there are third actual coding area coordinates that are consistent with the coordinates of the third center), and the coordinates of each third boundary vertex are inconsistent with the coordinates of each third boundary line, then it is determined that the actual QR code area is located within the actual coding area and does not overlap with the edge line of the actual coding area, and the QR code position detection result is determined to include the product under test as a product that has passed the QR code position detection.

[0070] Optionally, if the third center coordinates are not located within the range of the coordinates of each third actual coding area, and / or, at least one third boundary vertex coordinate among the coordinates of each third boundary vertex is consistent with at least one third boundary line coordinate among the coordinates of each third boundary line (e.g., both are (X1, Y1)), that is, it can be determined that the actual QR code area is not located within the actual coding area, and / or, there is an edge line overlap phenomenon, then it can be determined that the QR code position degree detection result includes the product under test as a product that fails the QR code position degree detection.

[0071] In this embodiment, by acquiring a product image of the product to be tested and determining a matching product template, and when the initial QR code area in the product image is detected to be located in the reference ROI area representing the coding area in the product template, and does not overlap with the edge of the reference ROI area, it can be preliminarily considered that the QR code of the product to be tested is located in the coding area, thus completing one QR code position detection process for the product to be tested. In order to obtain the QR code position of the product to be tested more accurately, the QR code position detection of the product to be tested can continue. The actual coding area and / or the actual QR code area in the product image are determined by using a preset pixel dynamic threshold and a closing operation model. Based on the actual coding area and / or the actual QR code area, the QR code position of the product to be tested is detected, and the corresponding QR code position detection result is obtained. Then, the advantages of the closing operation model can be used to accurately capture the actual coding area and / or the actual QR code area to effectively identify the QR code position of the product to be tested, thereby improving the accuracy of QR code position detection.

[0072] Based on the first embodiment of this application, a second embodiment of this application is proposed. In this second embodiment, content that is the same as or similar to the above embodiment can be referred to the above description, and will not be repeated hereafter. Based on this, refer to... Figure 3 In step S30, the step of determining the target region in the product image based on the preset pixel dynamic threshold and the preset closed operation model also includes steps c10-c20.

[0073] Step c10: Determine the pixel parameters of each pixel in the product image, and based on the pixel parameters and the preset pixel dynamic threshold, determine the first image region representing the coding area and / or the second image region representing the QR code area in the product image. Optionally, when preprocessing the product image, the pixel parameters of each pixel in the product image can be determined, such as grayscale value, pixel value, color parameters, brightness value, etc.

[0074] Optionally, a preset dynamic pixel threshold can be set for the coding area, or a preset dynamic pixel threshold can be set for the QR code area. The preset dynamic pixel thresholds of the two can be different.

[0075] Optionally, the pixel parameters of each pixel in the product image can be filtered based on a dynamic pixel threshold corresponding to the coding area, and a first image region representing the coding area can be determined based on the filtered pixels. Similarly, the pixel parameters of each pixel in the product image can be filtered based on a dynamic pixel threshold corresponding to the QR code area, and a second image region representing the QR code area can be determined based on the filtered pixels.

[0076] Optionally, step c10, which involves determining the first image region representing the coding area and / or the second image region representing the QR code area in the product image based on pixel parameters and a preset pixel dynamic threshold, includes steps c11-c13.

[0077] Step c11: For each pixel in the product image, determine the pixel parameter difference information between the pixel parameter and the pixel parameters of the pixel's neighboring pixels; Step c12: If the pixel parameter difference information is greater than the preset pixel dynamic threshold, then the pixel is determined to be the target pixel. Step c13: Determine the third image region containing all target pixels in the product image, and perform morphological hole filling on the third image region to obtain the fourth image region. If the preset pixel dynamic threshold is the same as the pixel dynamic threshold corresponding to the coding area, then the fourth image region is the first image region. If the preset pixel dynamic threshold is the same as the pixel dynamic threshold corresponding to the QR code area, then the fourth image region is the second image region.

[0078] For each pixel in a product image, pixels that are positionally adjacent to that pixel can be identified and designated as its neighboring pixels. Alternatively, the product image can be divided into pixel regions, resulting in multiple pixel regions. For each pixel within a region, all other pixels in that region can be considered its neighboring pixels.

[0079] Optionally, the same processing can be performed on each pixel in the product image. The following example only illustrates the process for a single pixel.

[0080] Optionally, the pixel parameters of a pixel and the pixel parameters of its neighboring pixels can be determined. Taking the pixel parameter as a brightness value as an example, the preset pixel dynamic threshold can also be a brightness threshold.

[0081] Optionally, the absolute brightness difference between a pixel's brightness value and that of its neighboring pixels can be determined and used as pixel parameter difference information. The system then checks whether this absolute brightness difference is greater than a brightness threshold. If it is, the pixel is considered a target pixel due to the significant brightness difference between it and its neighboring pixels. If the absolute brightness difference is less than or equal to the brightness threshold, the pixel is considered to have a smaller brightness difference with its neighboring pixels, allowing the system to proceed to determine the next pixel in the product image.

[0082] Optionally, all target pixels in the product image can be aggregated to form a third image region. The third image region can be detected to determine whether morphological hole filling is required. If not, the third image region is used as the first image region and / or the second image region. If so, morphological hole filling is performed on the third image region. For example, hole detection is first performed on the third image region to identify holes in the third image region (for example, background pixels with a pixel value of 0 can be used as holes). Then, based on the pixel values ​​of the pixels surrounding the hole, the hole can be processed to make the pixels at the hole consistent with the surrounding pixels. For example, if the pixels around the hole are all 1, while the pixels of the hole are 0, the pixels of the hole can be adjusted to 1, thereby realizing the morphological hole filling operation, obtaining a fourth image region, and using the fourth image region as the first image region and / or the second image region.

[0083] In this embodiment, for each pixel in the product image, the pixel parameter difference information corresponding to the pixel is compared with a preset pixel dynamic threshold to determine the target pixel, thereby obtaining the third image region. Then, morphological hole filling is performed to obtain the fourth image region, thus ensuring the accuracy and effectiveness of the determined fourth image region.

[0084] Step c20: Perform a closing operation on the first image region using a preset closing operation model to obtain the actual coding region, and / or perform a closing operation on the second image region using a preset closing operation model to obtain the actual QR code region.

[0085] Optionally, since some products cannot be filled with morphological holes due to dirty fibers and surface floating fibers (whitening), a closing operation model can be used to perform a closing operation on the fourth image area after morphological hole filling to obtain the actual coding area and / or the actual QR code area.

[0086] Optionally, for the first image region representing the coding area, the product image containing the first image region can be input into a preset closing operation model, so as to perform closing operation processing on the first image region through the closing operation model to obtain the image region representing the actual coding in the product image, and use it as the actual coding area.

[0087] Optionally, for the second image region representing the coding area, the same operation as for the first image region is adopted. That is, the product image containing the second image region can be input into a preset closing operation model, so as to perform closing operation processing on the second image region through the closing operation model to obtain the image region representing the actual coding in the product image, and use it as the actual QR code region.

[0088] Optionally, the following example only illustrates the processing of the first image region using a preset closing operation model. The process of processing the second image region using the preset closing operation model can also be referred to the following content, and will not be repeated here.

[0089] Optionally, step c20, which involves performing a closing operation on the first image region using a preset closing operation model to obtain the actual coding region, includes steps c21-c23.

[0090] Step c21: Using a preset closing operation model, perform a closing operation on the product image containing the first image region to obtain the fifth image region in the product image, and detect whether there is transformation information between the fifth image region and the first image region. Step c22: If transformation information exists, determine whether the convexity corresponding to the fifth image region meets the preset convexity condition, wherein the preset convexity condition includes the convexity reaching a preset maximum value or the convexity showing a decreasing trend. Step c23: If the condition is met, then the fifth image region is taken as the actual coding region.

[0091] Alternatively, convexity can be a key geometric feature in image processing and shape analysis. It describes how close a region is to a perfect convex shape and is a core indicator for measuring the “fullness” or “concavity” of a shape.

[0092] Optionally, in a closing operation processing step, convexity can be equal to the ratio between the area of ​​the image region (such as the fifth image region) and the area of ​​the convex hull of the image region (i.e., the pixel area relative to the convexity formed before the closing operation processing).

[0093] Optionally, the product image containing the first image region can be input into a preset closing operation model. In the closing operation model, the product image containing the first image region can be closed. For example, the product image containing the first image region can be closed multiple times. The model parameters in the closing operation model can be set to a single closing radius of 1.5 pixels. The first image region can be closed in a circular structure with a closing radius of 1.5 pixels. That is, the first image region is first expanded and then eroded to obtain the fifth image region in the product image, and the product image containing the fifth image region is output.

[0094] Optionally, the first image region and the fifth image region can be detected to determine whether there is transformation information between them. If there is no transformation information, the first image region and the fifth image region are consistent.

[0095] Optionally, if the first image region and the fifth image region are inconsistent, it can be determined that transformation information exists. Convexity detection can then be performed to determine the convexity corresponding to the fifth image region in the product image, and to detect whether this convexity reaches a preset maximum value (e.g., 1 or 0.99), or whether the convexity shows a decreasing trend (e.g., the convexity corresponding to the fifth image region is less than the convexity corresponding to the first image region). If the convexity reaches the preset maximum value, or if a decreasing trend is detected, the closing operation can be terminated, and the fifth image region in the product image can be used as the actual coding region, i.e., as the target region.

[0096] In this embodiment, a fifth image region of the product image is obtained by performing a closing operation using a closing operation model. There is transformation information between the fifth image region and the first image region, and when the convexity corresponding to the fifth image region satisfies a preset convexity condition, the fifth image region is taken as the actual coding region, thereby ensuring the validity of the determined actual coding region.

[0097] Optionally, after step c21, which detects whether there is transformation information between the fifth image region and the first image region, steps c24-c27 are included.

[0098] Step c24: If there is no transformation information, update the parameters of the closing operation model, and use the parameter-updated closing operation model to perform a closing operation on the product image containing the fifth image region to obtain the sixth image region in the product image. Step c25: Detect whether the convexity corresponding to the sixth image region satisfies the preset convexity condition; Step c26: If the convexity corresponding to the sixth image region does not meet the preset convexity condition, then the parameters of the parameter-updated closed operation model are updated again. Step c27: Based on the parameter-updated closing operation model and the sixth image region, perform the closing operation on the product image containing the fifth image region using the parameter-updated closing operation model until the convexity of the latest obtained image region satisfies the preset convexity condition, and use the latest obtained image region as the actual coding area.

[0099] Optionally, if it is determined that there is no transformation information, or the convexity corresponding to the fifth image region in the product image does not meet the preset convexity condition, the closing operation can continue to be performed, that is, the operation of steps c24-c27 can be executed.

[0100] Optionally, the model parameters of the closing operation model can be updated first. For example, the closing radius of the circular structure can be multiplied by 2, such as 2*1.5=3, which determines that the radius of the circular structure used in this closing operation can be 3 pixels. The closing operation model can then be used to perform a closing operation on the fifth image region in the product image using a circular structure with a radius of 3 pixels, resulting in the sixth image region. The same detection process as for the fifth image region is then performed on the sixth image region to determine whether the closing operation needs to be stopped. If the convexity corresponding to the sixth image region in the product image does not meet the preset convexity condition, the model parameters can be updated again, and the closing operation can be performed again until the convexity of the latest obtained image region meets the preset convexity condition. The latest obtained image region is then used as the actual coding area.

[0101] In addition, to help understand the principle of QR code position detection, the following example is provided.

[0102] For example, such as Figure 4 As shown, first, the product image of the product to be tested for QR code positional detection is acquired and used as the input image for QR code positional detection. Pixel regions can be extracted and output based on a preset pixel dynamic threshold. That is, the pixel region composed of pixels whose pixel parameter difference information is greater than the preset pixel dynamic threshold is extracted from the product image as the third pixel region. Then, hole filling is performed on the extracted pixel region to output Region1 (i.e., the fourth image region). That is, morphological hole filling is performed on the third pixel region to obtain the fourth image region. A closing operation can be performed on Region1 according to the closing operation model, and the model parameter of the closing operation model is initialized with radius R0 of 1.5. Then, the image region after the closing operation is output, such as the fifth image region. The operation of subtracting the unprocessed region from the processed region is performed, that is, subtracting the fourth image region from the fifth image region. It is determined whether the result is empty. If so, it is determined that there is no transformation information between the two, and subsequent closing operations can continue. After the closing operation is performed, the model parameter of the closing operation model is updated, for example, R0 = R0 * 2, and then the closing operation is performed again. If the result is empty, indicating a transformation between the two regions, the convexity of Region2 (the fifth image region) is calculated. It is then determined whether the convexity of the processed region is less than that of the unprocessed region; specifically, whether the convexity of the fifth image region is less than that of the fourth image region. If so, the convexity is determined to be decreasing, and the fifth image region can be used as the actual coding area or the actual QR code area, ending the closing operation. If not, meaning the convexity of the fifth image region is not less than that of the fourth image region, the model parameters of the closing operation model can be updated, for example, R0 = R0 * 2, and the closing operation is performed again until the end.

[0103] In this embodiment, when there is no transformation information between the fifth image region and the first image region, multiple closing operations can be performed to fully utilize the advantages of the closing operation model, so as to accurately obtain the actual coding area in the product image. Then, the actual coding area is used to detect the QR code position of the product under test, thereby improving the accuracy of QR code position detection.

[0104] Furthermore, this application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the QR code position detection method in Embodiment 1 above.

[0105] The following is for reference. Figure 5 The figure illustrates a structural diagram of an electronic device suitable for implementing embodiments of this application. The electronic devices in the embodiments of this application may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The devices shown in the figure are merely examples and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0106] The electronic device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for device operation. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. While electronic devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0107] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0108] The electronic device provided in this application, employing the QR code position detection method in the above embodiments, can solve the technical problem of how to improve the accuracy of QR code position detection. Compared with the prior art, the beneficial effects of the electronic device provided in this application are the same as those of the QR code position detection method provided in the above embodiments, and other technical features of this electronic device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0109] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0110] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0111] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the QR code position detection method in the above embodiments.

[0112] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0113] The aforementioned computer-readable storage medium may be included in an electronic device or may exist independently without being assembled into an electronic device.

[0114] The aforementioned computer-readable storage medium carries one or more programs, which, when executed by an electronic device, enable the electronic device to perform the steps in the aforementioned QR code position detection method.

[0115] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0116] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0117] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0118] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described QR code position detection method, thereby solving the technical problem of how to improve the accuracy of QR code position detection. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the QR code position detection method provided in the above embodiments, and will not be repeated here.

[0119] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the QR code position detection method described above.

[0120] The computer program product provided in this application can solve the technical problem of how to improve the accuracy of QR code position detection. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the QR code position detection method provided in the above embodiments, and will not be repeated here.

[0121] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for detecting the position of a QR code, characterized in that, The QR code position detection method includes: Acquire a product image of the product to be tested, and determine a product template that matches the product image; Detect whether the initial QR code region representing the QR code in the product image is located within the reference ROI region of the product template and does not overlap with the edge of the reference ROI region, wherein the reference ROI region is the image region representing the coding area; If the initial QR code area is located within the baseline ROI area and does not overlap with the edge line, then the target area in the product image is determined based on the preset pixel dynamic threshold and the preset closing operation model, wherein the target area includes the actual coding area and / or the actual QR code area. The QR code position detection result of the product under test is determined based on the target area.

2. The QR code position detection method as described in claim 1, characterized in that, The step of determining the target region in the product image based on a preset pixel dynamic threshold and a preset closing operation model includes: The pixel parameters of each pixel in the product image are determined, and based on the pixel parameters and a preset pixel dynamic threshold, a first image region representing the coding area and / or a second image region representing the QR code area in the product image are determined. The first image region is processed by a pre-defined closing operation model to obtain the actual coding region, and / or the second image region is processed by a pre-defined closing operation model to obtain the actual QR code region.

3. The QR code position detection method as described in claim 2, characterized in that, The step of determining the first image region representing the coding area and / or the second image region representing the QR code area in the product image based on the pixel parameters and a preset pixel dynamic threshold includes: For each pixel in the product image, determine the pixel parameter difference information between the pixel parameter of the pixel and the pixel parameters of the neighboring pixels of the pixel; If the difference in pixel parameters is greater than a preset dynamic pixel threshold, then the pixel is determined to be the target pixel; A third image region containing all the target pixels in the product image is determined, and morphological hole filling is performed on the third image region to obtain a fourth image region. If the preset pixel dynamic threshold is the pixel dynamic threshold corresponding to the coding region, then the fourth image region is the first image region. If the preset pixel dynamic threshold is the pixel dynamic threshold corresponding to the QR code region, then the fourth image region is the second image region.

4. The QR code position detection method as described in claim 2, characterized in that, The step of performing a closing operation on the first image region using a preset closing operation model to obtain the actual coded region includes: Using a preset closing operation model, a closing operation is performed on the product image containing the first image region to obtain the fifth image region in the product image, and it is detected whether there is transformation information between the fifth image region and the first image region. If transformation information exists, it is determined whether the convexity corresponding to the fifth image region satisfies the preset convexity condition, wherein the preset convexity condition includes the convexity reaching a preset maximum value or the convexity showing a decreasing trend. If the conditions are met, the fifth image region will be used as the actual censoring region.

5. The QR code position detection method as described in claim 4, characterized in that, After the step of detecting whether there is transformation information between the fifth image region and the first image region, the method includes: If there is no transformation information, the parameters of the closing operation model are updated, and the closing operation model with updated parameters is used to perform a closing operation on the product image containing the fifth image region to obtain the sixth image region in the product image. Detect whether the convexity corresponding to the sixth image region satisfies the preset convexity condition; If the convexity corresponding to the sixth image region does not meet the preset convexity condition, then the parameters of the closed operation model with updated parameters will be updated again. Based on the closed operation model with updated parameters and the sixth image region, the step of performing a closed operation on the product image containing the fifth image region using the closed operation model with updated parameters is executed until the convexity of the latest obtained image region satisfies the preset convexity condition, and the latest obtained image region is used as the actual coding region.

6. The QR code position detection method according to any one of claims 1-5, characterized in that, The step of detecting whether the initial QR code region representing the QR code in the product image is located within the reference ROI region of the product template and does not overlap with the edge of the reference ROI region includes: Determine the baseline ROI region of the product template, wherein the baseline ROI region is a closed region formed by connecting the centerlines of multiple rectangular regions at different locations in the product template; Map the initial QR code region and the reference ROI region to the same coordinate system, and determine whether the center coordinates of the initial QR code region are located within the reference ROI region under the same coordinate system, and whether there are any boundary vertex coordinates in the boundary vertex coordinates of the initial QR code region that overlap with the edge of the reference ROI region. If, in the same coordinate system, the center coordinates are located within the reference ROI region, and none of the boundary vertex coordinates overlap with the edge of the reference ROI region, then the initial QR code region is determined to be located within the reference ROI region and does not overlap with the edge of the reference ROI region.

7. The QR code position detection method according to any one of claims 1-5, characterized in that, The step of determining the QR code position detection result of the product to be tested based on the target area includes at least one of the following: In response to the target area including only the actual coding area, if the initial QR code area is located within the actual coding area and does not overlap with the edge of the actual coding area, then the QR code position detection result is determined to include the product under test as a product that passes the QR code position detection. In response to the target area including only the actual QR code area, if the actual QR code area is located within the reference ROI area and does not overlap with the edge of the reference ROI area, then the QR code position detection result is determined to include the product under test as a product that passes the QR code position detection. In response to the target area including the actual coding area and the actual QR code area, if the actual QR code area is located within the actual coding area and does not overlap with the edge of the actual coding area, then the QR code position detection result is determined to include the product under test as a product that passes the QR code position detection.

8. An electronic device, characterized in that, The electronic device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the QR code positional detection method as described in any one of claims 1 to 7.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the QR code position detection method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the QR code position detection method as described in any one of claims 1 to 7.