WO2021143212A1 - 二维码、二维码的编码方法、解码方法、装置和电子系统 - Google Patents
二维码、二维码的编码方法、解码方法、装置和电子系统 Download PDFInfo
- Publication number
- WO2021143212A1 WO2021143212A1 PCT/CN2020/119541 CN2020119541W WO2021143212A1 WO 2021143212 A1 WO2021143212 A1 WO 2021143212A1 CN 2020119541 W CN2020119541 W CN 2020119541W WO 2021143212 A1 WO2021143212 A1 WO 2021143212A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- information
- dimensional code
- core coding
- binary
- information bits
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 178
- 238000001514 detection method Methods 0.000 claims abstract description 207
- 108091026890 Coding region Proteins 0.000 claims description 135
- 108700026244 Open Reading Frames Proteins 0.000 claims description 47
- 230000008569 process Effects 0.000 claims description 43
- 238000006243 chemical reaction Methods 0.000 claims description 41
- 238000012545 processing Methods 0.000 claims description 24
- 238000004590 computer program Methods 0.000 claims description 20
- 238000004422 calculation algorithm Methods 0.000 claims description 17
- 239000013598 vector Substances 0.000 description 27
- 238000010586 diagram Methods 0.000 description 16
- 239000011159 matrix material Substances 0.000 description 9
- 230000006870 function Effects 0.000 description 8
- 239000003086 colorant Substances 0.000 description 5
- 238000005516 engineering process Methods 0.000 description 5
- 239000002699 waste material Substances 0.000 description 5
- 238000012937 correction Methods 0.000 description 4
- 239000007787 solid Substances 0.000 description 4
- 238000013461 design Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 208000003580 polydactyly Diseases 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 229910002056 binary alloy Inorganic materials 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 238000012549 training Methods 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K19/00—Record carriers for use with machines and with at least a part designed to carry digital markings
- G06K19/06—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
- G06K19/06009—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
- G06K19/06037—Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K17/00—Methods or arrangements for effecting co-operative working between equipments covered by two or more of main groups G06K1/00 - G06K15/00, e.g. automatic card files incorporating conveying and reading operations
Definitions
- the invention relates to the technical field of two-dimensional codes, in particular to a two-dimensional code, a two-dimensional code encoding method, a decoding method, a device and an electronic system.
- Two-dimensional code is a common numerical coding technology, which is widely used.
- the two-dimensional code has a better recognition effect for different encoding algorithms and different data volumes.
- the two-dimensional code in the related technology is usually realized by a matrix with a relatively fixed size, such as a matrix of 21*21, a matrix of 25*25, a matrix of 29*29, etc.; the matrix usually includes functional data and data codes And error correction codes.
- the purpose of the present invention is to provide a two-dimensional code, a two-dimensional code encoding method, a decoding method, a device and an electronic system, so as to improve the information efficiency of the two-dimensional code and improve the anti-blocking ability of the two-dimensional code.
- an embodiment of the present invention provides a two-dimensional code, the two-dimensional code includes a plurality of core coding regions; the core coding region includes designated information bits and detection information bits; wherein, the designated information bits include a preset original The binary information corresponding to the information; the detection information bit includes the position information of the core coding area.
- the information bit size of each core coding region is determined according to the data amount of the original information; the information bit size includes: the number of information bits included in the length of the core coding region, and the number of information bits included in the width of the core coding region.
- multiple core coding regions are arranged according to preset positions; each core coding region is preset with a position identifier corresponding to the core coding region; the binary information displayed on the designated information bit in each core coding region is passed through the original information The position identifier corresponding to the core coding region is converted.
- the detection information bits include multiple information bits at the edge positions of the core coding region; the multiple information bits form a detection pattern with a preset shape.
- the detection pattern includes an "L"-shaped pattern; at least a part of the information bits in the plurality of information bits are located in the first edge row of the core coding area, and the information bits in the plurality of information bits except for at least a part of the information are located at the first edge.
- the row is adjacent to the first edge column.
- the detection information bits include two groups, namely a first group of detection information bits and a second group of detection information bits; at least a part of the detection information bits in the first group of detection information bits are located in the first edge row of the core coding region, except for at least a part Information bits other than information are located on the first edge column adjacent to the first edge row;
- At least a part of the information bits in the second group of detected information bits are located on the second edge row of the core coding region, and the information bits except for at least part of the information are located on the second edge column adjacent to the second edge row;
- An edge row, a first edge column, a second edge row, and a second edge column are connected in sequence.
- each information bit in the first group of detected information bits displays the same binary information; in the second group of detected information bits, adjacent information bits display different binary information.
- the two-dimensional code also includes a locator; the locator is used to: divide the two-dimensional code into multiple target areas; each target area includes one or more core coding areas among the multiple core coding areas.
- the locator includes a plurality of locators; the locator is located at the vertex position of the target area; and each target area includes one core coding region among the multiple core coding regions.
- the locator includes a Hough circle.
- the embodiment of the present invention provides a two-dimensional code encoding method, which is applied to the two-dimensional code of the first aspect;
- the two-dimensional code to be encoded includes multiple core encoding regions;
- the method includes:
- the preset conversion method converts the preset original information into binary information; according to the preset binary information display rules, the binary information is respectively displayed in the designated information bits in each core encoding area to obtain the encoded two-dimensional code ;
- the core coding area also includes: detection information bits used to detect the position of the core coding area during the decoding process.
- the above method further includes: determining the information bit size of the core coding region in the two-dimensional code to be coded according to the data amount of the preset original information.
- the information bit scale includes: the number of information bits included in the length of the core coding region, and the number of information bits included in the width of the core coding region; according to the preset data amount of the original information, the core code in the two-dimensional code to be encoded is determined
- the step of the information bit scale of the region includes: determining the first information bit number in the core coding region that needs to display the binary information associated with the original information according to the preset data amount of the original information, and is used in the decoding process, The second information bit quantity of the detected information bits for detecting the position of the core coding region; and the information bit size of the core coding region is determined according to the first information bit quantity and the second information bit quantity.
- the step of converting the original information into binary information through a preset conversion method includes: for each core coding region, setting the position identifier of the core coding region in the two-dimensional code to be coded; and through the preset conversion In this way, the original information and the location identifier are converted into binary information to obtain the binary information corresponding to the core coding area; the step of displaying the binary information in the designated information bits in each core coding area includes: for each core coding area , The binary information corresponding to the core coding area is displayed in the designated information bit in the core coding area.
- the step of converting the original information and location identifiers into binary information through a preset conversion method includes: converting the original information and location identifiers into initial information in binary form; using a preset Reed-solomon encoding algorithm to convert The initial information is encoded to obtain the encoded information; the initial information and the encoded information are determined as binary information.
- the step of converting the original information and the location identifier into the initial information in binary form includes: converting the original information into the original information in binary form; converting the location identifier into the location identifier in binary form; converting the original information in binary form, The position identifier in the binary form and the redundant information of the preset number of bits are determined as the initial information in the binary form.
- an embodiment of the present invention provides a method for decoding a two-dimensional code, which is applied to the two-dimensional code of the first aspect;
- the two-dimensional code to be encoded includes a plurality of core coding regions; the method includes: Detect the detection information bit in the QR code in the image containing the QR code; determine the core coding area in the QR code according to the detected detection information bit; decode the binary information displayed on the specified information bit in the core coding area , Get the original information corresponding to the binary information.
- the two-dimensional code also includes multiple locators; the locators are used to: divide the two-dimensional code into multiple target areas; each target area includes a core coding area; from the image containing the two-dimensional code
- the step of detecting the detection information bits in the two-dimensional code includes: detecting the locator from the image containing the two-dimensional code; determining the target area in the two-dimensional code through the detected locator; detecting the two-dimensional code from the target area Detection information bits in the code.
- the step of determining the target area in the two-dimensional code through the detected locator includes: determining the number and relative position of the detected locator; and determining the number and relative position of the two-dimensional code according to the number and relative position of the locator. target area.
- the step of detecting the detection information bits in the two-dimensional code from the image containing the two-dimensional code includes: detecting the two-dimensional code from the image containing the two-dimensional code through a preset ROI region detection model The target area; the detection information bits in the two-dimensional code are detected from the target area.
- the detection information bits form a detection pattern with a preset shape; the edges of the detection pattern include straight line segments whose length meets the preset length range; the step of detecting the detection information bits in the two-dimensional code from the target area includes: Straight-line segment detection algorithm of, to detect straight-line segments from the target area; from the detected straight-line segments, delete straight-line segments whose length is less than the minimum value in the length range, and/or delete straight-line segments whose length is greater than the maximum value in the length range Segment: Determine the detection information bit in the QR code according to the remaining straight line segments in the target area.
- the step of determining the core coding area in the two-dimensional code according to the detected detection information bits includes: determining multiple vertices of the core coding area in the two-dimensional code according to the detected detection information bits; connecting by line segments The adjacent vertices among the multiple vertices determine the area enclosed by the line segment as the core coding area in the two-dimensional code.
- the step of connecting adjacent vertices among the plurality of vertices through line segments includes: if multiple groups of detection information bits are detected, for each group of detection information bits, connecting multiple vertices corresponding to the group of detection information bits through line segments.
- the step of decoding the binary information displayed on the designated information bit in the core encoding area to obtain the original information corresponding to the binary information includes: using the conversion method and the binary information display rule used in the encoding process to convert the binary information in the core encoding area , The binary information displayed on the designated information bit is decoded into the original information.
- an embodiment of the present invention provides a two-dimensional code encoding device, which is applied to the two-dimensional code of any one of the first aspects;
- the two-dimensional code to be encoded includes multiple core coding regions;
- the device Including: an information conversion module, used to convert the preset original information into binary information through a preset conversion method; a two-dimensional code determination module, used to display the binary information in each display according to the preset binary information display rules
- the designated information bits in the core coding region are obtained to obtain the encoded two-dimensional code; wherein, the core coding region also includes: detection information bits for detecting the position of the core coding region during the decoding process.
- an embodiment of the present invention provides a two-dimensional code decoding device, which is applied to the two-dimensional code of any one of the first aspects; the two-dimensional code to be encoded includes multiple core coding regions; the device Including: detection information bit detection module, used to detect the detection information bit in the two-dimensional code from the image containing the two-dimensional code; core coding area determination module, used to determine the detection information bit in the two-dimensional code according to the detected detection information bit The two-dimensional code decoding module is used to decode the binary information displayed on the designated information bit in the core coding area to obtain the original information corresponding to the binary information.
- an embodiment of the present invention provides an electronic system that includes: a processing device and a storage device; the storage device stores a computer program, and the computer program is executed when the processed device is running, as in any implementation of the second aspect
- an embodiment of the present invention provides a computer-readable storage medium with a computer program stored on the computer-readable storage medium.
- the computer program is run by a processing device, the two-dimensional code as in any one of the embodiments of the second aspect is executed.
- An embodiment of the present invention provides a two-dimensional code, a two-dimensional code encoding method, decoding method, device, and electronic system.
- the two-dimensional code includes a plurality of core coding regions, and the core coding region includes designated information bits and detection information. Bit; the designated information bit includes the preset binary information corresponding to the original information; the detected information bit includes the position information of the core coding area.
- the anti-blocking ability of the two-dimensional code is improved.
- FIG. 1 is a schematic structural diagram of an electronic system provided by an embodiment of the present invention
- FIG. 2 is a schematic diagram of the structure of a two-dimensional code provided by an embodiment of the present invention.
- FIG. 3 is a schematic diagram of the structure of a detection pattern provided by an embodiment of the present invention.
- FIG. 4 is a schematic structural diagram of another detection pattern provided by an embodiment of the present invention.
- FIG. 5 is a schematic structural diagram of another detection pattern provided by an embodiment of the present invention.
- Fig. 6 is a schematic structural diagram of another two-dimensional code provided by an embodiment of the present invention.
- FIG. 7 is a schematic structural diagram of another two-dimensional code provided by an embodiment of the present invention.
- FIG. 8 is a flowchart of a method for encoding a two-dimensional code according to an embodiment of the present invention.
- FIG. 9 is a flowchart of another method for encoding a two-dimensional code according to an embodiment of the present invention.
- FIG. 10 is a flowchart of another method for encoding a two-dimensional code according to an embodiment of the present invention.
- FIG. 11 is a flowchart of another method for encoding a two-dimensional code according to an embodiment of the present invention.
- FIG. 12 is a flowchart of a method for decoding a two-dimensional code provided by an embodiment of the present invention.
- FIG. 13 is a flowchart of another method for decoding a two-dimensional code provided by an embodiment of the present invention.
- FIG. 14 is a flowchart of a method for detecting information bits according to an embodiment of the present invention.
- 15 is a flowchart of another method for decoding a two-dimensional code provided by an embodiment of the present invention.
- 16 is a schematic diagram of the vertices of the core coding region in a two-dimensional code provided by an embodiment of the present invention.
- FIG. 17 is a schematic structural diagram of a two-dimensional code encoding device provided by an embodiment of the present invention.
- FIG. 18 is a schematic structural diagram of a two-dimensional code decoding device provided by an embodiment of the present invention.
- 200-two-dimensional code 210-core two-dimensional code area; 220-designated information bit; 230-detected information bit; 240-locator.
- the most commonly used numerical coding technology is the two-dimensional code, which has a wide range of applications and has good effects for many different codes and different amounts of data.
- the two-dimensional code due to the relatively fixed size of the two-dimensional code, it can hold a large amount of data, and there are many types of recognizable codes.
- the code type is single and the amount of data is small, the use of the two-dimensional code for identification will result in efficient information Lower, causing waste.
- the maximum allowable area is usually about 30% of the total area of the QR code, and the positioning pattern in the QR code cannot be blocked, resulting in a two-dimensional code. The code's ability to resist occlusion is poor.
- the embodiments of the present invention provide a two-dimensional code, a two-dimensional code encoding method, decoding method, device, and electronic system.
- the technology can be applied to scanning equipment, computers, mobile phones, cameras, tablet computers, and vehicle terminal equipment. And other equipment. This technology can be implemented by software and hardware, which will be described in the following embodiments.
- FIG. 1 an example electronic system 100 for implementing a two-dimensional code, a two-dimensional code encoding method, a decoding method, an apparatus, and an electronic system of an embodiment of the present invention will be described.
- the electronic system 100 includes one or more processing devices 102, one or more storage devices 104, an input device 106, an output device 108, and one or more image acquisition devices 110. These components are interconnected through the bus system 112 and/or other forms of connection mechanisms (not shown). It should be noted that the components and structure of the electronic system 100 shown in FIG. 1 are only exemplary and not restrictive, and the electronic system may also have other components and structures as required.
- the processing device 102 may be a gateway, or an intelligent terminal, or a device including a central processing unit (CPU) or other forms of processing units with data processing capabilities and/or instruction execution capabilities, and can be used for other devices in the electronic system 100.
- the data of the components are processed, and other components in the electronic system 100 can also be controlled to perform desired functions.
- the storage device 104 may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
- Volatile memory may include random access memory (RAM) and/or cache memory (cache), for example.
- the non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, and the like.
- One or more computer program instructions can be stored on the computer-readable storage medium, and the processing device 102 can run the program instructions to implement the client functions and/or other desired functions in the following embodiments of the present invention (implemented by the processing device). Function.
- Various application programs and various data such as various data used and/or generated by the application program, can also be stored in the computer-readable storage medium.
- the input device 106 may be a device used by the user to input instructions, and may include one or more of a keyboard, a mouse, a microphone, and a touch screen.
- the output device 108 may output various information (for example, images or sounds) to the outside (for example, a user), and may include one or more of a display, a speaker, and the like.
- the image acquisition device 110 may collect preview video frames or picture data (such as a picture to be recognized or a training picture), and store the collected preview video frames or image data in the storage device 104 for use by other components.
- preview video frames or picture data such as a picture to be recognized or a training picture
- each device in the exemplary electronic system used to implement the two-dimensional code, the two-dimensional code encoding method, the decoding method, the device, and the electronic system according to the embodiments of the present invention can be integrated or distributed, such as
- the processing device 102, the storage device 104, the input device 106, and the output device 108 are integrated in one body, and the image capture device 110 is set at a designated location where the picture can be captured.
- the electronic system can be implemented as an intelligent terminal such as a camera, a smart phone, a tablet computer, a computer, a vehicle-mounted terminal, and a video camera.
- the two-dimensional code 200 includes a plurality of core coding regions 210; the core coding region 210 includes designated information bits 220 and detection information bits 230; designated information bits 220 It includes the binary information corresponding to the preset original information; the detection information bit 230 includes the position information of the core coding area 210.
- the specified information bit can be the middle position of the core coding region, the detection information bit can be used to locate the position of the core coding region, the detection information bit can be at the edge position of the core coding region, and the coding information can be carried out according to actual needs.
- the main purpose of the design is to facilitate identification, locate the core area and decode the information of the area;
- the above-mentioned preset original information can be composed of digital information and letter information.
- the number information can be multiple digits, and the letter information can be one bit. , Such as 54281s, 345u, etc.; the above binary information can include "0" and "1", which can be obtained by converting the preset original information.
- this embodiment takes the two-dimensional code including four core coding regions, the designated information bit in each core coding region is the middle region, and the detection information bit is the edge region as an example, for description, in the two-dimensional code
- Each core coding area is the same.
- There are multiple information bits in the core coding area as shown in the small boxes shown in Figure 2.
- Each small box represents an information bit, which can display a binary information bit; the core coding area
- the number of information bits is not limited to the number shown in FIG. 2, and can be more or less, and can be set according to actual needs.
- the designated information bit in the figure can be the middle position of the core coding area.
- the small white box shown in Figure 2 can display the binary information corresponding to the preset original information; the detection information bit in the figure can be the edge of the core coding area.
- the location as shown in the small black shaded box in Figure 2, can display the location information of the core coding area.
- the core coding regions included in the two-dimensional code are not limited to the four shown in Figure 2, but can also be more or less; the shape of the core coding region is not limited to the square shown in the figure, but can also be It is rectangular, etc.; its arrangement is not limited to the arrangement shown in FIG. 2, it can be horizontal arrangement or vertical arrangement.
- the designated information bit and the detected information bit are not limited to the position shown in Figure 2, but can also be other positions in the core coding area, and the number of designated information bits and detected information bits is not limited to the number shown in Figure 2, and can be based on actual conditions. Need to be set.
- An embodiment of the present invention provides a two-dimensional code, the two-dimensional code includes a plurality of core coding regions, the core coding region includes designated information bits and detection information bits; wherein the designated information bits include preset original information corresponding to Binary information; the detection information bit includes the location information of the core coding area.
- the anti-blocking ability of the two-dimensional code is improved.
- the information bit size of each of the above-mentioned core coding regions is determined according to the data amount of the original information; the information bit size includes: the number of information bits included in the length of the core coding region, and the number of information bits included in the width of the core coding region.
- the data volume of the above-mentioned original information can be set according to the coding requirements, and the number of digits of the original information data can be set; for example, the original information specified by the code is five-digit information plus one letter information, and the letter information can only be s Or u, if the digital information of the original information is less than five digits, you can add zeros in front of the digital information to get a five-digit digital information, for example, the original information 345s, where the digital information is less than five digits, then complete , Get 00345s.
- the above-mentioned information bit size may include the length and width of the information bit of the core coding region. Specifically, before encoding, the number of information bits included in the length and width of the information bits in the core coding region of the corresponding two-dimensional code to be encoded can be determined according to the number of bits of the numeric information and letter information in the original information.
- the data amount of the binary information after the original information is converted into binary information can be determined according to the data amount of the original information; then based on the data amount of the binary information, the number of designated information bits in the core coding area can be determined; then, based on Specify the number of information bits and the shape of the preset core coding area to determine the number of detection information bits; when determining the number of detection information, you may also need to consider whether redundant information bits need to be reserved in the core coding area; and then according to the specified information
- the number of bits, the number of detected information bits, and the redundant information determine the length and width of the core coding area.
- the ultimate goal is to make the final determined core coding region information bit scale can accommodate the binary information corresponding to the above-mentioned original information, and at the same time, enable the detected information bit to maintain a certain shape and retain a certain number of redundant information bits, but
- the number of redundant information bits is limited. For example, only a few redundant information bits are provided to avoid too many redundant information bits, which may result in low information efficiency of the two-dimensional code.
- the information bit size of the core coding area is determined by the data amount of the original information, so that the size of the two-dimensional code is more flexible, and the information efficiency of the two-dimensional code is improved.
- multiple core coding regions are arranged according to preset positions; each core coding region is preset with a position identifier corresponding to the core coding region; the binary information displayed on the designated information bit in each core coding region is passed through the original information The position identifier corresponding to the core coding region is converted.
- the above-mentioned multiple core coding regions may be arranged in a horizontal or vertical position, or may be arranged in a preset shape according to the number of core coding regions.
- the above-mentioned position identifier may be index bit information.
- the position identifier can be set according to the number of core coding regions to distinguish the order of multiple core codes. For example, if there are four core coding regions, the value of the position identifier can be 0- 3, where 0 represents the first core coding region, 1 represents the second core coding region, 2 represents the third core coding region, and 3 represents the fourth core coding region.
- the location representation can be two information bits.
- the detection information bits include multiple information bits at the edge positions of the core coding region; the multiple information bits form a detection pattern with a preset shape.
- the above-mentioned multiple information bits can be one, two or more.
- the detection pattern of the above-mentioned preset shape can be a detection pattern composed of four non-adjacent vertex information bits in the rectangular core coding area, or it can be a continuous phase.
- the detection pattern can be anywhere on the edge of the core coding area, such as a solid L-shape in the lower left corner, and a black and white L-shape in the upper right corner.
- the black and white color can correspond to the "0" and "1" of the binary information, and the information with the binary information as "0" can be displayed as black, and the information with the binary information as "1" can be displayed as white.
- the detection pattern includes an "L"-shaped pattern; at least a part of the information bits in the plurality of information bits are located in the first edge row of the core coding area, and the information bits in the plurality of information bits except for at least a part of the information are located at the first edge.
- the row is adjacent to the first edge column.
- the first edge row may be the bottommost horizontal position of the core coding region, and the first edge column may be the leftmost vertical position adjacent to the first edge row. See a detection pattern shown in FIG. 3,
- the small black boxes in the figure represent seven information bits, of which four information bits are located on the first edge row of the core coding area, and three are located on the first edge column adjacent to the first edge row, forming an "L" ”Type detection pattern.
- FIG. 4 For another example, refer to another detection pattern shown in Figure 4.
- the small black squares in the figure represent 13 information bits, of which seven information bits are located on the first edge row of the core coding area, and six are located on the first edge row of the core coding area.
- An "L"-shaped detection pattern is formed on the first edge column adjacent to an edge row.
- the above-mentioned "L"-shaped detection pattern is not limited to the black form shown in Figures 3 and 4, it can also be black and white, and it is not limited to the position of the lower left corner shown in Figures 3 and 4, and can also be any one. The position of the vertex forms an "L"-shaped detection pattern.
- the detection information bits include two groups, namely a first group of detection information bits and a second group of detection information bits; at least a part of the detection information bits in the first group of detection information bits are located in the first edge row of the core coding region, except for at least a part Information bits other than information are located on the first edge column adjacent to the first edge row; at least a part of the information bits in the second group of detected information bits are located in the second edge row of the core coding area, and the information bits except at least part of the information are located On the second edge column adjacent to the second edge row; wherein the first edge row, the first edge column, the second edge row and the second edge column are connected in sequence.
- the first group of detected information bits can be a solid "L" pattern
- the second group of detected information bits can be a black and white "7" pattern.
- FIG. 5 Schematic diagram of the structure, the 13 small black boxes in the lower left corner of the figure represent the first group of detected information bits, and the 11 small black boxes in the upper right corner represent the second group of detected information bits.
- the first set of detection information bits is not limited to the black shown in Figure 5, but can also be black and white display colors.
- the second set of detection information bits is not limited to the black and white shown in Figure 5. The color can also be displayed in black.
- each information bit in the first group of detected information bits displays the same binary information; in the second group of detected information bits, adjacent information bits display different binary information.
- the same binary information mentioned above can be "0” or "1", and its corresponding display color can be black or gray and other colors; in the second group of detected information bits, adjacent information bits are displayed There are different binary information, which can be displayed in the order of "0” and “1", or displayed in the order of "1” and “0".
- the corresponding display colors of "0” and “1” can be displayed according to the specific Demand setting.
- the two-dimensional code also includes a locator 240; the locator 240 is used to: divide the two-dimensional code into multiple target areas; each target area includes one or more core codes in the multiple core code areas 210 Area 210.
- the above-mentioned locator can be a symbol of various shapes, such as a circle, a rectangle, etc.; the locator can be located between each core coding region in the image of the two-dimensional code, and can be smaller than the area of the core coding region;
- the number of locators can be one, two or more. If there is one locator in the QR code, the QR code can be divided into two target areas according to the locator. See the other one shown in Figure 6.
- the two-dimensional code has two core coding regions, and the middle position of the two core coding regions is a locator. According to the locator, the two core coding regions in the two-dimensional code can be identified.
- the two-dimensional code can also have four horizontally arranged core coding areas.
- the middle position of the four core coding areas is a locator.
- two target areas in the two-dimensional code can be identified.
- the target area includes two core coding areas.
- the number of the above-mentioned locators is not limited to one, and may also be two or more.
- the above-mentioned locator includes a plurality of; the locator is located at the vertex position of the target area; each target area includes one core coding area among the multiple core coding areas; the locator includes a Hough circle.
- the two-dimensional code includes four core coding areas, the number of locators is five, and the locator is a Hough circle as an example to illustrate the process of determining the target area in the two-dimensional code;
- each edge circle can form a circle with the center circle Vectors, so the two-dimensional code shown in Figure 8 can form multiple vectors, including: 12, 13, 14, 15; where the two vectors 12 and 14 are collinear vectors, and the two vectors 13 and 15 It is also a collinear vector;
- the target area in the QR code can be determined by two non-collinear vectors, for example, three circles 125 are detected, 12and 15can form a non-collinear vector, so it can be determined in the QR code The target area in the upper right corner; if other non-collinear vectors are detected, the target area corresponding to the non-collinear vector can also be determined.
- This embodiment provides a method for encoding a two-dimensional code, which is applied to the two-dimensional code of the foregoing embodiment; the two-dimensional code to be encoded includes a plurality of core coding regions; as shown in FIG. 8, the method includes the following step:
- Step S802 Convert the preset original information into binary information through a preset conversion method
- the above-mentioned preset conversion method may include a preset conversion bit number and a conversion algorithm. If the converted bit number is not enough for the preset bit number, a redundant bit can be added, and other information can be added to the redundant bit ;
- the conversion algorithm can be an information encoding method, through which the original information is converted into binary information. Specifically, the preset number of conversion bits can be determined according to the data volume of the original information, and the original information can be converted into binary information with a preset number of bits through a preset conversion algorithm.
- Step S804 According to the preset binary information display rule, the binary information is respectively displayed in the designated information bits in each core coding area to obtain the coded two-dimensional code; wherein, the core coding area also includes: In the process, the detection information bit of the position of the core coding region is detected.
- the foregoing preset binary information display rule may include a display mode, which may be a display color corresponding to the binary information, for example, 1 corresponds to white, 0 corresponds to black, and 1 corresponds to black, and 0 corresponds to white;
- the display colors are not limited to black and white, other colors can also be used, such as 1 corresponds to gray, 0 corresponds to yellow, and so on.
- the aforementioned preset binary information display rule may also include the arrangement of the information display, for example, the binary information is arranged in the form of zigzag, where the initial position of the arrangement can be multiple, and the arrangement direction can be vertical arrangement.
- the specified information bit can be the middle position of the core coding region
- the detection information bit can be used to locate the position of the core coding region
- the detection information bit can be at the edge position of the core coding region
- the coding information can be carried out according to actual needs.
- the main purpose of the design is to facilitate identification, locate the core area and decode the information of the area.
- the two-dimensional code to be encoded includes a plurality of core coding regions, and the original information is converted into binary information through a preset conversion method; and the binary information is displayed separately
- the designated information bits in each core coding area and the detection information bits for detecting the position of the core coding area will be displayed as the designated information bits in each core coding area.
- the above method further includes: determining the information bit size of the core coding region in the two-dimensional code to be coded according to the data amount of the preset original information.
- the above-mentioned preset original information may be composed of digital information and letter information.
- the digital information may be multiple digits, and the letter information may be one digit, such as 54281s, 345u, etc.; the data of the above-mentioned preset original information
- the amount can be set according to the needs of the encoding, and the number of digits of the original information data can be set; for example, the original information specified by the encoding is five digits plus one letter information, and the letter information can only be s or u.
- the above-mentioned two-dimensional code to be coded may include multiple core coding regions, which are the core regions of the two-dimensional code to be coded, and do not contain any information before being coded.
- the aforementioned information bit size may include the length and width of the information bit of the core coding region. Specifically, before encoding, the length and width of the information bits in the core encoding region of the corresponding two-dimensional code to be encoded can be determined according to the number of digits in the original information and the number of letter information.
- the information bit size of the core coding area is determined by the data amount of the original information, which makes the size of the two-dimensional code more flexible and improves the information efficiency of the two-dimensional code.
- This embodiment provides another two-dimensional code encoding method, which is implemented on the basis of the above-mentioned embodiment; wherein, the above-mentioned information bit scale includes: the number of information bits included in the length of the core coding region, and the size of the core coding region The number of information bits included in the width; based on this, this embodiment focuses on the specific implementation process of determining the information bit size of the core coding region in the two-dimensional code to be encoded according to the preset data amount of the original information (through steps S902-S904 Realization); As shown in Figure 9, the method includes the following steps:
- Step S902 according to the preset data amount of the original information, determine the number of first information bits in the core coding area that need to display the binary information associated with the original information, and for detecting the position of the core coding area during the decoding process The number of second information bits of the detected information bits;
- the above-mentioned binary information associated with the original information may include the original information itself, an index bit, and a redundant bit for byte alignment, where the index bit may be used to indicate the current binary information, which core coding area should be written into . Therefore, the above-mentioned number of first information bits may include binary information bits, index bits, and redundant bits corresponding to the original information, where the index bits may be two bits, and the number of redundant bits can be set according to actual coding requirements.
- the detection information bits mentioned above may be at the edge positions of the core coding area, and the number of them may be determined according to the number of the first information bits.
- the number of first information bits is 72 bits
- the number of second information bits can include, 21 bits of information can be used as a fixed L-shaped black frame for detection, and 19 bits of information can be used as a fixed black and white frame.
- Step S904 Determine the information bit size of the core coding region according to the first information bit quantity and the second information bit quantity;
- the above-mentioned core coding region can first determine the shape of the region, which can be a square or a rectangle with a specified shape; in addition, the size of the core coding region should not be too large relative to the data volume of the original information. Large, it can be that the area is filled with necessary data information such as binary information corresponding to the original information, area location information, detection information, etc., and then filled with a small amount of redundant bits to fill the core coding area.
- the shape of the core coding region can be determined first, and the information bit size can be determined according to the total number of the first information bit quantity and the second information bit quantity to determine the specific width and height.
- the number of first information bits can be arranged according to the shape of the region, and the second number of information bits can be arranged at the detection position of the region, and the size of the information bits can be determined according to the shape and size of the final arrangement.
- Step S906 Convert the original information into binary information through a preset conversion method
- step S908 according to the preset binary information display rule, the binary information is respectively displayed in the designated information bits in each core encoding area to obtain the encoded two-dimensional code; wherein, the core encoding area also includes: In the process, the detection information bit of the position of the core coding region is detected.
- This embodiment provides another two-dimensional code encoding method.
- the second information bit quantity of the detected information bit is detected at the position of the core coding region; the information bit size of the core coding region is determined according to the first information bit quantity and the second information bit quantity.
- the information bit size of the core coding area is set through the original information and the detected information bits.
- This embodiment provides another two-dimensional code encoding method, which is implemented on the basis of the above-mentioned embodiment; this embodiment focuses on the conversion of preset original information into binary information and the conversion of preset original information through a preset conversion method.
- the specific implementation process of the binary information respectively displayed in the designated information bits in each core coding area (implemented through steps S1006-S1008); as shown in Figure 10, the method includes the following steps:
- Step S1002 according to the preset data amount of the original information, determine the number of first information bits in the core coding area that need to display the binary information associated with the original information, and the number of bits used to detect the position of the core coding area during the decoding process. Detecting the second information bit quantity of the information bit;
- Step S1004 Determine the information bit size of the core coding region according to the number of first information bits and the number of second information bits;
- Step S1006 for each core coding region, set the position identifier of the core coding region in the two-dimensional code to be encoded; the original information and the position identifier are converted into binary information through a preset conversion method to obtain the corresponding core coding region Binary information;
- the above-mentioned location identifier can correspond to the information of the aforementioned index bit.
- the location identifier can be set according to the number of core coding regions to distinguish the order of multiple core codes. For example, if there are four core coding regions, the value of the location identifier can be 0-3, where 0 means the first core coding region, 1 means the second core coding region, 2 means the third core coding region, and 3 means the fourth core coding region.
- the location representation can be two information bits.
- Step S1102 Convert the original information and the location identifier into initial information in binary form
- the foregoing binary format can be converted from decimal to binary to convert the original information and location identifiers into initial information in binary format.
- the step of converting the original information and the location identifier into the initial information in binary form specifically includes: converting the original information into the original information in binary form; converting the location identifier into the location identifier in binary form; and converting the original information in binary form ,
- the position identification in binary form, and the redundant information of the preset number of bits are determined as initial information in binary form.
- the specific number of bits in the original information of the binary information can be determined according to the value range of the original information; if the range is small, the number of bits required is relatively small; similarly, the position identification in the binary form can also be based on the position identification
- the value range is determined. If the range is small, the number of bits required is relatively small; the redundant information of the preset number of bits can be set to "0", and the number of bits can be based on the total number of bits in the core area and the number of bits in the original information.
- the digits of the number and position identification are calculated in advance. Specifically, the bytes can be set. Each byte includes multiple digits. For example, a byte includes 8 digits.
- the number of digits for the above redundant information can be According to the total number of digits of the original information and the total number of digits of the position identification, the redundant information of the corresponding digits is set, so that the sum of each digit can be guaranteed to be an integer number of bytes; it can also be said that the number of redundant information
- the main purpose of the number is to align the bytes, and information can be added later.
- the original information is five-digit information and one-letter information, that is, "67854s"; the first five digits "67854" of the original information can be extracted as the identity identifier, and the letter s can be extracted as the marking information.
- the set rule can be set to "1"; in addition, the location identifier can be set to "0”; the decimal to binary format can be used to convert "67854" to binary form "10000100100001110", which can also become ID information.
- Add the mark information "1" corresponding to s which can also be called Mark information, and obtain the original information "100001001000011101" in the form of 17-bit binary, which can also become ID information; convert the position identification "0" into binary form to obtain the binary form
- the position identifier "00" of the binary format can also be used as Index information.
- the number of bits of the position identifier in binary form can be set according to preset rules; in addition, the redundant information of the preset number of bits can be set to four digits, that is, "0000” .
- the binary form of the original information "100001001000011101", the binary form of position identification "00”, and the preset number of redundant information "0000” are spliced in order to obtain the binary form of initial information as "100001001000011101000000".
- the information of the initial information is 24 bits. If four bits of redundant information are not added, the initial information is 20 bits. If one byte is set as an 8-bit binary number, in order to obtain the number of bytes of an integer , You can set the number of redundant information to four digits.
- step S1104 the initial information is encoded by a preset Reed-solomon encoding algorithm to obtain encoded information
- the above-mentioned Reed-solomon coding algorithm is an error correction code algorithm, and the function of the error correction code can be realized by using the characteristics of the Vantermont matrix or the Cauchy matrix.
- the initial information can be processed in a matrix operation to obtain the check data.
- the redundant check data the recoverability of the original information can be ensured, and the coded information can be obtained.
- the coded information may be 6-byte, 48-bit coded information.
- Step S1106 Determine the initial information and the coded information as binary information.
- the foregoing initial information may be 24-bit binary information
- the foregoing encoded information may be 48-bit
- the foregoing binary information may be obtained by addition
- the binary information may be 72-bit binary information.
- Step S1008 For each core coding region, the binary information corresponding to the core coding region is displayed in the designated information bit in the core coding region to obtain the encoded two-dimensional code.
- the binary information corresponding to the core coding region should be displayed in which core coding region, which can be determined by the position mark information in the binary information; the specified information bit includes the binary information corresponding to the initial information.
- the position also includes the position of the binary information corresponding to the detected information bit; specifically, the position of the binary information corresponding to the initial information can be in the middle of the core coding area, and the position of the binary information corresponding to the detected information bit can be at the edge of the core coding area.
- Location may include a plurality of core coding regions, and the arrangement order of the two core coding regions may be various. For example, two core coding regions may be arranged vertically or horizontally in the two-dimensional code.
- each core coding region can be accurately identified; through a preset conversion method, the original information and location identifiers are converted into binary information to obtain the corresponding core coding region.
- Binary information for each core coding region, the binary information corresponding to the core coding region is displayed in the designated information bits in the core coding region to obtain the encoded two-dimensional code.
- the information efficiency is improved, waste is avoided, and the anti-blocking ability of the two-dimensional code is improved.
- Embodiment 6 is a diagrammatic representation of Embodiment 6
- This embodiment provides a method for decoding a two-dimensional code, which is applied to the two-dimensional code of the second embodiment; the two-dimensional code to be decoded includes multiple core coding regions; the method is implemented on the basis of the above-mentioned embodiment , The decoded two-dimensional code corresponds to the two-dimensional code determined by the method in the foregoing embodiment; as shown in FIG. 12, the method includes the following steps:
- Step S1202 detecting the detection information bits in the two-dimensional code from the image containing the two-dimensional code
- the above-mentioned two-dimensional code is obtained by the encoding method of the foregoing embodiment.
- devices with camera and calculation functions such as mobile phones and computers, can be used to scan the image of the two-dimensional code, which can be identified by means of straight line detection, positioning, etc.
- the detection information bit in the QR code is obtained by the encoding method of the foregoing embodiment.
- Step S1204 Determine the core coding area in the two-dimensional code according to the detected detection information bits
- the core coding area corresponding to the detection information bit can be extracted by intercepting, and then the core code in the two-dimensional code can be determined area.
- Step S1206 Decode the binary information displayed on the designated information bit in the core coding area to obtain the original information corresponding to the binary information.
- the image containing the core coding region may be processed, so that the image can more clearly display the binary information displayed on the designated information bit in the core coding region.
- the binary information displayed on the designated information bit in the core encoding area is decoded to obtain the original information corresponding to the binary information.
- the detection information bits in the two-dimensional code are detected from the image containing the two-dimensional code; the core coding area in the two-dimensional code is determined according to the detected detection information bits; in the decoding core coding area, the specified information bit Obtain the original information corresponding to the binary information from the binary information displayed on the display, and decode the two-dimensional code.
- the decoding results show that under the 4*4 coding conditions, the theoretical maximum occluded area reaches 319.8%, with a core coding area as a unit, and the actual maximum occluded area is slightly larger than the theoretical value, far exceeding the current two-dimensional code The anti-occlusion ability.
- This embodiment provides another two-dimensional code decoding method, which is implemented on the basis of the above-mentioned embodiment, wherein the above-mentioned two-dimensional code further includes a plurality of locators; the locator is used to: Divided into multiple target areas; each target area includes a core coding area; based on this, this embodiment focuses on the specific implementation process of detecting the detection information bits in the two-dimensional code from the image containing the two-dimensional code (through Steps S1302-S1306), as shown in Figure 13, the method includes the following steps:
- Step S1302 detecting the locator from the image containing the two-dimensional code
- the above-mentioned locator can be a symbol of various shapes, such as a circle, a rectangle, etc.; the locator can be located between each core coding region in the image of the two-dimensional code, and can be smaller than the area of the core coding region;
- the embodiment takes the Hough circle as the locator as an example. For example, there are four core coding areas in the two-dimensional code, and there can be five locating circles.
- the QR code may not be scanned into the device, for example, only half of the QR code image is scanned. Therefore, the location circle detected in the image containing the QR code may not be five, and the QR code needs to be obtained by scanning. The image is ok.
- the position and coordinates of the locator can be obtained through a detection algorithm.
- a detection algorithm For example, if the locator in the above two-dimensional code is a Hough circle layout, Hough circle detection can be used to obtain the position and coordinates of the locating circle.
- Step S1304 Determine the target area in the QR code through the detected locator
- the locator detected by the Hough circle that is, the position and coordinates of the center of the circle, can determine the target area in the two-dimensional code according to the positions and coordinates of multiple circle centers.
- the step of determining the target area in the two-dimensional code through the detected locators specifically includes: determining the number and relative positions of the detected locators; determining the two-dimensional based on the number and relative positions of the locators The target area in the code.
- the above-mentioned relative position may be the position and coordinates of the designated position symbol, and the above-mentioned target area may be the core coding area of the two-dimensional code; in this embodiment, the two-dimensional code includes four core coding areas, and the number of locators is five.
- the circles 2345 in the remaining four positions are edge circles; each edge circle can form a vector with the center circle, so the two-dimensional code shown in Figure 8 can form multiple vectors, including: 12, 13, 14 , 15; Among them, the two vectors 12 and 14 are collinear vectors, and the two vectors 13 and 15 are also collinear vectors; the target area in the QR code can be determined by two non-collinear vectors, for example, detection 125Three circles, 12and 15can form a non-collinear vector, so the target area in the upper right corner of the QR code can be determined; if other non-collinear vectors are detected, the corresponding non-collinear vector can also be determined target area.
- the number of locators detected above can include multiple situations, and different processing logics can be set according to different situations.
- the locator is a Hough circle as an example, Explain the processing logic of the center circle and the edge circle of different numbers of locators:
- Case 1 If there is misrecognition, etc., other images are mistakenly recognized as locators. When the detected locators are greater than five, the center circle can be determined first. If there is a distance from all other circles, the average coordinate is less than the first preset Threshold circle, you can determine it as the center circle; if there is no other circle whose average coordinates are less than the first preset threshold, you can take the average coordinates as the coordinates of the center circle; filter the remaining circle distance from the center circle For a circle smaller than the second threshold, the circle can be determined as a misrecognized circle, and the remaining circles can be determined as edge circles.
- Case 2 If there are occlusions, etc., the detected locators will be less than five; the case of four or more is the same as the processing method of the above case 1; in the case of three, if the center circle does not exist, it will not Form a non-collinear vector, therefore, only deal with the existence of the central circle, determine the intersection of the shortest two sides as the central circle, or calculate the sum of the distances between each circle and other circles, and the smallest corresponding circle as the central circle, and the rest of the circles The edges are rounded.
- the position of each circle is determined, and the non-collinear vectors can be filtered out by using the determined center circle and edge circle; because there may be a certain angle of rotation when scanning the two-dimensional code image, the non-collinear vectors can be filtered out.
- the collinear vector calculates the orthogonality, rotates in the counterclockwise direction, removes the rotation angle, makes the target area straight, and finally determines the target area in the QR code.
- the target area can be one or more.
- the number of line vectors is determined.
- the present invention does not limit the number of core coding regions in the two-dimensional code. It can be four, two or three regions arranged side by side, etc.; the arrangement of multiple regions is also not limited, and it can be arranged horizontally. , It can also be arranged vertically, or arranged in various other forms.
- Step S1306 detecting the detection information bit in the two-dimensional code from the target area
- the detection information bits mentioned above can be in various shapes, such as L-shaped, square solid lines, or L-shaped, square black and white lines, etc.; therefore, for different detection information bits, two detection methods can be used to detect them.
- the detection information bit in the dimension code.
- the above-mentioned detection information bits constitute a detection pattern of a preset shape; the edge of the detection pattern includes a straight line segment whose length meets the preset length range;
- the shape of the above-mentioned detection pattern can be a solid L-shape or a black-and-white L-shape; when detecting the detection information bits in the two-dimensional code, only one detection pattern can be used; or one detection pattern can be used for detection. Another detection pattern assists in positioning the positioning point, for example, using a solid L-shape for detection, and another black-and-white L-shape assists in positioning the positioning point.
- the positioning point can be a point in a black-and-white L-shaped pattern. There are multiple, which can be set according to the actual shape of the detection pattern. The aforementioned preset length can be set according to the shape and size of the actual detection pattern.
- the method includes the following steps:
- Step S1401 detecting a straight line segment from the target area through a preset straight line segment detection algorithm
- the above-mentioned preset line segment detection algorithm can be LSD (Line Segment Detector, line segment detection algorithm) line detection and other methods. Since the detected object is an image of the target area, the grayscale image of the image can be input to the LSD line detection In the algorithm, the local straight contours in the image can be detected.
- LSD Line Segment Detector, line segment detection algorithm
- Step S1402 from the detected linear segments, delete the linear segments whose length is less than the minimum value in the length range, and/or delete the linear segments whose length is greater than the maximum value in the length range;
- the detected linear segments may have multiple different lengths, and the minimum value in the length range and the maximum value in the length range can be set according to the size of the information bits of the target area in the actual two-dimensional code. For example, if the information in the target area image is encoded in black and white, multiple straight line segments can be detected in black and white; if the detected straight line segments only have the smallest value in the range of length , You can delete the line segment whose length is less than the minimum value in the length range; if there are only line segments greater than the maximum value in the length range in the detected line segment, you can delete the line segment whose length is greater than the maximum value in the length range ; If there is a line segment less than the minimum value in the length range and a line segment greater than the maximum value in the length range in the detected straight line segment, you can delete the straight line segment whose length is less than the minimum value in the length range, and delete the length at the same time A straight line segment greater than the maximum value in the length range.
- Step S1403 Determine the detection information bit in the two-dimensional code according to the remaining straight line segments in the target area.
- the above-mentioned remaining straight line segments can be the straight line segments corresponding to the detection information bits, and the straight line segments can be the shape of the detection pattern composed of the detection information bits.
- the detection pattern is L-shaped
- the detected straight line segments can form an L-shaped ;
- the position of the detected straight line segment can be marked in the target area, and the detection information bit in the two-dimensional code can be determined according to the position.
- Step S1308 Determine the core coding area in the two-dimensional code according to the detected detection information bits
- Step S1310 Decode the binary information displayed on the designated information bit in the core coding area to obtain the original information corresponding to the binary information.
- the above step of detecting the detection information bits in the two-dimensional code from the image containing the two-dimensional code includes: detecting the two-dimensional code from the image containing the two-dimensional code through a preset ROI region detection model The target area; the detection information bits in the two-dimensional code are detected from the target area.
- the two-dimensional code of this detection method multiple core coding regions can be directly placed in the figure, without adding other components, and without setting locators, directly using the area detection method to detect all the detection information bits in the two-dimensional code.
- the aforementioned ROI (Regions Of Interest, region of interest) region detection model can extract a rough target region in the two-dimensional code image to be detected, and the target region can include all the core coding regions in the two-dimensional code, and then It can narrow the range of straight line extraction, reduce the amount of calculation, and improve the detection speed and detection accuracy.
- the foregoing process of detecting the detection information bit in the two-dimensional code from the target area is the same as the technical method described in step S1306 in this embodiment, and the technical effect achieved is also the same, and will not be repeated here.
- Embodiment 8 is a diagrammatic representation of Embodiment 8
- This embodiment provides another two-dimensional code decoding method, which is implemented on the basis of the above-mentioned embodiment; this embodiment focuses on determining the specific core coding area in the two-dimensional code based on the detected detection information bits.
- the implementation process (implemented through steps S1508-S1510) and the specific implementation process (implemented through step 1512) of the original information corresponding to the binary information by specifying the binary information displayed on the information bit in the decoding core coding area; as shown in Figure 15,
- the method includes the following steps:
- Step S1502 detecting the locator from the image containing the two-dimensional code
- Step S1504 Determine the target area in the QR code through the detected locator
- Step S1506 detecting the detection information bits in the two-dimensional code from the target area
- Step S1508 Determine multiple vertices of the core coding region in the two-dimensional code according to the detected detection information bits
- multiple key points can be determined according to the endpoints of the straight line segments corresponding to the detected detection information bits.
- FIG. 16 Referring to the structural schematic diagram of the vertices of the core coding region in a two-dimensional code shown in Figure 16, three straight line segments are detected. The three end points of the two outermost straight line segments are determined as vertices, corresponding to points 1, 2 and 3 in the figure. The position of point 4 can be determined according to the abscissa of point 1 and the ordinate of point 3 in the figure. Point 2, point 3, and point 4 can be determined as the three vertices of the core coding region in the two-dimensional code.
- the result detected by the straight line detection method may have an inaccurate offset, which may cause the position of point 4 in Figure 16 to be inaccurate.
- the positions of the aforementioned three vertices can be disturbed. That is, it is repeated multiple times to translate multiple pixels up, down, left, and right, for example, four times to move four pixels up, down, left, and right to make the positioning point more accurate.
- Step S1510 connecting adjacent vertices among the multiple vertices through line segments, and determining the area enclosed by the line segment as the core coding area in the two-dimensional code;
- connecting point 2 and point 3, and point 3 and point 4 can form an area, which can be determined as the core coding area in the two-dimensional code.
- each vertices can be determined for the straight line segment corresponding to each group of detected information bits, and adjacent vertices can be connected.
- step S1512 the binary information displayed on the designated information bit in the core encoding area is decoded into the original information through the conversion method and the binary information display rule used in the encoding process.
- the area formed by the connection may be a rectangle, or it may not be a rectangle, such as a parallelogram, etc.; the quadrilateral formed by multiple vertices can be imitated with the rectangle. Transformation processing.
- the image of the core coding area of the final two-dimensional code needs to be the same as the position of each information in the core coding area during encoding, for example, the image in the core encoding area during encoding
- the L-shaped detection information is in the lower left corner of the area, and the L-shaped detection information in the final core coding area image is in the upper left corner of the area. At this time, the image can be corrected so that the L-shaped detection information bit is shifted to the lower left of the area. Horn.
- the image of the above-mentioned core coding area is a grayscale image obtained by scanning
- the image can be subjected to adaptive binarization processing, so that the grayscale image becomes a black and white image.
- the information in the core coding area of the binary image is decoded.
- the black block is binary in the decoding process.
- the white block is the 0 in the binary system, which is extracted sequentially in the form of zigzag, and the resulting binary array is used as the output of the entire detection process.
- the effective number of information bits in the core encoding area is 72 bits; specifically, the input value of the black and white image in the core encoding area can be decoded by the encoding program.
- the program can be reed-solomon in the open source library. First, it decodes the 72-bit encoding information into 24-bit information bits, and then uses the 1st to 17th bits of information as ID information according to the order in the encoding process. The 18-bit information is used as Mark information, and the 19th to 20th bits are used as Index information. Finally, the arranged information is output to complete the encoding process.
- the core coding area in the two-dimensional code is determined by setting the vertices and connecting the line segments, which improves the accuracy of the detection result, and further improves the efficiency and accuracy of decoding.
- this embodiment provides a two-dimensional code encoding device, which applies the two-dimensional code of the second embodiment; the two-dimensional code to be encoded includes multiple core coding regions; as shown in FIG. 17 As shown, the device includes:
- the information conversion module 171 is configured to convert preset original information into binary information through a preset conversion method
- the two-dimensional code determination module 172 is used to display the binary information in the designated information bits in each core encoding area according to the preset binary information display rules to obtain the encoded two-dimensional code; wherein, the core encoding area also Including: the detection information bit used to detect the position of the core coding area during the decoding process.
- the above-mentioned device further includes a scale determination module, which is used to determine the information bit scale of the core coding region in the two-dimensional code to be coded according to the preset data amount of the original information.
- the above-mentioned information bit scale includes: the number of information bits included in the length of the core coding region, and the number of information bits included in the width of the core coding region; the above-mentioned scale determining module is configured to: determine according to the preset data amount of the original information
- the core coding area needs to display the number of first information bits of the binary information associated with the original information, and the number of second information bits used to detect the position of the core coding area during the decoding process; according to the first information
- the number of bits and the number of second information bits determine the size of the information bits in the core coding area.
- the above-mentioned information conversion module is used to: for each core coding region, set the position identifier of the core coding region in the two-dimensional code to be encoded; and convert the original information and the position identifier into binary information through a preset conversion method , The binary information corresponding to the core coding area is obtained; the above-mentioned two-dimensional code determining module is used for: for each core coding area, the binary information corresponding to the core coding area is displayed in the designated information bit in the core coding area.
- the above-mentioned information conversion module is used to: convert the original information and location identifiers into initial information in binary form; use a preset Reed-solomon encoding algorithm to encode the initial information to obtain encoded information; The information is determined to be binary information.
- the above-mentioned information conversion module is used to: convert original information into binary form of original information; convert position identification into binary form of position identification; convert binary form of original information, binary form of position identification, and preset number of bits
- the redundant information is determined as the initial information in binary form.
- An encoding device for a two-dimensional code determines the information bit size of multiple core coding regions in the two-dimensional code to be encoded according to the preset data amount of original information; through a preset conversion method, Convert the original information into binary information; according to the preset binary information display rules, the binary information is displayed in the designated information bit in each core coding area, and the detection information bit that detects the position of the core coding area is displayed in each The designated information bits in the core coding area are used to obtain the coded two-dimensional code.
- the information bit size of the core coding area is determined by the data volume of the original information, which enriches the size of the two-dimensional code and makes it more flexible; by setting multiple core coding areas in the two-dimensional code, During the coding process, the information efficiency is improved, waste is avoided, and the anti-blocking ability of the two-dimensional code is improved.
- this embodiment provides a two-dimensional code decoding device, which applies the two-dimensional code of the second embodiment; the two-dimensional code to be encoded includes multiple core coding regions; as shown in FIG. 18 As shown, the device includes:
- the detection information bit detection module 181 is used to detect the detection information bit in the two-dimensional code from the image containing the two-dimensional code;
- the core coding region determining module 182 is configured to determine the core coding region in the two-dimensional code according to the detected detection information bits;
- the two-dimensional code decoding module 183 is used to decode the binary information displayed on the designated information bit in the core coding area to obtain the original information corresponding to the binary information.
- the above-mentioned two-dimensional code also includes a plurality of locators; the locator is used to: divide the two-dimensional code into a plurality of target areas; each target area includes a core coding area; the above-mentioned detection information bit detection module is used for : Detect the locator from the image containing the two-dimensional code; determine the target area in the two-dimensional code through the detected locator; detect the detection information bit in the two-dimensional code from the target area.
- the above-mentioned detection information bit detection module is used to: determine the number and relative positions of the detected locators; and determine the target area in the two-dimensional code according to the number and relative positions of the locators.
- the above-mentioned detection information bit detection module is used to: detect the target area containing the two-dimensional code from the image containing the two-dimensional code through a preset ROI area detection model; and detect the target area in the two-dimensional code from the target area Check the information bit.
- the detection information bits constitute a detection pattern with a preset shape; the edge of the detection pattern includes a straight line segment whose length meets the preset length range; the detection information bit detection module is used to: Detect straight-line segments in the target area; from the detected straight-line segments, delete the straight-line segments whose length is less than the minimum value in the length range, and/or delete the straight-line segments whose length is greater than the maximum value in the length range; according to the remaining in the target area The straight line segment to determine the detection information bit in the two-dimensional code.
- the above-mentioned core coding region determination module is used for: determining multiple vertices of the core coding region in the two-dimensional code according to the detected detection information bits; connecting adjacent vertices of the multiple vertices by line segments, and enclosing the line segments The area is determined as the core coding area in the QR code.
- the above-mentioned core coding region determination module is used to: if multiple groups of detection information bits are detected, for each group of detection information bits, connect multiple vertices corresponding to the group of detection information bits through line segments.
- the above-mentioned two-dimensional code decoding module is used to decode the binary information displayed on the designated information bit in the core coding area into the original information through the conversion method and the binary information display rule used in the encoding process.
- An embodiment of the present invention provides a two-dimensional code decoding device, which detects the detection information bits in the two-dimensional code from an image containing the two-dimensional code; and determines the core code in the two-dimensional code according to the detected detection information bits Area: decode the binary information displayed on the designated information bit in the core coding area to obtain the original information corresponding to the binary information, and decode the two-dimensional code.
- the decoding results show that under the 4*4 coding conditions, the theoretical maximum occluded area reaches 319.8%, with a core coding area as a unit, and the actual maximum occluded area is slightly larger than the theoretical value, far exceeding the current two-dimensional code The anti-occlusion ability.
- Embodiment 11 is a diagrammatic representation of Embodiment 11:
- the embodiment of the present invention provides an electronic system, the electronic system includes: image acquisition equipment, processing equipment and storage device; image acquisition equipment for obtaining preview video frames or image data; storage device stored with computer programs, computer programs
- the steps of the above-mentioned two-dimensional code encoding method or the above-mentioned two-dimensional code encoding method are executed when the processed device is running.
- the embodiment of the present invention also provides a computer-readable storage medium, and a computer program is stored on the computer-readable storage medium.
- a computer program is stored on the computer-readable storage medium.
- the encoding method such as the above-mentioned two-dimensional code or the encoding of the two-dimensional code is executed. Method steps.
- the embodiment of the present invention also provides a computer program, including computer-readable code, when the computer-readable code runs on a processing device, it causes the processing device to execute the two-dimensional code encoding method described above, or the above two The steps of the encoding method of the dimension code.
- the two-dimensional code, the two-dimensional code encoding method, the decoding method, the device, and the computer program product of the electronic system provided by the embodiments of the present invention include a computer-readable storage medium storing a program code, and instructions included in the program code can be used for execution
- a computer-readable storage medium storing a program code
- instructions included in the program code can be used for execution
- the terms “installed”, “connected”, and “connected” should be understood in a broad sense, for example, they may be fixed connections or detachable connections. , Or integrally connected; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication between two components.
- installed e.g., they may be fixed connections or detachable connections. , Or integrally connected; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the internal communication between two components.
- the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
- the technical solution of the present invention essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present invention.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes. .
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
一种二维码(200)、二维码的编码方法、解码方法、装置和电子系统,该二维码(200)中包括多个核心编码区域(210),该核心编码区域(210)包括指定信息位(220)和检测信息位(230);其中的指定信息位(220)包括预设的原始信息对应的二进制信息;检测信息位(230)包括核心编码区域(210)的位置信息。该二维码(200)中,通过在二维码(200)中设置多个核心编码区域(210),提高了二维码(200)的抗遮挡能力。
Description
本申请要求在2020年01月16日提交中国专利局、申请号为202010049313.1、发明名称为“二维码、二维码的编码方法、解码方法、装置和电子系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本发明涉及二维码技术领域,尤其是涉及一种二维码、二维码的编码方法、解码方法、装置和电子系统。
二维码是常见的数值编码技术,应用非常广泛。二维码针对不同的编码算法、不同的数据量都有较好的识别效果。相关技术中的二维码,通常采用尺寸相对固定的矩阵实现,如21*21大小的矩阵、25*25大小的矩阵、29*29大小的矩阵等;矩阵中通常包括功能性数据、数据码和纠错码等区域。
发明内容
本发明的目的在于提供一种二维码、二维码的编码方法、解码方法、装置和电子系统,以提高二维码的信息有效率,提高二维码的抗遮挡能力。
第一方面,本发明实施例提供了一种二维码,该二维码包括多个核心编码区域;该核心编码区域包括指定信息位和检测信息位;其中,指定信息位包括预设的原始信息对应的二进制信息;检测信息位包括核心编码区域的位置信息。
进一步的,每个核心编码区域的信息位尺度,根据原始信息的数据量确定;信息位尺度包括:核心编码区域的长度包括的信息位数量,以及核心编码区域的宽度包括的信息位数量。
进一步的,多个核心编码区域按照预设位置排列;每个核心编码区域预设有该核心编码区域对应的位置标识;每个核心编码区域中的指定信息位上显示的二进制信息,通过原始信息和该核心编码区域对应的位置标识转换得到。
进一步的,检测信息位包括核心编码区域的边缘位置上的多个信息位;多个信息位组成预设形状的检测图案。
进一步的,检测图案包括“L”型图案;多个信息位中的至少一部分信息位位于核心编码区域的第一边缘行,多个信息位中除至少一部分信息以外的信息位位于与第一边缘行相邻的第一边缘列上。
进一步的,检测信息位包括两组,分别为第一组检测信息位和第二组检测信息位;第一组检测信息位中至少一部分信息位位于核心编码区域的第一边缘行,除至少一部分信息以外的信息位位于与第一边缘行相邻的第一边缘列上;
进一步的,第二组检测信息位中至少一部分信息位位于核心编码区域的第二边缘行,除至少一部分信息以外的信息位位于与第二边缘行相邻的第二边缘列上;其中,第一边缘行、第一边缘列、第二边缘行和第二边缘列依次连接。
进一步的,第一组检测信息位中的每个信息位上显示有相同的二进制信息;第二组检测信息位中,相邻的信息位显示有不同的二进制信息。
进一步的,二维码中还包括定位符;该定位符用于:将二维码划分为多个目标区域;每个目标区域中包括多个核心编码区域中的一个或多个核心编码区域。
进一步的,定位符包括多个;定位符位于目标区域的顶点位置;每个目标区域中包括多个核心编码区域中的一个核心编码区域。
进一步的,定位符包括霍夫圆。
第二方面,本发明实施例提供了一种二维码的编码方法,该方法应用于第一方面的二维码;待编码的二维码中包括多个核心编码区域;该方法包括:通过预设的转换方式,将预设的原始信息转换为二进制信息;按照预设的二进制信息显示规则,将二进制信息分别显示在每个核心编码区域中的指定信息位,得到编码后的二维码;其中,核心编码区域中还包括:用于在解码过程中,检测核心编码区域的位置的检测信息位。
进一步的,将预设的原始信息转换为二进制信息的步骤之前,上述方法还包括:根据预设的原始信息的数据量,确定待编码的二维码中核心编码区域的信息位尺度。
进一步的,信息位尺度包括:核心编码区域的长度包括的信息位数量,以及核心编码区域的宽度包括的信息位数量;根据预设的原始信息的数据量,确定待编码二维码中核心编码区域的信息位尺度的步骤,包括:根据预设的原始信息的数据量,确定核心编码区域中需要显示与原始信息相关联的 二进制信息的第一信息位数量,以及用于在解码过程中,检测核心编码区域的位置的检测信息位的第二信息位数量;根据第一信息位数量和第二信息位数量,确定核心编码区域的信息位尺度。
进一步的,通过预设的转换方式,将原始信息转换为二进制信息的步骤,包括:针对每个核心编码区域,设置该核心编码区域在待编码二维码中的位置标识;通过预设的转换方式,将原始信息和位置标识转换为二进制信息,得到该核心编码区域对应的二进制信息;将二进制信息分别显示在每个核心编码区域中的指定信息位的步骤,包括:针对每个核心编码区域,将该核心编码区域对应的二进制信息显示在该核心编码区域中的指定信息位。
进一步的,通过预设的转换方式,将原始信息和位置标识转换为二进制信息的步骤,包括:将原始信息和位置标识转换为二进制形式的初始信息;通过预设的Reed-solomon编码算法,将初始信息进行编码处理,得到编码信息;将初始信息和编码信息确定为二进制信息。
进一步的,将原始信息和位置标识转换为二进制形式的初始信息的步骤,包括:将原始信息转换为二进制形式的原始信息;将位置标识转换为二进制形式的位置标识;将二进制形式的原始信息、二进制形式的位置标识、以及预设位数的冗余信息,确定为二进制形式的初始信息。
第三方面,本发明实施例提供了一种二维码的解码方法,该方法应用于第一方面的二维码;待编码的二维码中包括多个核心编码区域;该方法包括:从包含有二维码的图像中检测二维码中的检测信息位;根据检测到的检测信息位,确定二维码中的核心编码区域;解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息。
进一步的,二维码中还包括多个定位符;定位符用于:将二维码划分为多个目标区域;每个目标区域中包括一个核心编码区域;从包含有二维码的图像中检测二维码中的检测信息位的步骤,包括:从包含有二维码的图像中检测定位符;通过检测出的定位符,确定二维码中的目标区域;从目标区域中检测二维码中的检测信息位。
进一步的,通过检测出的定位符,确定二维码中的目标区域的步骤,包括:确定检测出的定位符的数量和相对位置;根据定位符的数量和相对位置,确定二维码中的目标区域。
进一步的,从包含有二维码的图像中检测二维码中的检测信息位的步骤,包括:通过预设的ROI区域检测模型,从包含有二维码的图像中检测包 含有二维码的目标区域;从目标区域中检测二维码中的检测信息位。
进一步的,检测信息位组成预设形状的检测图案;检测图案的边缘包括长度满足预设长度范围的直线段;从目标区域中检测二维码中的检测信息位的步骤,包括:通过预设的直线段检测算法,从目标区域中检测直线段;从检测到的直线段中,删除长度小于长度范围中的最小值的直线段,和/或,删除长度大于长度范围中的最大值的直线段;根据目标区域中剩余的直线段,确定二维码中的检测信息位。
进一步的,根据检测到的检测信息位,确定二维码中的核心编码区域的步骤,包括:根据检测到的检测信息位,确定二维码中的核心编码区域的多个顶点;通过线段连接多个顶点中相邻的顶点,将线段所包围的区域,确定为二维码中的核心编码区域。
进一步的,通过线段连接多个顶点中相邻的顶点的步骤,包括:如果检测到多组检测信息位,针对每组检测信息位,通过线段连接该组检测信息位对应的多个顶点。
进一步的,解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息的步骤,包括:通过在编码过程中使用的转换方式和二进制信息显示规则,将核心编码区域中,指定信息位上显示的二进制信息解码为原始信息。
第四方面,本发明实施例提供了一种二维码的编码装置,该装置应用于第一方面任一项的二维码;待编码的二维码中包括多个核心编码区域;该装置包括:信息转换模块,用于通过预设的转换方式,将预设的原始信息转换为二进制信息;二维码确定模块,用于按照预设的二进制信息显示规则,将二进制信息分别显示在每个核心编码区域中的指定信息位,得到编码后的二维码;其中,核心编码区域中还包括:用于在解码过程中,检测核心编码区域的位置的检测信息位。
第五方面,本发明实施例提供了一种二维码的解码装置,该装置应用于第一方面任一项的二维码;待编码的二维码中包括多个核心编码区域;该装置包括:检测信息位检测模块,用于从包含有二维码的图像中检测二维码中的检测信息位;核心编码区域确定模块,用于根据检测到的检测信息位,确定二维码中的核心编码区域;二维码解码模块,用于解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息。
第六方面,本发明实施例提供了一种电子系统,该电子系统包括:处理 设备和存储装置;存储装置上存储有计算机程序,计算机程序在被处理设备运行时执行如第二方面任一实施方式的二维码的编码方法或第三方面任一实施方式的二维码的解码方法。
第七方面,本发明实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,计算机程序被处理设备运行时执行如第二方面任一实施方式的二维码的编码方法的步骤或第三方面任一实施方式的二维码的解码方法的步骤。
本发明实施例带来了以下有益效果:
本发明实施例提供的一种二维码、二维码的编码方法、解码方法、装置和电子系统,该二维码中包括多个核心编码区域,该核心编码区域包括指定信息位和检测信息位;其中的指定信息位包括预设的原始信息对应的二进制信息;检测信息位包括核心编码区域的位置信息。该二维码中,通过在二维码中设置多个核心编码区域,提高了二维码的抗遮挡能力。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种电子系统的结构示意图;
图2为本发明实施例提供的一种二维码的结构示意图;
图3为本发明实施例提供的一种检测图案的结构示意图;
图4为本发明实施例提供的另一种检测图案的结构示意图;
图5为本发明实施例提供的另一种检测图案的结构示意图;
图6为本发明实施例提供的另一种二维码的结构示意图;
图7为本发明实施例提供的另一种二维码的结构示意图;
图8为本发明实施例提供的一种二维码的编码方法的流程图;
图9为本发明实施例提供的另一种二维码的编码方法的流程图;
图10为本发明实施例提供的另一种二维码的编码方法的流程图;
图11为本发明实施例提供的另一种二维码的编码方法的流程图;
图12为本发明实施例提供的一种二维码的解码方法的流程图;
图13为本发明实施例提供的另一种二维码的解码方法的流程图;
图14为本发明实施例提供的一种检测信息位的检测方法的流程图;
图15为本发明实施例提供的另一种二维码的解码方法的流程图;
图16为本发明实施例提供的一种二维码中核心编码区域顶点的示意图;
图17为本发明实施例提供的一种二维码的编码装置的结构示意图;
图18为本发明实施例提供的一种二维码的解码装置的结构示意图。
图标:
200-二维码;210-核心二维码区域;220-指定信息位;230-检测信息位;240-定位符。
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
目前使用的最多的数值编码技术为二维码,其应用非常广泛,针对很多不同的编码、不同的数据量效果都较好。但是由于二维码尺寸相对固定,其可容纳的数据量较大,可识别的编码类型较多,对于编码类型单一、数据量小的应用场景,使用该二维码进行识别会造成信息有效率较低,造成浪费。在一种实现方式中,为了保证二维码能够被正确识别,通常允许的最大可遮挡面积为二维码总面积的30%左右,且二维码中的定位图案不能被遮挡,导致二维码的抗遮挡能力较差。然而对于某些具体的应用环境,需要的编码类型比较单一、数据量也较小,并不需要储存那么大的信息量,造成浪费;同时,其理论最大可遮挡面积仅为30%,且不可遮挡定位点。基于此,本发明实施例提供了一种二维码、二维码的编码方法、解码方法、装置和电子系统,该技术可以应用于扫描设备、计算机、手机、摄像机、平板电脑、车辆终端设备等多种设备中。该技术可以采用关软件和硬件实现,下面通过实施例进行描述。
实施例一:
首先,参照图1来描述用于实现本发明实施例的二维码、二维码的编码方法、解码方法、装置和电子系统的示例电子系统100。
如图1所示的一种电子系统的结构示意图,电子系统100包括一个或多个处理设备102、一个或多个存储装置104、输入装置106、输出装置108以及一个或多个图像采集设备110,这些组件通过总线系统112和/或其它形式的连接机构(未示出)互连。应当注意,图1所示的电子系统100的组件和结构只是示例性的,而非限制性的,根据需要,电子系统也可以具有其他组件和结构。
处理设备102可以是网关,也可以为智能终端,或者是包含中央处理单元(CPU)或者具有数据处理能力和/或指令执行能力的其它形式的处理单元的设备,可以对电子系统100中的其它组件的数据进行处理,还可以控制电子系统100中的其它组件以执行期望的功能。
存储装置104可以包括一个或多个计算机程序产品,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失性存储器例如可以包括只读存储器(ROM)、硬盘、闪存等。在计算机可读存储介质上可以存储一个或多个计算机程序指令,处理设备102可以运行程序指令,以实现下文的本发明实施例中(由处理设备实现)的客户端功能以及/或者其它期望的功能。在计算机可读存储介质中还可以存储各种应用程序和各种数据,例如应用程序使用和/或产生的各种数据等。
输入装置106可以是用户用来输入指令的装置,并且可以包括键盘、鼠标、麦克风和触摸屏等中的一个或多个。
输出装置108可以向外部(例如,用户)输出各种信息(例如,图像或声音),并且可以包括显示器、扬声器等中的一个或多个。
图像采集设备110可以采集预览视频帧或图片数据(如待识别图片或训练图片),并且将采集到的预览视频帧或图像数据存储在存储装置104中以供其它组件使用。
示例性地,用于实现根据本发明实施例的二维码、二维码的编码方法、解码方法、装置和电子系统的示例电子系统中的各器件可以集成设置,也可以分散设置,诸如将处理设备102、存储装置104、输入装置106和输出装置108集成设置于一体,而将图像采集设备110设置于可以采集到图片的指 定位置。当上述电子系统中的各器件集成设置时,该电子系统可以被实现为诸如相机、智能手机、平板电脑、计算机、车载终端、摄像机等智能终端。
实施例二:
本实施例提供了一种二维码,如图2所示,该二维码200包括多个核心编码区域210;该核心编码区域210包括指定信息位220和检测信息位230;指定信息位220包括预设的原始信息对应的二进制信息;检测信息位230包括核心编码区域210的位置信息。
上述指定信息位可以是核心编码区域的中间位置,上述检测信息位可以用于定位核心编码区域的位置,该检测信息位可以是在核心编码区域的边缘位置,其中的编码信息可以根据实际需要进行设计,主要目的是便于识别,定位核心区域解码该区域的信息;上述预设的原始信息可以是由数字信息和字母信息组成,作为示例,数字信息可以是多位的,字母信息可以是一位的,比如,54281s、345u等;上述二进制信息可以包括“0”和“1”,可以通过预设的原始信息转换得到。
参见图2所示,本实施例以二维码包括四个核心编码区域,每个核心编码区域中的指定信息位为中间区域,检测信息位为边缘区域为例,进行说明,二维码中每个核心编码区域都是相同的,核心编码区域中有多个信息位,如图2所示的小方框,每个小方框代表一个信息位,可以显示一个二进制信息位;核心编码区域中信息位的数量不局限于图2所示的数量,也可以更多或者更少,可以根据实际需求进行设置。图中的指定信息位可以为核心编码区域中间位置,如图2所示的白色小方框,可以显示预设的原始信息对应的二进制信息;图中的检测信息位可以为核心编码区域的边缘位置,如图2所示的黑色阴影小方框,可以显示核心编码区域的位置信息。
需要说明的是,二维码包括的核心编码区域不仅限于图2中所示的四个,也可以是更多或者更少;核心编码区域的形状也不仅限于图中所示的正方形,也可以是矩形等;其排列的方式也不仅限于图2所示的排列方式,可以是横向排列,也可以是竖向排列。指定信息位和检测信息位也不仅限于图2所示的位置,也可以是核心编码区域的其他位置,且指定信息位和检测信息位的数量也不仅限于图2所示的数量,可以根据实际需求进行设置。
本发明实施例提供的一种二维码,该二维码中包括多个核心编码区域,该核心编码区域包括指定信息位和检测信息位;其中的指定信息位包括预设 的原始信息对应的二进制信息;检测信息位包括核心编码区域的位置信息。该二维码中,通过在二维码中设置多个核心编码区域,提高了二维码的抗遮挡能力。
进一步的,上述每个核心编码区域的信息位尺度,根据原始信息的数据量确定;信息位尺度包括:核心编码区域的长度包括的信息位数量,以及核心编码区域的宽度包括的信息位数量。
上述原始信息的数据量可以根据编码的需求设定,可以设定原始信息数据的位数;例如,编码规定的原始信息为五位数字信息加一位字母信息,其中的字母信息只能为s或者u,如果原始信息的数字信息不足五位数,则可以在数字信息前面用零补齐,得到一个五位的数字信息,比如,原始信息345s,其中的数字信息不足五位,进行补齐,得到00345s。上述信息位尺度可以包括核心编码区域信息位的长度和宽度。具体的,在进行编码之前可以根据原始信息中,数字信息和字母信息的位数,确定相应的待编码的二维码中核心编码区域的信息位的长度和宽度包括的信息位数量。
例如,可以根据原始信息的数据量,确定该原始信息转换成二进制信息后,该二进制信息的数据量;再基于该二进制信息的数据量,确定核心编码区域中指定信息位的数量;然后,基于指定信息位的数量以及预设的核心编码区域的形状,确定检测信息位的数量;在确定检测信息的数量时,可能还需要考虑核心编码区域中是否需要保留冗余信息位;进而根据指定信息位的数量、检测信息位的数量和冗余信息为确定核心编码区域的长度和宽度。最终目的是,使得最终确定的核心编码区域信息位尺度,能够容下上述原始信息对应的二进制信息、同时,使检测信息位能够保持一定的形状,还可以保留一定数量的冗余信息位,但冗余信息位的数量有限,比如仅设置数个冗余信息位,避免冗余信息位过多造成二维码的信息有效率较低。
上述方式中,核心编码区域的信息位尺度,通过原始信息的数据量确定,使得二维码的尺寸更加灵活,提高了二维码的信息有效率。
进一步的,多个核心编码区域按照预设位置排列;每个核心编码区域预设有该核心编码区域对应的位置标识;每个核心编码区域中的指定信息位上显示的二进制信息,通过原始信息和该核心编码区域对应的位置标识转换得到。
具体的,上述多个核心编码区域可以按照横向或者竖向的位置进行排列,也可以根据核心编码区域的数量,按照预设的形状进行排列。上述位置 标识可以是索引位信息,该位置标识可以根据核心编码区域的数量设置,用于区分多个核心编码的顺序,比如,核心编码区域有四个,则位置标识的取值可以是0-3,其中0表示第一个核心编码区域、1表示第二个核心编码区域、2表示第三个核心编码区域、3表示第四个核心编码区域。具体的,可以通过预设的转换方式,将原始信息和位置标识转换为二进制信息时,位置表示可以为两个信息位。
进一步的,检测信息位包括核心编码区域的边缘位置上的多个信息位;多个信息位组成预设形状的检测图案。
上述多个信息位可以是一个、两个或者更多,上述预设形状的检测图案,可以是矩形的核心编码区域中不相邻的四个顶点信息位组成的检测图案,也可以是连续相邻的多个信息位组成的检测图案,该检测图案可以在核心编码区域边缘的任何位置,比如,左下角的实线L型、右上角的黑白相间L型等。其中的黑白色可以与二进制信息的“0”、“1”相对应,可以将二进制信息为“0”的信息显示为黑色,二进制信息为“1”的信息显示为白色。
进一步的,检测图案包括“L”型图案;多个信息位中的至少一部分信息位位于核心编码区域的第一边缘行,多个信息位中除至少一部分信息以外的信息位位于与第一边缘行相邻的第一边缘列上。
上述第一边缘行可以是核心编码区域最底部的横向位置,上述第一边缘列可以是与第一边缘行相邻的最左侧的竖向位置,参见图3所示的一种检测图案,图中的黑色小方框表示七个信息位,其中四个信息位位于核心编码区域的第一边缘行,三个位于与第一边缘行相邻的第一边缘列上,形成了一个“L”型的检测图案。
另一种示例,参见图4所示的另一种检测图案,图中的黑色小方框表示13个信息位,其中七个信息位位于核心编码区域的第一边缘行,六个位于与第一边缘行相邻的第一边缘列上,形成了一个“L”型的检测图案。当然上述“L”型检测图案不仅限于图3和图4所示的黑色形式,也可以是黑白相间的形式,也不仅限于图3和图4所示的左下角的位置,也可以是任意一个顶点的位置形成的“L”型检测图案。
进一步的,检测信息位包括两组,分别为第一组检测信息位和第二组检测信息位;第一组检测信息位中至少一部分信息位位于核心编码区域的第一边缘行,除至少一部分信息以外的信息位位于与第一边缘行相邻的第一边缘列上;第二组检测信息位中至少一部分信息位位于核心编码区域的第二边缘 行,除至少一部分信息以外的信息位位于与第二边缘行相邻的第二边缘列上;其中,第一边缘行、第一边缘列、第二边缘行和第二边缘列依次连接。
上述第一组检测信息位可以是实线的“L”型图案,第二组检测信息位可以是黑白相间的“7”型图案,具体的,可以参见图5所示的另一种检测图案的结构示意图,图中左下角的13个黑色小方框表示第一组检测信息位,右上角的11个黑色小方框表示第二组检测信息位。需要说明的是,第一组检测信息位不仅限于图5所示的黑色,也可以是黑白相间的显示颜色等,同理,第二组检测信息位也不仅限于图5所示的黑白相间的颜色,也可以是黑色显示等。
进一步的,第一组检测信息位中的每个信息位上显示有相同的二进制信息;第二组检测信息位中,相邻的信息位显示有不同的二进制信息。
上述相同的二进制信息可以是“0”,也可以是“1”,其对应的显示颜色可以是黑色,也可以是灰色等其他颜色;上述第二组检测信息位中,相邻的信息位显示有不同的二进制信息,可以是按照“0”和“1”的顺序显示,也可以是按照“1”和“0”的顺序显示,其中“0”和“1”对应的显示颜色可以根据具体需求设定。
另外,二维码中还包括定位符240;该定位符240用于:将二维码划分为多个目标区域;每个目标区域中包括多个核心编码区域210中的一个或多个核心编码区域210。
上述定位符可以是各种形状的符号,比如,圆形,矩形等;该定位符可以在二维码的图像中每个核心编码区域之间的位置,可以比核心编码区域的面积小;上述定位符的数量可以是一个、两个或者多个,若二维码中有一个定位符,根据该定位符,可以将二维码划分为两个目标区域,参见图6所示的另一种二维码的结构示意图,该二维码中有两个核心编码区域,两个核心编码区域的中间位置为定位符,根据该定位符,可以识别出二维码中的两个核心编码区域。当然,该二维码中也可以有四个横向排列核心编码区域,四个核心编码区域的中间位置为定位符,根据该定位符,可以识别出二维码中的两个目标区域,每个目标区域中包括两个核心编码区域。另外,上述定位符的个数不仅限于一个,也可以是两个或者多个。
进一步的,上述定位符包括多个;定位符位于目标区域的顶点位置;每个目标区域中包括多个核心编码区域中的一个核心编码区域;定位符包括霍夫圆。
本实施例以二维码中包括四个核心编码区域,定位符的数量为五个,定位符为霍夫圆为例,说明确定二维码中的目标区域的过程;参见图7所示另一种二维码的结构示意图,该二维码中有五个圆,中间的圆①为中心圆,其余四个位置的圆②③④⑤为边缘圆;其中每个边缘圆都可以与中心圆组成一个向量,因此图8中所示的二维码,可以构成多个向量,可以包括:①②、①③、①④、①⑤;其中①②和①④这两个向量为共线向量、①③和①⑤这两个向量也为共线向量;二维码中的目标区域可以通过非共线的两个向量确定,比如,检测出①②⑤三个圆,①②和①⑤可以构成非共线向量,因此可以确定二维码中右上角的目标区域;若检测出的是其他非共线向量,同样可以确定该非共线向量对应的目标区域。
实施例三:
本实施例提供了一种二维码的编码方法,该方法应用于上述实施例的二维码;待编码的二维码中包括多个核心编码区域;如图8所示,该方法包括如下步骤:
步骤S802,通过预设的转换方式,将预设的原始信息转换为二进制信息;
上述预设的转换方式可以包括预设的转换位数,还可以包括转换算法,其中,如果转换后的位数不够预设的位数,可以添加冗余位,该冗余位中可以添加其他的信息;该转换算法可以是信息的编码方法,将原始信息通过该方法转换为二进制信息。具体的,可以根据原始信息的数据量,确定预设的转换位数,通过预设的转换算法,将原始信息转换为预设位数的二进制信息。
步骤S804,按照预设的二进制信息显示规则,将二进制信息分别显示在每个核心编码区域中的指定信息位,得到编码后的二维码;其中,核心编码区域中还包括:用于在解码过程中,检测核心编码区域的位置的检测信息位。
上述预设的二进制信息显示规则可以包括显示的方式,该显示方式可以是二进制信息对应的显示颜色,比如,1对应白色,0对应黑色,同样的也可以是1对应黑的,0对应白色;其中的显示颜色不仅限于黑色和白色,也可以用其他颜色,比如1对应灰色,0对应黄色等。另外,上述预设的二进制信息显示规则还可以包括信息显示的排列方式,比如,按照zigzag的形式对二进制信息进行排列,其中,排列的初始位置可以有多种,排列的方向可以是竖向排列,也可以是横向排列,也可以是之字形排列;当然也可以不采 用zigzag方法,比如,点阵排列的方式等。上述指定信息位可以是核心编码区域的中间位置,上述检测信息位可以用于定位核心编码区域的位置,该检测信息位可以是在核心编码区域的边缘位置,其中的编码信息可以根据实际需要进行设计,主要目的是便于识别,定位核心区域解码该区域的信息。
本发明实施例提供的一种二维码的编码方法,待编码的二维码中包括多个核心编码区域,通过预设的转换方式,将原始信息转换为二进制信息;进而将二进制信息分别显示在每个核心编码区域中的指定信息位,同时将检测核心编码区域的位置的检测信息位,显示在每个核心编码区域中的指定信息位。该方式中,通过在二维码中设置多个核心编码区域,提高了二维码的抗遮挡能力。
另外,将预设的原始信息转换为二进制信息的步骤之前,上述方法还包括:根据预设的原始信息的数据量,确定待编码的二维码中核心编码区域的信息位尺度。
上述预设的原始信息可以是由数字信息和字母信息组成,作为示例,数字信息可以是多位的,字母信息可以是一位的,比如,54281s、345u等;上述预设的原始信息的数据量可以根据编码的需求设定,可以设定原始信息数据的位数;例如,编码规定的原始信息为五位数字信息加一位字母信息,其中的字母信息只能为s或者u,如果原始信息的数字信息不足五位数,则可以在数字信息前面用零补齐,得到一个五位的数字信息,比如,原始信息345s,其中的数字信息不足五位,进行补齐,得到00345s。上述待编码的二维码可以包含多个核心编码区域,该区域为待编码的二维码核心区域,在进行编码之前不包含任何信息。上述信息位尺度可以包括核心编码区域信息位的长和宽。具体的,在进行编码之前可以根据原始信息中,数字信息和字母信息的位数,确定相应的待编码的二维码中核心编码区域的信息位的长和宽。
该方式中,核心编码区域的信息位尺度,通过原始信息的数据量确定,使得二维码的尺寸更加灵活,提高了二维码的信息有效率。
实施例四:
本实施例提供了另一种二维码的编码方法,该方法在上述实施例的基础上实现;其中,上述信息位尺度包括:核心编码区域的长度包括的信息位数量,以及核心编码区域的宽度包括的信息位数量;基于此,本实施例重点描述根据预设的原始信息的数据量,确定待编码的二维码中核心编码区域的信 息位尺度的具体实现过程(通过步骤S902-S904实现);如图9所示,该方法包括如下步骤:
步骤S902,根据预设的原始信息的数据量,确定核心编码区域中需要显示与该原始信息相关联的二进制信息的第一信息位数量,以及用于在解码过程中,检测核心编码区域的位置的检测信息位的第二信息位数量;
上述与原始信息相关联的二进制信息可以包括原始信息本身,还可以包括索引位,以及用于字节对齐的冗余位,其中索引位可以用于指示当前二进制信息,应该写入哪个核心编码区域。因此上述第一信息位数量可以包括原始信息对应的二进制信息位数、索引位数和冗余位数,其中索引位数可以是两位,冗余位的数量可以根据实际的编码需求进行设置。上述检测信息位可以在核心编码区域的边缘位置,其数量可以根据第一信息位数量确定。
具体的,如果第一信息位数量为72位,则第二信息位数量可以包括,可以使用21位信息位作为固定的L形黑边框用于检测,使用19位信息作为固定的黑白相间边框用于检测,根据预设的二维码区域,该区域的信息为11*11=121,则剩余的9位,可以暂时不添加任何信息。
步骤S904,根据第一信息位数量和第二信息位数量,确定核心编码区域的信息位尺度;
在确定核心编码区域的信息位尺度之前,上述核心编码区域可以先确定区域的形状,可以是正方形或者是指定形状的矩形等;另外,核心编码区域的大小相对于原始信息的数据量,不能太大,可以是区域中填充了原始信息对应的二进制信息、区域位置信息、检测信息等必要的数据信息后,再填充少量的冗余位,即可填满该核心编码区域。
基于上述的前提标准,在实际实现时,首先可以确定核心编码区域的形状,信息位尺度可以根据第一信息位数量和第二信息位数量的总数量,确定具体的宽度和高度。比如,可以将第一信息位数量按照区域的形状进行排列,其次将第二信息位数量在区域的检测位置进行排列,根据最后的排列的形状大小,确定信息位尺度。
步骤S906,通过预设的转换方式,将原始信息转换为二进制信息;
步骤S908,按照预设的二进制信息显示规则,将二进制信息分别显示在每个核心编码区域中的指定信息位,得到编码后的二维码;其中,核心编码区域中还包括:用于在解码过程中,检测核心编码区域的位置的检测信息位。
本实施例提供了另一种二维码的编码方法,根据预设的原始信息的数据量,确定核心编码区域中需要显示与该原始信息相关联的二进制信息的第一信息位数量,以及用于在解码过程中,检测核心编码区域的位置的检测信息位的第二信息位数量;根据第一信息位数量和第二信息位数量,确定核心编码区域的信息位尺度。该方式中,通过原始信息以及检测信息位,设置核心编码区域的信息位尺寸,在数量较小,并不需要存储大量信息的情况下能够避免空间浪费,同时可以应用于具体的场景,能够丰富需要的编码类型,增强了设计的鲁棒性。
实施例五:
本实施例提供了另一种二维码的编码方法,该方法在上述实施例的基础上实现;本实施例重点描述通过预设的转换方式,将预设的原始信息转换为二进制信息和将二进制信息分别显示在每个核心编码区域中的指定信息位的具体实现过程(通过步骤S1006-S1008实现);如图10所示,该方法包括如下步骤:
步骤S1002,根据预设的原始信息的数据量,确定核心编码区域中需要显示与原始信息相关联的二进制信息的第一信息位数量,以及用于在解码过程中,检测核心编码区域的位置的检测信息位的第二信息位数量;
步骤S1004,根据第一信息位数量和第二信息位数量,确定核心编码区域的信息位尺度;
步骤S1006,针对每个核心编码区域,设置该核心编码区域在待编码二维码中的位置标识;通过预设的转换方式,将原始信息和位置标识转换为二进制信息,得到该核心编码区域对应的二进制信息;
上述位置标识可以对应前述索引位的信息,该位置标识可以根据核心编码区域的数量设置,用于区分多个核心编码的顺序,比如,核心编码区域有四个,则位置标识的取值可以是0-3,其中0表示第一个核心编码区域、1表示第二个核心编码区域、2表示第三个核心编码区域、3表示第四个核心编码区域。具体的,通过预设的转换方式,将原始信息和位置标识转换为二进制信息时,位置表示可以为两个信息位。
针对上述通过预设的转换方式,将原始信息和位置标识转换为二进制信息的步骤,参见图11所示的二进制信息转换方法的流程图,该方法包括如下步骤:
步骤S1102,将原始信息和位置标识转换为二进制形式的初始信息;
上述二进制形式可以通过十进制转换为二进制的方式,将原始信息和位置标识转换为二进制形式的初始信息。
其中,上述将原始信息和位置标识转换为二进制形式的初始信息的步骤,具体包括:将原始信息转换为二进制形式的原始信息;将位置标识转换为二进制形式的位置标识;将二进制形式的原始信息、二进制形式的位置标识、以及预设位数的冗余信息,确定为二进制形式的初始信息。
上述二进制信息的原始信息具体有多少位,可以根据原始信息的取值范围确定;若范围小,所需的位数相对就少;同理,上述二进制形式的位置标识,也可以根据位置标识的取值范围确定,若范围小,所需的位数相对就少;上述预设位数的冗余信息可以设置为“0”,其位数可以根据核心区域的总位数、原始信息的位数、位置标识的位数提前算好的,具体的,可以设置字节,每个字节包括多个位数,比如,一个字节包括8个位数,上述冗余信息的位数,可以根据原始信息的位数和位置标识的位数的总位数,设置相应位数的冗余信息,以使各个位数相加能够保证为整数个字节数;也可以说冗余信息的位数的主要目的是对齐字节,同时后续可以添加信息。
举例说明,原始信息为五位数字信息和一位字母信息,即“67854s”;可以将原始信息的前五位数“67854”提取出来作为身份标识,将字母s提取出来作为标记信息,根据预设的规则可以设置为“1”;另外,位置标识可以设置是“0”;可以通过十进制转换为二进制的方式,将“67854”转换为二进制形式为“10000100100001110”,也可以成为ID信息,后面加上s对应的标记信息“1”,也可以称为Mark信息,得到17位二进制形式的原始信息“100001001000011101”,也可以成为ID信息;将位置标识“0”转换为二进制形式,得到二进制形式的位置标识“00”,也可以成为Index信息,该二进制形式的位置标识的位数可以根据预设规则设置;另外,预设位数的冗余信息,可以设置为四位,即“0000”。将二进制形式的原始信息“100001001000011101”、二进制形式的位置标识“00”、以及预设位数的冗余信息“0000”,按照顺序拼接得到二进制形式的初始信息为“100001001000011101000000”。
需要说明的是,该初始信息的信息为24位,如果不加四位冗余信息,则该初始信息为20位,若设定一个字节为8位二进制数,为了得到整数的字节数,可以将冗余信息的位数设置为四位。
步骤S1104,通过预设的Reed-solomon编码算法,将初始信息进行编码 处理,得到编码信息;
上述Reed-solomon编码算法是一种纠错码算法,可以利用范特蒙矩阵或者柯西矩阵的特性实现纠错码的功能。具体的,可以将初始信息通过矩阵运算的方式进行处理,得到检验数据,根据这些冗余的校验数据,可以保证初始信息的可恢复性,从而得到编码信息。具体的,该编码信息可以是6个字节,48位的编码信息。
步骤S1106,将初始信息和编码信息确定为二进制信息。
具体的,上述初始信息可以是24位的二进制信息,上述编码信息可以是48位的,可以通过相加的方式,得到上述二进制信息,该二进制信息可以是72位的二进制信息。
步骤S1008,针对每个核心编码区域,将该核心编码区域对应的二进制信息显示在该核心编码区域中的指定信息位,得到编码后的二维码。
如果上述核心编码区域有多个,则上述核心编码区域对应的二进制信息应该显示在哪个核心编码区域中,可以通过二进制信息中的位置标记信息确定;上述指定信息位包括初始信息对应的二进制信息的位置,还包括检测信息位对应的二进制信息的位置;具体的,初始信息对应的二进制信息的位置可以在核心编码区域的中间位置,检测信息位对应的二进制信息的位置可以在核心编码区域的边缘位置。上述二维码可以包括多个核心编码区域,其排列顺序可以有多种,比如,两个核心编码区域在二维码中可以是竖向排列,也可以是横向排列。
该方式中,通过给每个核心编码区域设置位置标识,能够准确地识别每个核心编码区域;通过预设的转换方式,将原始信息和位置标识转换为二进制信息,得到该核心编码区域对应的二进制信息;针对每个核心编码区域,将该核心编码区域对应的二进制信息显示在该核心编码区域中的指定信息位,得到编码后的二维码。在识别二维码的过程中,提高了信息有效率,避免了浪费,同时提高了二维码的抗遮挡能力。
实施例六:
本实施例提供了一种二维码的解码方法,该方法应用于实施例二的二维码;待解码的二维码中包括多个核心编码区域;该方法在上述实施例的基础上实现,解码的二维码对应上述实施例方法确定的二维码;如图12所示,该方法包括如下步骤:
步骤S1202,从包含有二维码的图像中检测二维码中的检测信息位;
上述二维码是通过前述实施例的编码方法得到的,具体的,可以利用手机、电脑等带有摄像和计算功能的设备,扫描二维码的图像,可以通过直线检测、定位等方式,识别二维码中的检测信息位。
步骤S1204,根据检测到的检测信息位,确定二维码中的核心编码区域;
由于检测信息位的位置在核心编码区域的边缘,在检测到检测信息位后,可以通过截取的方式,将该检测信息位对应的核心编码区域,提取出来,进而确定二维码中的核心编码区域。
步骤S1206,解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息。
在解码上述核心编码区域前,可以将包含该核心编码区域的图像进行处理,使得图像更能清楚的显示核心编码区域中,指定信息位上显示的二进制信息。根据与前述实施例的编码方法对应的解码方法,解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息。
该方式中,从包含有二维码的图像中检测二维码中的检测信息位;根据检测到的检测信息位,确定二维码中的核心编码区域;解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息,解码二维码。其解码结果表明,在4*4的编码条件下,理论最大可遮挡面积达到319.8%,以一个核心编码区域为单位一,且实际最大可遮挡面积略大于理论值,远远超过目前二维码的抗遮挡能力。
实施例七:
本实施例提供了另一种二维码的解码方法,该方法在上述实施例的基础上实现,其中,上述二维码中还包括多个定位符;该定位符用于:将二维码划分为多个目标区域;每个目标区域中包括一个核心编码区域;基于此,本实施例重点描述从包含有二维码的图像中检测二维码中的检测信息位的具体实现过程(通过步骤S1302-S1306),如图13所示,该方法包括如下步骤:
步骤S1302,从包含有二维码的图像中检测定位符;
上述定位符可以是各种形状的符号,比如,圆形,矩形等;该定位符可以在二维码的图像中每个核心编码区域之间的位置,可以比核心编码区域的面积小;本实施例以定位符为霍夫圆为例,比如,二维码中有四个核心编码区域,定位圆可以有五个,但是在实际检测的过程中,由于在扫描二维码的过程中,可能不会全部将二维码扫描到设备中,比如只扫描到了一半的二维码图像,因此包含有二维码的图像中检测出的定位圆可能不是五个,需要根 据扫描得到二维码的图像确定。具体的,可以通过检测算法,获取定位符的位置和坐标。例如,上述二维码中的定位符为霍夫圆布局,则可以利用霍夫圆检测,获取定位圆的位置与坐标。
步骤S1304,通过检测出的定位符,确定二维码中的目标区域;
以定位符为霍夫圆为例,利用霍夫圆检测出的定位符,也就是圆心的位置和坐标,可以根据多个圆心的位置和坐标,确定二维码中的目标区域。
针对上述步骤中,通过检测出的定位符,确定二维码中的目标区域的步骤,具体包括:确定检测出的定位符的数量和相对位置;根据定位符的数量和相对位置,确定二维码中的目标区域。
上述相对位置可以是指定位符的位置和坐标,上述目标区域可以是二维码的核心编码区域;本实施例以二维码中包括四个核心编码区域,定位符的数量为五个,定位符为霍夫圆为例,说明确定二维码中的目标区域的过程;参见图7所示二维码的结构示意图,该二维码中有五个圆,中间的圆①为中心圆,其余四个位置的圆②③④⑤为边缘圆;其中每个边缘圆都可以与中心圆组成一个向量,因此图8中所示的二维码,可以构成多个向量,可以包括:①②、①③、①④、①⑤;其中①②和①④这两个向量为共线向量、①③和①⑤这两个向量也为共线向量;二维码中的目标区域可以通过非共线的两个向量确定,比如,检测出①②⑤三个圆,①②和①⑤可以构成非共线向量,因此可以确定二维码中右上角的目标区域;若检测出的是其他非共线向量,同样可以确定该非共线向量对应的目标区域。
具体的,上述检测出的定位符的数量可以包括多种情况,可以根据不同的情况设置不同的处理逻辑,以二维码中有五个定位符,该定位符是霍夫圆为例,进行说明不同数量定位符的中心圆与边缘圆的处理逻辑:
情况一:如果有误识别等情况,将其他图像误识别为定位符,检测出的定位符大于五个时,首先可以先确定中心圆,如果存在距离其他所有圆的平均坐标小于第一预设阈值的圆,则可以将其确定为中心圆;如果不存在距离其他所以圆的平均坐标小于第一预设阈值的圆,可以取平均坐标作为中心圆的坐标;筛选剩余圆中距中心圆距离小于第二阈值的圆,可以将该圆确定为误识别的圆,剩余的圆确定为边缘圆。
情况二:如果有遮挡等情况,检测出的定位符会小于五个;四个或者四个以上的情况与上述情况一的处理方法相同;三个的情况时,如果中心圆不存在就不会构成非共线向量,因此,只处理中心圆存在的情况,将最短两边 的交点确定为中心圆,或者计算每个圆与其他圆的距离和,和最小对应的圆为中心圆,其余的圆为边缘圆。
情况三,如果有遮挡等情况,检测出的定位符小于三个时,由于不可能构成非共线向量,确定一个子区域,所以直接作为无法解码的情况跳过该步骤。
通过上述方法,确定了每个圆的位置,利用确定的中心圆和边缘圆可以筛选出非共线向量;由于在扫描二维码图像时可能存在有一定角度的旋转,因此可以将筛选出非共线向量进行求正交计算,按照逆时针方向进行转动,去掉旋转角,使目标区域转正,最终确定二维码中的目标区域,该目标区域可以是一个或者多个,具体可以根据非共线向量的数量确定。
需要说明的是,实际的二维码中霍夫圆内没有数字,图8中圆内的数字只是为了方便说明各个圆的作用所做的标注。另外,本发明不限定二维码中核心编码区域的个数,可以是四个,也可以是两个或者三个区域并排排列等;多个区域的排列方式也不做限定,可以是横向排列,也可以是竖向排列,还可以是其他各种形式的排列。
步骤S1306,从目标区域中检测二维码中的检测信息位;
上述检测信息位可以是各种不同的形状,比如,L型、方形的实线或者L型、方形的黑白相间的线条等;因此针对不同的检测信息位,可以通过不同的检测方式检测得到二维码中的检测信息位。
其中,上述检测信息位组成预设形状的检测图案;该检测图案的边缘包括长度满足预设长度范围的直线段;
上述检测图案的形状可以是实线的L型,也可以是黑白相间的L型;执行检测二维码中的检测信息位时,可以仅使用一个检测图案;也可以使用一个检测图案进行检测,另一个检测图案协助定位定位点,比如,使用实线的L型进行检测,另一个黑白相间的L型协助定位定位点,该定位点可以是在黑白相间的L型图案中的点,可以有多个,具体可以根据实际的检测图案的形状设定。上述预设长度可以根据实际检测图案的形状大小设定。
参见图14所示检测信息位的检测方法的流程图,从目标区域中检测二维码中的检测信息位的步骤的具体实现过程,如图14所示,该方法包括如下步骤:
步骤S1401,通过预设的直线段检测算法,从目标区域中检测直线段;
上述预设的直线段检测算法可以是LSD(Line Segment Detector,直线 段检测算法)直线检测等方法,由于检测的对象是目标区域的图像,可以将该图像的灰度图,输入至LSD直线检测算法中,可以检测出图像中局部的直的轮廓。
步骤S1402,从检测到的直线段中,删除长度小于长度范围中的最小值的直线段,和/或,删除长度大于长度范围中的最大值的直线段;
上述检测到的直线段可以有多个不同的长度,上述长度范围中的最小值和长度范围中的最大值可以根据实际的二维码中目标区域的信息位尺寸设定。举例说明,若目标区域图像中的信息是利用黑白色的形式进行编码的,因此在黑白相间处可以检测出多个直线段;如果检测到的直线段中,只存在小于长度范围中的最小值的线段,可以删除长度小于长度范围中的最小值的直线段;如果检测到的直线段中,只存在大于长度范围中的最大值的线段,可以删除长度大于长度范围中的最大值的直线段;如果检测到的直线段中,即存在小于长度范围中的最小值的线段,又存在大于长度范围中的最大值的线段,可以删除长度小于长度范围中的最小值的直线段,同时删除长度大于长度范围中的最大值的直线段。
步骤S1403,根据目标区域中剩余的直线段,确定二维码中的检测信息位。
上述剩余的直线段可以是检测信息位对应的直线段,该直线段可以是检测信息位组成的检测图案的形状,比如,若检测图案为L型,则检测出的直线段可以构成一个L型;可以将检测出的直线段在目标区域中标注位置,根据该位置确定二维码中的检测信息位。
步骤S1308,根据检测到的检测信息位,确定二维码中的核心编码区域;
步骤S1310,解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息。
该方式中,针对不同数量的定位符,设置了不同的处理逻辑,通过寻找中心定位符与边缘定位符,利用非共线向量的方式,确定目标区域,能够快速准确的确定目标区域,同时解决了解码过程中的出现定位符过多或者过少的问题。
另外,上述从包含有二维码的图像中检测二维码中的检测信息位的步骤,包括:通过预设的ROI区域检测模型,从包含有二维码的图像中检测包含有二维码的目标区域;从目标区域中检测二维码中的检测信息位。
该检测方法的二维码,可以直接将多个核心编码区域放置于图中,不添 加其他组成部分,且不设置定位符,直接利用区域检测方法,检测二维码中所有的检测信息位。具体的,上述ROI(Regions Of Interest,感兴趣区域)区域检测模型,可以提取出待检测二维码图像中大致的目标区域,该目标区域可以包含二维码中的所有的核心编码区域,进而可以缩小直线提取范围,降低计算量,同时提高检测速度和检测准确率。上述从目标区域中检测二维码中的检测信息位的过程,与本实施例中步骤S1306描述的技术方法相同,所达到的技术效果也相同,在此不做赘述。
实施例八:
本实施例提供了另一种二维码的解码方法,该方法在上述实施例的基础上实现;本实施例重点描述根据检测到的检测信息位,确定二维码中的核心编码区域的具体实现过程(通过步骤S1508-S1510实现)和解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息的具体实现过程(通过步骤1512实现);如图15所示,该方法包括如下步骤:
步骤S1502,从包含有二维码的图像中检测定位符;
步骤S1504,通过检测出的定位符,确定二维码中的目标区域;
步骤S1506,从目标区域中检测二维码中的检测信息位;
步骤S1508,根据检测到的检测信息位,确定二维码中的核心编码区域的多个顶点;
具体的,可以根据检测到的检测信息位对应的直线段的端点,确定多个关键点,参见图16所示的一种二维码中核心编码区域顶点的结构示意图,检测出三条直线段,将最外侧的两个直线段的三个端点确定为顶点,对应图中的点1、点2、点3,根据图中点1的横坐标和点3的纵坐标可以确定点4的位置。可以将点2、点3和点4确定为二维码中的核心编码区域的三个顶点。
上述检测信息位对应的直线段,由于直线检测方法检测出的结果可能存在不准确的偏移,可能会导致图16中点4的位置不够精确,可以对前述三个顶点的位置进行扰动处理,即重复多次上下左右平移多个像素,比如,重复四次上下左右平移四个像素,以使定位点更准确。
步骤S1510,通过线段连接多个顶点中相邻的顶点,将线段所包围的区域,确定为二维码中的核心编码区域;
具体的,参见图16中的三个顶点,将点2与点3连接,点3与点4连接,可以构成一个区域,可以将该区域确定为二维码中的核心编码区域。
另外,如果检测到多组检测信息位,针对每组检测信息位,通过线段连接该组检测信息位对应的多个顶点。
由于检测出的定位符的数量不等,所以检测出的检测信息位可能有多组,可以针对每组的检测信息位对应的直线段,确定各个顶点,可以将相邻的顶点进行连接。
步骤S1512,通过在编码过程中使用的转换方式和二进制信息显示规则,将核心编码区域中,指定信息位上显示的二进制信息解码为原始信息。
在进行解码之前,由于多个顶点可能进行了扰动处理,因此通过连线构成的区域可能是一个矩形,也有可能不是矩形,比如,平行四边形等;可以将多个顶点构成的四边形与矩形进行仿射变换处理。另外,由于解码的过程与编码的过程完全对称,因此需要将最后确定的二维码的核心编码区域的图像与编码时核心编码区域中各个信息的位置相同,比如,编码时核心编码区域中的L型检测信息位在区域的左下角,最后确定的核心编码区域图像中L型检测信息位在区域的左上角,此时可以将图像进行转正,以使L型检测信息位转到区域的左下角。
由于上述核心编码区域的图像为扫描得到的灰度图,在得到转正后的核心编码区域后,可以将该图像进行自适应二值化处理,以使灰度图像变为黑白图像。最终对二值化图像的核心编码区域中的信息进行解码,对应编码的过程,若编码的二进制信息在写入二维码时,1为黑色,0为白色,则解码时黑色块为二进制中的1,白色块为二进制中的0,按照zigzag形式依次提取,得到的二进制数组作为整个检测过程的输出。
若在编码过程中输入的是72为的二进制信息,也就是核心编码区域中的有效信息位数为72位;具体的,可以将该核心编码区域的黑白图像输入值与编码程序对应的解码程序中,该程序可以是开源库中的reed-solomon,首先将72位的编码信息解码为24位信息位,然后按照编码过程中的排列顺序,将第1至17位信息作为ID信息,将第18位信息作为Mark信息,将第19至20位信息作为Index信息,最后将排列好的信息输出,完成编码的过程。
该方式中,通过设置顶点,利用线段连接的方式,确定二维码中的核心编码区域,提高了检测结果的准确率,进而提高了解码的效率和准确率。
实施例九:
对应于上述方法实施例,本实施例提供了一种二维码的编码装置,该装 置应用实施例二的二维码;待编码的二维码中包括多个核心编码区域;如图17所示,该装置包括:
信息转换模块171,用于通过预设的转换方式,将预设的原始信息转换为二进制信息;
二维码确定模块172,用于按照预设的二进制信息显示规则,将二进制信息分别显示在每个核心编码区域中的指定信息位,得到编码后的二维码;其中,核心编码区域中还包括:用于在解码过程中,检测核心编码区域的位置的检测信息位。
进一步的,上述装置还包括尺度确定模块,用于根据预设的原始信息的数据量,确定待编码的二维码中核心编码区域的信息位尺度。
进一步的,上述信息位尺度包括:核心编码区域的长度包括的信息位数量,以及核心编码区域的宽度包括的信息位数量;上述尺度确定模块用于:根据预设的原始信息的数据量,确定核心编码区域中需要显示与原始信息相关联的二进制信息的第一信息位数量,以及用于在解码过程中,检测核心编码区域的位置的检测信息位的第二信息位数量;根据第一信息位数量和第二信息位数量,确定核心编码区域的信息位尺度。
进一步的,上述信息转换模块用于:针对每个核心编码区域,设置该核心编码区域在待编码二维码中的位置标识;通过预设的转换方式,将原始信息和位置标识转换为二进制信息,得到该核心编码区域对应的二进制信息;上述二维码确定模块用于:针对每个核心编码区域,将该核心编码区域对应的二进制信息显示在该核心编码区域中的指定信息位。
进一步的,上述信息转换模块用于:将原始信息和位置标识转换为二进制形式的初始信息;通过预设的Reed-solomon编码算法,将初始信息进行编码处理,得到编码信息;将初始信息和编码信息确定为二进制信息。
进一步的,上述信息转换模块用于:将原始信息转换为二进制形式的原始信息;将位置标识转换为二进制形式的位置标识;将二进制形式的原始信息、二进制形式的位置标识、以及预设位数的冗余信息,确定为二进制形式的初始信息。
本发明实施例提供的一种二维码的编码装置,根据预设的原始信息的数据量,确定待编码的二维码中多个核心编码区域的信息位尺度;通过预设的 转换方式,将原始信息转换为二进制信息;按照预设的二进制信息显示规则,将二进制信息分别显示在每个核心编码区域中的指定信息位,同时将检测核心编码区域的位置的检测信息位,显示在每个核心编码区域中的指定信息位,得到编码后的二维码。该装置中,核心编码区域的信息位尺度,通过原始信息的数据量确定,丰富了二维码的尺寸,使其更加灵活;通过在二维码中设置多个核心编码区域,在识别二维码的过程中,提高了信息有效率,避免了浪费,同时提高了二维码的抗遮挡能力。
实施例十:
对应于上述方法实施例,本实施例提供了一种二维码的解码装置,该装置应用实施例二的二维码;待编码的二维码中包括多个核心编码区域;如图18所示,该装置包括:
检测信息位检测模块181,用于从包含有二维码的图像中检测二维码中的检测信息位;
核心编码区域确定模块182,用于根据检测到的检测信息位,确定二维码中的核心编码区域;
二维码解码模块183,用于解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息。
进一步的,上述二维码中还包括多个定位符;定位符用于:将二维码划分为多个目标区域;每个目标区域中包括一个核心编码区域;上述检测信息位检测模块用于:从包含有二维码的图像中检测定位符;通过检测出的定位符,确定二维码中的目标区域;从目标区域中检测二维码中的检测信息位。
进一步的,上述检测信息位检测模块用于:确定检测出的定位符的数量和相对位置;根据定位符的数量和相对位置,确定二维码中的目标区域。
进一步的,上述检测信息位检测模块用于:通过预设的ROI区域检测模型,从包含有二维码的图像中检测包含有二维码的目标区域;从目标区域中检测二维码中的检测信息位。
进一步的,上述检测信息位组成预设形状的检测图案;该检测图案的边缘包括长度满足预设长度范围的直线段;上述检测信息位检测模块用于:通过预设的直线段检测算法,从目标区域中检测直线段;从检测到的直线段中,删除长度小于长度范围中的最小值的直线段,和/或,删除长度大于长度范围 中的最大值的直线段;根据目标区域中剩余的直线段,确定二维码中的检测信息位。
进一步的,上述核心编码区域确定模块用于:根据检测到的检测信息位,确定二维码中的核心编码区域的多个顶点;通过线段连接多个顶点中相邻的顶点,将线段所包围的区域,确定为二维码中的核心编码区域。
进一步的,上述核心编码区域确定模块用于:如果检测到多组检测信息位,针对每组检测信息位,通过线段连接该组检测信息位对应的多个顶点。
进一步的,上述二维码解码模块用于:通过在编码过程中使用的转换方式和二进制信息显示规则,将核心编码区域中,指定信息位上显示的二进制信息解码为原始信息。
本发明实施例提供的一种二维码的解码装置,从包含有二维码的图像中检测二维码中的检测信息位;根据检测到的检测信息位,确定二维码中的核心编码区域;解码核心编码区域中,指定信息位上显示的二进制信息,得到二进制信息对应的原始信息,解码二维码。其解码结果表明,在4*4的编码条件下,理论最大可遮挡面积达到319.8%,以一个核心编码区域为单位一,且实际最大可遮挡面积略大于理论值,远远超过目前二维码的抗遮挡能力。
实施例十一:
本发明实施例提供了一种电子系统,该电子系统包括:图像采集设备、处理设备和存储装置;图像采集设备,用于获取预览视频帧或图像数据;存储装置上存储有计算机程序,计算机程序在被处理设备运行时执行如上述二维码的编码方法,或者上述二维码的编码方法的步骤。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的电子系统的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
本发明实施例还提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理设备运行时执行如上述二维码的编码方法,或者上二维码的编码方法的步骤。
本发明实施例还提供了一种计算机程序,包括计算机可读代码,当所述计算机可读代码在处理设备上运行时,导致所述处理设备执行如上述二维码的编码方法,或者上二维码的编码方法的步骤。
本发明实施例所提供的二维码、二维码的编码方法、解码方法、装置和电子系统的计算机程序产品,包括存储了程序代码的计算机可读存储介质,程序代码包括的指令可用于执行前面方法实施例中的方法,具体实现可参见方法实施例,在此不再赘述。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统和/或装置的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
另外,在本发明实施例的描述中,除非另有明确的规定和限定,术语“安装”、“相连”、“连接”应做广义理解,例如,可以是固定连接,也可以是可拆卸连接,或一体地连接;可以是机械连接,也可以是电连接;可以是直接相连,也可以通过中间媒介间接相连,可以是两个元件内部的连通。对于本领域的普通技术人员而言,可以具体情况理解上述术语在本发明中的具体含义。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
在本发明的描述中,需要说明的是,术语“中心”、“上”、“下”、“左”、“右”、“竖直”、“水平”、“内”、“外”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本发明和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本发明的限制。此外,术语“第一”、“第二”、“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。
最后应说明的是:以上所述实施例,仅为本发明的具体实施方式,用以说明本发明的技术方案,而非对其限制,本发明的保护范围并不局限于此,尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应 当理解:任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本发明实施例技术方案的精神和范围,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。
Claims (29)
- 一种二维码,其特征在于,所述二维码包括多个核心编码区域;所述核心编码区域包括指定信息位和检测信息位;其中,所述指定信息位包括预设的原始信息对应的二进制信息;所述检测信息位包括所述核心编码区域的位置信息。
- 根据权利要求1所述的二维码,其特征在于,每个所述核心编码区域的信息位尺度,根据所述原始信息的数据量确定;所述信息位尺度包括:所述核心编码区域的长度包括的信息位数量,以及所述核心编码区域的宽度包括的信息位数量。
- 根据权利要求1所述的二维码,其特征在于,所述多个核心编码区域按照预设位置排列;每个所述核心编码区域预设有该核心编码区域对应的位置标识;每个所述核心编码区域中的指定信息位上显示的二进制信息,通过所述原始信息和该核心编码区域对应的位置标识转换得到。
- 根据权利要求1-3任一项所述的二维码,其特征在于,所述检测信息位包括所述核心编码区域的边缘位置上的多个信息位;所述多个信息位组成预设形状的检测图案。
- 根据权利要求4所述的二维码,其特征在于,所述检测图案包括“L”型图案;所述多个信息位中的至少一部分信息位位于所述核心编码区域的第一边缘行,所述多个信息位中除所述至少一部分信息以外的信息位位于与所述第一边缘行相邻的第一边缘列上。
- 根据权利要求4所述的二维码,其特征在于,所述检测信息位包括两组,分别为第一组检测信息位和第二组检测信息位;所述第一组检测信息位中至少一部分信息位位于所述核心编码区域的第一边缘行,除所述至少一部分信息以外的信息位位于与所述第一边缘行相邻的第一边缘列上;所述第二组检测信息位中至少一部分信息位位于所述核心编码区域的第二边缘行,除所述至少一部分信息以外的信息位位于与所述第二边缘行相邻的第二边缘列上;其中,所述第一边缘行、所述第一边缘列、所述第二边缘行和所述第二边缘列依次连接。
- 根据权利要求6所述的二维码,其特征在于,所述第一组检测信息位中的每个信息位上显示有相同的二进制信息;所述第二组检测信息位中,相邻的信息位显示有不同的二进制信息。
- 根据权利要求1-7任一项所述的二维码,其特征在于,所述二维码中还包括定位符;所述定位符用于:将所述二维码划分为多个目标区域;每个所述目标区域中包括所述多个核心编码区域中的一个或多个核心编码区域。
- 根据权利要求8所述的二维码,其特征在于,所述定位符包括多个;所述定位符位于所述目标区域的顶点位置;每个所述目标区域中包括所述多个核心编码区域中的一个核心编码区域。
- 根据权利要求8或9所述的二维码,其特征在于,所述定位符包括霍夫圆。
- 一种二维码的编码方法,其特征在于,所述方法应用于权利要求1-10任一项所述的二维码;待编码的二维码中包括多个核心编码区域;所述方法包括:通过预设的转换方式,将预设的原始信息转换为二进制信息;按照预设的二进制信息显示规则,将所述二进制信息分别显示在每个所述核心编码区域中的指定信息位,得到编码后的所述二维码;其中,所述核心编码区域中还包括:用于在解码过程中,检测所述核心编码区域的位置的检测信息位。
- 根据权利要求11所述的方法,其特征在于,将预设的原始信息转换为二进制信息的步骤之前,所述方法还包括:根据预设的原始信息的数据量,确定待编码的二维码中核心编码区域的信息位尺度。
- 根据权利要求12所述的方法,其特征在于,所述信息位尺度包括:所述核心编码区域的长度包括的信息位数量,以及所述核心编码区域的宽度包括的信息位数量;所述根据预设的原始信息的数据量,确定待编码二维码中核心编码区域的信息位尺度的步骤,包括:根据预设的原始信息的数据量,确定所述核心编码区域中需要显示与所述原始信息相关联的二进制信息的第一信息位数量,以及用于 在解码过程中,检测所述核心编码区域的位置的检测信息位的第二信息位数量;根据所述第一信息位数量和所述第二信息位数量,确定所述核心编码区域的信息位尺度。
- 根据权利要求11所述的方法,其特征在于,通过预设的转换方式,将预设的原始信息转换为二进制信息的步骤,包括:针对每个所述核心编码区域,设置该核心编码区域在所述待编码二维码中的位置标识;通过预设的转换方式,将所述原始信息和所述位置标识转换为二进制信息,得到该核心编码区域对应的二进制信息;所述将所述二进制信息分别显示在每个所述核心编码区域中的指定信息位的步骤,包括:针对每个所述核心编码区域,将该核心编码区域对应的二进制信息显示在该核心编码区域中的指定信息位。
- 根据权利要求14所述的方法,其特征在于,通过预设的转换方式,将所述原始信息和所述位置标识转换为二进制信息的步骤,包括:将所述原始信息和所述位置标识转换为二进制形式的初始信息;通过预设的Reed-solomon编码算法,将所述初始信息进行编码处理,得到编码信息;将所述初始信息和所述编码信息确定为二进制信息。
- 根据权利要求15所述的方法,其特征在于,将所述原始信息和所述位置标识转换为二进制形式的初始信息的步骤,包括:将所述原始信息转换为二进制形式的原始信息;将所述位置标识转换为二进制形式的位置标识;将所述二进制形式的原始信息、所述二进制形式的位置标识、以及预设位数的冗余信息,确定为二进制形式的初始信息。
- 一种二维码的解码方法,其特征在于,所述方法应用于权利要求1-10任一项所述的二维码;待解码的二维码中包括多个核心编码区域;所述方法包括:从包含有所述二维码的图像中检测所述二维码中的检测信息位;根据检测到的所述检测信息位,确定所述二维码中的核心编码区域;解码所述核心编码区域中,指定信息位上显示的二进制信息,得 到所述二进制信息对应的原始信息。
- 根据权利要求17所述的方法,其特征在于,所述二维码中还包括多个定位符;所述定位符用于:将所述二维码划分为多个目标区域;每个所述目标区域中包括一个核心编码区域;所述从包含有所述二维码的图像中检测所述二维码中的检测信息位的步骤,包括:从包含有所述二维码的图像中检测所述定位符;通过检测出的所述定位符,确定所述二维码中的目标区域;从所述目标区域中检测所述二维码中的检测信息位。
- 根据权利要求18所述的方法,其特征在于,通过检测出的所述定位符,确定所述二维码中的目标区域的步骤,包括:确定检测出的所述定位符的数量和相对位置;根据所述定位符的数量和所述相对位置,确定所述二维码中的目标区域。
- 根据权利要求17所述的方法,其特征在于,所述从包含有所述二维码的图像中检测所述二维码中的检测信息位的步骤,包括:通过预设的ROI区域检测模型,从包含有所述二维码的图像中检测包含有所述二维码的目标区域;从所述目标区域中检测所述二维码中的检测信息位。
- 根据权利要求18-20任一项所述的方法,其特征在于,所述检测信息位组成预设形状的检测图案;所述检测图案的边缘包括长度满足预设长度范围的直线段;所述从所述目标区域中检测所述二维码中的检测信息位的步骤,包括:通过预设的直线段检测算法,从所述目标区域中检测直线段;从检测到的直线段中,删除长度小于所述长度范围中的最小值的直线段,和/或,删除长度大于所述长度范围中的最大值的直线段;根据所述目标区域中剩余的直线段,确定所述二维码中的检测信息位。
- 根据权利要求17所述的方法,其特征在于,根据检测到的所述检测信息位,确定所述二维码中的核心编码区域的步骤,包括:根据检测到的所述检测信息位,确定所述二维码中的核心编码区 域的多个顶点;通过线段连接所述多个顶点中相邻的顶点,将所述线段所包围的区域,确定为所述二维码中的核心编码区域。
- 根据权利要求22所述的方法,其特征在于,通过线段连接所述多个顶点中相邻的顶点的步骤,包括:如果检测到多组所述检测信息位,针对每组所述检测信息位,通过线段连接该组检测信息位对应的多个顶点。
- 根据权利要求17所述的方法,其特征在于,解码所述核心编码区域中,所述指定信息位上显示的二进制信息,得到所述二进制信息对应的原始信息的步骤,包括:通过在编码过程中使用的所述转换方式和所述二进制信息显示规则,将所述核心编码区域中,所述指定信息位上显示的二进制信息解码为所述原始信息。
- 一种二维码的编码装置,其特征在于,所述装置应用于权利要求1-10任一项所述的二维码;待编码的二维码中包括多个核心编码区域;所述装置包括:信息转换模块,用于通过预设的转换方式,将预设的原始信息转换为二进制信息;二维码确定模块,用于按照预设的二进制信息显示规则,将所述二进制信息分别显示在每个所述核心编码区域中的指定信息位,得到编码后的所述二维码;其中,所述核心编码区域中还包括:用于在解码过程中,检测所述核心编码区域的位置的检测信息位。
- 一种二维码的解码装置,其特征在于,所述装置应用于权利要求1-10任一项所述的二维码;待解码的二维码中包括多个核心编码区域;所述装置包括:检测信息位检测模块,用于从包含有所述二维码的图像中检测所述二维码中的检测信息位;核心编码区域确定模块,用于根据检测到的所述检测信息位,确定所述二维码中的核心编码区域;二维码解码模块,用于解码所述核心编码区域中,指定信息位上显示的二进制信息,得到所述二进制信息对应的原始信息。
- 一种电子系统,其特征在于,所述电子系统包括:处理设备和 存储装置;所述存储装置上存储有计算机程序,所述计算机程序在被所述处理设备运行时执行如权利要求11至16任一项所述的二维码的编码方法或17至24任一项所述的二维码的解码方法。
- 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,其特征在于,所述计算机程序被处理设备运行时执行如权利要求11至16任一项所述的二维码的编码方法的或17至24任一项所述的二维码的解码方法的步骤。
- 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在处理设备上运行时,导致所述处理设备执行如权利要求11至16任一项所述的二维码的编码方法或17至24任一项所述的二维码的解码方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010049313.1A CN111275152A (zh) | 2020-01-16 | 2020-01-16 | 二维码、二维码的编码方法、解码方法、装置和电子系统 |
CN202010049313.1 | 2020-01-16 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021143212A1 true WO2021143212A1 (zh) | 2021-07-22 |
Family
ID=70998891
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/119541 WO2021143212A1 (zh) | 2020-01-16 | 2020-09-30 | 二维码、二维码的编码方法、解码方法、装置和电子系统 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111275152A (zh) |
WO (1) | WO2021143212A1 (zh) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111275152A (zh) * | 2020-01-16 | 2020-06-12 | 北京迈格威科技有限公司 | 二维码、二维码的编码方法、解码方法、装置和电子系统 |
CN111711819B (zh) * | 2020-08-19 | 2020-12-08 | 长沙像素码科技有限公司 | 一种多元混进制的图像数据处理方法 |
CN112218133B (zh) * | 2020-09-15 | 2022-08-05 | 深圳市飞图视讯有限公司 | 投屏码生成方法、装置及终端设备 |
CN114912475A (zh) * | 2021-02-07 | 2022-08-16 | 华为技术有限公司 | 二维码识别方法及相关装置 |
US11828316B2 (en) * | 2021-11-04 | 2023-11-28 | David M. Mante | Storage, recall, and use of tightening specifications on threaded mechanical fasteners |
CN114399010B (zh) * | 2021-12-29 | 2024-08-27 | 中国电信股份有限公司 | 一种二维码编码、解码方法、装置、设备及介质 |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101430768A (zh) * | 2007-11-07 | 2009-05-13 | 刘涛 | 一种二维条码系统及其定位方法 |
CN102034127A (zh) * | 2009-09-28 | 2011-04-27 | 上海易悠通信息科技有限公司 | 新型大容量二维条码与系统及其编解码方法和应用 |
US20120069408A1 (en) * | 2010-09-20 | 2012-03-22 | Toshiba Tec Kabushiki Kaisha | Document management system and method thereof |
CN103268461A (zh) * | 2013-04-25 | 2013-08-28 | 浙江成功软件开发有限公司 | 一种基于二维码的内外网物理隔离数据交换方法 |
CN103400174A (zh) * | 2013-07-30 | 2013-11-20 | 人民搜索网络股份公司 | 一种二维码的编码方法、解码方法及系统 |
CN104143109A (zh) * | 2014-01-28 | 2014-11-12 | 深圳市雁联计算系统有限公司 | 一种二维码的编码和解码方法及其印刷物 |
CN111275152A (zh) * | 2020-01-16 | 2020-06-12 | 北京迈格威科技有限公司 | 二维码、二维码的编码方法、解码方法、装置和电子系统 |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102902997B (zh) * | 2012-09-21 | 2015-11-18 | 华南农业大学 | 一种二维码混合编码、解码装置及方法 |
US9710680B2 (en) * | 2014-12-17 | 2017-07-18 | International Business Machines Corporation | Creating mechanical stamps to produce machine-readable optical labels |
CN108280500A (zh) * | 2017-01-06 | 2018-07-13 | 百度在线网络技术(北京)有限公司 | 二维码的编码方法、解码方法、相关装置及设备 |
CN109754046B (zh) * | 2019-01-31 | 2022-09-27 | 北京迈格威科技有限公司 | 二维码、二维码的编码方法、解码方法、装置及设备 |
CN109831309A (zh) * | 2019-02-25 | 2019-05-31 | 胡辉萍 | 一种具有多重验证的安全码原理和方法 |
-
2020
- 2020-01-16 CN CN202010049313.1A patent/CN111275152A/zh active Pending
- 2020-09-30 WO PCT/CN2020/119541 patent/WO2021143212A1/zh active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101430768A (zh) * | 2007-11-07 | 2009-05-13 | 刘涛 | 一种二维条码系统及其定位方法 |
CN102034127A (zh) * | 2009-09-28 | 2011-04-27 | 上海易悠通信息科技有限公司 | 新型大容量二维条码与系统及其编解码方法和应用 |
US20120069408A1 (en) * | 2010-09-20 | 2012-03-22 | Toshiba Tec Kabushiki Kaisha | Document management system and method thereof |
CN103268461A (zh) * | 2013-04-25 | 2013-08-28 | 浙江成功软件开发有限公司 | 一种基于二维码的内外网物理隔离数据交换方法 |
CN103400174A (zh) * | 2013-07-30 | 2013-11-20 | 人民搜索网络股份公司 | 一种二维码的编码方法、解码方法及系统 |
CN104143109A (zh) * | 2014-01-28 | 2014-11-12 | 深圳市雁联计算系统有限公司 | 一种二维码的编码和解码方法及其印刷物 |
CN111275152A (zh) * | 2020-01-16 | 2020-06-12 | 北京迈格威科技有限公司 | 二维码、二维码的编码方法、解码方法、装置和电子系统 |
Also Published As
Publication number | Publication date |
---|---|
CN111275152A (zh) | 2020-06-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021143212A1 (zh) | 二维码、二维码的编码方法、解码方法、装置和电子系统 | |
US20210256253A1 (en) | Method and apparatus of image-to-document conversion based on ocr, device, and readable storage medium | |
JP7564962B2 (ja) | 画像処理方法、画像処理装置及び非一時的な記憶媒体 | |
US7950589B2 (en) | Program, information storage medium, two-dimensional code generation system, image generation system and printed material | |
JP6397977B2 (ja) | ドットパターン、ドットパターン形成媒体、ドットパターンの画像データを生成するプログラム、ドットパターン形成装置、光学装置、光学読み取り装置、情報入出力装置、ドットパターン読み取り装置 | |
US10885411B2 (en) | Machine-readable image encoding data | |
US20060274948A1 (en) | Stroke localization and binding to electronic document | |
JP4738469B2 (ja) | 画像処理装置、画像処理プログラムおよび画像処理方法 | |
JP4410231B2 (ja) | イメージコードの生成装置及びその方法とイメージコードのデコーディング装置及びその方法 | |
US20180253852A1 (en) | Method and device for locating image edge in natural background | |
CN107301366B (zh) | 一种嵌码视频中图形码的解码方法及装置 | |
WO2021004414A1 (zh) | 编码图形及其编码和读取方法、标定板和标定方法 | |
CN106407973B (zh) | 标在柱面上的ar码的鲁棒识别方法 | |
CN106570549A (zh) | 一种编码图案的生成、识别方法及装置 | |
EP3561729A1 (en) | Method for detecting and recognising long-range high-density visual markers | |
CN114399677A (zh) | 一种基于文本区域读取的指针仪表识别方法 | |
CN112183250A (zh) | 文字识别方法、装置、存储介质及电子设备 | |
CN115984856A (zh) | 文档图像矫正模型的训练方法、文档图像的矫正方法 | |
KR100834905B1 (ko) | 마커 패턴 인식 및 자세 추정을 통한 마커 인식 장치 및 방법 | |
CN114004890A (zh) | 姿态确定方法、装置、电子设备和存储介质 | |
JP5434671B2 (ja) | 画像表示装置、画像表示方法、および画像表示プログラム | |
KR20100089241A (ko) | 증강 현실 제공을 위한 마커 제작 및 인식 방법 | |
CN112187284A (zh) | 编码方法、编码图形、编码图形读取方法和拍摄装置 | |
CN113947529B (zh) | 图像增强方法、模型训练方法、构件识别方法及相关设备 | |
CN112183695B (zh) | 编码方法、编码图形、编码图形读取方法和拍摄装置 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20913946 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20913946 Country of ref document: EP Kind code of ref document: A1 |