Two-dimensional code, two-dimensional code generation method and two-dimensional code recognition method
By introducing a primary code and secondary code structure into the QR code, the problems of easy damage and difficult parsing of existing QR codes are solved, and a more efficient and accurate decoding process is achieved, which is suitable for scenarios such as shared bicycles.
Patent Information
- Application Number
- CN202410472904.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-18
- Publication Date
- 2025-10-24
AI Technical Summary
Existing QR codes are easily damaged and the parsing process is affected by various factors, resulting in unsatisfactory parsing results, especially in scenarios such as shared bicycles where decoding time is long and efficiency is low.
Design a QR code structure that includes a main code and a sub-code. The main code is used to store general information about the target object, and the sub-code is used to store identification information. The edges of the two codes overlap. Relevant information can be obtained by scanning either the main code or the sub-code. The sub-code contains less information and the parsing process is simpler.
It improves the efficiency and accuracy of QR code parsing, reduces decoding time, enhances fault tolerance, avoids vehicle unusability due to master code corruption, saves costs, and improves resource utilization.
Smart Images

Figure CN120832901A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a two-dimensional code, a two-dimensional code generation method and a two-dimensional code recognition method. BACKGROUND
[0002] In the prior art, the relevant information of an object is often identified by a two-dimensional code, for example, on a shared bicycle, various information of the corresponding vehicle is recorded by a two-dimensional code, and the vehicle is unlocked or locked based on the analysis result determined after a user scans the two-dimensional code, thereby facilitating the user to ride. However, since the two-dimensional code is usually arranged at a conspicuous and exposed position, it is easy to be damaged, and the process of obtaining the analysis result of the two-dimensional code is affected by many factors, resulting in certain difficulties in obtaining the analysis result of the two-dimensional code, and the analysis result of the two-dimensional code is not ideal. SUMMARY
[0003] Therefore, the embodiments of the present application aim to provide a two-dimensional code, a two-dimensional code generation method and a two-dimensional code recognition method to facilitate the determination of the analysis result of the two-dimensional code.
[0004] In a first aspect, the embodiments of the present application aim to provide a two-dimensional code, which comprises:
[0005] a main code, used to represent object information of a target object;
[0006] a sub-code, used to represent identification information of the target object, wherein a second area surrounded by the edge of the sub-code and a first area surrounded by the edge of the main code have an overlapping area.
[0007] Further, the sub-code is arranged at the periphery of the main code.
[0008] Further, the main code and the sub-code are generated based on the same or different encoding methods.
[0009] Further, the main code and the sub-code adopt the same or different display patterns.
[0010] Further, the sub-code comprises:
[0011] an information encoding block, used to represent the identification information of the target object;
[0012] a positioning pattern, used to represent the orientation information of the sub-code.
[0013] Further, the positioning pattern comprises at least one sub-pattern, each of the sub-patterns is uniformly arranged on the edge of the two-dimensional code, and each of the sub-patterns has a corresponding indicating direction.
[0014] Further, the sub-code is arranged in a polygonal shape, and each of the sub-patterns is arranged at a vertex of the polygonal shape.
[0015] Further, the target object is a shared bicycle; the object information further includes at least one of vehicle attribute information, lock information and usage information in addition to the identification information.
[0016] In a second aspect, the embodiments of the present application aim to provide a method for generating a two-dimensional code, the method comprising:
[0017] obtaining object information of a target object;
[0018] encoding the object information to generate a primary code;
[0019] encoding identification information in the object information to generate a secondary code;
[0020] combining the primary code and the secondary code to generate the two-dimensional code, wherein a second area enclosed by an edge of the secondary code and a first area enclosed by an edge of the primary code have an overlapping area.
[0021] Further, the encoding of the identification information in the object information to generate the secondary code comprises:
[0022] performing data conversion on the identification information to generate a corresponding binary code;
[0023] adding a preset check code to the binary code to generate a corresponding target data code;
[0024] combining the target data code, an error correction code and a preset positioning pattern to generate the secondary code.
[0025] In a third aspect, the embodiments of the present application aim to provide a method for recognizing a two-dimensional code, the two-dimensional code comprising a primary code and a secondary code, wherein a second area enclosed by an edge of the secondary code and a first area enclosed by an edge of the primary code have an overlapping area;
[0026] The method comprises:
[0027] obtaining an image to be recognized, the image to be recognized comprising the secondary code;
[0028] decoding the secondary code based on a preset reading sequence to determine identification information of a target object.
[0029] Further, the image to be recognized further comprises the primary code, and the method further comprises:
[0030] decoding the primary code to determine object information of the target object;
[0031] integrating the object information and the identification information to check and correct the identification information.
[0032] In a fourth aspect, an embodiment of the present application aims to provide a two-dimensional code generation device, the device comprising:
[0033] an acquisition unit configured to acquire object information of a target object;
[0034] a first generation unit configured to encode the object information to generate a primary code;
[0035] a second generation unit configured to encode identification information in the object information to generate a secondary code;
[0036] a combination unit configured to combine the primary code and the secondary code to generate the two-dimensional code, wherein a second area enclosed by an edge of the secondary code and a first area enclosed by an edge of the primary code have an overlapping area.
[0037] In a fifth aspect, an embodiment of the present application aims to provide a two-dimensional code recognition device, the two-dimensional code comprising a primary code and a secondary code, wherein a second area enclosed by an edge of the secondary code and a first area enclosed by an edge of the primary code have an overlapping area.
[0038] the device comprising:
[0039] a scanning unit configured to acquire a to-be-recognized image, the to-be-recognized image comprising the secondary code;
[0040] a decoding unit configured to decode the secondary code based on a preset reading sequence to determine identification information of a target object.
[0041] In a sixth aspect, an embodiment of the present application aims to provide a computer program product, the computer program product comprising computer programs / instructions, the computer programs / instructions being executed by a processor to implement the method according to any one of the above aspects.
[0042] In a seventh aspect, an embodiment of the present application aims to provide an electronic device, comprising a memory and a processor, the memory being configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of the above aspects.
[0043] In an eighth aspect, an embodiment of the present application aims to provide a computer-readable storage medium, the computer-readable storage medium storing a computer program, the computer program being executed by a processor to implement the method steps according to any one of the above aspects.
[0044] The technical scheme of the embodiment of the present application sets the main code for representing the object information of the target object and the secondary code for representing the identification information of the target object on the two-dimensional code, and the second area surrounded by the edge of the secondary code and the first area surrounded by the edge of the main code have an overlapping area, so that the user can obtain the relevant information of the target object by scanning the main code and / or the secondary code, and the process of determining the analysis result is more convenient. BRIEF DESCRIPTION OF DRAWINGS
[0045] The above and other objects, features and advantages of the present application will become more apparent from the following description of the embodiments of the present application taken with reference to the accompanying drawings, in which:
[0046] Figure 1 is a schematic diagram of the two-dimensional code of the embodiment of the present application;
[0047] Figure 2 is another schematic diagram of the two-dimensional code of the embodiment of the present application;
[0048] Figure 3 is still another schematic diagram of the two-dimensional code of the embodiment of the present application;
[0049] Figure 4 is a flowchart of the generation method of the two-dimensional code of the embodiment of the present application;
[0050] Figure 5 is a flowchart of the generation of the secondary code of the embodiment of the present application;
[0051] Figure 6 is a schematic diagram of the encoding process of the embodiment of the present application;
[0052] Figure 7 is a flowchart of the recognition method of the two-dimensional code of the embodiment of the present application;
[0053] Figure 8 is a schematic diagram of the decoding process of the embodiment of the present application;
[0054] Figure 9 is a schematic diagram of the generation device of the two-dimensional code of the embodiment of the present application;
[0055] Figure 10 is a schematic diagram of the recognition device of the two-dimensional code of the embodiment of the present application;
[0056] Figure 11 is a schematic diagram of the electronic device of the embodiment of the present application. DETAILED DESCRIPTION
[0057] The present application is described in the following embodiments, but the present application is not limited to these embodiments. In the following detailed description of the present application, some specific details are described in detail. The present application can also be fully understood without the description of these details. In order to avoid confusion of the essence of the present application, the well-known methods, processes, procedures, elements and circuits are not described in detail.
[0058] In addition, those skilled in the art should understand that the drawings provided herein are for illustrative purposes only, and the drawings are not necessarily drawn to scale.
[0059] Unless the context clearly requires otherwise, throughout the description and the claims of this application, the words "comprise", "comprising", and the like are to be construed in an inclusive sense as opposed to an exclusive or exhaustive sense; that is to say, in the sense of "including, but not limited to".
[0060] In the description of the present application, it should be understood that the terms "first", "second" and the like are only for the purpose of description and cannot be understood as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise stated, the meaning of "multiple" is two or more.
[0061] The solutions described in the specification and examples, if related to personal information processing, will be processed on the premise of legal basis (such as obtaining the consent of the subject of personal information, or being necessary for the performance of the contract, etc.), and only within the prescribed or agreed range. Users refuse to process personal information other than the necessary information required for basic functions, which will not affect the user's use of basic functions.
[0062] A two-dimensional code is a common coding method, which uses a certain specific geometric pattern to form a pattern for recording data symbol information on a plane according to a certain rule. With the development of computer technology, especially the Internet of Things technology, more and more two-dimensional codes appear in people's life. For example, the two-dimensional code is set on a shared bicycle, and the user scans the two-dimensional code on the vehicle by using a special riding software (i.e. APP) to unlock the vehicle based on the recognition result of the two-dimensional code, which is convenient for riding; for example, the two-dimensional code is set in the payment scene, and the consumer completes the payment by scanning the two-dimensional code. However, due to the fact that the existing two-dimensional code is easy to be damaged, and the analysis process is affected by many factors, it is difficult to obtain the two-dimensional code analysis result, and the two-dimensional code analysis result is not ideal. In view of this, the embodiments of the present application aim to provide a two-dimensional code and a two-dimensional code generation method and recognition method to facilitate determination of the two-dimensional code analysis result.
[0063] The following will be described by taking the two-dimensional code in the shared bicycle as an example, but it should be understood that the two-dimensional code in the embodiment can also be extended to other scenarios where the two-dimensional code needs to be set and recognized, and the application scenarios of the two-dimensional code in the embodiment are not limited here.
[0064] Figure 1 is a schematic diagram of the two-dimensional code of the embodiment of the application. As shown in Figure 1 , the two-dimensional code in the embodiment includes a main code 1 and a secondary code 2, wherein the main code 1 is used to represent the object information of the target object, and the secondary code 2 is used to represent the identification information of the target object, and the second area surrounded by the edge of the secondary code 2 and the first area surrounded by the edge of the main code 1 have an overlapping area. Thus, in the embodiment, when using the two-dimensional code, the user can obtain the relevant information of the target object through the scanned main code and / or secondary code, without relying on a specific code to determine the parsing result, so that the process of determining the parsing result is more convenient.
[0065] Optionally, as shown in Figure 1 , the main code 1 in the embodiment can adopt a traditional form of two-dimensional code, and the main code 1 adopts a square shape, and the functional area on the main code includes an encoding area 11 and three positioning areas 12 respectively arranged at the top corners. Among them, the object information of the target object stored in the encoding area 11 in the main code 1 is the general information of the target object. Taking the shared bicycle as the target object, the general information includes at least one of the vehicle attribute information, the lock information and the use information and other vehicle-related information. Among them, the identification information represents the unique identification of the vehicle, and the vehicle ID can be used as the identification information of the vehicle to distinguish different vehicles. The vehicle attribute information includes the basic information such as the vehicle brand, type, color, and manufacturing date. The lock information includes the lock type, lock number, and lock status (such as whether it is occupied, whether it is damaged) of the lock. The use information includes the use record, riding distance, riding time, and riding cost of the vehicle. Other vehicle-related information is usually information used to manage and maintain the vehicle, including maintenance records, fault reports, etc. At the same time, each positioning area 12 of the main code 1 is used to indicate the orientation of the main code 1, and each positioning area represents a different orientation, and the direction and position of the main code can be determined through the relative positions between the orientations. Thus, in the embodiment, when determining the parsing result based on the main code, the main code position can be adjusted to the standard position based on the positioning area in the main code scanned by the user, and then the corresponding parsing result is determined by parsing the data in the encoding area, and then the multiple relevant information of the target object can be obtained.
[0066] Further, since the user only needs to obtain the identification information of the vehicle when riding a bike and unlocking the specified vehicle, the main code usually includes a lot of information other than the identification information of the vehicle. When the main code is scanned and analyzed to determine the identification of the vehicle, it is necessary to rely on a general and complete two-dimensional code protocol to complete the analysis, which causes the decoding time to be too long, and the analysis of a large amount of unnecessary data causes unnecessary time cost in the analysis process.
[0067] Therefore, in the sub-code 2 in the embodiment, only the necessary information required for realizing the corresponding function in the main code 1 is stored, such as the identification information of the target object. When the user needs to unlock the shared bike, the purpose of unlocking the vehicle can be achieved by scanning and analyzing the sub-code. Since the amount of information stored in the sub-code is less than that stored in the main code, and the analysis process can use a more simple and efficient analysis protocol, the analysis process of obtaining the analysis result can be completed in a shorter time, thereby saving the time cost when using the two-dimensional code, improving the determination efficiency of the analysis result, and making the determination of the analysis result more convenient.
[0068] Meanwhile, since the sub-code is added, the embodiment can provide additional scanning and analysis functions on the basis of the original two-dimensional code, increase the redundancy of data, and help improve the fault tolerance and error correction performance of the two-dimensional code, thereby improving the accuracy of the analysis result of the two-dimensional code.
[0069] In addition, when the main code is damaged and the corresponding analysis result cannot be obtained, the unlocking function can be realized by relying on the analysis result of the sub-code. In this way, the determination of the analysis result is facilitated, and the problem that the existing vehicle cannot continue to be used due to the damage of the original two-dimensional code (i.e., the two-dimensional code including only the main code) is avoided, which leads to waste of vehicle resources and improves the utilization rate of vehicle resources.
[0070] Moreover, based on the above method of setting the two-dimensional code, and when unlocking the vehicle under the condition that the sub-code and the main code coexist, the improved two-dimensional code can be applied to the existing vehicle equipment by software updating in the embodiment, without the need to replace the hardware, which can further save the cost of the two-dimensional code and the vehicle.
[0071] It should be understood that the type (such as identification information) and the amount of the same information stored in the main code and the sub-code in the embodiment can be adjusted according to actual use requirements to meet the needs of realizing the corresponding function by the main code and / or the sub-code in a specific use scenario, and to accelerate the scanning and analysis speed of the two-dimensional code composed of the main code and the sub-code, improve the analysis efficiency of the two-dimensional code, and make the two-dimensional code applicable to more different scenarios and improve the applicability of the two-dimensional code.
[0072] Meanwhile, optionally, the primary code and the secondary code in the embodiment can be generated based on the same or different encoding methods to represent the respective stored information based on the encoded data. Meanwhile, by providing the same or different encoding methods as described above to enable the primary code and the secondary code to store the corresponding information, the generation manner of the two-dimensional code can be more flexible.
[0073] Further, to facilitate the setting of the two-dimensional code and provide multiple setting possibilities, the embodiment presents the information stored in the primary code and the secondary code through a preset display pattern, such as a combination of black and white squares and different color dots, and each display element (i.e., one black square, one white square, one dot, etc.) represents a numerical value, such as 0 or 1 in a binary code. Meanwhile, the display pattern adopted by the primary code and the secondary code in the embodiment can be the same or different, for example, the primary code and the secondary code both adopt black and white squares to present the corresponding valid information; or the primary code adopts black and white squares to present the corresponding valid information (including the general information of the target object), and the secondary code adopts black and white dots to present the corresponding valid information (including the identification information of the target object). Thus, the embodiment displays the primary code and the secondary code through the above method, which can make the setting manner of the primary code and the secondary code more flexible. Moreover, when the primary code and the secondary code are displayed using the same display scheme, the integrity of the two-dimensional code setting can be improved; when the primary code and the secondary code are displayed using different display patterns, it is beneficial to distinguish the primary code and the secondary code.
[0074] Optionally, as shown in Figure 1 the secondary code 2 in the embodiment is arranged at the periphery of the primary code 1, at this time, the shape of the two-dimensional code is consistent with the shape of the secondary code (i.e., the shape of the external contour of the two-dimensional code is consistent with the shape of the external contour of the secondary code), when the secondary code is a polygon, the shape of the two-dimensional code is a polygon with the same shape but different size as the secondary code; when the secondary code is a circle, the shape of the two-dimensional code is a circle with the same shape but different size as the secondary code. Thus, the embodiment arranges the secondary code at the periphery of the primary code, which can generate a new two-dimensional code by only adding the secondary code in the case where the primary code already exists and does not interfere with the use of the primary code, which is beneficial to save the setting cost of the two-dimensional code; it also enables the user to quickly scan the two-dimensional code and quickly determine the corresponding analysis result based on the identification of the primary code and / or the secondary code, which improves the use efficiency of the two-dimensional code and makes the use of the two-dimensional code more convenient. Meanwhile, the embodiment adds the secondary code, which can provide additional code scanning and analysis functions for the two-dimensional code, increase the redundancy of data, and help to improve the fault tolerance and error correction performance of the two-dimensional code.
[0075] Further, as shown in Figure 1As shown, the secondary code 2 in this embodiment includes an information encoding block 21, which is used to represent the identification information of the target object. This identification information is presented via a display pattern located within the area formed between the outer contours of the secondary code 2 and the outer contours of the primary code 1. The user can obtain the identification information of the target object by scanning the information encoding block 21 in the secondary code 2. It should be understood that since the area represented by the information encoding block 21 surrounds the display area of the primary code 1, when the parsing result is determined by scanning the entire information encoding block 21, the primary code 1 will also appear in the scanned image. The parsing result can then be determined by decoding the primary code and / or the secondary code.
[0076] Specifically, in this embodiment, the information encoding block 21 in the secondary code 2 and the encoding region 11 in the primary code 1 can be generated using the same or different encoding methods, and the information encoding block 21 and the encoding region 11 can use the same or different display patterns. Thus, by configuring the information encoding block in the secondary code and the encoding region in the primary code using the above method, the primary and secondary codes can be configured more flexibly, thereby meeting the needs of different usage scenarios and improving the applicability of the QR code.
[0077] It should also be understood that while both the primary and secondary codes can parse the same target object's identification information, the secondary code contains less information than the primary code, so the secondary code parsing process takes less time than the primary code parsing process, resulting in a higher parsing efficiency. In this case, especially if the original primary code is damaged, users can quickly obtain the target object's identification information based on the secondary code's parsing result and perform corresponding functions based on this identification information, which helps improve the user experience of the target object.
[0078] Further, if Figure 1 As shown, the secondary code 2 in this embodiment also includes a positioning pattern. The positioning pattern is used to indicate the secondary code's orientation information. Optionally, the positioning pattern in this embodiment includes at least one sub-pattern 22, each of which is arranged on the edge of the QR code and has a corresponding indicating direction. Thus, by setting the positioning pattern in this embodiment, the orientation of the secondary code can be determined based on different sub-patterns, thereby improving the accuracy and efficiency of secondary code recognition.
[0079] Alternatively, as Figure 1 As shown, the sub-pattern 22 in the positioning pattern of the secondary code 2 of this embodiment and the positioning area 12 in the main code 1 can adopt the same or different display patterns, which can be set according to actual usage scenarios and needs.
[0080] Optionally, when each sub-pattern in the positioning pattern is arranged on the edge of the two-dimensional code, in order to facilitate the arrangement of the positioning pattern, each sub-pattern in the positioning pattern can be arranged uniformly on the edge of the two-dimensional code, for example, when the sub-code is arranged in a polygonal shape, each sub-pattern is arranged on a vertex of the polygonal shape; when the sub-code is arranged in a circular shape, each sub-pattern is arranged on an edge position of the circular shape; of course, each positioning pattern can also be arranged randomly on different positions of the edge of the two-dimensional code.
[0081] Further, each sub-pattern in the embodiment can be arranged in any shape, such as a square, a triangle, a circle or other shapes, and the same or different shapes can be used between different sub-patterns; meanwhile, the external contour of each sub-pattern can be fitted with the external contour shape of the sub-code, or can be arranged entirely within the external contour of the sub-code. Further, the number of sub-patterns in the embodiment can be arranged as 3, 4 or other numbers. Thus, by providing different arrangement modes of sub-patterns in the positioning pattern, the arrangement of the positioning pattern in the sub-code is more flexible, and the convenience of the two-dimensional code arrangement is improved.
[0082] Further, the information encoding block in the sub-code can also be divided into a plurality of encoding sub-modules in the embodiment, for example, when the sub-code is a square, the area in the sub-code can be divided along two diagonal lines of the square shape, and four small areas are formed, each area corresponds to an encoding sub-module, and each encoding sub-module stores the identification information of the target object. When the user scans the two-dimensional code to determine the analysis result, only one encoding sub-module and the sub-pattern in the positioning pattern closest to the scanned encoding sub-module can be used to obtain the identification information of the target object in the embodiment. At this time, the relative position relationship between the scanned sub-pattern and the display pattern of the encoding sub-module is used to determine the position of the encoding sub-module in the two-dimensional code, and the information stored in the encoding sub-module is read based on the identified position of the encoding sub-module, and then the identification information of the target object is obtained.
[0083] In order to facilitate understanding, examples of different forms of two-dimensional codes are given in the embodiment. As shown in FIG. 1a, a two-dimensional code in a polygonal shape is shown, and as shown in FIG. 1b, a two-dimensional code in a circular shape is shown. Figure 1In the two-dimensional code shown, the main code 1 is set to be square. At three vertices of the main code 1, positioning areas 12 in the shape of the character "回" are respectively set. The area on the main code 1 except for the three positioning areas 12 is the coding area 11, and general information of the target object is stored in the coding area 11. At the same time, the secondary code 2 is set on the periphery of the main code 1, and its shape is the same square as that of the main code 1. Sub-patterns 22 are respectively set at four vertex positions of the secondary code 2. The sub-patterns 22 are in the shape of a triangle, and the two right-angled sides of the triangle shape respectively coincide with the contour of the secondary code 2. The four sub-patterns 22 together form the positioning pattern of the secondary code 2. The information coding block 21 in the secondary code 2 is located between the positioning pattern and the main code 1. The outer contour of the information coding block 21 is in the shape of an octagon, and the inner contour is a square with the same shape as the outer contour of the main code 1. Moreover, the identification information of the target object stored in the information coding block 21 is presented by a display pattern different from that of the coding area 11 in the main code 1.
[0084] In the two-dimensional code as Figure 2 shown, the main code 1 is set to be square. At three vertices of the main code 1, positioning areas 12 in the shape of the character "回" are respectively set. The area on the main code 1 except for the three positioning areas 12 is the coding area 11, and general information of the target object is stored in the coding area 11. At the same time, the secondary code 2 is set on the periphery of the main code 1, and its shape is the same square as that of the main code 1. Sub-patterns 22 are respectively set at four vertex positions of the secondary code 2. The shape of the sub-patterns 22 is a shape enclosed by two right-angled sides and an arc side bent in the right-angled direction. The outer contour (i.e., the two right-angled sides) of the sub-patterns 22 coincides with the contour of the secondary code 2. The four sub-patterns 22 together form the positioning pattern of the secondary code 2. The information coding block 21 in the secondary code 2 is located between the positioning pattern and the main code 1. The outer contour of the information coding block 21 coincides with the arc sides of each sub-pattern 22, and the inner contour is a square with the same shape as the outer contour of the main code 1. Moreover, the identification information of the target object stored in the information coding block 21 is presented by a display pattern different from that of the coding area 11 in the main code 1.
[0085] In the two-dimensional code as Figure 3In the QR code shown, the main code 1 is set to be square, and positioning areas 12 in the shape of the Chinese character "回" are respectively set at three vertices of the main code 1. The area of the main code 1 other than the three positioning areas 12 is the encoding area 11, and general information of the target object is stored in the encoding area 11. At the same time, the secondary code 2 is set on the periphery of the main code 1, and the shape is a circle different from that of the main code 1. The positioning pattern in the secondary code 2 includes three sub-patterns 22. The three sub-patterns 22 are all located inside the edge of the QR code (i.e., the outer contour of the secondary code 2). The shape of the sub-pattern 22 is the same as the shape of the positioning area 12 in the main code 1, and the relative position relationship of each sub-pattern 22 is also the same as the relative position of each positioning area 12. At the same time, the information encoding block 21 in the secondary code 2 is located between the positioning pattern and the main code 1. The outer contour and the inner contour of the information encoding block 21 are both circular, and the outer contour is respectively tangent to one vertex close to the main code 1 in each sub-pattern 22, and the inner contour is respectively tangent to the four vertices of the main code 1. The identification information of the target object stored in the information encoding block 21 is presented by a display pattern different from the encoding area 11 in the main code 1.
[0086] It should be noted that the QR code structure given in this embodiment is only an example, and can be specifically set according to actual usage requirements. The entire presentation method of the QR code is not limited here.
[0087] After introducing the structure of the QR code, the generation method and recognition method of the QR code will be further described in this embodiment.
[0088] Figure 4 is a flowchart of the generation method of the QR code according to an embodiment of the present invention. As Figure 4 shown, the above QR code is generated through the following steps in this embodiment.
[0089] In step S410, object information of the target object is obtained.
[0090] In this embodiment, the object information of the target object is the general information of the target object, and the general information at least includes the identification information of the target object. Taking the target object as a shared bicycle for example, the general information, in addition to including the identification information of the vehicle, also includes at least one of other vehicle-related information such as vehicle attribute information, lock information, and usage information.
[0091] In step S420, the object information is encoded to generate the main code.
[0092] In this embodiment, the main code can adopt the traditional form of QR code. When encoding the object information of the target object based on the existing encoding method to generate the main code, the existing QR code generation method can be used to generate it, which will not be elaborated here.
[0093] In step S430, the identification information in the object information is encoded to generate the secondary code.
[0094] Optionally, the secondary code can be generated by using the same or different encoding method as that of the primary code in this embodiment. Further, the secondary code is generated based on the method shown in Figure 5 in order to improve the encoding efficiency and speed up the generation of the secondary code, which specifically includes the following steps. Meanwhile, the schematic diagram of the encoding process is shown in Figure 6 .
[0095] In step S510, the data conversion is performed on the identification information to generate the corresponding binary code.
[0096] In this embodiment, the data format of the identification information can be the decimal data as shown in Figure 6 , or other formats of data. In order to facilitate the generation of the secondary code, the format conversion is performed on the identification information to generate the corresponding binary code in this embodiment when the secondary code is generated.
[0097] In step S520, the preset check code is added to the binary code to generate the corresponding target data code.
[0098] In this embodiment, the check code is the data calculated from part of the data in the target data code according to a certain algorithm, for example, step one calculates the sum of the even digit codes, step two multiplies the sum by a certain multiple; step three calculates the sum of the odd digit codes; step four adds or subtracts the results in step two and step three, step five subtracts the result obtained in step four by a number greater than or equal to the result obtained in step four and which is the smallest integer multiple of 10, and the difference is the value of the check code. Meanwhile, the integrity of the data in the secondary code can be reflected by the check code in this embodiment, so that effective error checking can be performed in the subsequent two-dimensional code recognition process, and the accuracy of the two-dimensional code analysis result is improved.
[0099] Optionally, the check code in this embodiment is directly added to the starting position of the binary code after being generated, and the target data code as shown in Figure 6 is generated, so that the corresponding secondary code is generated based on the target data code, which is beneficial to improve the accuracy of the two-dimensional code analysis result.
[0100] In step S530, the target data code, the error correction code and the preset positioning pattern are combined to generate the secondary code.
[0101] In this embodiment, after the target data code corresponding to the identification information of the target object is determined, the target data code, the error correction code and the preset positioning pattern are combined to generate the secondary code of the pattern as shown in Figure 6 . The error correction code is used to enhance the robustness of the secondary code, so that the secondary code can still be correctly decoded when it is subsequently faced with scanning errors, stains or damage, which is beneficial to further improve the decoding efficiency and decoding accuracy of the secondary code.
[0102] Optionally, to improve the security of the data in the QR code, Figure 6 As shown in , in this embodiment, after the target data code is generated, a preset encryption code is added to the target data code to encrypt the target data code, and the encrypted target data code, error correction code and preset positioning pattern are combined to generate a secondary code.
[0103] It should be noted that when the information contained in the QR code of this embodiment is encrypted data, ordinary users cannot directly read and parse this information. This information can only be decrypted and processed through the relevant systems of the vehicle platform (for example, through authorized scanners or applications, etc.) to ensure security and accuracy.
[0104] At the same time, it should be understood that in this embodiment, under the premise of determining the structure of the QR code to be generated, the execution order between the operation of generating the primary code based on the object information of the target object and the operation of generating the secondary code based on the identification information in the object information of the target object can be set according to the actual usage scenario. The primary code can be generated first and then the secondary code, or the secondary code can be generated first and then the main code, or the primary code and the secondary code can be generated at the same time.
[0105] In step S440 , the primary code and the secondary code are combined to generate a two-dimensional code, wherein the second area enclosed by the edges of the secondary code overlaps with the first area enclosed by the edges of the primary code.
[0106] In this embodiment, after the primary code and the secondary code are generated respectively based on the above method, the generated primary code and the secondary code are combined according to the aforementioned QR code structure to generate a corresponding QR code.
[0107] The technical solution in this embodiment is to encode the object information of the target object to generate a primary code after obtaining the object information of the target object, encode the identification information in the object information of the target object to generate a secondary code, and then combine the primary code and the secondary code to generate a QR code. The QR code generation process is simpler and more convenient.
[0108] Figure 7 Flowchart of the method for recognizing a two-dimensional code according to an embodiment of the present invention. Figure 7 As shown, in this embodiment, the above-mentioned QR code is identified through the following steps.
[0109] In step S710, an image to be recognized is obtained.
[0110] In this embodiment, the to-be-recognized image can be obtained by scanning the two-dimensional code by the user terminal. When the to-be-recognized image only includes the primary code in the two-dimensional code (for example, the scanning area is small), the corresponding analysis result is determined by subsequently recognizing the primary code; when the to-be-recognized image only includes the secondary code in the two-dimensional code (for example, the primary code is damaged and only the secondary code in the periphery of the primary code can be scanned), the corresponding analysis result is determined by subsequently recognizing the secondary code; and when the to-be-recognized image includes both the primary code and the secondary code in the two-dimensional code, the corresponding analysis result can be determined by subsequently recognizing the primary code and / or the secondary code.
[0111] Optionally, in order to improve the analysis efficiency, the recognition process of the secondary code in the to-be-recognized image is taken as an example for description in this embodiment.
[0112] In step S720, the secondary code is decoded based on the preset reading sequence to determine the identification information of the target object.
[0113] In this embodiment, the decoding process is the inverse process of the foregoing encoding process, and the information stored in the secondary code can be analyzed by decoding to further determine the identification information of the target object. Meanwhile, the decoding process of the primary code is similar to that of the secondary code, which will not be described herein again.
[0114] Optionally, in this embodiment, the secondary code is analyzed based on the decoding process shown in Figure 8 When the secondary code is provided with the encryption code, the secondary code needs to be decrypted first to determine the target data code with the encryption code corresponding to the display pattern of the secondary code. When the secondary code is not provided with the encryption code, the subsequent decoding steps are directly executed. The decoding steps include judging the check code in the secondary code, determining the target data code containing the check code and the data corresponding to the identification information, the target data code adopting a binary data format; after the target data code is determined, the check code in the target data code is deleted to determine the binary code corresponding to the identification information of the target object; finally, the binary code is converted into the preset data format by format conversion, and the identification information of the target object is determined.
[0115] Further, in order to improve the analysis efficiency, when the secondary code is decoded in this embodiment, the position of the secondary code in the to-be-recognized image is corrected based on at least one sub-pattern in the positioning pattern of the secondary code, the recognition image of the secondary code is adjusted to a standard image, and then the display pattern in the information encoding block (or at least one encoding sub-module) of the secondary code in the standard image is recognized based on the above method based on the preset reading sequence, and the corresponding analysis result is obtained.
[0116] It should be noted that the preset reading sequence in this embodiment is the reading sequence determined when the two-dimensional code is generated. For example, when the primary code and the secondary code in the two-dimensional code are recognized Figure 1When the sub-code in the two-dimensional code shown in the middle is read, it can start from a specific sub-pattern (such as the triangular sub-pattern in the upper left corner) and read all the encoding in the sub-code information encoding block counterclockwise. It should be understood that the reading order here is only an example, and can be determined according to the context and needs of the actual application scenario.
[0117] In step S730, the main code is decoded to determine the object information of the target object.
[0118] Optionally, to further improve the accuracy of the two-dimensional code analysis result, in the embodiment, when determining the analysis result corresponding to the sub-code, the main code in the to-be-recognized image is also decoded to further determine the object information (such as the aforementioned general information) of the target object stored in the main code. Further, the process of decoding the main code in the embodiment can adopt the same method as the decoding process of the aforementioned sub-code, or can determine the object information of the target object stored in the main code based on other existing two-dimensional code decoding methods. The specific setting can be made according to the actual use scenario, which will not be described here.
[0119] In step S740, the object information is integrated with the identification information to verify and correct the identification information.
[0120] In the embodiment, after decoding the main code and the sub-code respectively and determining the corresponding analysis results, that is, determining the identification information in the object information of the target object corresponding to the main code and the object information of the target object corresponding to the sub-code, the object information of the target object and the identification information are integrated to verify the identification information obtained by analyzing the sub-code. When the verification result represents that the identification information in the analysis results corresponding to the sub-code and the main code is consistent, it indicates that the identification information of the target object stored in the sub-code and the main code is consistent. Conversely, when the verification result represents that the identification information in the analysis results corresponding to the sub-code and the main code is inconsistent, it indicates that the identification information of the target object stored in the sub-code and the main code is inconsistent, and the identification information stored in the main code and / or the sub-code needs to be corrected to ensure the accuracy of the information stored in the two-dimensional code and improve the use accuracy of the two-dimensional code.
[0121] The technical scheme of the embodiment can improve the analysis efficiency of the identification information of the target object by decoding the sub-code based on the preset reading order after obtaining the to-be-recognized image to determine the identification information of the target object. At the same time, by decoding the main code to determine the object information of the target object and integrating the object information of the target object with the identification information obtained by analyzing the sub-code, the identification information in the analysis result can be verified and corrected to ensure the reliability of the use of the two-dimensional code and the accuracy of the two-dimensional code analysis result.
[0122] Figure 9 is a schematic diagram of a two-dimensional code generation device of an embodiment of the present application. As shown inFigure 9 As shown in the figure, the generation device in the embodiment includes an acquisition unit 101, a first generation unit 102, a second generation unit 103, and a combination unit 104. The acquisition unit 101 is configured to acquire object information of a target object. The first generation unit 102 is configured to encode the object information to generate a primary code. The second generation unit 103 is configured to encode identification information in the object information to generate a secondary code. The combination unit 104 is configured to combine the primary code and the secondary code to generate a two-dimensional code, wherein a second area surrounded by an edge of the secondary code and a first area surrounded by an edge of the primary code have an overlapping area.
[0123] Optionally, the second generation unit 103 in the embodiment is further configured to, when generating the secondary code, perform data conversion on the identification information to generate a corresponding binary code, add a preset check code to the binary code to generate a corresponding target data code, and combine the target data code, an error correction code, and a preset positioning pattern to generate the secondary code.
[0124] Figure 10 is a schematic diagram of a recognition device of a two-dimensional code according to an embodiment of the present application. As shown in the figure, Figure 10 The recognition device in the embodiment is configured to recognize the two-dimensional code described above, which includes a primary code and a secondary code, and a second area surrounded by an edge of the secondary code and a first area surrounded by an edge of the primary code have an overlapping area. The recognition device includes a scanning unit 201 and a decoding unit 202. The scanning unit 201 is configured to acquire a to-be-recognized image, and the to-be-recognized image includes the secondary code. The decoding unit 202 is configured to decode the secondary code based on a preset reading sequence to determine identification information of a target object.
[0125] Optionally, the decoding unit 202 in the embodiment is further configured to decode the primary code to determine object information of the target object, and integrate the object information of the target object with the identification information to check and correct the identification information.
[0126] Figure 11 is a schematic diagram of an electronic device according to an embodiment of the present application. As shown in the figure, Figure 11The electronic device shown is a general address query device, which comprises a general computer hardware structure, at least comprising a processor 31 and a memory 32. The processor 31 and the memory 32 are connected through a bus 33. The memory 32 is suitable for storing instructions or programs executable by the processor 31. The processor 31 can be a stand-alone microprocessor, or a set of one or more microprocessors. Thus, the processor 31 performs the processing of data and the control of other devices by executing the instructions stored in the memory 32, thereby implementing the method flow of the embodiments of the application as described above. The bus 33 connects the above-mentioned components together, and connects the above-mentioned components to a display controller 34 and a display device, and an input / output (I / O) device 35. The input / output (I / O) device 35 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a body sense input device, a printer, and other devices known in the art. Typically, the input / output device 35 is connected to the system through an input / output (I / O) controller 36.
[0127] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, device (apparatus) or computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer- readable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0128] The present application is described with reference to flowcharts according to the methods, devices (apparatuses) and computer program products of the embodiments of the present application. It should be understood that each flow in the flowcharts can be implemented by computer program instructions.
[0129] These computer program instructions can be stored in a computer readable memory capable of directing the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product comprising instruction devices, which implement the flow Figure 1 specified in one flow or multiple flows.
[0130] These computer program instructions can also be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one flow or multiple flows. Figure 1
[0131] Another embodiment of the present application relates to a non-volatile storage medium for storing a computer readable program for causing a computer to execute some or all of the above-mentioned method embodiments.
[0132] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned method embodiments can be completed by a program stored in a storage medium, including a plurality of instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in the embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage media that can store program codes.
[0133] The above-mentioned is only the preferred embodiment of the present application, and is not used to limit the present application. For those skilled in the art, the present application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A two-dimensional code, characterized by, The two-dimensional code comprises: a main code for representing object information of a target object; a sub-code for representing identification information of the target object, wherein a second area surrounded by edges of the sub-code and a first area surrounded by edges of the main code have an overlapping area.
2. The two-dimensional code according to claim 1, wherein The sub-code is arranged at a periphery of the main code.
3. The two-dimensional code according to claim 1, wherein The main code and the sub-code are generated based on the same or different encoding methods.
4. The two-dimensional code according to claim 1, wherein The main code and the sub-code adopt the same or different display patterns.
5. The two-dimensional code according to claim 1, wherein The sub-code comprises: an information encoding block for representing identification information of the target object; a positioning pattern for representing orientation information of the sub-code.
6. The two-dimensional code according to claim 5, wherein, The positioning pattern comprises at least one sub-pattern, each of the sub-patterns is uniformly arranged at an edge of the two-dimensional code, and each of the sub-patterns has a corresponding indication direction.
7. The two-dimensional code according to claim 6, wherein The sub-code is arranged in a polygonal shape, and each of the sub-patterns is arranged at a vertex of the polygonal shape.
8. The two-dimensional code according to claim 1, wherein The target object is a shared bicycle, and the object information comprises at least one of vehicle attribute information, lock information and usage information in addition to the identification information.
9. A method of generating a two-dimensional code, characterized by, The method comprises: obtaining object information of a target object; encoding the object information to generate a main code; encoding identification information in the object information to generate a sub-code; combining the main code and the sub-code to generate the two-dimensional code, wherein a second area surrounded by edges of the sub-code and a first area surrounded by edges of the main code have an overlapping area.
10. The method of claim 9, wherein, The encoding of the identification information in the object information to generate the sub-code comprises: performing data conversion on the identification information to generate a corresponding binary code; adding a preset check code to the binary code to generate a corresponding target data code; combining the target data code, an error correction code and a preset positioning pattern to generate the sub-code.
11. A method of recognizing a two-dimensional code, characterized by, The two-dimensional code comprises a main code and a sub-code, and a second area surrounded by edges of the sub-code and a first area surrounded by edges of the main code have an overlapping area; The method comprises: obtaining an image to be recognized, the image to be recognized comprising the sub-code; decoding the sub-code based on a preset reading sequence to determine identification information of a target object.
12. The method of claim 11, wherein, The image to be recognized further comprises a main code, and the method further comprises: decoding the main code to determine object information of the target object; integrating the object information and the identification information to check and correct the identification information.
13. An apparatus for generating a two-dimensional code, characterized by comprising: The apparatus comprises: an obtaining unit configured to obtain object information of a target object; a first generating unit configured to encode the object information to generate a main code; a second generating unit configured to encode identification information in the object information to generate a sub-code; a combining unit configured to combine the main code and the sub-code to generate the two-dimensional code, wherein a second area surrounded by edges of the sub-code and a first area surrounded by edges of the main code have an overlapping area.
14. An identification device of a two-dimensional code, characterized by comprising: The two-dimensional code comprises a main code and a sub-code, and a second area surrounded by edges of the sub-code and a first area surrounded by edges of the main code have an overlapping area; The apparatus comprises: The scanning unit is configured to acquire a to-be-identified image, and the to-be-identified image comprises the sub-codes. The decoding unit is configured to decode the sub-codes based on a preset reading sequence, and determine the identification information of the target object.
15. A computer program product, characterised in that, The computer program product comprises computer programs / instructions, and the computer programs / instructions are executed by a processor to implement the method in any one of claims 9-12.
16. An electronic device comprising a memory and a processor, characterized in that The memory is configured to store one or more computer program instructions, and the one or more computer program instructions are executed by the processor to implement the method in any one of claims 9-12.
17. A computer readable storage medium characterized by: The computer program is stored in the computer readable storage medium, and the computer program is executed by a processor to implement the method steps in any one of claims 9-12.
Citation Information
Patent Citations
Nested QR code encoding method and decoding method
CN110929296A
High-strength two-dimensional code capable of being quickly positioned and recognized and positioning and recognition method thereof
CN115879485A
Object on which two-dimensional code is disposed, and two-dimensional code generation method, identification method, generation apparatus, and identification apparatus
US20200334507A1
Quick response code information reading and generation method and apparatus
WO2019085710A1