A QR code recognition and positioning method and device
By identifying the horizontal line segment and vertical line segment in the first rectangular identification in the QR code, the vertical and horizontal coordinates of the QR code area are determined, and the problem of failure in QR code recognition is solved, and accurate QR code recognition is achieved.
Patent Information
- Application Number
- CN202211269006.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-17
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-10-17
AI Technical Summary
During the QR QR code identification process, the horizontal positioning graph cannot analyze the vertical coordinates of all pixels in the area between horizontal adjacent vertex areas, and the vertical positioning graph cannot analyze the horizontal coordinates of all pixels in the area between vertical adjacent vertex areas, resulting in the QR QR code identification failure.
By scanning the QR code, the first rectangle identification is obtained and the horizontal line segment arranged from the vertical direction and the vertical line segment arranged from the horizontal direction are identified. According to the coordinates of these line segments, the first and second regions of the QR code include the vertical coordinates and horizontal coordinates of the pixels to realize the identification and positioning of the QR QR code.
Through the horizontal line segment arranged from the vertical direction and the vertical line segment arranged from the horizontal direction in the first rectangle mark, the coordinates of the pixels in the QR code area are determined, and combined with the analysis results of the horizontal positioning graphics and the vertical positioning graphics, the successful identification of the QR QR code is realized, avoiding the problem of recognition failure.
Smart Images

