Quick response code and recognition method therefor, electronic device, storage medium, and program product
By designing a QR code with N information areas and K positioning structures, the problem of integrating existing QR codes with the display interface is solved, achieving efficient scanning and a good user experience.
Patent Information
- Application Number
- PCT/CN2025/078591
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-09-20
- Filing Date
- 2025-02-21
- Publication Date
- 2025-11-27
AI Technical Summary
The existing QR code's lookup pattern and data area display pattern are too complex, making it impossible to integrate with the display interface content and affecting the user's viewing experience.
The QR code design employs N information areas and K positioning structures. Each information area contains multiple information points. The structure is simple and can be integrated with the displayed content. The target information can be obtained by scanning only a portion of the information areas.
It improves the scanning efficiency of QR codes and the user viewing experience, while reducing the area covered by the display interface.
Smart Images

Figure CN2025078591_27112025_PF_FP_ABST
Abstract
Description
QR code, QR code identification method, electronic device, storage medium and program product
[0001] The present application claims priority to the Chinese patent application No. 202410647073.3, filed on May 23, 2024, entitled "QR code, QR code identification method, electronic device, storage medium and program product", the content of which is incorporated herein by reference in its entirety. And the present application also claims priority to the Chinese patent application No. 202411325724.3, filed on September 20, 2024, entitled "QR code, QR code identification method, electronic device, storage medium and program product", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD
[0002] The present application relates to the field of information technology, in particular to a QR code, a QR code identification method, an electronic device, a storage medium and a program product. BACKGROUND
[0003] At present, QR codes are widely used in different scenarios in various industries and are also applied to all aspects of life, for example, mobile payment, information identification and the like through QR codes, which greatly improves the convenience of daily life.
[0004] FIG. 1A shows a structural diagram of a Quick Response (QR) code 100, and the QR code 100 shown in FIG. 1A can generally include several components. For example, the QR code 100 includes finder patterns 101 at the lower left corner, the upper left corner and the upper right corner, respectively, when an electronic device scans the QR code 100, the three finder patterns 101 can make the electronic device determine that the current scanned content is a QR code, and the electronic device can also determine the outer frame of the QR code 100 based on the three finder patterns 101, the QR code 100 also includes a whole data area 102 represented by the blank part of the content of the QR code frame in FIG. 1A, it can be understood that the data area 103 is generally composed of high-density strip irregular patterns with black and white (not shown here).
[0005] The above-mentioned QR code cannot be fused with the display content on the display interface due to the complexity of the finder pattern and the display pattern in the data area, which results in the QR code existing only in the case of covering part of the display content of the electronic device or being displayed in the blank area of the display content of the display interface, affecting the user's viewing experience. SUMMARY
[0006] Embodiments of the present application provide a two-dimensional code, a method for identifying the two-dimensional code, an electronic device, a storage medium and a program product. The two-dimensional code can display target information to be conveyed by a plurality of complete two-dimensional codes through N information areas. In this case, even if the electronic device only scans part of the N information areas, the target information conveyed by the two-dimensional code can be obtained, and the scanning efficiency of the two-dimensional code is improved.
[0007] In a first aspect, the present application provides a two-dimensional code, the two-dimensional code comprising N information areas and K positioning structures, wherein N is greater than 1, and K is greater than or equal to 1; the K positioning structures are used to position each information area in the N information areas respectively, and the information content of the N information areas is used to represent target information corresponding to the two-dimensional code; the positioning structure comprises one or more positioning points, and the information content of the information area comprises a plurality of information points.
[0008] In the two-dimensional code provided by the embodiments of the present application, the information area and the positioning structure are both composed of points, the structure is simple, and a large area of the display content of the display interface of the electronic device is not covered, only a part of the points is covered, so that the electronic device can directly display the two-dimensional code on the original display content, that is, the fusion of the two-dimensional code and the underlying display content of the electronic device is realized, and the user viewing experience is improved.
[0009] It should be noted that the target information of the two-dimensional code mentioned in the embodiments of the present application can also be referred to as information to be conveyed by the two-dimensional code, two-dimensional code information, two-dimensional code data information, two-dimensional code text information, etc. The target information in the two-dimensional code can be different based on different use scenarios of the two-dimensional code. For example, in a data cloning scenario, the target information carried by the two-dimensional code can be SSID information and password information of WIFI, etc. Or, in a bracelet pairing scenario, the information carried by the two-dimensional code can be pairing code information, etc.
[0010] In a possible implementation of the first aspect, the N information areas comprise M information area groups, each information area group comprises at least one information area, and the information content of at least two information area groups in the M information area groups is the same and is used to represent the target information corresponding to the two-dimensional code, wherein the information content comprises a plurality of information points, M is less than or equal to N and greater than 1.
[0011] It can be understood that in this application, the two-dimensional code displays the target information to be conveyed by the two-dimensional code through the N information areas. Specifically, the N information areas include M information area groups, the contents of the M information area groups are the same, and each of the M information area groups can be used to decode the target information to be conveyed by the two-dimensional code. In some embodiments, the contents of each of the M information area groups are the same, and each of the M information area groups can be used to decode the target information to be conveyed by the two-dimensional code. The relationship between the information area group and the information area can be referred to the information area group and the information area shown in FIG. 4B. In addition, the shape of the two-dimensional code is not limited in this application, and the shape of the two-dimensional code can be square, circular, annular, triangular, etc. The shape of the two-dimensional code shown in FIG. 4C is square, and the shape of the two-dimensional code shown in FIG. 4D is annular.
[0012] For the structure of the two-dimensional code described above, when the electronic device scans the two-dimensional code, only at least one of the M information area groups is scanned, and the target information to be conveyed by the two-dimensional code can be obtained, without the need to obtain the target information by scanning the entire two-dimensional code, which can improve the scanning efficiency of the two-dimensional code.
[0013] In a possible implementation of the first aspect, the target information includes a plurality of first information, and the information point state of each information area is used to represent at least one of the plurality of first information and a corresponding serial number of the at least one first information in the target information.
[0014] In a possible implementation of the first aspect, the first information includes one or more of a number, a letter, and a symbol.
[0015] It can be understood that the first information can be a character. For example, the first information can be any combination of numbers, letters, symbols, etc., which is not limited in this embodiment. Taking FIG. 4C as an example, the target information is 148258, and the first information can be numbers 1, 4, 8, 2, 5, and 8. Each information area displays one first information, for example, the information area a is used to display the first information 1 and the corresponding serial number 0 of the first information 1 in the target information.
[0016] Taking FIG. 4D as an example, the target information is 148258, and the first information can be numbers 1, 4, 8, 2, 5, and 8. Each information area displays one first information, for example, the information area A1 is used to display the first information 1 and the corresponding serial number 0 of the first information 1 in the target information.
[0017] In a possible implementation of the first aspect, the number of information points in each information area is the same, the different states of each information point in each information area correspond to different values, and each information area is represented by the value corresponding to each information point. The code symbol represents at least one first information corresponding to each information area and the corresponding serial number of the at least one first information in the target information.
[0018] The present application does not limit the number of information points included in each information region, nor does it limit the state of the information points. Exemplarily, the state of the information points can be the solid circle state and the hollow circle state shown in FIG. 6B. Different states of the information points correspond to different numerical values, and then the multiple numerical values corresponding to the multiple information points are sorted according to the position serial numbers of the information points, so that the symbol corresponding to each information region can be obtained, and then the first information corresponding to each information region and the serial number or position of the first information in the target information can be obtained by decoding the symbol.
[0019] For another example, in another possible implementation, corresponding to the information point existing in the information region in the first state, the information point corresponds to the first numerical value; corresponding to the information point existing in the information region in the second state, the information point corresponds to the second numerical value, the first numerical value is different from the second numerical value, the first state is the display state, and the second state is the non-display state.
[0020] The state of such information points can be seen from the content shown in FIG. 6C. Different states can correspond to different numerical values, for example, the display state corresponds to the numerical value 1, i.e., the first numerical value; the hollow circle state (i.e., the non-display state) corresponds to the numerical value 0, i.e., the second numerical value.
[0021] In a possible implementation of the first aspect, corresponding to different version numbers of the two-dimensional code, the number of information points in the first state in the information region is different.
[0022] For example, for the version number V1.0, the number of information points (i.e., bright points) in the first state in each information region is 2 points. For the version number V2.0, the number of information points (i.e., bright points) in the first state in each information region is 3 points.
[0023] In a possible implementation of the first aspect, each positioning structure is located between two adjacent information regions.
[0024] In a possible implementation of the first aspect, one positioning structure is used to position one corresponding information region; or, two adjacent positioning structures are used to position the information region between the two adjacent positioning structures; or, one positioning structure is used to position two adjacent information regions.
[0025] In a possible implementation of the first aspect, the shape of the two-dimensional code is a ring formed by a first outer circle and a first inner circle, the positioning structure includes an outer positioning point and an inner positioning point; the outer positioning point is located on the first outer circle, and the inner positioning point is located on the first inner circle; and N information regions are located in a first region between the first outer circle and the first inner circle.
[0026] It can be understood that, based on the foregoing, the shape of the two-dimensional code can be annular, and the positioning structure can include positioning points. Thus, in this case, the plurality of positioning points can further be specifically divided into outer positioning points and inner positioning points. As shown in FIG. 5E, the outer positioning point 1 and the outer positioning point 2 are located on the outer circle (i.e., the first outer circle), and the inner positioning point 1' and the inner positioning point 2' are located on the inner circle (i.e., the first inner circle). In addition, the information area is located in the annular region (i.e., the first region) formed by the outer circle and the inner circle.
[0027] In a possible implementation of the first aspect, the two-dimensional code further includes a plurality of reference points, the plurality of reference points are located in the first region, and the display color of the plurality of reference points in the two-dimensional code is different from the display color of the information points having the display state; and any information point displays a first color at a first time, displays a second color at a second time, and displays a third color at a third time, and the first color, the second color, and the third color are different.
[0028] For example, the reference point displays gray in the first frame, displays blue in the second frame, and displays yellow in the third frame. The selection of the first time, the second time, and the third time is not limited in the present application, and the selection of the first color, the second color, and the third color is not limited in the present application.
[0029] It can be understood that the color of the information point is different at different times, and the color of the reference point in the information area remains the same at different times. In addition, the color of the reference point and the color of the information point can be different colors that are close in color, so that the overall color of the two-dimensional code observed by the user is more coordinated, and the visual experience is improved. Such a two-dimensional code includes reference points, and the way of adding different display colors to the reference points and the information points can make the user unable to observe the specific structure of the two-dimensional code, thereby improving the privacy of the two-dimensional code.
[0030] In a second aspect, the present application provides a two-dimensional code recognition method for the two-dimensional code provided above. The method is applied to an electronic device and includes: scanning a two-dimensional code to be recognized, the two-dimensional code to be recognized including N information areas and K positioning structures, where N is greater than 1, K is greater than or equal to 1, the K positioning structures are used to position each of the N information areas respectively, the positioning structure includes one or more positioning points, and the information area includes a plurality of information points; and determining target information corresponding to the two-dimensional code to be recognized based on the N information areas in the two-dimensional code to be recognized.
[0031] In the embodiments of the present application, each information area can be determined based on the positioning structure, and the decoding of the two-dimensional code to be recognized can be implemented based on each information area. In addition, since the two-dimensional code in the embodiments of the present application is composed of multiple points, the complexity is low, and the display content of the display device can be integrated, thereby improving the viewing experience of the user when scanning the code.
[0032] In a possible implementation of the second aspect, the target information corresponding to the to-be-identified two-dimensional code is determined based on the N information regions in the to-be-identified two-dimensional code, and includes: performing symbol data extraction on the N information regions to obtain N symbol data corresponding to the N information regions respectively; and performing decoding on the N symbol data to obtain the target information corresponding to the to-be-identified two-dimensional code.
[0033] In a possible implementation of the second aspect, the N information regions include M information region groups, each information region group includes at least one information region, information contents of at least two information region groups in the M information region groups are same and are used to represent the target information corresponding to the two-dimensional code, M is less than or equal to N and M is greater than 1.
[0034] It can be understood that, since the two-dimensional code represents M target information through the M information region groups, and information contents of at least two information region groups in the M information region groups are same and can be used to decode the target information to be conveyed by the two-dimensional code. In some embodiments, information contents of each information region group in the M information region groups are same and can be used to decode the target information to be conveyed by the two-dimensional code. Therefore, when the electronic device scans the two-dimensional code, at least one information region group in the M information region groups is scanned, and the target information to be conveyed by the two-dimensional code can be obtained, without the need to obtain the target information by scanning the entire two-dimensional code, which can improve the scanning efficiency of the two-dimensional code.
[0035] In a possible implementation of the second aspect, the target information corresponding to the to-be-identified two-dimensional code is determined based on the N information regions in the to-be-identified two-dimensional code, and includes: performing symbol data extraction on the N information regions to obtain N symbol data corresponding to the N information regions respectively; and performing decoding on the N symbol data to obtain the target information corresponding to the to-be-identified two-dimensional code.
[0036] The M same first target information is subjected to first fusion processing to obtain fused second target information corresponding to the to-be-identified two-dimensional code.
[0037] It can be understood that, the M same first target information is subjected to fusion processing to obtain fused second target information corresponding to the to-be-identified two-dimensional code can be understood as taking any first target information in the M same first target information as the second target information.
[0038] In a possible implementation of the second aspect, the symbol data extraction is performed on the N information regions to obtain N symbol data corresponding to the N information regions respectively, and includes: determining a plurality of numerical values corresponding to a plurality of information points in each information region based on states of the plurality of information points, wherein information points with different states correspond to different numerical values; and arranging the plurality of numerical values in an order of serial numbers corresponding to the plurality of information points to obtain symbol data corresponding to each information region.
[0039] It can be understood that, since different states of the information points correspond to different values, for the plurality of information points in each information region, the plurality of values corresponding to the plurality of information points are arranged according to the position serial numbers of the plurality of information points, so that the symbol data corresponding to each information region can be obtained. At this time, the symbol data is a string composed of a plurality of binary values. As shown in FIG. 6B, the hollow circles can correspond to the value 0, and the solid circles can correspond to the value 1, that is, the information points with the position serial numbers 1 and 2 correspond to the value 1, and the values of the remaining information points are 0, so the symbol corresponding to the information region A1 (that is, the information region A1) is 011000000000.
[0040] In a possible implementation of the second aspect, the information point has a first state, and the information point corresponds to a first value; the information point has a second state, and the information point corresponds to a second value, the first value being different from the second value, the first state being a display state, and the second state being a non-display state.
[0041] Exemplarily, if the state of the information point is the display state, the first value corresponding to the information point can be 1, and if the state of the information point is the non-display state, the second value corresponding to the information point can be 0. Therefore, in FIG. 6C, the information points with the position serial numbers 1 and 2 correspond to the first value 1, and the values of the remaining information points are 0. The symbol data corresponding to the information region A1 (that is, the information region A1) is still 011000000000.
[0042] In a possible implementation of the second aspect, the information point has a first state, and the information point corresponds to a first value; the information point has a second state, and the information point corresponds to a second value, the first value being different from the second value, the first state being a display state, and the second state being a non-display state.
[0043] In a possible implementation of the second aspect, the first target information corresponding to the two-dimensional code includes a plurality of first information, and the first information includes one or more of a number, a letter, and a symbol.
[0044] It can be understood that the first information can be a number, a letter, etc., which is not limited in the embodiments of the present application. Taking FIG. 4D as an example below, the target information is 148258, and the first information can be the numbers 1, 4, 8, 2, 5, and 8. Each information region displays one first information, for example, the information region a is used to display the first information 1 and the serial number 0 of the first information 1 in the target information.
[0045] Taking FIG. 4D as an example below, the target information is 148258, and the first information can be the numbers 1, 4, 8, 2, 5, and 8. Each information region displays one first information, for example, the information region A1 is used to display the first information 1 and the serial number 0 of the first information 1 in the target information.
[0046] In a possible implementation of the second aspect, the decoding of the N symbol data to obtain the target information corresponding to the to-be-identified two-dimensional code comprises: searching the code table based on the N symbol data, determining the first information corresponding to each symbol data in the code table and the sequence number corresponding to the first information; and determining the target information corresponding to the to-be-identified two-dimensional code based on the plurality of first information corresponding to the N symbol data and the sequence numbers corresponding to the plurality of first information.
[0047] The code table can be shown in Table 2 below, and the code table can include the correspondence among the first information, the sequence number corresponding to the first information, and the symbol. Therefore, after the electronic device obtains the symbol data, the electronic device searches the code table to determine the first information corresponding to each symbol data in the code table and the sequence number of the first information. Taking the symbol data 011000000000 involved above as an example, the electronic device can determine, based on the symbol data and by searching Table 2 below, that the first information (i.e., the payload data) corresponding to the symbol data in Table 2 is 1 and the sequence number is 0.
[0048] In a possible implementation of the second aspect, the searching of the code table based on the N symbol data, the determination of the first information corresponding to each symbol data in the code table, and the determination of the sequence number corresponding to the first information comprise:
[0049] The plurality of first symbol data corresponding to the N symbol data and used to represent the same first information are the same, the code table is searched based on the plurality of first symbol data, the first information corresponding to the plurality of first symbol data is determined, and the sequence number corresponding to the first information is determined; the plurality of first symbol data are different, the second fusion processing is performed on the plurality of first symbol data to obtain a plurality of second symbol data, the code table is searched based on the plurality of second symbol data, the first information corresponding to the plurality of second symbol data is determined, and the sequence number corresponding to the first information is determined.
[0050] It can be understood that, in an actual display process of a two-dimensional code, the plurality of first symbol data used to represent the same first information can be the same or different. If the plurality of first symbol data used to represent the same first information are the same, it indicates that the first symbol data is correct, and the code table is searched based on the first symbol data to determine the first information. If the plurality of first symbol data used to represent the same first information are different, it indicates that at least one of the plurality of first symbol data is incorrect, the code table cannot be searched based on the incorrect first symbol data to obtain the first information, and the second fusion processing needs to be performed on the plurality of first symbol data to obtain the second symbol data after fusion, and then the code table is searched based on the second symbol data to determine the first information.
[0051] In a possible implementation of the second aspect, the second fusion processing is performed on the plurality of first symbol data corresponding to different first information, to obtain a plurality of second symbol data, including: keeping the same values of the information points corresponding to the same serial numbers in the plurality of first symbol data unchanged, and setting the different values of the information points corresponding to the same serial numbers as a first value, to obtain the plurality of second symbol data corresponding to the plurality of symbol data.
[0052] As shown in FIG. 12, the information area A1 and the information area A10 are used to represent the same first information, but the symbol data corresponding to the information area A1 is 010000000000, and the symbol data corresponding to the information area A10 is 001000000000, the two symbol data are different, and the second fusion processing can be performed on the two symbol data. The value of the first bit in the symbol data corresponding to the information area A1 is 1, and the values of the other bits are 0. The value of the second bit in the symbol data corresponding to the information area A10 is 1, and the values of the other bits are 0. Therefore, the value of the second bit in the symbol data corresponding to the information area A1 is set to 1, and the value of the first bit in the symbol data corresponding to the information area A10 is set to 1. In this way, the symbol data corresponding to the information area A1 and the information area A10 is 011000000000.
[0053] Similarly, after the second fusion processing, the symbol data corresponding to the information area A3 and the information area A12 is 000000000010, and the symbol data corresponding to the information area A5 and the information area A8 is 000000110010.
[0054] In a possible implementation of the second aspect, the first information corresponding to the plurality of second symbol data and the serial numbers corresponding to the first information are determined by searching the code table based on the plurality of second symbol data, including: determining the first information corresponding to the third symbol data in the code table and the serial numbers corresponding to the first information, corresponding to the third symbol data in the plurality of second symbol data, the number of first values is equal to the number threshold; performing error correction processing on the fourth symbol data to obtain the fifth symbol data, corresponding to the fourth symbol data in the plurality of second symbol data, the number of first values is not equal to the number threshold; and determining the first information corresponding to the fifth symbol data in the code table and the serial numbers corresponding to the first information.
[0055] It can be understood that the number of the first values (i.e., value 1) in each information area of the two-dimensional code shown in FIG. 12 is fixed, and is all 2. The number of value 1 in the code element data 011000000000 corresponding to the information area A1 and the information area A10 is 2, and the code table can be searched based on the code element data to determine the first information corresponding to the information area A1 and the information area A10. However, the number of value 1 in the code element data 000000000010 corresponding to the information area A3 and the information area A12 is 1, and the code table cannot be searched based on the code element data to determine the first information corresponding to the information area A3 and the information area A12. The code element data 000000110010 corresponding to the information area A5 and the information area A8 is the same. Therefore, in this case, the code element data can be corrected, and then the code table is searched based on the corrected code element data.
[0056] In a possible implementation of the second aspect, for the fourth code element data in which the number of the first values is not equal to the number threshold among the plurality of second code element data, the fourth code element data is corrected to obtain fifth code element data after correction, including:
[0057] corresponding to the number of the first values being greater than the number threshold, the number of the first values exceeding the number threshold is set as the second value to obtain the fifth code element data in which the number of the first values is equal to the number threshold; and corresponding to the number of the first values being less than the number threshold, the number of the second values not satisfying the number threshold is set as the first value to obtain the fifth code element data in which the number of the first values is equal to the number threshold.
[0058] It can be understood that still taking FIG. 12 as an example, there is only one value 1 in the code element data 000000000010 corresponding to the information area A3 and the information area A12, and at this time, one value 0 in 000000000010 can be changed to 1 to determine whether the code element data after correction exists in the code table. Specifically, only when the code element data after correction is 000000100010, the code element data exists in the code table, and therefore, the code element data corresponding to the information area A3 and the information area A12 is 000000100010, and the first information and the serial number of the first information represented by the code element data are 8 and 2 respectively.
[0059] There are only three values 1 in the code element data 000000110010 corresponding to the information area A5 and the information area A8, and at this time, one value 1 in 000000110010 can be changed to 0 to determine whether the code element data after correction exists in the code table. Specifically, only when the code element data after correction is 000000010010, the code element data exists in the code table, and therefore, the code element data corresponding to the information area A5 and the information area A8 is 000000010010, and the first information and the serial number of the first information represented by the code element data are 5 and 4 respectively.
[0060] In a possible implementation of the second aspect, the method further includes: determining the N information areas based on the K positioning structures corresponding to the case that there is no missing positioning point in the K positioning structures of the to-be-identified two-dimensional code; and determining the N information areas based on the K positioning structures corresponding to the case that there is a missing positioning point in the K positioning structures of the to-be-identified two-dimensional code, and filling in the missing positioning point.
[0061] In a possible implementation of the second aspect, the filling in the missing positioning point includes: filling in the missing positioning point based on other positioning points in a first positioning structure in the K positioning structures corresponding to the case that the missing positioning point is part of the positioning points in the first positioning structure; and filling in the missing positioning point based on an adjacent positioning structure of the first positioning structure corresponding to the case that the missing positioning point is all of the positioning points in the first positioning structure in the N positioning structures.
[0062] For example, as shown in FIG. 5E, taking the case that the inner positioning point 1' and the outer positioning point 2 (i.e., part of the positioning points in one positioning structure) are known as an example, the outer positioning point 1 and the inner positioning point 2' can be determined in the following manner: the intersection of the line connecting the center and the inner positioning point 1' in FIG. 5E and the outer circle can be determined as the outer positioning point 1; and the intersection of the line connecting the center and the outer positioning point 2 and the inner circle can be determined as the inner positioning point 2'.
[0063] As shown in FIG. 5H, taking the case that the outer positioning point 1, the inner positioning point 1', the outer positioning point 3, and the inner positioning point 3' are known as an example, the outer positioning point 2 and the inner positioning point 2' (i.e., the missing positioning structure between the two known positioning structures) can be determined in the following manner: the line 1 connecting the center and the inner positioning point 1' is determined, the line 2 connecting the center and the inner positioning point 3' is determined, then the line 3 that bisects the angle between the line 1 and the line 2 and passes through the center is determined. Further, the intersection of the line 3 and the outer circle is the outer positioning point 2, and the intersection of the line 3 and the inner circle is the inner positioning point 2'.
[0064] In a third aspect, the present application provides a two-dimensional code identification method, the method comprising: scanning a to-be-identified two-dimensional code, the to-be-identified two-dimensional code comprising N information areas and K positioning structures, wherein N is greater than 1, K is greater than or equal to 1, the K positioning structures are used to position each of the N information areas, a positioning structure comprises one or more positioning points, and an information area comprises a plurality of information points;
[0065] obtaining a version number corresponding to the to-be-identified two-dimensional code; and determining target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information areas in the to-be-identified two-dimensional code.
[0066] In some embodiments, there can be multiple versions of the two-dimensional code, different versions of the two-dimensional code correspond to different code tables, when generating the two-dimensional code, the version number of the two-dimensional code can be determined based on the amount of data to be transmitted, and the corresponding two-dimensional code can be generated based on the code table corresponding to the version number of the two-dimensional code. In the two-dimensional code identification method provided in the embodiments of the present application, in the case where the version of the two-dimensional code includes multiple versions, the electronic device that scans the two-dimensional code can first determine the version number corresponding to the two-dimensional code based on the number of bright spots in the two-dimensional code, obtain the code table corresponding to the version number, and decode the two-dimensional code based on the code table corresponding to the version number, so as to realize correct identification of the two-dimensional code.
[0067] In a possible implementation of the third aspect, the obtaining of the version number corresponding to the two-dimensional code to be identified includes: obtaining the number of target information points in the N information areas that are in a display state; and determining the version number corresponding to the two-dimensional code to be identified based on the number of target information points in the N information areas that are in the display state.
[0068] In a possible implementation of the third aspect, the determining of the version number corresponding to the two-dimensional code to be identified based on the number of target information points in the N information areas that are in the display state includes: when the number of target information points in each information area in the N information areas that are in the display state is a first number, determining the version number corresponding to the two-dimensional code to be identified based on the first number; and when the number of information areas in which the number of target information points is a second number is greater than the number of information areas in which the number of target information points is any number other than the second number, determining the version number corresponding to the two-dimensional code to be identified based on the second number.
[0069] In the embodiments of the present application, when the number of target information points in each information area in the N information areas that are in the display state is the same, for example, the first number, the version number corresponding to the two-dimensional code to be identified is determined based on the first number. For example, when the number of target information points in each information area that is in the display state is 2, or the total number of target information points in all information areas is 48, the version number V1.0 can be determined based on the two-dimensional code version number mapping table shown in Table 3. When the number of target information points in each information area that is in the display state is 3, or the total number of target information points in all information areas is 60, the version number V2.0 can be determined based on the two-dimensional code version number mapping table shown in Table 3.
[0070] When the number of target information points in each information area in the N information areas in the display state is different, and the number of information areas in which the number of target information points is the second number is greater than the number of information areas in which the number of target information points is any number other than the second number, the version number corresponding to the to-be-recognized two-dimensional code is determined based on the second number. For example, in the 13 information areas corresponding to the to-be-recognized two-dimensional code, the number of bright spots in 10 information areas is 2, and the number of bright spots in 2 information areas is 3, and the output version number is the version number corresponding to the information area in which the number of bright spots is 2, for example, the version number V1.0.
[0071] In the embodiments of the application, in the case that the number of bright spots in each information area is different, the version number with the maximum probability can be selected, and the accuracy of two-dimensional code recognition is improved.
[0072] In a possible implementation of the third aspect, the version number corresponding to the to-be-recognized two-dimensional code is determined based on the number of target information points in the N information areas in the display state, and the number of positioning points in the to-be-recognized two-dimensional code, comprising: obtaining the number of target information points in the N information areas in the display state and the number of positioning points in the to-be-recognized two-dimensional code; determining the version number corresponding to the to-be-recognized two-dimensional code based on the number of target information points in the N information areas in the display state and the number of positioning points in the to-be-recognized two-dimensional code.
[0073] In some embodiments, the version number can also be determined based on the total number of bright spots in the to-be-recognized two-dimensional code, that is, the sum of the number of information points in all information areas and the total number of positioning points. For example, the total number of bright spots in the to-be-recognized two-dimensional code is 48, and the version number V1.0 can be determined based on Table 1.
[0074] In a possible implementation of the third aspect, the number of target information points in the N information areas in the to-be-recognized two-dimensional code in the display state is obtained, comprising: obtaining the number of information points in the N information areas in the to-be-recognized two-dimensional code in the display state; obtaining the number of stray points in the N information areas in the to-be-recognized two-dimensional code in the display state; determining the number of target information points in the N information areas based on the number of information points and the number of stray points in the N information areas.
[0075] In the embodiments of the application, when the number of bright spots in the information area is counted, the stray points in the information area can be removed, and the accuracy of two-dimensional code recognition is improved.
[0076] In a possible implementation of the third aspect, the number of stray points in the N information areas in the to-be-recognized two-dimensional code in the display state is obtained, comprising: obtaining the positioning structure in the to-be-recognized two-dimensional code; performing affine transformation processing on the standard two-dimensional code template based on the extracted positioning structure to obtain a processed two-dimensional code template; aligning the processed two-dimensional code template and the to-be-recognized two-dimensional code, regarding the unaligned information points in the N information areas in the display state as stray points, and obtaining the number of stray points.
[0077] In some embodiments, since the shooting direction of the to-be-recognized two-dimensional code can be upward shooting, downward shooting, oblique shooting, etc., the to-be-recognized two-dimensional code can not be aligned with the standard two-dimensional code, and therefore, the standard two-dimensional code template can be subjected to affine or perspective transformation based on the extracted positioning points in the to-be-recognized two-dimensional code, to obtain a processed (distorted) two-dimensional code template (mask), and make the processed (distorted) two-dimensional code template (mask) consistent with the distortion direction of the to-be-recognized two-dimensional code, so that the processed (distorted) two-dimensional code template (mask) can be aligned with the to-be-recognized two-dimensional code.
[0078] In some embodiments, the to-be-recognized two-dimensional code can also be subjected to affine or perspective transformation based on the positioning points and the standard two-dimensional code template, to obtain a to-be-recognized two-dimensional code without distortion, and align the to-be-recognized two-dimensional code without distortion with the standard two-dimensional code template, to determine the number of target information points in each information area.
[0079] In a possible implementation of the third aspect, the version number corresponding to the to-be-recognized two-dimensional code is obtained by: determining the version number corresponding to the to-be-recognized two-dimensional code as the first version number, corresponding to the smallest difference between the sum of the total number of information points in the N information areas in the display state and the total number of positioning points in the to-be-recognized two-dimensional code, and the sum of the total number of information points in the N information areas in the display state and the total number of positioning points in the to-be-recognized two-dimensional code corresponding to the first version number of the version numbers corresponding to the two-dimensional code.
[0080] In some embodiments, when the total number of bright points (i.e., the sum of the total number of target information points in the N information areas in the display state and the total number of positioning points in the to-be-recognized two-dimensional code) corresponding to the to-be-recognized two-dimensional code is inconsistent with the total number of bright points corresponding to each version number, the version number corresponding to the total number of bright points corresponding to the two-dimensional code is determined as the version number corresponding to the smallest difference between the total number of bright points corresponding to each version number and the total number of bright points corresponding to the to-be-recognized two-dimensional code, i.e., the version number corresponding to the closest total number of bright points.
[0081] It can be understood that in some embodiments, during the process of extracting the two-dimensional code as shown in FIG. 15, there can be a situation that some positioning points or information points in the two-dimensional code are missing, so that the total number of bright points in the to-be-recognized two-dimensional code is not strictly consistent with the total number of bright points corresponding to each version number. For example, the number of bright points in some information areas can be two, and the number of bright points in some information areas can be three. In this case, the version number can be determined according to the nearest neighbor method of the total number of bright points. For example, the total number of bright points of the to-be-recognized two-dimensional code is 47, which is closest to the total number of bright points corresponding to the version number V1.0, and therefore, the version number V1.0 is determined as the version number corresponding to the to-be-recognized two-dimensional code. In this way, the situation that the two-dimensional code is damaged and cannot be decoded can be avoided, and the user experience can be improved.
[0082] In a possible implementation of the third aspect, the target information corresponding to the to-be-identified two-dimensional code is determined based on the version number corresponding to the to-be-identified two-dimensional code and the N information regions in the to-be-identified two-dimensional code, and includes: determining a target code table corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code, the target code table being used to reflect a mapping relationship between the symbol data and the first information and the sequence number corresponding to the first information; performing symbol data extraction on the N information regions to obtain symbol data corresponding to the N information regions; searching the target code table based on the N symbol data to determine the first information corresponding to each symbol data and the sequence number corresponding to the first information in the target code table; and determining the target information corresponding to the to-be-identified two-dimensional code based on the plurality of first information corresponding to the N symbol data and the sequence number corresponding to the plurality of first information.
[0083] In some embodiments, the target information corresponding to the to-be-identified two-dimensional code is determined based on the plurality of first information corresponding to the N symbol data and the sequence number corresponding to the plurality of first information, and can include: determining M same first target information corresponding to the N information regions based on the plurality of first information corresponding to the N symbol data and the sequence number corresponding to the plurality of first information; and performing first fusion processing on the M same first target information to obtain fused second target information corresponding to the to-be-identified two-dimensional code.
[0084] In some embodiments, when the N information regions only contain one target information, the plurality of same first target information can not be fused, and the target information corresponding to the to-be-identified two-dimensional code is determined based on the plurality of first information corresponding to the N symbol data and the sequence number corresponding to the plurality of first information.
[0085] In a possible implementation of the third aspect, the N information regions are determined based on at least one positioning structure included in the to-be-identified two-dimensional code, and the positioning structure includes one or more positioning points.
[0086] In a fourth aspect, the present application provides an electronic device, which has a display screen, and the display screen is used to display the two-dimensional code of the first aspect and any possible implementation of the first aspect.
[0087] In a fifth aspect, the present application provides an electronic device, which includes: one or more processors; one or more memories; and the one or more memories store one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device performs the two-dimensional code identification method of the second aspect and any possible implementation of the second aspect.
[0088] In a sixth aspect, the present application provides a computer-readable storage medium, which stores instructions, and when the instructions are executed on a computer, the computer performs the two-dimensional code identification method of the second aspect and any possible implementation of the second aspect.
[0089] In a seventh aspect, the present application provides a computer program product, which comprises computer instructions, when the computer instructions are executed on an electronic device, the electronic device executes the two-dimensional code recognition method of the second aspect and any possible implementation of the second aspect. BRIEF DESCRIPTION OF DRAWINGS
[0090] FIG. 1A shows a structural diagram of a two-dimensional code 100 according to some embodiments of the present application;
[0091] FIGS. 1B-1D show interface diagrams when an old device 300 and a new device 310 clone data according to some embodiments of the present application;
[0092] FIG. 1E shows a scenario diagram when a mobile phone and a watch clone data according to some embodiments of the present application;
[0093] FIG. 2 shows a structural diagram of a two-dimensional code according to some embodiments of the present application;
[0094] FIGS. 3A-3B show scenario diagrams when an electronic device scans a two-dimensional code 100 according to some embodiments of the present application;
[0095] FIGS. 4A-4D show structural diagrams of the two-dimensional code provided by the present application according to some embodiments of the present application;
[0096] FIG. 5A shows a structural diagram of a two-dimensional code when the number of outside positioning points and inside positioning points is the same as the number N of information areas according to some embodiments of the present application;
[0097] FIG. 5B shows a diagram of four positioning points corresponding to information area A1 in FIG. 5A according to some embodiments of the present application;
[0098] FIG. 5C shows a structural diagram of a two-dimensional code when the number of outside positioning points and inside positioning points is different from the number of information areas according to some embodiments of the present application;
[0099] FIG. 5D shows a diagram of two positioning points corresponding to information area A1 in FIG. 5C according to some embodiments of the present application;
[0100] FIG. 5E shows a diagram of determining each positioning point based on part of the positioning points of the two-dimensional code according to some embodiments of the present application;
[0101] FIG. 5F shows a structural diagram of a two-dimensional code when the number of outside positioning points and inside positioning points is different from the number of information areas according to some embodiments of the present application;
[0102] FIG. 5G illustrates a diagram of two positioning points corresponding to information area A1 in FIG. 5F, according to some embodiments of the present application;
[0103] FIG. 5H illustrates a diagram of a second case of determining each positioning point based on a two-dimensional code, according to some embodiments of the present application;
[0104] FIG. 5I illustrates a diagram of a state of information points in an information area, according to some embodiments of the present application;
[0105] FIG. 6A illustrates a diagram of setting a serial number of an information point, according to some embodiments of the present application;
[0106] FIG. 6B illustrates a diagram of a state of information points in a first information area A1, according to some embodiments of the present application;
[0107] FIG. 6C illustrates a diagram of a state of information points in a second information area A1, according to some embodiments of the present application;
[0108] FIG. 7A illustrates a diagram of a complete structure of a two-dimensional code when a first PIN code is 148258, according to some embodiments of the present application;
[0109] FIG. 7B illustrates a diagram of a complete structure of a two-dimensional code when a second PIN code is 148258, according to some embodiments of the present application;
[0110] FIG. 8 illustrates a diagram of distribution of serial numbers of bits of a PIN code corresponding to each information area, according to some embodiments of the present application;
[0111] FIG. 9 illustrates a diagram of a flow of a first two-dimensional code recognition method, according to some embodiments of the present application;
[0112] FIG. 10A illustrates a diagram of a structure of a first two-dimensional code to be recognized, according to some embodiments of the present application;
[0113] FIG. 10B illustrates a diagram of a structure of the two-dimensional code to be recognized after each positioning point is supplemented, according to some embodiments of the present application;
[0114] FIG. 10C illustrates a diagram of a structure of the two-dimensional code to be recognized when a serial number of an information point 1 and an information point 2 is determined, according to some embodiments of the present application;
[0115] FIG. 11 illustrates a diagram of a flow of a second two-dimensional code recognition method, according to some embodiments of the present application;
[0116] FIG. 12 illustrates a diagram of a structure of a second two-dimensional code to be recognized, according to some embodiments of the present application;
[0117] FIG. 13A illustrates a flow diagram of a third method of QR code recognition, according to some embodiments of the present disclosure;
[0118] FIG. 13B illustrates a flow diagram of a fourth method of QR code recognition, according to some embodiments of the present disclosure;
[0119] FIG. 13C illustrates a structure diagram of a QR code in the related art, according to some embodiments of the present disclosure;
[0120] FIG. 14A illustrates a structure diagram of a fusion QR code, according to some embodiments of the present disclosure;
[0121] FIGS. 14B-14D illustrate interface diagrams of a new device 400 and an old device 410 when data cloning is performed based on a fusion QR code, according to some embodiments of the present disclosure;
[0122] FIG. 15 illustrates a flow diagram of a method of extracting a positioning point from a fusion QR code, according to some embodiments of the present disclosure;
[0123] FIG. 16 illustrates structure diagrams of four types of QR codes, according to some embodiments of the present disclosure;
[0124] FIG. 17 illustrates a flow diagram of a method of generating a QR code, according to some embodiments of the present disclosure;
[0125] FIG. 18 illustrates a flow diagram of a method of recognizing a QR code, according to some embodiments of the present disclosure;
[0126] FIG. 19 illustrates a diagram of a noise point of a QR code, according to some embodiments of the present disclosure;
[0127] FIG. 20 illustrates a flow diagram of a fifth method of QR code recognition, according to some embodiments of the present disclosure;
[0128] FIG. 21 illustrates a flow diagram of a sixth method of QR code recognition, according to some embodiments of the present disclosure;
[0129] FIG. 22 illustrates a flow diagram of a seventh method of QR code recognition, according to some embodiments of the present disclosure;
[0130] FIG. 23 illustrates a structure diagram of an electronic device displaying a QR code or performing a method of QR code recognition, according to some embodiments of the present disclosure. DETAILED DESCRIPTION
[0131] Illustrative embodiments of the present disclosure include, but are not limited to, QR codes and methods of recognizing the same, electronic devices, storage media, and program products.
[0132] The following first explains the specific terms involved in the embodiments of the present application.
[0133] Two-dimensional code: The structure of the current two-dimensional code can be mainly seen from FIG. 1. Such a two-dimensional code records data symbol information according to a certain rule in a plane (two-dimensional direction) based on a certain specific geometric figure. In order to be recognized by a computer, the two-dimensional code uses several geometric shapes corresponding to binary to represent text value information, for example, white blocks represent binary "0" and black blocks represent "1". In this way, electronic devices can interpret the information contained in the two-dimensional code by identifying colors and arrangements.
[0134] Personal identification number (PIN): commonly known as PIN code. In the present application, for the convenience of description, the target information corresponding to the two-dimensional code is uniformly described as the PIN code. The PIN code can be composed of numbers, letters, characters, etc. It can be understood that the number of bits of the PIN code is the number of data (or called payload data) contained in the PIN code. For example, if the PIN code is 148258, the PIN code is a 6-bit PIN code.
[0135] The application scenarios of the two-dimensional code involved in the present application are described in detail below.
[0136] Currently, the scanning and identifying scenarios of the two-dimensional code include but are not limited to new machine verification, bracelet pairing, account login, one-key screen projection, data cloning, etc. Taking the data cloning scenario as an example, this scenario can be used for data cloning between two devices (usually one new device and one old device) after scanning the two-dimensional code. Specifically, the old device can establish a connection with the new device through WIFI by scanning the two-dimensional code located in the display interface of the new device, and after the connection is established, the old device can transmit data to the new device. The two-dimensional code on the new device can carry information such as the service set identifier (SSID) of WIFI and the password of WIFI.
[0137] The above application scenarios are described in detail below in combination with FIGS. 1B-1D. Taking a new device and an old device as both being a mobile phone as an example, FIG. 1B shows a display interface schematic diagram of an old device 300 and a new device 310. The display interface of the old device 300 displays a prompt information "please open'mobile phone cloning' on the new device, select this is 'new device' to obtain a hotspot two-dimensional code", and displays a scanning area 301. The display interface of the new device 310 displays a prompt information "open'mobile phone cloning' on the old device, select this is 'old device', scan the two-dimensional code below to establish a connection", and displays a two-dimensional code 302 to be scanned. Then, as shown in FIG. 1C, the old device 300 can scan the two-dimensional code 302 on the display interface of the new device 310 to obtain the SSID information and password information of the WIFI carried in the two-dimensional code 302, so as to establish a connection with the new device 310. After the connection is successful, as shown in FIG. 1D, the display interface of the old device 300 displays a data selection area 303, and the data selection area 303 includes options of multiple data types, such as a gallery, contacts, messages, and a voice recorder. The display interface of the new device 310 displays a connection success prompt information "please select the data to be migrated in the old device". Then, when the user selects the data to be migrated (for example, selects the gallery, contacts, messages, and voice recorder related data) in the display interface of the old device 300 and clicks a "next step" control, the selected data in the old device 300 can be migrated / cloned to the new device 310.
[0138] It can be understood that the above data cloning scenario can also include data cloning between two devices of different types, which is not limited by the embodiments of the present application. For example, as shown in FIG. 1E, the old device 300 is a mobile phone, and the new device 310 is a watch. The mobile phone scans the two-dimensional code displayed in the watch to perform data cloning.
[0139] As described above, the prior art two-dimensional code has a complex structure and cannot be integrated with other display content of the display interface, resulting in poor user viewing experience.
[0140] To solve the above technical problem, the present application provides a two-dimensional code, which includes N information areas (or information regions, partitions, information blocks, etc.) and K positioning structures, wherein N is greater than 1, and K is greater than or equal to 1; the K positioning structures are used to position each of the N information areas, and the information content of the N information areas is used to represent target information corresponding to the two-dimensional code; the positioning structure includes one or more positioning points, and the information content of the information area includes a plurality of information points (or information area particles). In some embodiments, the number of information points of each information area is the same, for example, both are two.
[0141] The two-dimensional code provided by the embodiments of the present application is composed of dots in the information area and the positioning structure, which is simple in structure and does not cover the display content of the display interface of the electronic device in a large area, but only covers the dots, so that the electronic device can directly display the two-dimensional code on the original display content, that is, the two-dimensional code and the underlying display content of the electronic device are fused, and the user viewing experience is improved.
[0142] It should be noted that the target information of the two-dimensional code mentioned in the embodiments of the present application can also be referred to as information to be conveyed by the two-dimensional code, two-dimensional code information, two-dimensional code data information, two-dimensional code text information, etc. The target information in the two-dimensional code can be different based on different use scenarios of the two-dimensional code. For example, in the data cloning scenario, the target information carried by the two-dimensional code can be the SSID information and password information of WIFI, etc. Or, in the bracelet pairing scenario, the information carried by the two-dimensional code can be the pairing code information, etc.
[0143] In some embodiments, each positioning structure can be used to locate one information area, or two adjacent positioning structures are used to locate one information area between the two positioning structures.
[0144] In some embodiments, one positioning structure can be used to locate two adjacent information areas. In this way, the number of positioning structures can be effectively reduced, the complexity of the two-dimensional code structure can be reduced, and each information area can be located faster during two-dimensional code recognition, thereby accelerating the decoding speed.
[0145] In some embodiments, the shape of the two-dimensional code can be square, circular, triangular, annular, etc. The shape of the two-dimensional code is not limited by the present application. For example, the two-dimensional code is annular, as shown in FIG. 2, which can include 24 positioning points (such as positioning point 1, positioning point 1', positioning point 2, positioning point 2' in FIG. 3, etc.) and 12 information areas (such as information areas A1-A12 in the figure). Among them, the positioning point 1, the positioning point 1', the positioning point 2, and the positioning point 2' can be used to locate one information area A1. The positioning point 1, the positioning point 1', the positioning point 2, and the positioning point 2' can be referred to as one positioning structure, that is, one positioning structure is used to locate one information area. Or, in some embodiments, the positioning point 1 and the positioning point 1' can be referred to as one positioning structure, which is used to locate the information area A1, and the positioning point 2 and the positioning point 2' can be referred to as one positioning structure, which is used to locate the information area A2.
[0146] Or the positioning point 1 and the positioning point 1' are referred to as one positioning structure, and the positioning point 2 and the positioning point 2' are referred to as one positioning structure, that is, the information area A1 is located by two adjacent positioning structures. In some embodiments, the positioning point 1 and the positioning point 1' can be referred to as one positioning structure, which is used to locate the information area A1, and the positioning point 2 and the positioning point 2' can be referred to as one positioning structure, which is used to locate the information area A2.
[0147] In some embodiments, the positioning points can further include outer positioning points and inner positioning points, the outer positioning points being the positioning points (e.g., positioning point 1 and positioning point 2) located on the outer circle (i.e., the first outer circle) in FIG. IB, and the inner positioning points being the positioning points (e.g., positioning point 1' and positioning point 2') located on the inner circle (i.e., the first inner circle). In this case, the information regions are located in the annular region (i.e., the first region) formed by the outer circle and the inner circle.
[0148] In some embodiments, one positioning structure can be composed of one outer positioning point and one corresponding inner positioning point, and each positioning structure is arranged between two adjacent information regions, for example, the positioning structure composed of positioning point 1 and positioning point 1' is arranged between information region Al and information region A12.
[0149] In some embodiments, the number of outer positioning points and the number of inner positioning points can be the same or different. In addition, the number of outer positioning points can be the same as or different from the number of information regions; similarly, the number of inner positioning points can be the same as or different from the number of information regions. The structure of the positioning points will be described in detail below with reference to FIGS. 5A-5I, which will not be described here again.
[0150] In addition, for the two-dimensional code shown in FIG. 1, since the three finder patterns contained in the two-dimensional code are used to determine the outer frame of the two-dimensional code, when the electronic device scans the two-dimensional code, it is necessary to ensure that the three finder patterns of the two-dimensional code are all located in the scanning area of the electronic device. FIG. 3A shows a schematic diagram of an electronic device scanning a two-dimensional code 100. In FIG. 3A, the three finder patterns 101 of the two-dimensional code 100 are all located in the scanning area 104 of the electronic device. In this case, the electronic device can further identify the information contained in the two-dimensional code 100. However, if only part of the two-dimensional code 100 is located in the scanning area 104 of the electronic device, that is, as shown in FIG. 3B, only one of the three finder regions 101 is located in the scanning area 104 of the electronic device, then the electronic device cannot identify the information contained in the two-dimensional code 100, which reduces the scanning efficiency of the electronic device on the two-dimensional code 100.
[0151] For example, for the scenarios shown in FIGS. IB-1D or FIG. IE, the structure of the two-dimensional code 302 will cause the old device 300 to need to ensure that the three finder patterns of the two-dimensional code 302 are completely located in the scanning area 301 of the old device 300 when scanning the two-dimensional code 302, otherwise the old device 300 will not be able to obtain the target information displayed / transmitted in the two-dimensional code 302, such as the PIN code (e.g., SSID information and password information of WIFI) corresponding to the two-dimensional code 302, etc., which will result in a low scanning efficiency of the two-dimensional code.
[0152] To solve the problem, in some embodiments, the N information regions can further include M information region groups (or information region groups), each of which includes at least one information region, and there are at least two information region groups whose information contents are the same, i.e., the distribution states of the information points are the same, and are used to represent the same target information. Wherein, M is less than or equal to N and M is greater than 1. It can be understood that the information content of each information region is a plurality of information points (or information region particles). When the distribution states of the information points (such as the positions and display states of the information points) of two information regions are the same, the two information regions represent the same information. Therefore, the distribution states of the information points of the two information region groups can refer to the distribution states of the information points of the corresponding information regions in the two information region groups.
[0153] It can be understood that in some embodiments, the information content of each information region group is the same, and is used to represent the same target information.
[0154] In this way, in the process of scanning the code by the electronic device, as long as the region containing one or more target information in the two-dimensional code provided by the present application is scanned, the complete target information conveyed by the two-dimensional code can be obtained, and the present application embodiment is not limited. In this way, even if the entire two-dimensional code is not scanned, the correct recognition of the two-dimensional code can be realized, and the code scanning efficiency is improved.
[0155] In some embodiments, when each information region group includes one information region, the information points displayed by each information region represent one complete target information of the two-dimensional code. For example, as shown in FIG. 4A, the information represented by the information points displayed by each information region is a complete target information. Specifically, the two-dimensional code includes information regions a, b, c, and d, each of which can also be an information region group, and the information region a can display the information points corresponding to information I1; the information region b can display the information points corresponding to information I2; the information region c can display the information points corresponding to information I3; and the information region d can display the information points corresponding to information I4. It can be understood that in this case, the information I1, I2, I3, and I4 are the same, and are a complete target information.
[0156] It can be understood that for the convenience of description, the information points displayed by the information regions of the two-dimensional code to represent the corresponding information or target information in the embodiments of the present application can also be referred to as the information regions displaying the information or target information.
[0157] Based on the structure of the two-dimensional code, as long as any one information region is scanned by the electronic device, the target information in the information region can be obtained, without the need to scan the entire two-dimensional code or the entire region to obtain the target information corresponding to the two-dimensional code, thereby improving the code scanning efficiency.
[0158] For another example, in some embodiments, when each information region group includes a plurality of information regions, the display content of the plurality of information regions included in each information region group collectively represents a complete target information. For example, as shown in FIG. 4B, the information represented by the display content of two adjacent information regions constitutes a complete target information of a two-dimensional code. Specifically, in FIG. 4B, information region a and information region c constitute information region group AC, and information region b and information region d constitute information region group BD. Information I1 and I3 collectively constitute a complete target information, information I2 and I4 collectively constitute a complete target information, and the complete target information constituted by information I1 and I3 is the same as the complete target information constituted by information I2 and I4.
[0159] Based on the structure of the two-dimensional code, the electronic device can obtain the complete target information corresponding to the two-dimensional code by scanning information region a and information region c or scanning information region b and information region d. For example, by scanning information region a and information region c, information I1 and I3 in the information regions can be obtained, and then the complete target information corresponding to the two-dimensional code can be obtained. Therefore, the electronic device does not need to scan the entire two-dimensional code to obtain the complete target information corresponding to the two-dimensional code, thereby improving the scanning efficiency.
[0160] It can be understood that the structure of the two-dimensional code shown in FIGS. 4A and 4B is only an example and does not constitute a complete limitation on the structure of the two-dimensional code of the present application. For example, the present application does not limit the number of information regions and information region groups, which can be determined based on the target information to be conveyed by the two-dimensional code. In addition, the shape of the two-dimensional code is not limited, for example, the shape of the two-dimensional code can be square, circular, triangular, and annular, etc.
[0161] In some embodiments, taking an example in which the complete target information corresponding to the two-dimensional code is a PIN code and the PIN code includes a plurality of payload data (i.e., first information), each information region can be used to display (or represent) at least one payload data in the plurality of payload data and the (bit number) sequence number corresponding to the at least one payload data in the target information. In this way, after the electronic device scans the two-dimensional code, based on the state of the information points displayed by each information region and the corresponding sequence number, the electronic device can obtain the symbol data corresponding to each information region, thereby decoding at least one payload data and the (bit number) sequence number corresponding to the at least one payload data in the target information based on the symbol data and the code table (shown in Table 2 below), and sorting the plurality of payload data based on the bit number sequence number, thereby obtaining the correct PIN code. Taking a six-digit PIN code 148258 as an example, the bit number sequence number corresponding to the payload data 1 can be 0, the bit number sequence number corresponding to the payload data 4 can be 1, and so on. Therefore, if the PIN code is 148258, the information region can be used to display the corresponding information points 01, 14, 28, 32, 45, and 58.
[0162] In some examples, the two-dimensional code provided by the present application can further comprise at least one positioning structure for positioning a plurality of target regions, wherein one positioning structure is used for positioning at least one target region. For example, the positioning structure can comprise a positioning point.
[0163] The structure of the two-dimensional code provided by the present application is further described below with the example that the six-digit PIN code 148258 can be determined based on the two-dimensional code.
[0164] In some examples, the two-dimensional code is square, as shown in FIG. 4D, which can comprise a plurality of positioning points (for example, points A, B, C, and D in the figure) and a plurality of information regions (for example, information regions a, b,..., and I in FIG. 4D). There are a total of 12 information regions in FIG. 4D, and the four positioning points A, B, C, and D are used for positioning three information regions a, b, and c.
[0165] To display the PIN code 148258 based on the two-dimensional code, for example, information region a can be used to represent the payload data 1 and the corresponding bit number 0, i.e., the information point corresponding to the display information 01; information region b can be used to represent the payload data 4 and the corresponding bit number 1, i.e., the information point corresponding to the display information 14; information region c can be used to represent the payload data 8 and the corresponding bit number 2, i.e., the information point corresponding to the display information 28; information region d can be used to represent the payload data 1 and the corresponding bit number 0, i.e., the information point corresponding to the display information 01; information region e can be used to represent the payload data 4 and the corresponding bit number 1, i.e., the information point corresponding to the display information 14; information region f can be used to represent the payload data 8 and the corresponding bit number 2, i.e., the information point corresponding to the display information 28; information region g can be used to represent the payload data 2 and the corresponding bit number 3, i.e., the information point corresponding to the display information 32; information region h can be used to represent the payload data 5 and the corresponding bit number 4, i.e., the information point corresponding to the display information 45; information region i can be used to represent the payload data 8 and the corresponding bit number 5, i.e., the information point corresponding to the display information 58; information region j can be used to represent the payload data 2 and the corresponding bit number 3, i.e., the information point corresponding to the display information 32; information region k can be used to represent the payload data 5 and the corresponding bit number 4, i.e., the information point corresponding to the display information 45; and information region I can be used to represent the payload data 8 and the corresponding bit number 5, i.e., the information point corresponding to the display information 58.
[0166] It can be seen that the information area a, the information area b, the information area c and the information area g, the information area h, the information area i constitute an information area group, and jointly represent a complete target information 148258; the information area d, the information area e, the information area f and the information area j, the information area k, the information area l constitute another information area group, and jointly represent a complete target information 148258. Therefore, even if the electronic device only scans the left half or the right half of the two-dimensional code, the complete target information corresponding to the two-dimensional code can be obtained, and the PIN code corresponding to the two-dimensional code can be determined.
[0167] It can be understood that the above-mentioned FIG. 4D is only an example and does not constitute all limitations of the present application. For example, the information area a, the information area b, the information area c can also respectively represent the same information as the information area g, the information area h, the information area i, etc.
[0168] In some other embodiments, taking the annular two-dimensional code as an example, as shown in FIG. 4D, the two-dimensional code can include a plurality of positioning points (for example, points 1, 1', 2, 2' in the figure) and a plurality of information areas (for example, information areas A1, A2, …, A12 in the figure). There are a total of 12 information areas in FIG. 4D (that is, N is 12), and the four positioning points 1, 1', 2, 2' correspond to an information area A1.
[0169] In some embodiments, the positioning points can further include outer positioning points and inner positioning points. The outer positioning points are the positioning points (for example, the positioning point 1 and the positioning point 2) located on the outer circle (that is, the first outer circle) in FIG. 4D, and the inner positioning points are the positioning points (for example, the positioning point 1' and the positioning point 2') located on the inner circle (that is, the first inner circle). At this time, the information area is located in the annular region (that is, the first region) formed by the outer circle and the inner circle. The number of outer positioning points and the number of inner positioning points can be the same or different. In addition, the number of outer positioning points can be the same as the number of information areas, or different; similarly, the number of inner positioning points can be the same as the number of information areas, or different.
[0170] If the PIN code 148258 is to be displayed based on the two-dimensional code, for example, the information area A1 in FIG. 4D can be used to represent the payload data 1 of the PIN code and the corresponding bit number 0, i.e., the information point corresponding to the display information 01; the information area A2 can be used to represent the payload data 4 and the corresponding bit number 1, i.e., the information point corresponding to the display information 14; the information area A3 can be used to represent the payload data 8 and the corresponding bit number 2, i.e., the information point corresponding to the display information 28; the information area A4 can be used to represent the payload data 2 and the corresponding bit number 3, i.e., the information point corresponding to the display information 32; the information area A5 can be used to represent the payload data 5 and the corresponding bit number 4, i.e., the information point corresponding to the display information 45; and the information area A6 can be used to represent the payload data 8 and the corresponding bit number 5, i.e., the information point corresponding to the display information 58. On this basis, the remaining information areas A7 to A12 can again represent the 6-digit PIN code 148258. For example, the information area A7 displays the information point corresponding to the display information 01; the information area A8 displays the information point corresponding to the display information 14; the information area A9 displays the information point corresponding to the display information 28; the information area A10 displays the information point corresponding to the display information 32; the information area A11 displays the information point corresponding to the display information 45; and the information area A12 displays the information point corresponding to the display information 58.
[0171] As can be seen, the information areas A1 to A6 form one information area group, and the information areas A7 to A12 form another information area group. Therefore, when the electronic device scans the two-dimensional code provided in FIG. 4D, even if the two-dimensional code is not entirely located in the scanning area of the electronic device, for example, only the left half or the right half of the two-dimensional code in FIG. 4D is located in the scanning area of the electronic device, the electronic device can still obtain the target information corresponding to the two-dimensional code according to the scanned part of the two-dimensional code, and obtain the PIN code corresponding to the two-dimensional code.
[0172] In some examples, the payload data and the corresponding bit number can also be represented by different information areas, instead of being represented by one information area as shown in FIG. 4C and FIG. 4D. In addition, the rules for representing target information by two-dimensional codes of other shapes are the same as described above, and will not be repeated here.
[0173] In some examples, each information area includes a plurality of information points, that is, the two-dimensional code can represent the target information corresponding to a plurality of information areas based on the states of the information points.
[0174] In addition, for a certain bit payload data in the target information represented by the repeated information regions, if the information region that should represent the certain bit data fails to represent the payload data (e.g., the information region is damaged, etc.), the electronic device can determine the payload data through other information regions that represent the data. For example, as shown in FIG. 4D, if the information region A1 fails to accurately deliver the corresponding 0th bit payload data 1, but the information region A7 accurately delivers the 0th bit payload data 1, the electronic device can determine the 0th bit payload data 1 based on the information region A7. In this way, the scanning efficiency of the two-dimensional code can be improved, and thus the acquisition efficiency of the data delivered by the two-dimensional code and the code scanning robustness can be improved.
[0175] It can be understood that, in some other embodiments, at least part of the target information in the complete target information is also displayed in the two-dimensional code, that is, at least part of the target information is displayed in the two-dimensional code at a certain moment, and another part of the target information is displayed in the two-dimensional code at another moment. The electronic device obtains the complete target information by integrating the part of the target information displayed in the two-dimensional code at different moments.
[0176] Based on the two-dimensional code described above, the present application also provides a two-dimensional code identification method for identifying the two-dimensional code. In the method, after the electronic device scans the two-dimensional code, the electronic device can determine the target information corresponding to the two-dimensional code to be identified according to N information regions in the two-dimensional code to be identified. Specifically, the electronic device can perform symbol extraction on each information region according to the values corresponding to the states of the information points in the information region, and then decode the symbols to obtain the target information corresponding to the plurality of information regions.
[0177] In some examples, the values of the information points are “0” or “1”, and thus the symbol of each information region is a string obtained by arranging a certain number of “0” or “1” in a certain order. The electronic device can search for a corresponding relationship table (also referred to as a code table) stored in the electronic device according to the symbol corresponding to each information region, to determine the first information corresponding to each symbol, and thus obtain the target information represented by the plurality of symbols. The corresponding relationship table is a list pre-stored in the electronic device, and is used to represent the corresponding relationship between the symbols and the first information.
[0178] Based on the structure of the two-dimensional code described above, when the electronic device scans the two-dimensional code, even if the two-dimensional code is not entirely located in the scanning region of the electronic device, the electronic device can obtain the target information to be delivered by the two-dimensional code according to the scanned part of the two-dimensional code, which improves the efficiency of the electronic device in obtaining the information delivered by the two-dimensional code, and improves the scanning efficiency of the two-dimensional code and the code scanning robustness.
[0179] Before the structure of the two-dimensional code provided by the embodiments of the present application is described in detail, the electronic device to which the two-dimensional code is applied and the application scenario are first introduced.
[0180] It can be understood that the two-dimensional code provided in the present application can be displayed in the display interface or display screen of an electronic device, and the present application does not limit the type and form of the electronic device. For example, the electronic device includes, but is not limited to, any electronic device such as a mobile phone, a tablet computer, a computer, a wearable device, an augmented reality (AR) device, etc.
[0181] The present application also does not limit the application scenario of the two-dimensional code. For example, the two-dimensional code provided in the present application can be applied to the data cloning scenarios shown in FIGS. 1B-1E, and can also be applied to scenarios such as bracelet pairing, account login, one-key screen projection, etc.
[0182] It can be understood that, for the convenience of description, the two-dimensional code provided in the present application will be described in detail below with reference to the ring shape shown in FIG. 4D. It can be understood that the principles of the structures of two-dimensional codes of different shapes are the same and can be mutually referred to.
[0183] In an exemplary embodiment, the two-dimensional code provided in the present application includes N information regions, each of which can be used to transmit information of at least n bits, and the target information corresponding to the two-dimensional code includes a plurality of first information. That is, each information region can express at least one first information and the corresponding serial number of the first information in the target information through the numerical value of at least n information points in the information region, thereby conveying the corresponding target information. Taking the target information 148258 as an example, the plurality of first information can include 1, 4, 8, 2, 5, and 8, but it should be understood that the target information is a plurality of first information arranged in a certain order. At this time, each information region can express each first information and the corresponding serial number through the numerical value of n information points, for example, 01, 14, 28, 32, 45, and 58, thereby expressing the target information as 148258.
[0184] The number N of information regions and the size of the number n of information points are not limited in the embodiments of the present application, and the size of N and n can be set according to experience or adjusted flexibly according to the actual application scenario.
[0185] In addition, the two-dimensional code provided in the present application also includes a positioning structure, wherein the positioning structure can include positioning points, and the positioning points are used to determine and distinguish different information regions. The positioning points can include outer positioning points and inner positioning points, and the number of outer positioning points and inner positioning points is not limited in the embodiments of the present application. The number of outer positioning points can be the same as or different from the number of information regions; similarly, the number of inner positioning points can be the same as or different from the number of information regions.
[0186] For the convenience of description, the structure of the two-dimensional code will be described below with N being 12 and n being 12 as an example.
[0187] The locating points of the two-dimensional code provided in the present application are described in detail below.
[0188] Based on the foregoing, the number of the outer locating points can be the same as the number N of the information areas, or can be different; the number of the inner locating points can be the same as the number N of the information areas, or can be different. It can be understood that, regardless of the number and position of the outer locating points and the inner locating points, the electronic device scanning the two-dimensional code can infer the locating points corresponding to each information area through the given outer locating points and inner locating points.
[0189] Specifically, FIG. 5A shows a schematic diagram of a two-dimensional code structure in which the number of outer locating points and inner locating points is the same as the number N of information areas. In FIG. 5A, the two-dimensional code includes 12 information areas, and each information area includes 12 information points that can be used to represent the payload data. Specifically, the 12 information points can represent different values (“0” or “1”) through different states, represent the payload data and the serial number corresponding to the payload data, and further represent the target information. However, for simplicity of illustration, only the positions to which the information points can correspond are represented by 12 points (dashed circles in the figure), and the different states of the information points are not shown, which will be described in detail below.
[0190] In addition, the two-dimensional code further includes 12 outer locating points and 12 inner locating points, wherein the area formed by two adjacent outer locating points and the two inner locating points corresponding thereto is an information area (the area formed by the dashed lines in the figure). In this case, each information area corresponds to four locating points. Taking information area A1 in FIG. 5A as an example, the schematic diagram of the four locating points corresponding to information area A1 can be seen from FIG. 5B.
[0191] For the structure of such a two-dimensional code, the electronic device can determine which points are outer locating points and which points are inner locating points after scanning the two-dimensional code, according to the fact that a plurality of points are located on the same outer circle / inner circle. Then, the information area is determined according to the four adjacent locating points, and the payload data corresponding to the information area and the serial number corresponding to the payload data are determined based on the values corresponding to the different states of the information points in the information area.
[0192] FIG. 5C shows a schematic diagram of a two-dimensional code structure in which the number of outer locating points and inner locating points is different from the number N of information areas. In FIG. 5C, the two-dimensional code includes 12 information areas, and each information area includes 12 information points. In addition, the two-dimensional code further includes 6 outer locating points and 6 inner locating points, and one information area corresponds to one outer locating point and one inner locating point in a diagonal position relationship with the outer locating point. In this case, each information area corresponds to two locating points. Taking information area A1 in FIG. 5C as an example, the schematic diagram of the two locating points corresponding to information area A1 can be seen from FIG. 5D.
[0193] For the structure of such a two-dimensional code, after the electronic device scans the two-dimensional code, the four positioning points (two outer positioning points and two inner positioning points) corresponding to the current information area can be determined according to the outer positioning point and the inner positioning point corresponding to the current information area, that is, the positioning points are complemented.
[0194] For example, as shown in FIG. 5E, the electronic device can determine the outer circle through which the six outer positioning points pass, and the center of the outer circle. Then, taking inner positioning point 1' and outer positioning point 2' as an example, outer positioning point 1 and inner positioning point 2' can be determined in the following manner: the intersection of the line connecting the center and inner positioning point 1' in FIG. 5E with the outer circle can be determined as outer positioning point 1; the intersection of the line connecting the center and outer positioning point 2 with the inner circle can be determined as inner positioning point 2'. The determination of other outer positioning points and inner positioning points is similar, and will not be described one by one. After the 12 outer positioning points and 12 inner positioning points are determined in the above manner, the electronic device can determine each information area, and then obtain the PIN code corresponding to the two-dimensional code based on the payload data corresponding to each information area and the serial number corresponding to the payload data.
[0195] FIG. 5F shows another structure of a two-dimensional code in which the number of outer positioning points and inner positioning points is different from the number of information areas. In (A) of FIG. 5F, the two-dimensional code includes 12 information areas, and each information area includes 12 information points, in addition, the outer positioning points and the inner positioning points are located on the same side of the corresponding information area. In this case, each information area corresponds to two positioning points. Taking information area A1 in FIG. 5F as an example, the schematic diagram of the two positioning points corresponding to information area A1 can be seen in FIG. 5G.
[0196] For the structure of such a two-dimensional code, after the electronic device scans the two-dimensional code, the four positioning points (two outer positioning points and two inner positioning points) corresponding to the current information area can be determined according to the outer positioning point and the inner positioning point corresponding to the current information area, that is, the positioning points are complemented.
[0197] For example, as shown in FIG. 5H, the electronic device can determine an outer circle through which the six outer positioning points pass, determine an inner circle through which the six inner positioning points pass, and determine the center of the outer circle (or the inner circle). Then, taking outer positioning point 1 and inner positioning point 1', outer positioning point 3 and inner positioning point 3' as examples, outer positioning point 2 and inner positioning point 2' can be determined as follows: a line 1 connecting the center and inner positioning point 1' is determined, a line 2 connecting the center and inner positioning point 3' is determined, then an angle bisector of the angle between line 1 and line 2 is determined, and a line 3 passing through the center is determined. Further, the intersection of line 3 and the outer circle is outer positioning point 2, and the intersection of line 3 and the inner circle is inner positioning point 2'. The determination of other outer positioning points and inner positioning points is similar, and thus will not be described again. After the 12 outer positioning points and the 12 inner positioning points are determined based on the above method, the electronic device can determine each information region, and then obtain the PIN code corresponding to the two-dimensional code based on the payload data corresponding to each information region and the sequence number corresponding to the payload data.
[0198] It can be understood that in the two-dimensional code shown in (B) and (C) of FIG. 5F, only the number and position of the outer positioning points and the inner positioning points are different from those in (A) of FIG. 5F, and the electronic device determines all the positioning points based on the given outer positioning points and inner positioning points in the same way as the principle described above, which will not be described again.
[0199] In the structure of the two-dimensional code described above, it can be understood that two adjacent information regions share an outer positioning point and an inner positioning point, that is, part of the positioning points of a certain information region can be determined based on the positioning points of the information region adjacent thereto, which is helpful for the rapid determination of the information region and the rapid extraction of the code elements of the information region, and can also reduce the use of positioning points (or positioning symbols) in the two-dimensional code and reduce the complexity of the two-dimensional code.
[0200] The information regions of the two-dimensional code provided in the present application will be described in detail below.
[0201] In an exemplary embodiment, an information region can represent the payload data and the sequence number corresponding to the payload data through the states of the 12 information points included therein. Different information points can be set in different states to represent different values (for example, "0" or "1") of the information points, and the different values of the plurality of information points arranged in a certain order can represent the corresponding payload data and the sequence number corresponding to the payload data, and further represent the target information corresponding to the two-dimensional code. For example, the first state of an information point corresponds to a first value, the second state corresponds to a second value, and the first value and the second value are different.
[0202] Taking the previous FIG. 5G as an example, the 12 circles in FIG. 5G represent the positions of the 12 information points or the positions where the information points can be displayed. Therefore, the information points in different positions can have different serial numbers. In the actual application of the two-dimensional code, the 12 information points can have different states to represent different numerical values "0" or "1". For example, FIG. 5I shows a schematic diagram of the states and positions of information points. In (A) of FIG. 5I, the states of two information points are represented by solid circles, and the numerical values corresponding to the two information points are "1", while the other ten information points are not displayed in the two-dimensional code, and the numerical values corresponding to the remaining information points are "0". Arranging the numerical values "1" and "0" according to the serial numbers of each information point can obtain a string, i.e., a code element, which can represent the payload data corresponding to the information area and the serial number corresponding to the payload data. In addition, (B) of FIG. 5I is another schematic diagram of the states and positions of information points, which represents the principle of the payload data and the serial number corresponding to the payload data, which is the same as (A) of FIG. 5I, and will not be described in detail.
[0203] The embodiments of the present application do not limit the setting manner of the serial numbers of the information points in each information area, and the setting manner of the serial numbers of the information points in each information area of the two-dimensional code can be the same. FIG. 6A shows a schematic diagram of the setting of the serial numbers of information points. As shown in FIG. 6A, the 12 information points in information area A1 can be divided into three rows from inside to outside, and the serial numbers of the four information points from right to left in the first row can be 0-3, and the serial numbers of the four information points from right to left in the second row can be 4-7, and the serial numbers of the four information points from right to left in the third row can be 8-11. The setting manner of the serial numbers of the information points in other information areas is the same, for example, the setting manner of the serial numbers of the 12 information points in information area A2 can still refer to the content shown in FIG. 6A.
[0204] It can be understood that the numerical values "0" or "1" corresponding to each information point can be represented by the state of the information point, and the embodiments of the present application do not limit the corresponding relationship between the numerical value and the state. For example, when the numerical value of an information point is "0", the state of the information point can be a hollow circle; when the numerical value of an information point is "1", the state of the information point can be changed to a solid circle. Based on the two-dimensional code structure shown in FIG. 6A, if the numerical values corresponding to the information points with serial numbers 1 and 2 in information area A1 are "1" and the rest are "0", the states of the information points in information area A1 can be referred to FIG. 6B.
[0205] For another example, when the value of an information point is "0", the information point can not be displayed in the two-dimensional code, and vice versa, when the value of the information point is "1", the information point is displayed in the two-dimensional code in the state of a solid circle. Based on the two-dimensional code structure shown in FIG. 6A, if the values corresponding to the information points with serial numbers 1 and 2 in the information area A1 are "1" and the rest are "0", the states of the information points in the information area A1 can be referred to FIG. 6C. That is, in this case, the first state is the display state, the second state is the non-display state, and the first value corresponding to the first state is 1 and the second value corresponding to the second state is 0.
[0206] It can be understood that the shape of the information point in the embodiment of the present application can be a circle, or other shapes such as a triangle, which is not limited in the present application.
[0207] Therefore, the payload data corresponding to each information area and the serial number corresponding to the payload data can be represented by different values corresponding to information points with different serial numbers, and the different values corresponding to information points with different serial numbers can be in the form of a string. For example, based on the setting of the serial numbers of the information points shown in FIG. 6A, if the values corresponding to the information points with serial numbers 1 and 2 in the information area A1 are "1" and the rest are "0", the string corresponding to the 12 information points in the information area A1 is 011000000000. The string can be used to represent the payload data corresponding to the information area A1 and the serial number corresponding to the payload data.
[0208] It can be understood that, for the convenience of description, the present application is described by taking an example that two information points in 12 information points correspond to values "1" and the rest are "0". However, it should be understood that the number of information points corresponding to the value "1" can be flexibly set according to the actual application scenario, and the present application does not limit the size of the number, for example, it can be 3, etc. In addition, the number of information points with the value "1" in each information area can be the same or different, for example, the number of information points with the value "1" in the information area A1 is 2, the number of information points with the value "1" in the information area A2 is 3, etc. The embodiments of the present application do not limit this.
[0209] In the embodiment of the present application, the payload data corresponding to each information area and the serial number corresponding to the payload data can be in the form of unit data and ten data. For example, the unit data is the payload data in the PIN code (i.e. the target information), and the ten data is the serial number corresponding to the payload data. For example, if the 6-bit PIN code is 148258, the payload data corresponding to the 0th bit is 1, and the information area is used to represent the data 01. In some embodiments, the payload data can also include the overhead of the upper protocol that may exist when the two-dimensional code delivers the target information.
[0210] In some embodiments, the ten's data can also be the payload data, and the unit's data is the serial number corresponding to the payload data, which is not limited in the embodiments of the present application.
[0211] Taking the PIN code 148258 to be transmitted by the two-dimensional code as an example, the structure of the two-dimensional code is described.
[0212] It can be understood that, since the PIN code 148258 with 6 digits needs to be transmitted, the serial number corresponding to the number of digits of the PIN code can be represented by 0-5. Table 1 below shows the correspondence between the serial number of the number of digits of the PIN code and the payload data in the corresponding PIN code. As shown in Table 1, the payload data corresponding to the serial number 0 is 1; the payload data corresponding to the serial number 1 is 4; the payload data corresponding to the serial number 2 is 8; the payload data corresponding to the serial number 3 is 2; the payload data corresponding to the serial number 4 is 5; and the payload data corresponding to the serial number 5 is 8.
[0213] Table 1
[0214] That is, the payload data corresponding to the plurality of information areas and the serial number corresponding to the payload data at least include 01, 14, 28, 32, 45, and 58.
[0215] In the exemplary embodiments, the payload data corresponding to each information area and the serial number corresponding to the payload data can be represented by different values corresponding to different information points, so the data transmitted by 12 information points corresponding to the serial number 0 is 01, and by analogy, the data transmitted by 12 information points corresponding to the serial number 1 is 14; the data transmitted by 12 information points corresponding to the serial number 2 is 28; the data transmitted by 12 information points corresponding to the serial number 3 is 32; the data transmitted by 12 information points corresponding to the serial number 4 is 45; and the data transmitted by 12 information points corresponding to the serial number 5 is 58.
[0216] How the 12 information points represent the payload data and the serial number corresponding to the payload data required to be transmitted in the foregoing will be described in detail below.
[0217] Table 2 below shows a code table (i.e., a correspondence table) of a 6-digit PIN code. The code table can reflect the correspondence between the serial number of the number of digits of the PIN code and the corresponding payload data, and the correspondence between the code elements of the 12 information points. Table 2 includes: the serial number of the number of digits of the PIN code, and the serial number has a value range of 0-5, because Table 2 is a code table of a 6-digit PIN code; the payload data, and the payload data has a value range of 0-9; and the values of the 12 information points, wherein the serial numbers of the 12 information points are 0-11 respectively, and the values of the information points are "0" or "1".
[0218] Table 2
[0219] It can be understood that the code table shown in Table 2 is only an example and does not constitute a limitation on the embodiments of the present application. For example, the number of bits of the PIN code corresponding to the code table is not limited, and the number of bits can be flexibly set according to the actual application scenario. Further, the specific content included in the code table can also be determined according to the number of bits of the PIN code to which the code table is applied, as long as the code elements corresponding to the information points and the sequence number of the PIN code bits and the payload data are one-to-one corresponding.
[0220] For example, as shown in Table 2, when the sequence number is 0, the payload data is different, and the code elements of the 12 information points are also different. In addition, when the sequence number is different, different payload data also corresponds to different code elements of the 12 information points. The purpose of such setting is to ensure that the code elements of the 12 information points can reflect the sequence number of the number of bits of the PIN code and the size of the corresponding payload data.
[0221] In some embodiments, there are two values "1" in the code elements of the 12 information points in Table 2, and the number of values "1" in other code tables is not limited by the embodiments of the present application, as long as the corresponding relationship between the sequence number of the number of bits of the PIN code and the corresponding payload data and the code elements of the 12 information points can be clearly reflected.
[0222] In some embodiments, based on the foregoing, if the number of information points with the value "1" included in each information region is different, the code table provided by the embodiments of the present application is not limited to one of the above Table 2. For example, if the number of information points with the value "1" in a certain information region is 2, the electronic device can decode the code element corresponding to the information region based on the above Table 2; if the number of information points with the value "1" in a certain information region is 3, the electronic device also needs to decode the code element corresponding to the information region based on another code table. For example, unlike the above Table 2, the code element corresponding to the sequence number and the payload data in the other code table can have three information points with the value "1".
[0223] Taking the payload data transmitted by the 12 information points and the serial number corresponding to the payload data as 01 as an example, according to the code table in Table 2, the code (or code data, string data, binary data) of the 12 information points corresponding to the payload data with the serial number 0 and the PIN code with the payload data 1 is 011000000000. That is, in the 12 information points, the value corresponding to the information point with the serial number 0 is 0, the value corresponding to the information point with the serial number 1 is 1, and so on. Exemplarily, the two-dimensional code when the payload data transmitted by the 12 information points and the serial number corresponding to the payload data is 01 can be as shown in the information area A1 in the foregoing FIG. 6B or FIG. 6C. In this way, when scanning the two-dimensional code, the electronic device can determine the code (for example, 011000000000) of the 12 information points according to the state of the 12 information points, and further parse the payload data 1 and the serial number 0 corresponding to the payload data represented by the information area according to the code table shown in Table 2.
[0224] The setting mode of the other five data of the six-bit PIN code is the same as described above, which will not be described again here.
[0225] In addition, since the two-dimensional code transmits the six-bit PIN code based on the 12 information areas, the remaining six information areas can repeatedly transmit the six-bit PIN code. Exemplarily, the remaining six information areas can transmit 32, 45, 58, 01, 14, and 28 in sequence, respectively.
[0226] Based on the state of the information points corresponding to different values shown in FIG. 6B, the structure of the complete two-dimensional code can be referred to FIG. 7A; based on the state of the information points corresponding to different values shown in FIG. 6C, the structure of the complete two-dimensional code can be referred to FIG. 7B. In addition, the distribution of the serial numbers of the bits of the PIN codes corresponding to the information areas can be referred to FIG. 8.
[0227] The two-dimensional code provided in the present application adopts a discrete dot pattern, that is, the two-dimensional code includes a plurality of positioning points and information points, and there is a strict geometric relationship between the points, so that the electronic device can determine the PIN code corresponding to the two-dimensional code by the information transmitted by each point in the two-dimensional code. In addition, the number of points contained in the two-dimensional code provided in the present application is small, for example, some positioning points can be determined based on other known positioning points, so that the two-dimensional code is more simplified.
[0228] The two-dimensional code provided in the embodiments of the present application, since the number N of information areas is greater than the number of bits of the PIN code to be transmitted by the two-dimensional code, that is, the PIN code to be transmitted can be repeatedly presented in the information areas of the two-dimensional code, therefore, even if the electronic device scans the two-dimensional code provided in the present application, the two-dimensional code is not located in the scanning area of the electronic device, the electronic device can also obtain the PIN code to be transmitted by the two-dimensional code according to the part of the two-dimensional code scanned, so that the scanning efficiency of the two-dimensional code can be improved, and further the acquisition efficiency and the code scanning robustness of the data transmitted by the two-dimensional code can be improved.
[0229] In addition, the PIN code can be repeatedly represented in different information areas of the two-dimensional code, so that for a certain bit payload data of the repeatedly represented PIN code, if the information area that should represent the certain bit payload data fails to represent the payload data, the electronic device can determine the payload data through other information areas that represent the payload data, so that the scanning efficiency of the two-dimensional code can be improved, and the acquisition efficiency and the code scanning robustness of the target information delivered by the two-dimensional code can be improved.
[0230] Based on the two-dimensional code provided in the application described above, the application further provides a two-dimensional code identification method for identifying the two-dimensional code. It can be understood that the two-dimensional code identification method provided in the application can be applied to the data cloning scenarios shown in FIGS. 1B to 1E, and can also be applied to scenarios such as bracelet pairing, account login, and one-key screen projection.
[0231] Before the two-dimensional code identification method provided in the embodiments of the application is described in detail below, the electronic device to which the method can be applied is described first. It can be understood that the two-dimensional code identification method provided in the embodiments of the application is applicable to any electronic device with a two-dimensional code scanning function or a camera, including but not limited to any electronic device such as a mobile phone, a tablet computer, a computer, a wearable device, an augmented reality (AR) device, and the like. The type and form of the electronic device are not limited in the embodiments of the application.
[0232] In addition, in the embodiments of the application, the type of the electronic device that executes the two-dimensional code identification method can be the same as or different from the type of the electronic device that displays the two-dimensional code described above. For example, the case where the electronic device that executes the two-dimensional code identification method scans the two-dimensional code includes but is not limited to the following: a mobile phone scans a two-dimensional code in the screen of another mobile phone, a mobile phone scans a two-dimensional code in the screen of a tablet computer, a mobile phone scans a two-dimensional code in the screen of a computer, a mobile phone scans a two-dimensional code in the screen of a watch, a tablet computer scans a two-dimensional code in the screen of a mobile phone, a tablet computer scans a two-dimensional code in the screen of another tablet computer, a tablet computer scans a two-dimensional code in the screen of a computer, a tablet computer scans a two-dimensional code in the screen of a watch, and the like.
[0233] It can be understood that in some embodiments, the device that executes the method is a device that at least contains a camera, and the device that displays the two-dimensional code provided in the application is a device that at least contains a display screen.
[0234] The two-dimensional code identification method provided in the embodiments of the application is described in detail below. As shown in FIG. 9, the method can include the following steps:
[0235] 901: Scan a two-dimensional code to be identified.
[0236] The to-be-recognized two-dimensional code includes N information areas, the N information areas include M information area groups, each information area group includes at least one information area, and the M information area groups include at least two information area groups with the same display content, and the at least two information area groups display a target information of the to-be-recognized two-dimensional code, where M is less than or equal to N and greater than 1.
[0237] It can be understood that the electronic device can scan the to-be-recognized two-dimensional code through a camera.
[0238] The embodiments of the present application do not limit the type and device of the electronic device on which the to-be-recognized two-dimensional code is displayed, and the related description of the two-dimensional code can be referred to in the foregoing description, which will not be repeated here. In addition, in the embodiments of the present application, the electronic device for scanning the to-be-recognized two-dimensional code and the electronic device for displaying the to-be-recognized two-dimensional code can be the same type of electronic device, or can be different types of electronic device, which can be specifically understood from the examples listed in the foregoing description, and will not be repeated here.
[0239] In some other embodiments, the to-be-recognized two-dimensional code can also be pre-stored in the electronic device, for example, the to-be-recognized two-dimensional code is stored in the gallery application of the electronic device in the form of a picture. In this case, the electronic device can directly determine the to-be-recognized two-dimensional code in response to the selection operation of the user, and then scan the to-be-recognized two-dimensional code.
[0240] 902: determining the target information corresponding to the to-be-recognized two-dimensional code based on the N information areas in the to-be-recognized two-dimensional code.
[0241] It can be understood that in the embodiments of the present application, the information area is an information area.
[0242] In some embodiments, determining the target information corresponding to the to-be-recognized two-dimensional code based on the N information areas in the to-be-recognized two-dimensional code can include the following steps 9021 to 9023.
[0243] 9021: performing symbol extraction on each information area in the to-be-recognized two-dimensional code to obtain symbol data corresponding to the N information areas.
[0244] In some embodiments, the electronic device can first determine each positioning point in the to-be-recognized two-dimensional code, and then determine a plurality of information areas based on the positioning points.
[0245] In the K positioning structures corresponding to the to-be-identified two-dimensional code, if there is no missing positioning point, for example, the number of outer positioning points and the number of inner positioning points are both the same as the number of information areas, the N information areas are determined based on the K positioning structures; if there is a missing positioning point in the K positioning structures corresponding to the to-be-identified two-dimensional code, for example, the number of outer positioning points and / or the number of inner positioning points is less than the number of information areas, the missing positioning point is filled, and the N information areas are determined based on the K positioning structures after the filling,
[0246] In some embodiments, the filling of the missing positioning point includes: for the missing positioning point being part of the positioning points in the first positioning structure of the K positioning structures, the missing positioning point is filled based on other positioning points in the first positioning structure; for the missing positioning point being all of the positioning points in the first positioning structure of the N positioning structures, the missing positioning point is filled based on adjacent positioning structures of the first positioning structure. The determination method of the positioning point can be referred to the related description of FIGS. 5A-5I in the foregoing description, which will not be repeated here.
[0247] Based on the foregoing description of the structure of the two-dimensional code, it can be known that the to-be-identified two-dimensional code in the present application includes a plurality of information areas, and each information area includes a plurality of information points, each information point has a corresponding numerical value, and the plurality of information points with numerical values can be used to represent the payload data (i.e., the first information) and the sequence number corresponding to the payload data. In an exemplary embodiment, the unit digit data can be the payload data corresponding to each digit in the PIN code, and the ten digit data can be the sequence number corresponding to each payload data.
[0248] Based on the structure of the to-be-identified two-dimensional code described above, after the electronic device scans the to-be-identified two-dimensional code, the symbol extraction of each information area can be performed. Exemplarily, the process of symbol extraction of each information area is also the process of obtaining the string (or binary data) of the plurality of information points included in each information area according to the numerical value of the information point in each information area.
[0249] In an exemplary embodiment, the numerical value of each information point can be “0” or “1”, and different numerical values correspond to different states of the information points. The embodiments of the present application do not limit the states of the information points corresponding to different numerical values.
[0250] For example, when the value of an information point is "0", the state of the information point can be a hollow circle corresponding to the information point in FIG. 6B; when the value of an information point is "1", the state of the information point can be different from the hollow circle in FIG. 6B, for example, the hollow circle corresponding state is changed to a solid circle. In this case, the manner in which the electronic device determines the symbol of the plurality of information points included in a certain information region can be as follows: the electronic device arranges the values ("0" or "1") corresponding to each sequence number according to the sequence number of the plurality of information points and the state of each information point (for example, whether the information point is represented by a hollow circle or a solid circle), and the string of values corresponding to the plurality of information points, that is, the symbol, can be obtained. That is, the symbol is composed of a plurality of values "0" or "1" arranged in order.
[0251] It can be understood that in this case, each information point is displayed in the to-be-recognized two-dimensional code, but the display form is different, that is, each information point represents the corresponding value by a solid circle or a hollow circle. Therefore, since each information point is displayed in the to-be-recognized two-dimensional code, the electronic device can correspond the sequence number of the information point to each information point, and then obtain the symbol corresponding to the plurality of information points in the above manner.
[0252] For another example, when the value of an information point is "0", as shown in FIG. 6C, the state of the information point can not be displayed in the to-be-recognized two-dimensional code, and conversely, when the value of the information point is "1", the information point can be displayed in the to-be-recognized two-dimensional code in the state of a solid circle. However, unlike the case where each information point is displayed in the to-be-recognized two-dimensional code, in this case, the information point corresponding to the value "0" is not displayed in the to-be-recognized two-dimensional code, and therefore, in the case where only a small number of information points are displayed in each information region, the electronic device cannot directly correspond the sequence number of the information point to each information point.
[0253] At this time, the manner in which the electronic device determines the symbol of the plurality of information points can be as follows: the electronic device determines the length of the line connecting the center of the outer circle and the inner circle of the to-be-recognized two-dimensional code and / or the included angle of the line with the positioning point corresponding to the center and the displayed information point, because the positions of information points with different sequence numbers in the information region are different, the position of the information point can be determined by the length of the line connecting the information point and the center and / or the included angle described above, and then the sequence number of the information point is determined.
[0254] 9022: decode the N symbols to obtain M same first target information corresponding to the N information regions.
[0255] In the embodiments of the present application, the electronic device can decode the symbols of each information region in the following manner: the electronic device finds a corresponding code table based on the symbols corresponding to the plurality of information points, wherein the code table can reflect the correspondence between the sequence number of the bit number of the PIN code and the corresponding payload data, and the plurality of information points form a string.
[0256] After the electronic device finds the corresponding code table based on the symbols, obtains the payload data corresponding to the information region and the sequence number corresponding to the payload data, the electronic device can arrange the payload data corresponding to the plurality of information regions in a certain order to obtain the first target information.
[0257] In some embodiments, if the number of information regions included in the provided to-be-recognized two-dimensional code is greater than the bit number of the PIN code to be transmitted, the information regions of the to-be-recognized two-dimensional code are redundant, that is, the electronic device can obtain M identical first target information through decoding.
[0258] 9023: performing first fusion processing on the M identical first target information to obtain the fused second target information corresponding to the to-be-recognized two-dimensional code.
[0259] In some embodiments, if the number of information regions included in the provided to-be-recognized two-dimensional code is greater than the bit number of the PIN code to be transmitted, the information regions of the to-be-recognized two-dimensional code are redundant, that is, the electronic device can obtain M identical first target information through decoding.
[0260] It can be understood that in some embodiments, if the information regions of the provided two-dimensional code are not redundant, that is, all the information regions of the two-dimensional code represent a complete target information, the fusion processing in step 9023 can not be performed, and the N symbols can be directly decoded to obtain the target information corresponding to the two-dimensional code.
[0261] FIG. 10A shows a structural schematic diagram of a to-be-recognized two-dimensional code. It can be understood that the PIN code to be transmitted by the to-be-recognized two-dimensional code shown in FIG. 10A is the same as that in FIG. 7B, except that the display of the positioning points in FIG. 10A is different from the number of positioning points in FIG. 7B. In addition, in order to make the structure of the to-be-recognized two-dimensional code shown in FIG. 10A clearer, an outer circle and an inner circle represented by a dashed line are added in FIG. 10A, which can be used to distinguish the positioning points and the displayed information points, and facilitate the illustration, but it should be understood that the outer circle and the inner circle are not displayed when the to-be-recognized two-dimensional code is displayed on the display screen of the electronic device.
[0262] The two-dimensional code recognition method provided by the present application will be described in detail below based on the to-be-recognized two-dimensional code shown in FIG. 10A. Referring to FIG. 11, the method can at least include the following steps:
[0263] 1101: scanning a to-be-recognized two-dimensional code.
[0264] It can be understood that the principle and content of this step are substantially the same as those of the principle and content of the foregoing step 901, and thus will not be described herein again.
[0265] 1102: Determine each positioning point in the to-be-recognized two-dimensional code.
[0266] In the embodiments of the present application, the positioning points of the to-be-recognized two-dimensional code include outer positioning points and inner positioning points. It can be understood that the determination manner of the positioning points when the number of outer positioning points and / or inner positioning points is different from the number of information areas has been described in the related content of FIGS. 5B and 5C, and the principle of the determination manner of the positioning points is similar, and thus will not be described herein again.
[0267] The case of the outer positioning points and the inner positioning points shown in FIG. 10A is the same as that shown in FIG. 5B, and thus the determination manner of the positioning points of the to-be-recognized two-dimensional code shown in FIG. 10A can be referred to the related description of FIG. 5B. In addition, the structure of the to-be-recognized two-dimensional code after each positioning point is supplemented can be referred to FIG. 10B.
[0268] 1103: Perform symbol extraction on each information area in the to-be-recognized two-dimensional code determined based on each positioning point.
[0269] The following will specifically describe how to perform symbol extraction on each information area in combination with FIG. 10B. Taking information area A1 in FIG. 10B as an example, the information area A1 includes two information points with a value of “1”, i.e., information point 1 and information point 2. Specifically, the manner of performing symbol extraction on the information area A1 includes the following steps.
[0270] S1: Draw a line connecting the center of the to-be-recognized two-dimensional code and each information point, respectively, calculate the length of each line or the length of the line segment connecting the information point and the nearest inner or outer positioning point, and calculate the included angle between each line segment and the line connecting the inner and outer positioning points corresponding to the information area A1.
[0271] Exemplarily, referring to FIG. 10C, the line connecting the inner and outer positioning points corresponding to the information area A1 can be line 1 in FIG. 10C, or line 2 in FIG. 10C; the line connecting the center and information point 1 can be line 3 in FIG. 10C; and the line connecting the center and information point 2 can be line 4 in FIG. 10C.
[0272] In this step, the electronic device can calculate the length of the line connecting the center and the information point. That is, the electronic device can calculate the length of line 3 and the length of line 4 in FIG. 10C.
[0273] In addition, the electronic device can also calculate the length of the line connecting the information point and the closest inner or outer positioning point. That is, the electronic device can calculate the length of the line connecting information point 2 and inner positioning point 1’ and the length of the line connecting information point 1 and inner positioning point 2’ in FIG. 10C.
[0274] In addition, the electronic device can also calculate the angle between each line segment and line 1 and / or line 2. That is, the electronic device can calculate the angle between line 4 and line 1 and / or line 2 in FIG. 10C; similarly, the electronic device can also calculate the angle between line 3 and line 1 and / or line 2. Furthermore, the electronic device can also calculate the angle between the line connecting information point 2 and inner positioning point 1’ and line 1, and the angle between the line connecting information point 1 and inner positioning point 2’ and line 2.
[0275] S2: Determine the positions of information point 1 and information point 2 based on the length of each line and the angle between the lines, and obtain the symbol corresponding to information area A1.
[0276] For example, the electronic device can determine the position of information point 1 based on the length of line 3 and the angle between line 1 and / or line 2 and line 3. The electronic device can determine the position of information point 2 based on the length of line 4 and the angle between line 1 and / or line 2 and line 4.
[0277] For example, based on the length of the line and the angle between the lines, and the case shown in FIG. 6A, it can be determined that the serial number corresponding to information point 1 is 1, and the serial number corresponding to information point 2 is 2. Since each information area corresponds to a 12-bit string, in the case where the values corresponding to information point 1 and information point 2 are both “1”, the symbol corresponding to information area 1 is 011000000000.
[0278] According to the principles shown in steps S1 and S2 described above, symbol extraction can be performed on each information area to obtain the string corresponding to each information area. It can be understood that the string corresponding to each information area includes two “1” and ten “0”.
[0279] 1104: Decode the symbol of each information area based on the code table to obtain the payload data corresponding to each information area and the serial number corresponding to the payload data.
[0280] The process of decoding the symbol is also the process of performing inverse mapping based on the code table, and the code table can refer to Table 2 described above. Still taking the symbol 01100000000 corresponding to information area 1 as an example, searching Table 2 can obtain that the bit number serial number of the PIN code corresponding to the symbol is 0, and the payload data is 1, therefore, the payload data corresponding to information area 1 and the serial number corresponding to the payload data can be represented by 01 (also referred to as row number).
[0281] The determination manner of the payload data of the other information areas and the serial numbers corresponding to the payload data is the same, and thus will not be described again. The data corresponding to the information areas A1 to A12 are 01, 14, 28, 32, 45, 58, 32, 45, 58, 01, 14, 28, respectively.
[0282] 1105: Fuse the payload data corresponding to the redundant areas and the serial numbers corresponding to the payload data, to obtain a PIN code delivered by the to-be-recognized two-dimensional code.
[0283] Continuing to refer to the example described above, in which the data 01, 14, 28, 32, 45, and 58 each appears twice, it indicates that the regions corresponding to the bit numbers 0, 1, 2, 3, 4, and 5 have information area redundancy. After the redundant information areas are fused (i.e., the first fusion processing), the data corresponding to the to-be-recognized two-dimensional code can be obtained as 01, 14, 28, 32, 45, and 58. The electronic device can arrange the units (i.e., the payload data) in the above plurality of data according to the PIN bit number sequence, to obtain 148258. Therefore, the electronic device can determine that the PIN code corresponding to the to-be-recognized two-dimensional code is 148258.
[0284] In the method, the data corresponding to the information areas in the to-be-recognized two-dimensional code includes not only the payload data in the PIN code, but also the bit number sequence corresponding to the payload data in the PIN code. In this way, when the electronic device scans the to-be-recognized two-dimensional code, the electronic device can determine the corresponding data according to the code elements in the information areas, and then sort the payload data corresponding to each information area based on the bit number sequence, to obtain the PIN code delivered by the to-be-recognized two-dimensional code, thereby improving the information acquisition efficiency and the code scanning robustness of the two-dimensional code.
[0285] It can be understood that, in the process of decoding the code elements of each information area to obtain the PIN code corresponding to the to-be-recognized two-dimensional code, the code elements of the plurality of information points corresponding to each information area can be successfully decoded. In some embodiments, if the code elements of the plurality of information points corresponding to at least one information area in the to-be-recognized two-dimensional code cannot be successfully decoded, for example, the number of information points with the value “1” in the code element is different from the number threshold, resulting in an error code element, the electronic device can perform an error correction operation on the error code element.
[0286] Next, another two-dimensional code recognition method provided by the present application will be described in detail based on the two-dimensional code shown in FIG. 12 as an example of the to-be-recognized two-dimensional code.
[0287] Referring to FIG. 13A, the method can at least include the following steps:
[0288] 1301: Scan the to-be-recognized two-dimensional code.
[0289] 1302: Determine each positioning point in the two-dimensional code to be identified.
[0290] 1303: Perform symbol extraction on each information area in the two-dimensional code to be identified.
[0291] It can be understood that the principles of steps 1301-1303 described above are the same as those of steps 1101-1103 described above, and details can be referred to the foregoing description, which will not be repeated here.
[0292] 1304: Decode the symbols corresponding to each information area to obtain the payload data corresponding to the correct symbol, the serial number, and the first symbol with errors.
[0293] As can be understood from the structure shown in FIG. 12, in the two-dimensional code to be identified, information area A1 and information area A10 are used to represent the same payload data, but only one information point in information area A1 and information area A10 has a value of “1”, and the corresponding symbol (i.e., the first symbol) is also different, indicating that the symbols of information area A1 and information area A10 are both incorrect; only one information point in information area A3 has a value of “1”, and there is no information point in information area A12 corresponding to the value “1”; and one information point in information area A5 has a value of “1”. The number of information points with a value of “1” in the above information areas is different from the number threshold (for example, 2), and therefore the symbols corresponding to the above information areas are incorrect symbols.
[0294] The number of information points with a value of “1” in information area A2 and information area A11 is 2, and the symbols (i.e., the first symbols) of information area A2 and information area A11 are the same, indicating that the symbols of information area A2 and information area A11 are both correct, and the payload data represented by information area A2 and information area A11 and the serial number can be obtained based on the symbol lookup table.
[0295] Similarly, information area A4, information area A6, information area A7, information area A8, and information area A9 will not be described one by one.
[0296] Therefore, the electronic device can decode the correct symbols corresponding to the above information areas to obtain the corresponding payload data and serial number.
[0297] In this way, based on the symbols corresponding to the above information areas and the code table shown in Table 2 described above, it can be obtained that the data corresponding to information area A2 is 14, the data corresponding to information area A4 is 32, the data corresponding to information area A6 is 58, the data corresponding to information area A7 is 32, the data corresponding to information area A8 is 45, the data corresponding to information area A9 is 58, and the data corresponding to information area A11 is 14.
[0298] The data corresponding to the information area A1 to the information area A12 can be represented as xx, 14, xx, 32, xx, 58, 32, 45, 58, xx, 14, xx. Wherein, "xx" represents unknown data corresponding to the information area. However, based on FIG. 12, it can be known that the symbol corresponding to the information area A1 is 010000000000, the symbol corresponding to the information area A3 is 000000000010, the symbol corresponding to the information area A5 is 000000100000, the symbol corresponding to the information area A10 is 001000000000, and the symbol corresponding to the information area A12 is 000000000000.
[0299] 1305: performing a second fusion processing on the first symbol with error to obtain a plurality of second symbols.
[0300] Secondly, the symbol corresponding to the information area A1 is 010000000000, the symbol corresponding to the information area A10 is 001000000000, and the information area A1 and the information area A10 are used to represent the same data, and the number of bits of the corresponding PIN code is 0. Therefore, the electronic device can fuse the symbols in the information area A1 and the information area A10. The value of the first bit in the symbol corresponding to the information area A1 is 1, and the values of the remaining bits are 0. The value of the second bit in the symbol corresponding to the information area A10 is 1, and the values of the remaining bits are 0. Therefore, the value of the second bit in the symbol corresponding to the information area A1 is set to 1, and the value of the first bit in the symbol corresponding to the information area A10 is set to 1. In this way, the symbols corresponding to the information area A1 and the information area A10 are both 011000000000 (i.e., a second symbol).
[0301] The symbol corresponding to the information area A3 is 000000000010, the symbol corresponding to the information area A12 is 000000000000, and the information area A3 and the information area A12 are used to represent the same data, and the number of bits of the corresponding PIN code is 2. Therefore, the electronic device can fuse the symbols in the information area A3 and the information area A12 to obtain a fused symbol 000000000010.
[0302] The symbol corresponding to the information area A5 is 000000100000, the symbol corresponding to the information area A8 is 000000010010, and the information area A5 and the information area A8 are used to represent the same data, and the number of bits of the corresponding PIN code is 4. Therefore, the electronic device can fuse the symbols in the information area A5 and the information area A8 to obtain a fused symbol 000000110010.
[0303] 1306: performing error correction on the symbol in the plurality of second symbols whose number of values 1 is not a quantity threshold to obtain a corrected symbol.
[0304] Based on the step 1305, the quantity of the value "1" in the second symbol corresponding to the information area A1 and the information area A10 is equal to the quantity threshold (e.g., 2), and thus the symbol corresponding to the information area A1 and the information area A10 does not need to be corrected. In addition, the symbol corresponding to the information area A1 and the information area A10 in this case can be taken as an example of the third symbol.
[0305] The second symbol corresponding to the information area A3 and the information area A12 is 000000000010, and the quantity of the value "1" in the second symbol is less than the quantity threshold, and thus the symbol needs to be corrected. The symbol corresponding to the information area A3 and the information area A12 in this case can be taken as an example of the fourth symbol.
[0306] In this case, the specific correction manner can be to set the value "0" of the quantity that does not satisfy the quantity threshold to the value "1", to obtain the fifth symbol in which the quantity of the value "1" is equal to the quantity threshold. Taking 000000000010 as an example, one value "0" in 000000000010 can be changed to "1", and it is determined whether the symbol after correction exists in the corresponding relationship table. Specifically, only when the symbol after correction is 000000100010, the symbol exists in the corresponding relationship table, and thus the fifth symbol corresponding to the information area A3 and the information area A12 is 000000100010.
[0307] Similarly, the second symbol corresponding to the information area A5 and the information area A8 is 000000110010, and the quantity of the value "1" in the second symbol is greater than the quantity threshold, and thus the symbol needs to be corrected. The symbol corresponding to the information area A5 and the information area A8 in this case can be taken as an example of the fourth symbol.
[0308] In this case, the specific correction manner can be to set the value "1" of the quantity that exceeds the quantity threshold to the value "0", to obtain the fifth symbol in which the quantity of the value "1" is equal to the quantity threshold. Taking 000000110010 as an example, one value "1" in 000000110010 can be changed to "0", and it is determined whether the symbol after correction exists in the corresponding relationship table. Specifically, only when the symbol after correction is 000000010010, the symbol exists in the corresponding relationship table, and thus the fifth symbol corresponding to the information area A5 and the information area A8 is 000000010010.
[0309] In some embodiments, if the quantity of the information point with the value "1" included in each information area is different, the electronic device can also determine the bit sequence number corresponding to the information area based on the quantity of the information point with the value "1" in each information area. Alternatively, in some other embodiments, the electronic device can also determine which two information areas are used to represent the same payload data based on the quantity of the information point with the value "1". These manners are all helpful for the electronic device to correct the symbol.
[0310] 1307: decode the fused second symbol and the corrected symbol to obtain a PIN code delivered by the to-be-identified two-dimensional code.
[0311] It can be understood that the data corresponding to the fused symbol 011000000000 of the information area A1 and the information area A10 is 01 after decoding.
[0312] The data corresponding to the corrected symbol 000000000010 of the information area A3 and the information area A12 is 28 after decoding.
[0313] The data corresponding to the corrected symbol 000000010010 of the information area A5 and the information area A8 is 45 after decoding.
[0314] At this time, the data corresponding to the information areas A1 to A12 have all been determined, and are respectively 01, 14, 28, 32, 45, 58, 32, 45, 58, 01, 14, 28. The first fusion processing is performed on these data to obtain 01, 14, 28, 32, 45, 58. Then, the payload data is sorted based on the serial numbers, and the PIN code corresponding to the two-dimensional code is 148258.
[0315] Based on the above example, FIG. 13B shows another flowchart for identifying a two-dimensional code. As shown in FIG. 13B, the flowchart can include the following steps.
[0316] 1310: draw a line through the center and a certain information point in the information area, calculate the length of the line segment or the length of the line segment connecting the information point and the nearest inner or outer positioning point, and the included angle of each line segment with the line 1 and / or the line 2.
[0317] It can be understood that the line 1 and the line 2 in this step can be the line 1 and the line 2 in FIG. 10C, and the information point in this step can be the information point 1 or the information point 2 in FIG. 10C.
[0318] The principle of this step is basically the same as that of the previous step S1, which will not be described here.
[0319] 1320: determine the position serial number of the information point by the included angle and the distance of the line segment.
[0320] It can be understood that determining the position serial number of the information point can also be understood as determining the row and column of the information point in FIG. 6A.
[0321] 1330: analyze the positions (row and column) of all information points in the information area, and output 12 bits (in theory, there are 2 ones and 1 zero in 12 bits).
[0322] It can be understood that the block information area can refer to the information area A1 in FIG. 10C, and analyzing the positions of all information points in the block information area, that is, analyzing the positions / statuses of all information points in the information area A1 in FIG. 10C, 12 bits corresponding to the information area A1 are obtained, that is, the symbol is 011000000000.
[0323] 1340: 12 bits of each block information area are obtained.
[0324] 1350: De-mapping is performed based on Table 2 to obtain 12 rows (some rows can be empty because of errors).
[0325] The rows can be the payload data and the serial numbers corresponding to the payload data mentioned above.
[0326] It can be understood that the steps 1300-1350 described above have the same principle as the steps 1103-1104 described above, and will not be described again.
[0327] 1360: The starting bit of the PIN code is determined by cyclic shift based on the tens of the 12 rows.
[0328] It can be understood that in this step, if the information area A1 in FIG. 10C is set as the starting bit of the two-dimensional code, that is, the electronic device obtains each payload data and the serial number corresponding to the payload data based on the starting bit in a certain order, and then obtains the PIN code. In this case, if the tens of the data corresponding to the information area A1 are not 0, the electronic device can perform a cyclic shift operation to move the data with the bit number 0 to the information area A1, and other data also follow the same movement rule. After cyclic shift of each data, the electronic device directly takes the data corresponding to the information area A1 as the starting point, and arranges the units of the data in each information area in order (such as clockwise order), and the PIN code is obtained.
[0329] However, it should be understood that in the two-dimensional code structure shown in FIG. 10C, the bit number corresponding to the information area A1 is 0, that is, in this example, no shift operation is needed, and the information area A1 is directly taken as the starting point, and the rows corresponding to each information area are obtained clockwise.
[0330] In some examples, this step is an optional step. If no shift is performed, the electronic device can directly arrange the units corresponding to the tens of the 12 rows in order, such as 012345, to obtain the PIN code.
[0331] 1370: If there is a starting empty domain fusion, fusion is performed.
[0332] The sending end refers to the transmitting end, that is, the electronic device displaying the two-dimensional code. If there is a sending end spatial fusion, that is, the two-dimensional code corresponds to a 6-bit PIN code, but 12 rows are obtained in step 1350, which indicates that there are repeated or redundant rows in the 12 rows. At this time, the redundant rows can be fused, for example, 6 rows are obtained after fusion. The specific principle of this step can be referred to the previous step 1105, which will not be described here.
[0333] 1380: Perform error correction on each error code block 12 bits in the order of Table 2 and after cyclic shift.
[0334] The error code block can refer to the information area mentioned above.
[0335] 1390: Output the listed units according to the order.
[0336] It can be understood that the principles of the above steps 1370-1390 are the same as those of the previous steps 1305-1307, which will not be described here.
[0337] In this method, since the number of information areas in the to-be-recognized two-dimensional code is greater than the number of bits of the PIN code transmitted by the to-be-recognized two-dimensional code, each payload data of the PIN code can be repeatedly displayed in the to-be-recognized two-dimensional code, for example, multiple information areas correspond to the same payload data and the serial number corresponding to the payload data. Therefore, when a certain information area cannot represent the corresponding payload data and the serial number corresponding to the payload data, for example, the number of values "1" in the symbols of the information area is not equal to the number threshold, the electronic device can also correct the error symbols of the information area based on the symbols of other information areas corresponding to the same payload data and the serial number corresponding to the payload data. For example, the error symbols are corrected based on the symbols of the information area transmitting the same payload data and the serial number corresponding to the payload data. In this way, the symbols can be corrected in the case of symbol errors of the information area, the correct symbols are obtained, and then the PIN code transmitted by the to-be-recognized two-dimensional code is obtained, which improves the acquisition efficiency of the information transmitted by the two-dimensional code and the robustness of code scanning.
[0338] In some embodiments, in order to make the user's eyes unable to directly observe the two-dimensional code displayed in the electronic device display screen, a method uses the human eye's visual persistence, i.e., the human eye's color insensitivity, to encode the two-dimensional code, for example, the human eye can perceive yellow when red and green are quickly refreshed. Therefore, in the above method, if the two-dimensional code (i.e., the two-dimensional code 100 in the foregoing FIG. 1) shown in FIG. 13C (A) is set to display green and red alternately in the display screen, for example, the first frame displays a green two-dimensional code, the second frame displays a red two-dimensional code, and the two frames are displayed in the display screen at a rate of 60 frames per second. Because the alternating speed of the two frames is too fast, and based on the human eye's visual persistence characteristics, when the user's eyes observe the above two-dimensional code, the color of each frame is interchanged, and the human eye cannot observe the specific structure of the red or green two-dimensional code, but can observe a yellow blank area, as shown in FIG. 13C (B), that is, when the human eye observes, the area corresponding to the original red-green two-dimensional code becomes yellow, and there is no specific structure of the two-dimensional code in the observed area.
[0339] However, in the above method, although the human eye cannot observe the two-dimensional code displayed in different colors in the display screen at a rate of 60 frames per second, when another electronic device (or scanning device) scans the two-dimensional code, the scanning device takes pictures of the two-dimensional code at a rate of 60 frames per second, and can display the photographed red-green two-dimensional code in the display screen of the scanning device at a rate of 30 frames per second. For the human eye, the visual persistence phenomenon at a rate of 30 frames per second is not strong, that is, if the human eye observes the red-green two-dimensional code displayed alternately at a rate of 30 frames per second, it can still clearly observe the red-green two-dimensional code and the specific structure of the two-dimensional code, rather than the yellow blank area described above.
[0340] That is, the above method of avoiding the human eye from observing the two-dimensional code only works when the human eye directly observes the display screen displaying the two-dimensional code, and when the human eye observes the two-dimensional code presented by the display screen of the scanning device, the specific structure of the two-dimensional code can still be observed, reducing the user's experience.
[0341] Based on the above technical problems, the structure of the two-dimensional code provided in the present application can also incorporate other underlying animations when the electronic device's display screen displays the two-dimensional code. That is, when the electronic device's display screen displays the two-dimensional code, the user cannot directly observe the structure of the two-dimensional code shown in the foregoing FIG. 7B, but based on other animations, for example, animations (such as composed of multiple reference points) similar in color to the target points (including information points and positioning points) included in the two-dimensional code are combined with the two-dimensional code to form a fused two-dimensional code. In this way, the two-dimensional code in the electronic device display screen that the user can observe satisfies: the color is similar to the underlying animation, and the shape is also similar to the underlying animation, so that the human eye cannot observe the structure of the two-dimensional code, improving the display effect of the two-dimensional code.
[0342] The schematic diagram of the fusion two-dimensional code that can be observed by the user in the electronic device is shown in FIG. 14A. The application scenario of the fusion two-dimensional code shown in FIG. 14A is described below.
[0343] The two-dimensional code shown in FIG. 14A can also be applied to the data cloning scenario, which is substantially the same as the scenarios shown in FIGS. 1B-1E. Taking the new device and the old device as both being mobile phones as an example, FIG. 14B shows a schematic diagram of an interface of a new device 400 after the new device 400 is powered on for the first time. Exemplarily, in response to a user powering on the new device 400, for example, pressing the power-on key for a long time, the new device 400 is powered on and displays the interface 1400 shown in (A) of FIG. 14B. Exemplarily, the interface 1400 displays a language selection area 1401, and the language selection area 1401 contains multiple languages that can be selected by the user, such as Chinese, English, Japanese, etc. The user selects the control corresponding to the corresponding language (for example, selects “Simplified Chinese”), and then clicks the “Start using” control 1402. The interface of the new device 400 jumps to the interface 1410 shown in (B). The interface 1410 displays a region selection area 1403, and the region selection area 1403 contains multiple regions that can be selected by the user, such as region A01, region B01, region C01, etc. The user selects the corresponding region (for example, selects “region A01”), and then clicks the “Continue” control 1404. The interface of the new device 400 jumps to the interface 1420 shown in (C). The interface 1420 displays a prompt information “Waiting for connection”, and the fusion two-dimensional code 1405.
[0344] In addition, in response to the selection operation of the “Continue” control 1404, the new device 400 sends a broadcast to find the old device 410 that can be connected to the new device 400 to complete the subsequent business such as data cloning. Exemplarily, within a certain range around the new device 400, the old device 410 that uses the same communication protocol as the new device 400 can receive the broadcast sent by the new device 400. As shown in (A) of FIG. 14C, after receiving the broadcast, the old device 410 can display the interface 1430, which displays the prompt information “Connect to the new device” and the “Log in and connect” control 1406. In response to the selection operation of the “Log in and connect” control 1406, the interface of the old device 410 jumps to the interface 1440 shown in (B) of FIG. 14C. The interface 1440 displays a scanning area 1407 and the prompt information “Scan to connect”, “Align the scanning frame to the pattern on the new device”, etc.
[0345] After the user scans the fusion two-dimensional code 1405 displayed on the display screen of the new device 400 based on the scanning area 1407 in the old device 410, the user can obtain the SSID information and password information of the WIFI carried in the fusion two-dimensional code 1405 to establish a connection with the new device 400. The schematic diagram of the connection success interface 1450 of the new device 400 can be seen in (A) of FIG. 14D, and the interface 1450 has prompt information such as "quickly turn on the new device" and "authentication success".
[0346] After the old device 410 and the new device 400 successfully establish a connection, the old device 410 can migrate relevant data to the new device 400, that is, perform data cloning. As shown in (B) of FIG. 14D, the display interface 1460 of the new device 400 displays prompt information such as "quickly turn on the new device" and "migrating system data".
[0347] Based on the above-mentioned application scenarios, after the electronic device scans the fusion two-dimensional code shown in FIG. 14A, the target two-dimensional code in the state shown in FIG. 7B needs to be extracted from the fusion two-dimensional code, and the positioning points in the target two-dimensional code need to be extracted. The process can include the following steps.
[0348] 1501: The electronic device continuously photographs the electronic device displaying the fusion two-dimensional code to obtain a plurality of photographed frames.
[0349] The type of the photographed electronic device and the electronic device displaying the fusion two-dimensional code is not limited in the embodiments of the present application, and the types of the two can be the same or different. For details, refer to the related description above, which will not be repeated here.
[0350] The electronic device (or referred to as the scanning end) continuously photographs to obtain a plurality of photographed frames. The time interval between the plurality of photographed frames can be set based on experience or adjusted flexibly according to the actual application scenario, which is not limited here. In addition, any photographed frame in the plurality of photographed frames can be seen in (A) of FIG. 15, wherein (A) includes the display interface of the electronic device displaying the fusion two-dimensional code, and the display interface includes prompt information "align the framing frame on your other device to this image".
[0351] In the embodiments of the present application, the fusion two-dimensional code has a corresponding dynamic effect, which can be presented based on the color of the underlying animation and the color of the target point of the two-dimensional code. Taking the implementation of the underlying animation based on the color of a plurality of reference points as an example, the color of the reference point can be fixed, and the color of the target point of the fusion two-dimensional code can change, for example, the color of the target point in the two consecutive photographed frames is different.
[0352] Thus, the color of the reference point in each of the plurality of photographed frames of the fusion two-dimensional code acquired by the electronic device is the same, and the color of the target point is different. For example, a certain target point displays a first color (such as gray) at a first time, displays a second color (such as blue) at a second time, and displays a third color (such as yellow) at a third time. The selection of the first color, the second color, and the third color is not limited in the embodiments of the present application. It should be understood that the target point can also display more different colors at more different times, and is not limited to the three colors corresponding to the three times. In addition, the colors of different target points in the plurality of target points at the same time can be different, such as a certain target point changing colors according to gray, blue, and yellow at different times, and another target point changing colors according to blue, gray, and yellow.
[0353] 1502: Regionally screenshot the region corresponding to the fusion two-dimensional code included in the plurality of photographed frames to obtain a plurality of fusion two-dimensional code regions.
[0354] It can be understood that each fusion two-dimensional code region can include one fusion two-dimensional code. A schematic diagram of any fusion two-dimensional code region (or ring region) obtained by the screenshot can be seen in (B) in FIG. 15, and (B) includes a fusion two-dimensional code 1510.
[0355] 1503: The electronic device differentiates the plurality of fusion two-dimensional code regions to obtain a plurality of differential two-dimensional code regions.
[0356] It can be understood that a schematic diagram of the differential two-dimensional code region can be seen in (C) in FIG. 15, and the differential two-dimensional code region (or differential result) includes a differential two-dimensional code obtained by differentiating the fusion two-dimensional code, which is composed of white points in (C).
[0357] Exemplarily, the differentiation processing on the plurality of fusion two-dimensional code regions can be to find the difference of the pixel values of the same points in different fusion two-dimensional code regions. Based on the above content, it can be known that the color of the target point of the fusion two-dimensional code is different in different fusion two-dimensional code regions, and thus the differentiation processing can filter out the target point of the fusion two-dimensional code, and thus the differential two-dimensional code region is obtained, and the differential two-dimensional code region includes a structure diagram of the differential two-dimensional code.
[0358] 1504: The electronic device binarizes the plurality of differential two-dimensional code regions to obtain a plurality of differential binary diagrams.
[0359] It can be understood that a schematic diagram of any differential binary diagram in the plurality of differential binary diagrams can be seen in (D) in FIG. 15, and the differential binary diagram includes a target two-dimensional code, which is composed of white points in (D). Based on (C) and (D), it can be known that the display of the target two-dimensional code in (D) is clearer, so that the subsequent execution of the steps of the electronic device for analyzing the target two-dimensional code to obtain the corresponding PIN can be facilitated.
[0360] 1505: The electronic device extracts the positioning points in the target two-dimensional code.
[0361] The schematic diagram of the extracted positioning points can be seen in (E) in FIG. 15, and the circled points in the diagram are the positioning points recognized by the electronic device. In addition, the manner in which the electronic device extracts / recognizes the positioning points can be seen in the related description of the previous FIGS. 5A-5C, which will not be described here again.
[0362] It can be understood that the embodiments of the present application do not limit the colors of the positioning points and the information points included in the target two-dimensional code, as long as the electronic device can obtain the PIN code corresponding to the target two-dimensional code based on the positional relationship between the positioning points and the information points.
[0363] In the method, the two-dimensional code is fused with the underlying animation displayed by the electronic device, and the display color of the target point in the two-dimensional code is similar to the color of the underlying animation, so that the user cannot observe the specific structure of the two-dimensional code in the display screen, and the visual effect of the two-dimensional code is improved. In addition, the area of the information area (i.e., the area of the annular region) of the two-dimensional code is relatively small compared to the total area occupied by the two-dimensional code, which reduces the graphical complexity of the two-dimensional code, so that the electronic device can more easily determine the PIN code corresponding to the two-dimensional code, and the user's use experience is further improved.
[0364] It can be understood that in daily life, electronic billboards, computers, and television screens, and other electronic devices will send a large amount of information and advertising that is meaningless to most users, affecting the user's experience of using the electronic device. Therefore, in some existing visible light communication systems, implicit information that cannot be perceived by the human eye of the user is embedded in the images or videos displayed by the LED or LCD composed of electronic billboards or television, computer screens, and the like, and these implicit information can be captured by a digital camera, and after being processed by a decoding algorithm, the implicit information can be recovered therefrom. This approach can solve the above problem.
[0365] Taking a shopping scenario as an example, generally, the implicit information can be used to introduce in depth to the user in need the goods normally displayed on the screen of the electronic device, or even directly push the purchase link of the product. Using the implicit information service system to replace the visible advertisement to introduce and promote the goods can reduce the advertisement harassment to the user on the premise of ensuring the promotion effect of the corresponding product. Specifically, if the user is interested in the displayed goods, the user can obtain the implicit information embedded in the image of the goods by taking a photo with the mobile phone. The implicit information in the present application can refer to the implicit information included in the two-dimensional code, which can be the PIN code included in the two-dimensional code.
[0366] Therefore, taking the example of the implicit information such as the product details contained in the two-dimensional code shown in FIG. 7A, FIG. 7B or FIG. 14A, the two-dimensional code provided by the present application can be displayed in an electronic device such as a television, and the user can use the electronic device to capture the two-dimensional code corresponding to a product in the television, and then perform decoding and other processing on the captured two-dimensional code, so as to obtain the implicit information such as the product details and the purchase link contained in the two-dimensional code. In this way, the user experience can be improved.
[0367] In some embodiments, there can be multiple versions of the two-dimensional code, and different versions of the two-dimensional code correspond to different code tables. When generating the two-dimensional code, the version number of the two-dimensional code can be determined based on the amount of data to be transmitted, and the corresponding two-dimensional code can be generated based on the code table corresponding to the version number of the two-dimensional code.
[0368] In some embodiments, the number of information points in the display state of each information area is different in different versions of the two-dimensional code, and the target information conveyed (transmitted) by different versions of the two-dimensional code is different. The target information of the two-dimensional code can be any combination of numbers, letters, and characters with a preset bit number (for example, 6 bits). For example, for version number V1.0, the target information of the two-dimensional code can be a 6-digit PIN code, that is, 6 digits; for version number V2.0, the target information of the two-dimensional code can be 6-bit information containing numbers and letters; and for version number V3.0, the target information of the two-dimensional code can be 6-bit information containing numbers, letters, and symbols. The present application does not limit the format of the target information corresponding to different versions.
[0369] Taking the example of the mapping table of the number of information points (or bright points) in the display state of each information area (or each partition) corresponding to different version numbers, the total number of bright points, and the total data amount in Table 3, the display area is 12, the number of positioning points is 24, and the number of information point positions (serial numbers) in each information area is 20.
[0370] Table 3:
[0371] As shown in Table 3 and (a) of Fig. 16, for version number V1.0, the number of bright points of each display area is 2 points, the total number of bright points (i.e. the sum of the number of bright points of all information areas and the total number of positioning points) is 48, and the total amount of data transmitted is 90 bits, taking the number of display areas as 12 and the number of positioning points as 24 as examples. For version number V2.0, as shown in Table 3 and (b) of Fig. 16, the number of bright points of each display area is 3 points, the total number of bright points is 60, and the total amount of data transmitted is 121 bits. For version number V3.0, as shown in Table 3 and (c) of Fig. 16, the number of bright points of each display area is 4 points, the total number of bright points is 72, and the total amount of data transmitted is 146 bits. For version number V4.0, as shown in Table 3 and (d) of Fig. 16, the number of bright points of each display area is 5 points, the total number of bright points is 84, and the total amount of data transmitted is 167 bits.
[0372] It can be understood that the calculation formula of the amount of data transmitted by each version of the two-dimensional code is as follows:
[0373] Wherein, D1 is the amount of data transmitted by each version of the two-dimensional code, n is the number of positions of information points of each information area, for example, can be 20, 12, etc., and n1 is the number of bright points of each information area.
[0374] In some embodiments, the corresponding code table of different versions of the two-dimensional code can refer to Table 2 described above, and the corresponding letters or symbols are added on the basis of the value range of the payload data being 0-9, and the data (i.e. binary data 0 or 1) corresponding to the information points of different serial numbers is set. For example, for the code table corresponding to version number V1.0, the value of the payload data can be 0-9, the serial number is 20, and the data corresponding to the 20 serial number information points can contain two 1s; for the code table corresponding to version number V2.0, the value of the payload data can be 0-9 and English letters (for example, 26 letters a-z), the serial number is 20, and the data corresponding to the 20 serial number information points can contain three 1s. For the code table corresponding to version number V3.0, the value of the payload data can be 0-9 and English letters (for example, 26 letters a-z) and symbols (for example, *, #, etc.), the serial number is 20, and the data corresponding to the 20 serial number information points can contain four 1s, etc.
[0375] It can be understood that the setting mode of the code table described above is only an example, and the code table can be set arbitrarily according to actual needs, and the embodiments of the present application are not limited.
[0376] Fig. 17 shows a flowchart of a two-dimensional code generation process. As shown in Fig. 17, the method of two-dimensional code generation can be executed by an electronic device, and the method can include:
[0377] 1701: Determine the version number of the to-be-generated two-dimensional code based on the amount of data to be transmitted.
[0378] It can be understood that in some embodiments, the electronic device can obtain the data to be transmitted, i.e., the target information, and then determine the version number of the two-dimensional code based on the amount of data corresponding to the target information and the two-dimensional code version number mapping table (for example, the mapping table shown in Table 3). For example, the target information is the aforementioned "148258", and the amount of data to be transmitted is 90 bits, and then the version number can be determined as V1.0. For example, the target information is the aforementioned "14825a", and the amount of data to be transmitted is 121 bits, and then the version number can be determined as V2.0, and so on.
[0379] 1702: Encode the target information to be transmitted based on the encoding rule (code table) corresponding to the version number.
[0380] In some embodiments, after determining the version number corresponding to the two-dimensional code, the electronic device can obtain the code table (or called code element mapping table, mapping table, encoding mapping table, encoding rule, etc.) corresponding to the version number, and encode the target information to be transmitted based on the code table corresponding to the version number, i.e., obtain the code element (or called code element data, binary data, etc.) of each information area.
[0381] For example, for the target information to be transmitted "148258", the version number of the to-be-generated two-dimensional code is V1.0, and if the code table corresponding to the version number 1.0 is Table 2, taking the payload data required to be transmitted in one information area as an example, the payload data in the target information is 1 and the corresponding serial number in the target information is 0, according to Table 2, the code element of 12 information points corresponding to the serial number 0 and the payload data 1 in the PIN code is 011000000000. The setting mode of the other 5 bits is the same, which will not be described here.
[0382] In addition, since the two-dimensional code transmits a 6-bit PIN code based on 12 information areas, the remaining six information areas can repeatedly transmit the 6-bit PIN code and the corresponding serial number. For example, the remaining six information areas can transmit 32, 45, 58, 01, 14, 28, and so on in order.
[0383] 1703: Generate a two-dimensional code based on the obtained encoded information.
[0384] In some embodiments, after obtaining the encoded information, such as the code element corresponding to each information area, the setting of the information points in each information area of the two-dimensional code can be performed based on the code element corresponding to each information area, so as to generate a new two-dimensional code.
[0385] The information points in each information area can be set based on the sequence numbers of the positions of the information points in the information area and the symbols corresponding to the sequence numbers. For example, when the symbol is 1, the information point is in a display state, and when the symbol is 0, the corresponding information point is in a non-display state. The specific setting manner of the information points can be referred to the foregoing description, for example, FIG. 6A and FIG. 6C, which will not be repeated here.
[0386] It can be understood that the embodiments of the present application can improve the transmission data amount of the two-dimensional code by setting multiple versions of the two-dimensional code. In addition, different versions of the two-dimensional code can be selected based on actual needs, and the diversification of selection is improved.
[0387] In some embodiments, when the version of the two-dimensional code includes multiple versions, the electronic device that scans the two-dimensional code can first determine the version number corresponding to the two-dimensional code based on the number of bright points in the two-dimensional code, and obtain a mapping table corresponding to the version number, and decode the two-dimensional code based on the mapping table corresponding to the version number.
[0388] The two-dimensional code recognition method provided in the embodiments of the present application will be described in detail below. The method can be executed by an electronic device. FIG. 18 shows a schematic diagram of a flow of a two-dimensional code recognition method. As shown in FIG. 18, the method can include the following steps:
[0389] 1801: Scan a two-dimensional code to be recognized.
[0390] The two-dimensional code to be recognized includes N information areas, the N information areas include M information area groups, each information area group includes at least one information area, and the information contents of at least two information area groups in the M information area groups are the same and are used to represent target information corresponding to the two-dimensional code, wherein M is less than or equal to N and M is greater than 1, and the information content can include multiple information points.
[0391] It can be understood that the electronic device can scan the two-dimensional code to be recognized by using a camera.
[0392] The embodiments of the present application do not limit the type and device of the electronic device on which the two-dimensional code to be recognized is displayed. The specific description can be referred to the foregoing description of the two-dimensional code, which will not be repeated here. In addition, in the embodiments of the present application, the electronic device that scans the two-dimensional code to be recognized and the electronic device that displays the two-dimensional code to be recognized can be the same type of electronic device or different types of electronic devices. The specific description can be referred to the foregoing examples, which will not be repeated here.
[0393] In some embodiments, the to-be-recognized two-dimensional code can be extracted from a video played on a screen of the electronic device, or a displayed photo, or pre-stored in the electronic device, for example, stored in the form of a picture in a gallery application of the electronic device. In this case, the electronic device can determine the to-be-recognized two-dimensional code directly in response to a selection operation of the user, and then scan the to-be-recognized two-dimensional code.
[0394] 1802: Obtain a version number corresponding to the to-be-recognized two-dimensional code.
[0395] It can be understood that, in some embodiments, obtaining the version number corresponding to the to-be-recognized two-dimensional code can include: obtaining a number of target information points in N information regions of the to-be-recognized two-dimensional code in a display state; and determining the version number corresponding to the to-be-recognized two-dimensional code based on the number of target information points in the N information regions in the display state.
[0396] In some embodiments, the manner of determining the version number corresponding to the to-be-recognized two-dimensional code based on the number of target information points in the N information regions in the display state can be as follows:
[0397] When the number of target information points in each information region in the N information regions in the display state is the same, for example, a first number, the version number corresponding to the to-be-recognized two-dimensional code is determined based on the first number. For example, when the number of target information points in each information region in the display state is 2, or the total number of target information points in all information regions is 48, the version number V1.0 can be determined based on the two-dimensional code version number mapping table shown in Table 3. When the number of target information points in each information region in the display state is 3, or the total number of target information points in all information regions is 60, the version number V2.0 can be determined based on the two-dimensional code version number mapping table shown in Table 3.
[0398] When the number of target information points in each information region in the N information regions in the display state is different, and the number of information regions in which the number of target information points is a second number is greater than the number of information regions in which the number of target information points is any number other than the second number, the version number corresponding to the to-be-recognized two-dimensional code is determined based on the second number. For example, when, in the 13 information regions corresponding to the to-be-recognized two-dimensional code, the number of bright points in 10 information regions is 2, and the number of bright points in 2 information regions is 3, the version number corresponding to the information region in which the number of bright points is 2 is output, for example, the version number V1.0.
[0399] In some embodiments, obtaining the number of target information points in the N information areas in the to-be-recognized two-dimensional code in a display state can include: obtaining the number of information points in the N information areas in the to-be-recognized two-dimensional code in a display state; obtaining the number of noise points in the N information areas in the to-be-recognized two-dimensional code in a display state; and determining the number of target information points in the N information areas based on the number of information points and the number of noise points. For example, the number of target information points in the N information areas can be obtained by subtracting the number of noise points from the number of information points.
[0400] In some embodiments, obtaining the number of noise points in the N information areas in the to-be-recognized two-dimensional code in a display state can include: obtaining a positioning structure in the to-be-recognized two-dimensional code; performing affine transformation processing on a standard two-dimensional code template based on the extracted positioning structure to obtain a processed two-dimensional code template; aligning the processed two-dimensional code template and the to-be-recognized two-dimensional code, regarding information points in the N information areas in a display state that are not aligned as noise points, and obtaining the number of noise points.
[0401] For example, as shown in FIG. 19, the information point that is not aligned (noise point) can be point B11 that is not in the standard position of information point B1 of information area B1 shown in FIG. 19, and information points that are not aligned in other information areas can refer to information area B1, which will not be described herein again.
[0402] In the embodiments of the present application, when counting the number of bright points in the information area, the noise points in the information area can be removed to improve the accuracy of two-dimensional code recognition.
[0403] In some embodiments, the version number can also be determined based on the total number of bright points in the to-be-recognized two-dimensional code, i.e., the sum of the number of information points in all information areas and the total number of positioning points. For example, if the total number of bright points in the to-be-recognized two-dimensional code is 48, the version number can be determined as V1.0 based on Table 1.
[0404] In some embodiments, when the total number of bright points corresponding to the to-be-recognized two-dimensional code (i.e., the sum of the total number of target information points in the N information areas in a display state and the total number of positioning points in the to-be-recognized two-dimensional code) is inconsistent with the total number of bright points corresponding to each version number, the version number corresponding to the total number of bright points corresponding to the two-dimensional code that is closest to the total number of bright points corresponding to the to-be-recognized two-dimensional code is taken as the version number corresponding to the to-be-recognized two-dimensional code.
[0405] It can be understood that in some embodiments, during the process of extracting the two-dimensional code as shown in FIG. 15, there may be a situation that there are some noise points or some positioning points or information points missing in the two-dimensional code, so that the total number of bright points in the to-be-identified two-dimensional code is not strictly consistent with the total number of bright points corresponding to each version number. For example, there may be two bright points in some information areas and three bright points in some information areas. In this case, the nearest neighbor method of the total number of bright points can be used to determine the version number. For example, the total number of bright points of the to-be-identified two-dimensional code is 47, which is closest to the total number of bright points corresponding to the version number V1.0. Therefore, the version number V1.0 is taken as the version number corresponding to the to-be-identified two-dimensional code. In this way, the situation that the two-dimensional code is damaged and cannot be decoded can be avoided, and the user experience is improved.
[0406] 1803: Determine the target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information areas in the to-be-identified two-dimensional code.
[0407] In some embodiments, determining the target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information areas in the to-be-identified two-dimensional code comprises:
[0408] Determine the target code table corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code. The target code table is used to reflect the mapping relationship between the code element data (or binary data) and the first information and the sequence number corresponding to the first information. It can be understood that each version number corresponds to a code table. Therefore, after determining the version number corresponding to the to-be-identified two-dimensional code, the code table corresponding to the to-be-identified two-dimensional code, i.e., the target code table, can be determined.
[0409] Then, the code element extraction is performed on the N information areas to obtain the code element data corresponding to the N information areas. The target code table is searched based on the code element data corresponding to the N information areas to determine the first information corresponding to the code element data in the target code table and the sequence number corresponding to the first information.
[0410] Based on the plurality of first information corresponding to the code element data corresponding to the N information areas and the sequence number corresponding to the plurality of first information, M same first target information corresponding to the N information areas is determined. The first fusion processing is performed on the M same first target information to obtain the fused second target information corresponding to the to-be-identified two-dimensional code.
[0411] It should be noted that after determining the code table corresponding to the to-be-identified two-dimensional code, the subsequent decoding scheme, i.e., the scheme for obtaining the target information corresponding to the two-dimensional code, can refer to step 902, which will not be described here.
[0412] In the two-dimensional code recognition method provided by the embodiments of the present application, in the case where the version of the two-dimensional code includes multiple versions, the electronic device that scans the two-dimensional code can first determine the version number corresponding to the two-dimensional code based on the number of bright spots in the two-dimensional code, and obtain the code table corresponding to the version number, and decode the two-dimensional code based on the code table corresponding to the version number, so as to realize correct recognition of the two-dimensional code. In addition, the version number can be determined according to the nearest neighbor method of the total number of bright spots, so that the situation that the two-dimensional code is damaged and cannot be decoded can be avoided, and the user experience is improved. In addition, when the number of bright spots in the information area is counted, the noise points in the information area can be removed, so that the accuracy of two-dimensional code recognition is improved.
[0413] FIG. 20 shows a flowchart of a two-dimensional code recognition method, in which the version number of the two-dimensional code to be recognized can be determined based on the total number of bright spots in the two-dimensional code. The method can be executed by an electronic device, and can include the following steps:
[0414] 2001: Extracting the two-dimensional code to be recognized from a video stream or a photo played on a screen.
[0415] It can be understood that the electronic device can scan the two-dimensional code from a video stream or a photo displayed on a screen (such as a screen for playing advertisements, a mobile phone screen, etc.) played by another electronic device, and extract the two-dimensional code to be recognized based on the steps shown in FIG. 15.
[0416] In some embodiments, the two-dimensional code to be recognized can also be pre-stored in the electronic device, for example, the two-dimensional code to be recognized is stored in the gallery application of the electronic device in the form of a picture. In this case, the electronic device can directly determine the two-dimensional code to be recognized in response to the selection operation of the user, and then scan the two-dimensional code to be recognized and extract the two-dimensional code to be recognized based on the steps shown in FIG. 15.
[0417] It can be understood that in some embodiments, the two-dimensional code to be recognized extracted by the electronic device can be in a partially damaged state, such as the presence of noise points, missing positioning points, etc.
[0418] 2002: Obtaining the total number of bright spots in the two-dimensional code to be recognized.
[0419] It can be understood that in the embodiments of the present application, the total number of bright spots corresponding to the two-dimensional code to be recognized can be the sum of the total number of information points in the N information areas in the two-dimensional code to be recognized and the total number of positioning points in the two-dimensional code to be recognized.
[0420] 2003: Outputting the version number corresponding to the two-dimensional code to be recognized based on the total number of bright spots in the two-dimensional code to be recognized.
[0421] In some embodiments, the version number corresponding to the to-be-identified two-dimensional code can be determined based on the total number of bright spots in the to-be-identified two-dimensional code and the two-dimensional code version number mapping table. For example, if the total number of bright spots in the to-be-identified two-dimensional code is consistent with the total number of bright spots corresponding to a certain version number, the version number can be taken as the version number corresponding to the to-be-identified two-dimensional code. For example, if the total number of bright spots in the to-be-identified two-dimensional code is 48, the version number V1.0 can be determined based on Table 3.
[0422] In some embodiments, if the total number of bright spots corresponding to each version number in the two-dimensional code version number mapping table is inconsistent with the total number of bright spots corresponding to the to-be-identified two-dimensional code, the version number corresponding to the total number of bright spots closest to the total number of bright spots corresponding to the to-be-identified two-dimensional code can be taken as the version number corresponding to the to-be-identified two-dimensional code.
[0423] It can be understood that, in some embodiments, during the two-dimensional code extraction process shown in FIG. 15, there may be some cases where there are some noise points or some missing positioning points or information points in the two-dimensional code. Therefore, the total number of bright spots in the to-be-identified two-dimensional code may not be strictly consistent with the total number of bright spots corresponding to each version number. For example, there may be some information areas with 2 bright spots and some information areas with 3 bright spots. In this case, the version number can be determined according to the nearest neighbor method of the total number of bright spots. For example, if the total number of bright spots in the to-be-identified two-dimensional code is 47, the total number of bright spots corresponding to the version number V1.0 is the closest, and therefore the version number V1.0 can be taken as the version number corresponding to the to-be-identified two-dimensional code.
[0424] 2004: determining the target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information areas in the to-be-identified two-dimensional code.
[0425] It can be understood that, after the version number corresponding to the two-dimensional code is determined, the code table corresponding to the version number can be obtained, and the target information corresponding to the to-be-identified two-dimensional code can be determined based on the code table corresponding to the version number and the N information areas in the to-be-identified two-dimensional code.
[0426] It can be understood that, in step 2004, the target information corresponding to the to-be-identified two-dimensional code can be determined based on the code table and the N information areas in the to-be-identified two-dimensional code, which can be referred to step 903 and will not be described here.
[0427] In the two-dimensional code recognition method provided by the embodiments of the present application, when the version of the two-dimensional code includes multiple versions, the electronic device that scans the two-dimensional code can first determine the version number corresponding to the two-dimensional code based on the total number of bright spots in the information area of the two-dimensional code, obtain the mapping table corresponding to the version number, and decode the two-dimensional code based on the code table corresponding to the version number, thereby achieving correct recognition of the two-dimensional code. In addition, the version number can be determined according to the nearest neighbor method of the total number of bright spots, which can avoid the situation that the two-dimensional code cannot be decoded due to damage and improve user experience.
[0428] FIG. 21 shows a flowchart of a method for identifying a two-dimensional code, wherein the method can determine a version number of the two-dimensional code to be identified based on the number of bright spots in each information area of the two-dimensional code, the method can be executed by an electronic device, and the method can include:
[0429] 2101: Extracting a two-dimensional code to be identified from a video stream or a photo played on a screen.
[0430] It can be understood that step 2101 can refer to step 2001, and details are not described herein.
[0431] 2102: Filling in all missing positioning points in the two-dimensional code to be identified.
[0432] In some embodiments, if the number of positioning points in the two-dimensional code to be identified is not 2 times the number of information areas, all missing positioning points in the two-dimensional code to be identified can be filled in based on the method shown in FIGS. 5C-5H. Details of the method for filling in the positioning points are not described herein.
[0433] 2103: Positioning information areas of the two-dimensional code to be identified based on the positioning points and counting the number of information points in each information area.
[0434] In some embodiments, after the positioning points in the two-dimensional code to be identified are filled in, the information areas can be positioned based on the positioning points (i.e., the positioning points on the inner circle and the outer circle), and the number of information points in each information area can be counted.
[0435] 2104: Determining a version number based on the number of information points in each information area.
[0436] For example, when the number of information points in each information area of the N information areas in a display state is the same, for example, a first number, the version number corresponding to the two-dimensional code to be identified can be determined based on the first number. For example, when the number of information points in each information area in a display state is 2, the version number can be determined as V1.0 based on the two-dimensional code version number mapping table shown in Table 3. When the number of information points in each information area in a display state is 3, the version number can be determined as V2.0 based on the two-dimensional code version number mapping table shown in Table 3.
[0437] It can be understood that there can be speckles or some points missing in the two-dimensional code, and therefore the number of information points in the N information areas in the display state is not the same, if the number of information points is the number of information areas of the second number is greater than the number of information points of any number of information areas other than the second number, the version number corresponding to the to-be-identified two-dimensional code is determined based on the second number. For example, in 13 information areas, there are 10 information areas with 2 bright points, and 2 information areas with 3 bright points, and the output version number is the version number corresponding to 2 points, for example, version number V1.0. That is, the version number with the highest probability is selected.
[0438] 2105: Determine the target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information areas in the to-be-identified two-dimensional code.
[0439] It can be understood that step 2105 can refer to step 2004, which will not be described here.
[0440] In the two-dimensional code recognition method provided by the embodiments of the present application, in the case where the version of the two-dimensional code includes multiple versions, the electronic device that scans the two-dimensional code can first determine the version number corresponding to the two-dimensional code based on the number of bright points in each information area in the two-dimensional code, and obtain the code table corresponding to the version number, and decode the two-dimensional code based on the code table corresponding to the version number, to realize correct recognition of the two-dimensional code. In addition, in the case where the number of bright points in each information area is different, the version number with the highest probability can be selected to improve the accuracy of two-dimensional code recognition.
[0441] FIG. 22 shows a flowchart of a two-dimensional code recognition method, wherein the version number of the to-be-identified two-dimensional code can be determined based on the number of bright points after removing speckles in each information area of the two-dimensional code, the method can be executed by an electronic device, and the method can include:
[0442] 2201: Extract a to-be-identified two-dimensional code from a video stream or a photo played on a screen.
[0443] It can be understood that step 2201 can refer to step 2101, which will not be described here.
[0444] 2202: Fill in all missing positioning points in the to-be-identified two-dimensional code.
[0445] It can be understood that step 2202 can refer to step 2102, which will not be described here.
[0446] 2203: Perform affine or perspective transformation processing on the to-be-identified two-dimensional code based on the extracted positioning points in the to-be-identified two-dimensional code and a standard two-dimensional code mask, to obtain a processed (distorted) two-dimensional code mask.
[0447] It can be understood that the standard two-dimensional code template can be a two-dimensional code pattern without damage and without distortion as shown in FIG. 7B.
[0448] In some embodiments, since the shooting direction of the to-be-recognized two-dimensional code can be upward shooting, downward shooting, oblique shooting, etc., the to-be-recognized two-dimensional code can not be aligned with the standard two-dimensional code, and therefore, the standard two-dimensional code template can be subjected to affine or perspective transformation based on the extracted positioning points in the to-be-recognized two-dimensional code, to obtain a processed (distorted) two-dimensional code template (mask), and make the processed (distorted) two-dimensional code template (mask) consistent with the distortion direction of the to-be-recognized two-dimensional code, so that the processed (distorted) two-dimensional code template (mask) and the to-be-recognized two-dimensional code can be aligned.
[0449] In some embodiments, the to-be-recognized two-dimensional code can also be subjected to affine or perspective transformation based on the positioning points and the standard two-dimensional code template, to obtain a to-be-recognized two-dimensional code without distortion, and align the to-be-recognized two-dimensional code without distortion with the standard two-dimensional code template, to determine the noise points in the information area, and thereby obtain the number of target information points in each information area.
[0450] 2204: Obtain the number of target information points in each information area based on the processed (distorted) two-dimensional code template (mask).
[0451] In some embodiments, after aligning the affine or perspective transformed (distorted) two-dimensional code template mask with the to-be-recognized two-dimensional code, the noise points can be filtered out, i.e., the number of information points in the N information areas can be reduced by the number of noise points to obtain the number of target information points (number of bright points) in the N information areas.
[0452] 2205: Output the version number based on the number of target information points in each information area.
[0453] When the number of target information points in each information area in the N information areas in a display state is the same, for example, the first number, the version number corresponding to the to-be-recognized two-dimensional code is determined based on the first number. For example, the number of target information points in each information area in a display state is 2, or the total number of target information points in all information areas is 48, and the version number V1.0 can be determined based on the two-dimensional code version number mapping table shown in Table 3. For example, the number of target information points in each information area in a display state is 3, or the total number of target information points in all information areas is 60, and the version number V2.0 can be determined based on the two-dimensional code version number mapping table shown in Table 3.
[0454] When the number of target information points in each information region in the N information regions in a display state is different, and the number of information regions in which the number of target information points is the second number is greater than the number of information regions in which the number of target information points is any number other than the second number, the version number corresponding to the to-be-identified two-dimensional code is determined based on the second number. For example, in the 13 information regions corresponding to the to-be-identified two-dimensional code, the number of bright spots in 10 information regions is 2, and the number of bright spots in 2 information regions is 3, and the output version number is the version number corresponding to the information region with 2 bright spots, for example, version number V1.0.
[0455] 2206: Determine the target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information regions in the to-be-identified two-dimensional code.
[0456] It can be understood that step 2206 can refer to step 2004, which will not be described here.
[0457] In the two-dimensional code identification method provided by the embodiments of the present application, when the version of the two-dimensional code includes multiple versions, the electronic device that scans the two-dimensional code can first determine the version number corresponding to the two-dimensional code based on the number of bright spots in the information region in the two-dimensional code, obtain the mapping table corresponding to the version number, and decode the two-dimensional code based on the mapping table corresponding to the version number, thereby realizing correct identification of the two-dimensional code. In addition, when the number of bright spots in the information region is counted, the noise points in the information region can be removed, thereby improving the accuracy of two-dimensional code identification.
[0458] In some embodiments, the present application provides an electronic device having a display screen for displaying the two-dimensional code described in the above embodiments.
[0459] In some embodiments, the present application further provides a computer readable medium having instructions stored thereon, which, when executed on a computer, cause the computer to perform the two-dimensional code identification method described in the above embodiments.
[0460] In some embodiments, the present application further provides an electronic device, which includes one or more processors, one or more memories, and one or more programs stored in the one or more memories and executable by the one or more processors to cause the electronic device to perform the two-dimensional code identification method described in the above embodiments.
[0461] In some embodiments, the present application further provides a computer program product, which includes execution instructions stored in a readable storage medium, and at least one processor of an electronic device can read the execution instructions from the readable storage medium, and the at least one processor executes the execution instructions to cause the electronic device to implement the two-dimensional code identification method described in the above embodiments.
[0462] FIG. 23 shows a structural schematic diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 23, the electronic device can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, etc.
[0463] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.
[0464] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated in one or more processors.
[0465] The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0466] The processor 110 can also have a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or has used repeatedly. If the processor 110 needs to use the instructions or data again, it can call them directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system. The processor can be used to execute the satellite communication method mentioned in the present application.
[0467] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to realize data storage functions. For example, files such as music and videos are saved in the external memory card.
[0468] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like. The data storage area can store data created during the use of the electronic device (such as audio data, a phonebook, etc.), and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like. The processor 110 executes various function applications and data processing of the electronic device by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory disposed in the processor.
[0469] The SIM card interface 195 is used to connect a SIM card.
[0470] It can be understood that, as used herein, the term "module" can refer to, or include, an application specific integrated circuit (ASIC), an electronic circuit, a processor (shared, dedicated, or group) and / or memory that execute one or more software or firmware programs, a combinational logic circuit, and / or other suitable hardware components that provide the described functionality or that are otherwise part of the described functionality, or as part of these hardware components.
[0471] It can be understood that, in the embodiments of the present application, the processor can be a microprocessor, a digital signal processor, a microcontroller, etc., and / or any combination thereof. According to another aspect, the processor can be a single-core processor, a multi-core processor, etc., and / or any combination thereof.
[0472] Embodiments disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. Embodiments of the application can be implemented as computer programs or program code executing on programmable systems comprising at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0473] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices, in known fashion. For purposes of this application, a processing system includes any system that has a processor, such as a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0474] The program code can be implemented in a high level procedural or object oriented programming language to communicate with a processing system. The program code can be implemented in assembly or machine language, if desired. In fact, the mechanisms described herein are not limited in scope to any particular programming language. In any case, the language can be a compiled or interpreted language.
[0475] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments can also be implemented as instructions carried by or stored on a transitory or non-transitory machine-readable (e.g., computer-readable) medium, which can be read and executed by one or more processors. For example, the instructions can be distributed over the network or by other computer readable media. Thus, a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including without limitation floppy disks, optical disks, optical disks, CD-ROMs, magnetic cassettes or tapes, ROMs, RAMs, erasable programmable ROMs (EPROMs), electrically erasable programmable ROMs (EEPROMs), magnetic or optical cards, flash memories, or tangible, machine-readable storage used in the transmission of information over the Internet via electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals digital signals, etc.). Accordingly, the machine-readable media includes any type of computer-readable media.
[0476] In the drawings, some of the structures or method features can be shown in particular arrangements and / or orders. However, it should be understood that such specific arrangements and / or orders can not be required. Instead, these features can be arranged in a different manner and / or order than shown in the illustrative drawings, in some embodiments. Additionally, inclusion of a structural or method feature in a particular figure is not meant to imply that such feature is required in all embodiments, and in some embodiments, such feature can not be included or can be combined with other features.
[0477] It should be noted that each unit / module mentioned in the embodiments of the devices of the present application is a logical unit / module, and in physical form, one logical unit / module can be a physical unit / module, or a part of a physical unit / module, or a combination of multiple physical unit / modules, and the physical implementation form of the logical unit / module itself is not the most important, and the combination of the functions implemented by these logical units / modules is the key to solving the technical problems proposed in the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned embodiments of the devices of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed in the present application, which does not mean that the above-mentioned device embodiments do not have other units / modules.
[0478] It should be noted that in the examples and descriptions of the present patent, relationship terms such as first and second are only 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 the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including one" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0479] Although the present application has been illustrated and described with reference to certain preferred embodiments thereof, it should be understood by those skilled in the art that various changes in form and details can be made therein without departing from the scope of the present application.
Claims
1. A two-dimensional code, characterized by, The two-dimensional code comprises N information areas and K positioning structures, wherein N is greater than 1, and K is greater than or equal to 1; The K positioning structures are used for positioning each of the N information areas respectively, and information content of the N information areas is used for representing target information corresponding to the two-dimensional code; The positioning structure comprises one or more positioning points, and the information content of the information area comprises a plurality of information points.
2. The two-dimensional code according to claim 1, wherein The N information areas comprise M information area groups, and each of the information area groups comprises at least one information area; Information content of at least two information area groups in the M information area groups is the same, and is used for representing the target information corresponding to the two-dimensional code, M is less than or equal to N and greater than 1.
3. The two-dimensional code according to claim 1 or 2, characterized in that, The target information comprises a plurality of first information, and the information points of each of the information areas are used for representing at least one first information in the plurality of first information and a corresponding serial number of the at least one first information in the target information.
4. The two-dimensional code according to claim 3, wherein The first information comprises one or more of a number, a letter and a symbol.
5. The two-dimensional code according to claim 4, wherein, The number of information points of each of the information areas is the same, different states of the information points of each of the information areas correspond to different values, and each of the information areas represents the at least one first information corresponding to each of the information areas and the corresponding serial number of the at least one first information in the target information through code element data corresponding to the values of the information points.
6. The two-dimensional code according to claim 5, wherein, Corresponding to the information point existing in the information area in a first state, the information point corresponds to a first value; Corresponding to the information point existing in the information area in a second state, the information point corresponds to a second value, the first value is different from the second value, the first state is a display state, and the second state is a non-display state.
7. The two-dimensional code according to claim 6, wherein Corresponding to different version numbers of the two-dimensional code, the number of information points in the first state in the information area is different.
8. The two-dimensional code according to any one of claims 1 to 7, characterized in that, Each of the positioning structures is located between two adjacent information areas.
9. The two-dimensional code according to any one of claims 1 to 8, characterized in that, One of the positioning structures is used for positioning one corresponding information area; Or, two adjacent positioning structures are used for positioning information areas between the two adjacent positioning structures; Or, one of the positioning structures is used for positioning two adjacent information areas.
10. The two-dimensional code according to any one of claims 1 to 9, wherein, The shape of the two-dimensional code is a ring formed by a first outer circle and a first inner circle, the K positioning structures comprise a plurality of outer positioning points and a plurality of inner positioning points, each positioning structure comprises one outer positioning point and one inner positioning point; The plurality of outer positioning points are distributed on the first outer circle according to a first preset interval, and the inner positioning points are distributed on the first inner circle according to a second preset interval; and The N information areas are located in a first region between the first outer circle and the first inner circle.
11. The two-dimensional code according to claim 10, characterized in that, The two-dimensional code further comprises a plurality of reference points, the plurality of reference points are located in the first region, and a display color of the plurality of reference points in the two-dimensional code is different from a display color of the information points having the display state; And Any of the information points displays a first color at a first time, a second color at a second time, and a third color at a third time, and the first color, the second color, and the third color are different.
12. A two-dimensional code recognition method characterized by comprising: The method is applied to an electronic device, and the method comprises: scanning a to-be-recognized two-dimensional code, the to-be-recognized two-dimensional code comprising N information areas and K positioning structures, wherein N is greater than 1, K is greater than or equal to 1, the K positioning structures are used for positioning each of the N information areas respectively, the positioning structure comprises one or more positioning points, and the information area comprises a plurality of information points; determining target information corresponding to the to-be-recognized two-dimensional code based on the N information areas in the to-be-recognized two-dimensional code.
13. The method of claim 12, wherein, The method comprises: extracting symbol data of the N information areas to obtain N symbol data corresponding to the N information areas respectively; decoding the N symbol data to obtain the target information corresponding to the to-be-recognized two-dimensional code.
14. The method of claim 13, wherein, The N information areas comprise M information area groups, and each of the information area groups comprises at least one information area. At least two information area groups in the M information area groups have the same information content, and are used for representing the target information corresponding to the two-dimensional code, M is less than or equal to N and greater than 1.
15. The method of claim 14, wherein, The method comprises: decoding the N symbol data to obtain M same first target information corresponding to the N information areas; performing first fusion processing on the M same first target information to obtain second target information corresponding to the to-be-recognized two-dimensional code after fusion.
16. The method according to any one of claims 13-15, characterized in that, The method comprises: determining a plurality of numerical values corresponding to a plurality of information points in each of the information areas based on states of the plurality of information points, wherein information points having different states correspond to different numerical values; arranging the plurality of numerical values in an order of serial numbers corresponding to the plurality of information points to obtain symbol data corresponding to each of the information areas.
17. The method of claim 16, wherein, The information point corresponding to the first state corresponds to a first numerical value; The information point corresponding to the second state corresponds to a second numerical value, the first numerical value is different from the second numerical value, the first state is a display state, and the second state is a non-display state.
18. The method according to any one of claims 13-17, characterized by, The target information corresponding to the two-dimensional code comprises a plurality of first information, and the first information comprises one or more of a number, a letter, and a symbol.
19. The method of claim 18, wherein, The method comprises: finding a code table based on the N symbol data to determine first information corresponding to each of the symbol data in the code table and serial numbers corresponding to the first information; determining the target information corresponding to the to-be-recognized two-dimensional code based on a plurality of first information corresponding to the N symbol data and serial numbers corresponding to the plurality of first information.
20. The method of claim 19, wherein, The step of looking up the code table based on the N code data elements to determine the first information corresponding to each code data element in the code table and the sequence number corresponding to the first information includes: If multiple first code metadata corresponding to the same first information are identical among the N code metadata, the code table is searched based on the multiple first code metadata to determine the first information corresponding to the multiple first code metadata and the sequence number corresponding to the first information. Since the multiple first code metadata are different, a second fusion process is performed on the multiple first code metadata to obtain multiple second code metadata. Based on the multiple second code metadata, the code table is searched to determine the first information corresponding to the multiple second code metadata and the sequence number corresponding to the first information.
21. The method of claim 20, wherein, The first code metadata, corresponding to the differences among the plurality of first code metadata, undergoes a second fusion process to obtain a plurality of second code metadata, including: The same values of information points with the same sequence number in the plurality of first code metadata are kept unchanged, and the different values of information points with the same sequence number are set as the first value to obtain the plurality of second code metadata corresponding to the plurality of code metadata.
22. The method of claim 20 or 21, wherein, The step of searching the code table based on the plurality of second code metadata to determine the first information corresponding to the plurality of second code metadata and the sequence number corresponding to the first information includes: For the third code metadata corresponding to the plurality of second code metadata where the number of first values is equal to the number threshold, determine the first information corresponding to the third code metadata in the code table and the sequence number corresponding to the first information; For the fourth code metadata corresponding to the plurality of second code metadata where the number of first values is not equal to the number threshold, the fourth code metadata is subjected to error correction processing to obtain the error-corrected fifth code metadata. Determine the first information corresponding to the fifth code data in the code table and the sequence number corresponding to the first information.
23. The method of claim 22, wherein, The fourth code metadata, corresponding to the plurality of second code metadata in which the number of the first values is not equal to the number threshold, undergoes error correction processing to obtain the error-corrected fifth code metadata, including: If the number of the first value is greater than the number threshold, the first value that exceeds the number threshold is set as the second value, and the fifth code metadata is obtained in which the number of the first value is equal to the number threshold. If the number of the first value is less than the quantity threshold, the second value that does not meet the quantity threshold is set as the first value, and the fifth code metadata is obtained where the number of the first value is equal to the quantity threshold.
24. [Amended pursuant to Rule 91 on 15.04.2025] The method according to any one of claims 12-22, characterized in that, The method further includes: There are no missing positioning points in the K positioning structures corresponding to the QR code to be identified, and the N information areas are determined based on the K positioning structures; If there are missing positioning points in the K positioning structures corresponding to the QR code to be identified, the missing positioning points are filled in, and the N information areas are determined based on the filled K positioning structures.
25. The method of claim 24, wherein, The process of filling in the missing positioning points includes: The missing locating point is a part of locating points in a first locating structure of the K locating structures, and the missing locating point is filled based on other locating points in the first locating structure; The missing locating point is all locating points in a first locating structure of the K locating structures, and the missing locating point is filled based on adjacent locating structures of the first locating structure.
26. A two-dimensional code recognition method characterized by comprising: The method is applied to an electronic device, and the method comprises: Scanning a to-be-recognized two-dimensional code, the to-be-recognized two-dimensional code comprising N information areas and K locating structures, wherein N is greater than 1, K is greater than or equal to 1, the K locating structures are used for locating each of the N information areas respectively, the locating structure comprises one or more locating points, and the information area comprises a plurality of information points; Obtaining a version number corresponding to the to-be-recognized two-dimensional code; Determining target information corresponding to the to-be-recognized two-dimensional code based on the version number corresponding to the to-be-recognized two-dimensional code and the N information areas in the to-be-recognized two-dimensional code.
27. The method of claim 26, wherein, The obtaining of the version number corresponding to the to-be-recognized two-dimensional code comprises: Obtaining a quantity of target information points in a display state in the N information areas in the to-be-recognized two-dimensional code; Determining the version number corresponding to the to-be-recognized two-dimensional code based on the quantity of target information points in a display state in the N information areas.
28. The method of claim 27, wherein, The determining of the version number corresponding to the to-be-recognized two-dimensional code based on the quantity of target information points in a display state in the N information areas comprises: When the quantity of target information points in a display state in each of the N information areas is a first quantity, determining the version number corresponding to the to-be-recognized two-dimensional code based on the first quantity; When the quantity of information areas in which the quantity of target information points is a second quantity is greater than the quantity of information areas in which the quantity of target information points is any quantity other than the second quantity, determining the version number corresponding to the to-be-recognized two-dimensional code based on the second quantity.
29. The method of claim 26, wherein, The determining of the version number corresponding to the to-be-recognized two-dimensional code based on the quantity of target information points in a display state in the N information areas comprises: Obtaining the quantity of target information points in a display state in the N information areas and the quantity of locating points in the to-be-recognized two-dimensional code; Determining the version number corresponding to the to-be-recognized two-dimensional code based on the quantity of target information points in a display state in the N information areas and the quantity of locating points in the to-be-recognized two-dimensional code.
30. The method of any one of claims 27-29, wherein, The obtaining of the quantity of target information points in a display state in the N information areas in the to-be-recognized two-dimensional code comprises: Obtaining the quantity of information points in a display state in the N information areas in the to-be-recognized two-dimensional code; Obtaining the quantity of noise points in a display state in the N information areas in the to-be-recognized two-dimensional code; Determining the quantity of target information points in the N information areas based on the quantity of information points and the quantity of noise points in the N information areas.
31. The method of claim 27, wherein, The acquiring the number of the display state of the speckle in the N information areas in the to-be-identified two-dimensional code comprises: Acquiring the positioning structure in the to-be-identified two-dimensional code; Based on the extracted positioning structure, affine transformation processing is performed on the standard two-dimensional code template to obtain a processed two-dimensional code template; Aligning the processed two-dimensional code template and the to-be-identified two-dimensional code, taking the unaligned information points in the N information areas in the display state as speckles, and acquiring the number of the speckles.
32. The method of claim 26, wherein, The acquiring the version number corresponding to the to-be-identified two-dimensional code comprises: The sum of the total number of the information points in the N information areas in the display state and the total number of the positioning points in the to-be-identified two-dimensional code, and the difference between the sum of the total number of the information points in the N information areas in the display state and the total number of the positioning points in the corresponding first version number of each version number corresponding to the two-dimensional code is the minimum, and the version number corresponding to the to-be-identified two-dimensional code is determined as the first version number.
33. The method of any one of claims 26-32, wherein, The determining the target information corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code and the N information areas in the to-be-identified two-dimensional code comprises: Determining the target code table corresponding to the to-be-identified two-dimensional code based on the version number corresponding to the to-be-identified two-dimensional code, the target code table being used to reflect the mapping relationship between the code element data and the first information and the sequence number corresponding to the first information; Extracting the code element data of the N information areas to obtain the code element data corresponding to the N information areas; Based on the N code element data, the target code table is searched to determine the first information corresponding to each code element data in the target code table and the sequence number corresponding to the first information; Based on the plurality of first information corresponding to the N code element data and the sequence number corresponding to the plurality of first information, the target information corresponding to the to-be-identified two-dimensional code is determined.
34. An electronic device, comprising: The electronic device has a display screen, and the display screen is used to display the two-dimensional code of any one of claims 1-10.
35. An electronic device, comprising: Comprise: One or more processors; One or more memories; the one or more memories store one or more programs, when the one or more programs are executed by the one or more processors, the electronic device executes the two-dimensional code recognition method of any one of claims 12-30.
36. A computer-readable storage medium, characterized in that, The readable storage medium stores instructions, and the instructions make the computer execute the two-dimensional code recognition method of any one of claims 12-33 when the computer executes.
37. A computer program product, characterised in that, Comprise: Computer instructions, when the computer instructions run on an electronic device, make the electronic device execute the two-dimensional code recognition method of any one of claims 12-33.
Citation Information
Patent Citations
Network based commodity anti-counterfeit two-dimensional code redundancy design method
CN101937517A
Constituting method of novel two-dimensional bar code
CN102890787A
New type of two-dimensional code and generating method thereof, and two-dimensional code tag
CN106127279A
Composite image feature code and a manufacturing method thereof
CN109829524A
Annular two-dimensional code positioning position detection generation and identification method
CN114897000A