Figure CN115587607B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of two-dimensional code recognition and positioning, and in particular to a method and device for recognizing and positioning a QR two-dimensional code. Background Art
[0002] A QR code is a black and white graphic that records data symbol information and is distributed in a plane using certain geometric shapes in a certain pattern. A common QR code is the Quick Response Code (QR code), in which Quick Response is a coding method.
[0003] In some implementations of QR code positioning and recognition, first, the pixel positions of the area between adjacent vertex areas and the center area in the QR code area are determined through horizontal positioning patterns and vertical positioning patterns; then, based on the pixel positions of the area between adjacent vertex areas and the center area in the QR code area, the QR code area is decoded, and finally the data compliance information recorded in the QR code is obtained.
[0004] However, in the scenario where the area between adjacent vertex areas in the QR code area is located by means of horizontal positioning patterns and vertical positioning patterns, the horizontal positioning pattern cannot resolve the vertical coordinates of all pixels in the area between horizontally adjacent vertex areas, and the vertical positioning pattern cannot resolve the horizontal coordinates of all pixels in the area between vertically adjacent vertex areas, resulting in failure of QR code recognition. Summary of the invention
[0005] In order to solve the problem of QR two-dimensional code recognition failure caused by the horizontal positioning pattern being unable to resolve the vertical coordinates of all pixels in the area between horizontally adjacent vertex areas, and the vertical positioning pattern being unable to resolve the horizontal coordinates of all pixels in the area between vertically adjacent vertex areas, the present application provides a QR two-dimensional code recognition and positioning method and device.
[0006] In order to solve the above technical problems, the embodiments of the present application disclose the following technical solutions:
[0007] In a first aspect, the present application discloses a method for identifying and locating a QR code, including:
[0008] Scan the QR code to obtain a first rectangular mark, where the first rectangular mark is set at the top corner area of the QR code;
[0009] Identify the vertically arranged horizontal line segments and the horizontally arranged vertical line segments in the first rectangular mark;
[0010] Determine the ordinate of the pixel in the first area of the QR code according to the first ordinate corresponding to the horizontal line segment, and determine the ordinate of the pixel in the second area of the QR code according to the first ordinate corresponding to the vertical line segment, so as to identify and locate the QR code;
[0011] The first area is an area adjacent to the first rectangular mark in the horizontal direction in the two-dimensional code, and the second area is an area adjacent to the first rectangular mark in the vertical direction in the two-dimensional code.
[0012] Optionally, in the step of identifying the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark, the method includes:
[0013] According to the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark, the first longitudinal coordinates of the longitudinally arranged horizontal line segments and the first transverse coordinates of the transversely arranged vertical line segments in the first rectangular mark are determined.
[0014] Optionally, before the step of identifying the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark, the method includes:
[0015] A first detection area is determined according to the first rectangular mark, and a relative position between the first detection area and the first rectangular mark is fixed.
[0016] Optionally, in the step of determining the first detection area according to the first rectangular marker, wherein the relative position of the first detection area and the first rectangular marker is fixed, the method includes:
[0017] The longitudinal coordinate of the outer boundary line segment of the first detection area is determined according to the longitudinal coordinate of the outer boundary horizontal line segment arranged vertically in the first rectangular mark, and the horizontal coordinate of the outer boundary line segment of the first detection area is determined according to the horizontal coordinate of the outer boundary vertical line segment arranged horizontally in the first rectangular mark.
[0018] Optionally, in the process of identifying and locating the QR code according to the first ordinate and the first abscissa, the method includes:
[0019] According to the first ordinate, determine the ordinate corresponding to the first center point of the first rectangular mark, and according to the ordinate corresponding to the first center point, determine the ordinate of the pixel in the first area of the two-dimensional code, wherein the first center point is a point equidistant from both ends of an adjacent horizontal line segment;
[0020] According to the first horizontal coordinate, determine the horizontal coordinate corresponding to the second center point of the first rectangular mark, and according to the horizontal coordinate corresponding to the second center point, determine the horizontal coordinate of the pixel contained in the second area of the QR code, wherein the second center point is a point equidistant from both ends of the adjacent vertical line segment;
[0021] The two-dimensional code is identified and located according to the vertical coordinates of the pixels included in the first area of the two-dimensional code and the horizontal coordinates of the pixels included in the second area of the two-dimensional code.
[0022] In a second aspect, the present application discloses a QR code recognition and positioning device, including:
[0023] A scanning module is used to execute: scanning the QR code to obtain a first rectangular mark, where the first rectangular mark is set at a top corner area of the QR code;
[0024] A recognition module, used to execute: recognizing the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark;
[0025] Execution module: Determine the vertical coordinate of the pixel in the first area of the QR code according to the first vertical coordinate corresponding to the horizontal line segment, and determine the horizontal coordinate of the pixel in the second area of the QR code according to the first horizontal coordinate corresponding to the vertical line segment, so as to identify and locate the QR code, wherein the first area is the adjacent area of the first rectangular mark in the horizontal direction in the QR code, and the second area is the adjacent area of the first rectangular mark in the vertical direction in the QR code.
[0026] Optionally, identify the module, specifically for performing:
[0027] According to the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark, the first longitudinal coordinates of the longitudinally arranged horizontal line segments and the first transverse coordinates of the transversely arranged vertical line segments in the first rectangular mark are determined.
[0028] Optionally, the execution module is also used to execute:
[0029] A first detection area is determined according to the first rectangular mark, and a relative position between the first detection area and the first rectangular mark is fixed.
[0030] Optionally, the execution module is also used to execute:
[0031] The longitudinal coordinate of the outer boundary line segment of the first detection area is determined according to the longitudinal coordinate of the outer boundary horizontal line segment arranged vertically in the first rectangular mark, and the horizontal coordinate of the outer boundary line segment of the first detection area is determined according to the horizontal coordinate of the outer boundary vertical line segment arranged horizontally in the first rectangular mark.
[0032] Optional, execution module, specifically used to execute:
[0033] According to the first ordinate, determine the ordinate corresponding to the first center point of the first rectangular mark, and according to the ordinate corresponding to the first center point, determine the ordinate of the pixel in the first area of the two-dimensional code, wherein the first center point is a point equidistant from both ends of an adjacent horizontal line segment;
[0034] According to the first horizontal coordinate, determine the horizontal coordinate corresponding to the second center point of the first rectangular mark, and according to the horizontal coordinate corresponding to the second center point, determine the horizontal coordinate of the pixel contained in the second area of the QR code, wherein the second center point is a point equidistant from both ends of the adjacent vertical line segment;
[0035] The two-dimensional code is identified and located according to the vertical coordinates of the pixels included in the first area of the two-dimensional code and the horizontal coordinates of the pixels included in the second area of the two-dimensional code.
[0036] The beneficial effects of the present application are as follows: the vertical coordinates of the pixels in the first area are determined by the vertically arranged horizontal line segments in the first rectangular mark; the horizontal coordinates of the pixels in the second area are obtained by the horizontally arranged vertical line segments in the first rectangular mark. The vertical coordinates of the pixels in the first area and the horizontal coordinates of the pixels in the second area are combined with the horizontal coordinates of the pixels in the first area, the vertical coordinates of the pixels in the second area, and the horizontal and vertical coordinates of the pixels in the central area parsed through the horizontal positioning pattern and the vertical positioning pattern to achieve QR two-dimensional code recognition. The failure of QR two-dimensional code recognition caused by the inability to parse the vertical coordinates of the pixels in the first area and the horizontal coordinates of the pixels in the second area is avoided.
[0037] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0039] Figure 1 A schematic diagram of a QR code recognition and positioning method provided in an embodiment of the present application;
[0040] Figure 2 A schematic diagram of the structure of a QR two-dimensional code provided in an embodiment of the present application;
[0041] Figure 3 A schematic diagram of the structure of a first rectangular mark provided in an embodiment of the present application;
[0042] Figure 4 A schematic diagram of the structure of another first rectangular mark provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0044] To facilitate the technical solution of the application, some concepts involved in the application are first explained below.
[0045] The QR two-dimensional code includes multiple modules, which are divided into black modules and white modules according to polarity. The black module includes multiple adjacent black pixels, and the white module includes multiple adjacent white pixels. The first rectangular logo is a figure composed of three nested squares of black and white and different sizes. The length and width of the first rectangular logo are both 7 modules, and each module includes N*N pixels, where N can be selected as a positive integer greater than or equal to 1.
[0046] The seventh row of modules between the first adjacent rectangular logos in the horizontal direction of the QR two-dimensional code is a horizontal positioning pattern, and the seventh column of modules between the first adjacent rectangular logos in the vertical direction of the QR two-dimensional code is a vertical positioning pattern. When the three black and white squares of different sizes of the first rectangular logo include two black squares and one white square, the modules at both ends of the horizontal positioning pattern and the vertical positioning pattern are white modules, and when the three black and white squares of different sizes of the first rectangular logo include two white squares and one black square, the modules at both ends of the horizontal positioning pattern and the vertical positioning pattern are black modules.
[0047] See also Figure 1 and Figure 2 The present application embodiment provides a QR code recognition and positioning method, comprising the following steps:
[0048] Step S110: Scan the QR code to obtain a first rectangular mark, where the first rectangular mark is set at the top corner area of the QR code.
[0049] In some embodiments, a first detection area is determined based on a first rectangular marker 1, and a relative position of the first detection area and the first rectangular marker 1 is fixed so that within the scope of the first detection area, the vertically arranged horizontal line segments and the horizontally arranged vertical line segments in the first rectangular marker 1 are obtained.
[0050] like Figure 3As shown, in some embodiments, the first detection area includes a first sub-area 2, a second sub-area 3, a third sub-area 4, a fourth sub-area 5, a fifth sub-area 6, a sixth sub-area 7, a seventh sub-area 8 and an eighth sub-area 9, the first sub-area 2, the second sub-area 3, the third sub-area 4 and the fourth sub-area 5 are arranged in sequence along the vertical direction, the fifth sub-area 6, the sixth sub-area 7, the seventh sub-area 8 and the eighth sub-area 9 are arranged in sequence along the horizontal direction, and the longitudinally arranged horizontal line segments are obtained from the first sub-area 2, the second sub-area 3, the third sub-area 4 and the fourth sub-area 5, and the transversely arranged vertical line segments are obtained from the fifth sub-area 6, the sixth sub-area 7, the seventh sub-area 8 and the eighth sub-area 9.
[0051] In some embodiments, the length of the first rectangular identifier 1 is assigned to each area included in the first detection area. As the length of each area included in the first detection area, the length of the first rectangular identifier 1 is the distance from the left end to the right end of the first rectangular identifier 1 in the horizontal direction.
[0052] According to the distribution ratio of black modules and white modules in the first detection area, the width of each area included in the first detection area is obtained, the width of the first sub-area 2, the fourth sub-area 5, the fifth sub-area 6 and the eighth sub-area 9 are all 0.5 modules, and the width of the second sub-area 3, the third sub-area 4, the sixth sub-area 7 and the seventh sub-area 8 are all 2 modules.
[0053] The vertical coordinate of the lower boundary horizontal line segment of the second sub-area 3 is 2 modules away from the vertical coordinate of the upper boundary horizontal line segment of the third sub-area 4, and the horizontal coordinate of the right boundary vertical line segment of the sixth sub-area 7 is 2 modules away from the horizontal coordinate of the left boundary vertical line segment of the seventh sub-area 8.
[0054] In some embodiments, the longitudinal coordinate of the outer boundary line segment of the first detection area is determined according to the longitudinal coordinate of the outer boundary horizontal line segment arranged vertically in the first rectangular identifier 1, and the horizontal coordinate of the outer boundary line segment of the first detection area is determined according to the horizontal coordinate of the outer boundary vertical line segment arranged horizontally in the first rectangular identifier 1, and the position of the first detection area is determined according to the longitudinal coordinate and horizontal coordinate of the outer boundary line segment of the first detection area.
[0055] In some embodiments, the longitudinal coordinates of the outer boundary line segments arranged vertically in the first detection area differ from the longitudinal coordinates of the outer boundary horizontal line segments arranged vertically in the corresponding first rectangular mark 1 by 2 pixels, the horizontal coordinates of the outer boundary line segments arranged horizontally in the first detection area differ from the horizontal coordinates of the outer boundary vertical line segments arranged horizontally in the corresponding first rectangular mark 1 by 2 pixels, and the outer boundary line segments of the first detection area are longer than the length and width of the first rectangular mark 1.
[0056] Since the QR code to be scanned may be deformed, the length of the outer boundary line segment of the first detection area is set to be greater than the length and width of the first rectangular mark 1, thereby avoiding failure in obtaining the first rectangular mark 1 due to deformation of the QR code.
[0057] Step S120: identifying the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark.
[0058] In some embodiments, the first ordinate of the vertically arranged horizontal line segment and the first abscissa of the horizontally arranged vertical line segment in the first rectangular mark 1 are determined according to the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark 1 .
[0059] In some embodiments, the first ordinate of the horizontal line segment and the first abscissa of the vertical line segment are determined according to the maximum value of the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark 1 .
[0060] Step S130: determining the vertical coordinates of the pixels in the first area of the QR code according to the first vertical coordinates corresponding to the horizontal line segments, and determining the horizontal coordinates of the pixels in the second area of the QR code according to the first horizontal coordinates corresponding to the vertical line segments, so as to identify and locate the QR code;
[0061] The first area is an area adjacent to the first rectangular mark in the horizontal direction in the two-dimensional code, and the second area is an area adjacent to the first rectangular mark in the vertical direction in the two-dimensional code.
[0062] In some embodiments, according to the first ordinate, the ordinate corresponding to the first center point of the first rectangular mark 1 is determined, and according to the ordinate corresponding to the first center point, the ordinate of the pixel included in the first area of the two-dimensional code is determined, and the first center point is a point equidistant from both ends of the adjacent horizontal line segment;
[0063] According to the first horizontal coordinate, determine the horizontal coordinate corresponding to the second center point of the first rectangular mark 1, and according to the horizontal coordinate corresponding to the second center point, determine the horizontal coordinate of the pixel included in the second area of the two-dimensional code, and the second center point is a point equidistant from both ends of the adjacent vertical line segment;
[0064] The two-dimensional code is identified and located according to the vertical coordinates of the pixels included in the first area of the two-dimensional code and the horizontal coordinates of the pixels included in the second area of the two-dimensional code.
[0065] Since each module in the first rectangular identifier 1 is connected, and the pixels in the horizontal and vertical directions in each module are connected, the vertical coordinates of the pixels in the first area and the horizontal coordinates of the pixels in the second area can be determined from the vertically arranged horizontal line segments and the horizontally arranged vertical line segments in the first rectangular identifier 1, so as to identify and locate the QR code.
[0066] When obtaining the ordinates of the pixels included in the adjacent area in the horizontal direction of the first rectangular identifier 1, obtain the first rectangular identifier 1 with the larger pixel difference between black pixels and white pixels in the horizontal line segments of the two first rectangular identifiers 1 in the horizontal direction, and the first rectangular identifier 1 with the smaller pixel difference between black pixels and white pixels; obtain the product of the ordinate corresponding to the first center point of the first rectangular identifier 1 with the larger pixel difference and the first coefficient as the first product; obtain the product of the ordinate corresponding to the first center point of the first rectangular identifier 1 with the smaller pixel difference and the second coefficient as the second product; and use the sum of the first product and the second product as the ordinate of the pixels included in the first area. The sum of the first coefficient and the second coefficient is 1, and the first coefficient is greater than the second coefficient.
[0067] By multiplying the vertical coordinates corresponding to the first center points of the first rectangular markers 1 in two horizontal directions adjacent to the first region by different coefficients (a first coefficient and a second coefficient), the accuracy of obtaining the vertical coordinates of the pixels contained in the first region is improved.
[0068] When obtaining the horizontal coordinates of pixels included in the adjacent area in the vertical direction of the first rectangular identifier 1, obtain the first rectangular identifier 1 with a larger pixel difference between black pixels and white pixels in the vertical line segments of the two first rectangular identifiers 1 in the vertical direction, and the first rectangular identifier 1 with a smaller pixel difference between black pixels and white pixels; obtain the product of the horizontal coordinate corresponding to the second center point of the first rectangular identifier 1 with the larger pixel difference and the first coefficient as the first product; obtain the product of the horizontal coordinate corresponding to the second center point of the first rectangular identifier 1 with the smaller pixel difference and the second coefficient as the second product; and use the sum of the first product and the second product as the horizontal coordinate of the pixels included in the second area.
[0069] By multiplying the horizontal coordinates corresponding to the second center points of the first rectangular mark 1 in two vertical directions adjacent to the second area by different coefficients (first coefficient and second coefficient), the accuracy of obtaining the horizontal coordinates of the pixels contained in the second area is improved.
[0070] In some embodiments, the first sub-region 2, the second sub-region 3, the third sub-region 4, the fourth sub-region 5, the fifth sub-region 6, the sixth sub-region 7, the seventh sub-region 8 and the eighth sub-region 9 are equally divided into N small regions, and the vertical coordinates or horizontal coordinates in each of the N small regions are obtained, and the average value of the N vertical coordinates or the horizontal coordinates is used as the first vertical coordinate corresponding to the horizontal line segment or the first horizontal coordinate corresponding to the vertical line segment, and the accuracy of obtaining the first vertical coordinate corresponding to the horizontal line segment and the first horizontal coordinate corresponding to the vertical line segment is improved by taking the average value.
[0071] like Figure 4As shown, in some embodiments, N can be selected as a positive integer greater than 1. When N is 3, three vertical coordinates or horizontal coordinates in the small area 10 are obtained, and the average value of the three vertical coordinates or the horizontal coordinates is used as the first vertical coordinate corresponding to the horizontal line segment or the first horizontal coordinate corresponding to the vertical line segment. By taking the average value, the accuracy of obtaining the first vertical coordinate corresponding to the horizontal line segment and the first horizontal coordinate corresponding to the vertical line segment is improved.
[0072] Corresponding to the above-mentioned embodiment of a QR two-dimensional code recognition and positioning method, the present application also provides an embodiment of a QR two-dimensional code recognition and positioning device. The device includes:
[0073] A scanning module is used to execute: scanning the QR code to obtain a first rectangular mark 1, where the first rectangular mark 1 is set at a top corner area of the QR code;
[0074] The recognition module is used to perform: identifying the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark 1; in some embodiments, the recognition module is specifically used to perform:
[0075] According to the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark 1 , the first ordinates of the vertically arranged horizontal line segments and the first abscissas of the horizontally arranged vertical line segments in the first rectangular mark 1 are determined.
[0076] Execution module: Determine the vertical coordinate of the pixel in the first area of the QR code according to the first vertical coordinate corresponding to the horizontal line segment, and determine the horizontal coordinate of the pixel in the second area of the QR code according to the first horizontal coordinate corresponding to the vertical line segment, so as to identify and locate the QR code, wherein the first area is the adjacent area of the first rectangular mark 1 in the horizontal direction in the QR code, and the second area is the adjacent area of the first rectangular mark 1 in the vertical direction in the QR code.
[0077] In some embodiments, the execution module is further configured to execute:
[0078] According to the first rectangular mark 1 , a first detection area is determined, and the relative position of the first detection area and the first rectangular mark 1 is fixed.
[0079] In some embodiments, the execution module is further configured to execute:
[0080] The longitudinal coordinate of the outer boundary segment of the first detection area is determined according to the longitudinal coordinate of the outer boundary horizontal line segment arranged vertically in the first rectangular identifier 1, and the horizontal coordinate of the outer boundary segment of the first detection area is determined according to the horizontal coordinate of the outer boundary vertical line segment arranged horizontally in the first rectangular identifier 1.
[0081] In some embodiments, the execution module is specifically configured to execute:
[0082] According to the first ordinate, determine the ordinate corresponding to the first center point of the first rectangular mark 1, and according to the ordinate corresponding to the first center point, determine the ordinate of the pixel in the first area of the two-dimensional code, wherein the first center point is a point equidistant from both ends of an adjacent horizontal line segment;
[0083] According to the first horizontal coordinate, determine the horizontal coordinate corresponding to the second center point of the first rectangular mark 1, and according to the horizontal coordinate corresponding to the second center point, determine the horizontal coordinate of the pixel included in the second area of the two-dimensional code, and the second center point is a point equidistant from both ends of the adjacent vertical line segment;
[0084] The two-dimensional code is identified and located according to the vertical coordinates of the pixels included in the first area of the two-dimensional code and the horizontal coordinates of the pixels included in the second area of the two-dimensional code.
[0085] In some embodiments, the scanning module is communicatively connected to the identification module and the execution module, and the identification module is communicatively connected to the execution module.
[0086] Since the above embodiments are all described by citing and combining with other embodiments, different embodiments have the same parts, and the same and similar parts between the embodiments in this specification can be referred to each other, and will not be elaborated in detail here.
[0087] It should be noted that, in this specification, relational terms such as "first" and "second" are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a circuit structure, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such circuit structure, article or device. In the absence of further restrictions, the existence of an element defined by the sentence "includes a..." does not exclude the existence of other identical elements in the circuit structure, article or device including the element.
[0088] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the disclosure of the invention herein. The present application is intended to cover any modification, use or adaptation of the present invention, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the content of the claims. The above-described embodiments of the present application do not constitute a limitation on the scope of protection of the present application.
Claims
1. A QR code recognition and positioning method, characterized in that: The method comprises: Scan the QR code to obtain a first rectangular mark, where the first rectangular mark is set in a top corner area of the QR code; Identify the vertically arranged horizontal line segments and the horizontally arranged vertical line segments in the first rectangular mark; Determine the vertical coordinate of the pixel in the first area of the two-dimensional code according to the first vertical coordinate corresponding to the horizontal line segment, and determine the horizontal coordinate of the pixel in the second area of the two-dimensional code according to the first horizontal coordinate corresponding to the vertical line segment, so as to identify and locate the two-dimensional code; The first area is an area adjacent to the first rectangular mark in the horizontal direction in the two-dimensional code, and the second area is an area adjacent to the first rectangular mark in the vertical direction in the two-dimensional code; Before the step of identifying the vertically arranged horizontal line segments and the horizontally arranged vertical line segments in the first rectangular mark, the method includes: Determine a first detection area according to the first rectangular mark, wherein a relative position between the first detection area and the first rectangular mark is fixed; In the process of identifying and locating the two-dimensional code according to the first ordinate and the first abscissa, the method includes: Determine the ordinate corresponding to the first center point of the first rectangular mark according to the first ordinate, and determine the ordinate of the pixel in the first area of the two-dimensional code according to the ordinate corresponding to the first center point, wherein the first center point is a point equidistant from both ends of the adjacent horizontal line segment; Determine the horizontal coordinate corresponding to the second center point of the first rectangular mark according to the first horizontal coordinate, and determine the horizontal coordinate of the pixel contained in the second area of the two-dimensional code according to the horizontal coordinate corresponding to the second center point, wherein the second center point is a point equidistant from both ends of the adjacent vertical line segment; The two-dimensional code is identified and located according to the vertical coordinates of the pixels in the first area of the two-dimensional code and the horizontal coordinates of the pixels in the second area of the two-dimensional code.
2. The QR code recognition and positioning method according to claim 1, characterized in that: In the step of identifying the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark, the method includes: According to the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark, the first longitudinal coordinates of the longitudinally arranged horizontal line segments and the first transverse coordinates of the transversely arranged vertical line segments in the first rectangular mark are determined.
3. The QR code recognition and positioning method according to claim 1, characterized in that: In the step of determining a first detection area according to the first rectangular mark, wherein a relative position between the first detection area and the first rectangular mark is fixed, the method includes: The longitudinal coordinate of the outer boundary line segment of the first detection area is determined according to the longitudinal coordinate of the outer boundary horizontal line segment arranged vertically in the first rectangular identifier, and the horizontal coordinate of the outer boundary line segment of the first detection area is determined according to the horizontal coordinate of the outer boundary vertical line segment arranged horizontally in the first rectangular identifier.
4. A QR code recognition and positioning device, characterized in that: include: A scanning module is used to execute: scanning the two-dimensional code to obtain a first rectangular mark, where the first rectangular mark is set in a top corner area of the two-dimensional code; A recognition module, used to execute: recognizing the horizontal line segments arranged vertically and the vertical line segments arranged horizontally in the first rectangular mark; Execution module: determining the vertical coordinate of the pixel in the first area of the two-dimensional code according to the first vertical coordinate corresponding to the horizontal line segment, and determining the horizontal coordinate of the pixel in the second area of the two-dimensional code according to the first horizontal coordinate corresponding to the vertical line segment, so as to identify and locate the two-dimensional code, wherein the first area is the adjacent area of the first rectangular mark in the horizontal direction of the two-dimensional code, and the second area is the adjacent area of the first rectangular mark in the vertical direction of the two-dimensional code; The identification module is specifically used to execute: Determine, according to the difference between the pixel values of the black pixels and the white pixels in the first rectangular mark, the first ordinate of the horizontal line segment arranged vertically and the first abscissa of the vertical line segment arranged horizontally in the first rectangular mark; The execution module is specifically used to execute: Determine the ordinate corresponding to the first center point of the first rectangular mark according to the first ordinate, and determine the ordinate of the pixel in the first area of the two-dimensional code according to the ordinate corresponding to the first center point, wherein the first center point is a point equidistant from both ends of the adjacent horizontal line segment; Determine the horizontal coordinate corresponding to the second center point of the first rectangular mark according to the first horizontal coordinate, and determine the horizontal coordinate of the pixel contained in the second area of the two-dimensional code according to the horizontal coordinate corresponding to the second center point, wherein the second center point is a point equidistant from both ends of the adjacent vertical line segment; The two-dimensional code is identified and located according to the vertical coordinates of the pixels in the first area of the two-dimensional code and the horizontal coordinates of the pixels in the second area of the two-dimensional code.
5. The QR code recognition and positioning device according to claim 4, characterized in that: The execution module is further used to execute: A first detection area is determined according to the first rectangular mark, and a relative position between the first detection area and the first rectangular mark is fixed.
6. The QR code recognition and positioning device according to claim 5, characterized in that: The execution module is further used to execute: The longitudinal coordinate of the outer boundary line segment of the first detection area is determined according to the longitudinal coordinate of the outer boundary horizontal line segment arranged vertically in the first rectangular identifier, and the horizontal coordinate of the outer boundary line segment of the first detection area is determined according to the horizontal coordinate of the outer boundary vertical line segment arranged horizontally in the first rectangular identifier.
Citation Information
Patent Citations
Two-dimensional code decoding system and method
CN104517089A
Two-dimensional code positioning method and device, equipment and storage medium
CN113496134A