QR code, QR code generation, identification method, device and equipment
The narrow-bar two-dimensional code addresses the space constraint issue by minimizing positioning patterns and enhancing recognition efficiency through structured color blocks, enabling effective use in limited spaces.
Patent Information
- Application Number
- CN202110634241.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-18
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2039-03-18
AI Technical Summary
Traditional QR codes are inconvenient for use in scenarios with limited space due to their large stake point structures, which occupy a significant area.
A narrow-bar two-dimensional code is generated with reduced positioning patterns, utilizing a rectangular area filled with specific color blocks to minimize space usage while maintaining data capacity, and a method for recognizing these codes is developed to enhance efficiency.
The narrow-bar two-dimensional code occupies less area, allowing for convenient use in small spaces and improves recognition efficiency by focusing on reduced positioning patterns and structured color blocks.
Smart Images

Figure CN113420859B_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application with application number 201910205310.X filed on March 18, 2019, and entitled “Narrow Bar QR Code, Generation and Recognition Method, Device and Equipment for Narrow Bar QR Code”. Technical Field
[0002] One or more embodiments of the present specification relate to the field of image processing technology, and in particular, to a narrow-bar two-dimensional code, and a method, device, and apparatus for generating and recognizing a narrow-bar two-dimensional code. Background Art
[0003] A two-dimensional bar code is a bar code that records information by means of graphics distributed in a two-dimensional direction on a plane according to a certain pattern. Among them, the QR two-dimensional code (QR code for short) is the most common. Traditional QR codes usually have three large stake point structures for positioning. In the binary two-dimensional code, the black and white length ratio of the line segments of the large stake point structure satisfies 1:1:3:1:1. However, in some scenarios, for example, when the two-dimensional code is used to record information related to the book number, the traditional two-dimensional code is not convenient to use because the space for posting the QR code is relatively small.
[0004] Therefore, it is necessary to generate a two-dimensional code to facilitate use when the use space is relatively small. Summary of the invention
[0005] One or more embodiments of the present specification describe a narrow bar two-dimensional code, a method, device and apparatus for generating and recognizing a narrow bar two-dimensional code, which can generate a small two-dimensional code so that it can be conveniently used in a situation where the use space is relatively small.
[0006] In a first aspect, a method for generating a narrow barcode is provided, comprising:
[0007] Determine a rectangular area, wherein the rectangular area includes blocks to be filled arranged in a grid shape;
[0008] Filling two square areas at two vertices of the rectangular area with two positioning patterns respectively, wherein each positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block;
[0009] In the rectangular area, for each positioning pattern, the area surrounding the positioning pattern is filled with the first color block to form a corresponding isolation area;
[0010] The first color block and the second color block corresponding to the two-dimensional code data are filled in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0011] In a second aspect, a method for recognizing a narrow barcode is provided, comprising:
[0012] Get the image of the narrow bar QR code;
[0013] Detecting a positioning pattern in the image, the positioning pattern comprising a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block, and the periphery of the positioning pattern has an isolation area formed by the first color block;
[0014] When two positioning patterns are detected, based on the center positions of the two positioning patterns, a target area including a rectangular area corresponding to the narrow bar two-dimensional code is determined in the image;
[0015] Determine a data area to be identified from the target area;
[0016] The two-dimensional code data in the data area is identified.
[0017] In a third aspect, a narrow bar two-dimensional code is provided, comprising:
[0018] Two positioning patterns, the two positioning patterns are located at two vertices of the rectangular area, wherein each positioning pattern includes a square structure located at the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block;
[0019] two isolation areas, each isolation area is formed by a first color block surrounding one of the positioning patterns in the rectangular area;
[0020] The data area used to form the two-dimensional code data includes an area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0021] In a fourth aspect, a device for generating a narrow barcode is provided, comprising:
[0022] A determination unit, used to determine a rectangular area, wherein the rectangular area includes blocks to be filled arranged in a grid shape;
[0023] A filling unit, used to fill two square areas at two vertices in the rectangular area determined by the determining unit with two positioning patterns, wherein each positioning pattern includes a square structure located at the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block;
[0024] The filling unit is further configured to fill, for each positioning pattern in the rectangular area determined by the determining unit, an area surrounding the positioning pattern with a first color block to form a corresponding isolation area;
[0025] The filling unit is further used to fill the first color block and the second color block corresponding to the two-dimensional code data in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0026] In a fifth aspect, a narrow bar two-dimensional code recognition device is provided, comprising:
[0027] An acquisition unit, used for acquiring an image of a narrow bar two-dimensional code;
[0028] a detection unit, configured to detect a positioning pattern in the image acquired by the acquisition unit, wherein the positioning pattern includes a square structure located in the center and composed of first color blocks, and a frame structure surrounding the square structure and composed of second color blocks, and an isolation area formed by the first color blocks is provided on the periphery of the positioning pattern;
[0029] a determination unit, configured to determine, when the detection unit detects the two positioning patterns, a target area including a rectangular area corresponding to the narrow bar two-dimensional code in the image based on the center positions of the two positioning patterns;
[0030] The determination unit is further used to determine the data area to be identified from the target area;
[0031] The identification unit is used to identify the two-dimensional code data of the data area determined by the determination unit.
[0032] In a sixth aspect, a device for generating a narrow barcode is provided, comprising:
[0033] Memory;
[0034] one or more processors; and
[0035] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and when the programs are executed by the processors, the following steps are implemented:
[0036] Determine a rectangular area, wherein the rectangular area includes blocks to be filled arranged in a grid shape;
[0037] Filling two square areas at two vertices of the rectangular area with two positioning patterns respectively, wherein each positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block;
[0038] In the rectangular area, for each positioning pattern, the area surrounding the positioning pattern is filled with the first color block to form a corresponding isolation area;
[0039] The first color block and the second color block corresponding to the two-dimensional code data are filled in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0040] In a seventh aspect, a narrow bar two-dimensional code recognition device is provided, comprising:
[0041] Memory;
[0042] one or more processors; and
[0043] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and when the programs are executed by the processors, the following steps are implemented:
[0044] Get the image of the narrow bar QR code;
[0045] Detecting a positioning pattern in the image, the positioning pattern comprising a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block, and the periphery of the positioning pattern has an isolation area formed by the first color block;
[0046] When two positioning patterns are detected, based on the center positions of the two positioning patterns, a target area including a rectangular area corresponding to the narrow bar two-dimensional code is determined in the image;
[0047] Determine a data area to be identified from the target area;
[0048] The two-dimensional code data in the data area is identified.
[0049] The narrow bar two-dimensional code, the generation and recognition method, device and equipment of the narrow bar two-dimensional code provided by one or more embodiments of the present specification determine a rectangular area, which includes blocks to be filled arranged in a grid shape. Two square areas at two vertices in the rectangular area are filled with two positioning patterns, respectively, wherein each positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounded by a second color block. In the rectangular area, for each positioning pattern, the area surrounding the positioning pattern is filled with the first color block to form a corresponding isolation area. The first color block and the second color block corresponding to the two-dimensional code data are filled in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area. It can be seen from this that the narrow bar two-dimensional code generated by the present specification can contain only two positioning patterns, thereby greatly reducing the area of the narrow bar two-dimensional code, which can be convenient for use in cases where the use space is relatively small. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0051] Figure 1 A flow chart of a method for generating a narrow bar two-dimensional code provided in one embodiment of this specification;
[0052] Figure 2a One of the positioning graphic diagrams provided in this manual;
[0053] Figure 2b This is the second positioning graphic diagram provided in this manual;
[0054] Figure 3 A schematic diagram of the isolation area of the positioning pattern provided in this specification;
[0055] Figure 4 A schematic diagram of the narrow bar QR code provided for this manual;
[0056] Figure 5 A flow chart of a method for recognizing a narrow bar two-dimensional code provided in one embodiment of this specification;
[0057] Figure 6 A schematic diagram of a device for generating a narrow bar two-dimensional code provided in one embodiment of this specification;
[0058] Figure 7 A schematic diagram of a narrow bar two-dimensional code recognition device provided in one embodiment of this specification;
[0059] Figure 8 A schematic diagram of a device for generating a narrow bar two-dimensional code provided in one embodiment of this specification;
[0060] Fig. 9 A schematic diagram of a narrow barcode recognition device provided in accordance with an embodiment of the present specification. DETAILED DESCRIPTION
[0061] The solution provided in this specification is described below in conjunction with the accompanying drawings.
[0062] Figure 1 The flowchart of the method for generating a narrow bar two-dimensional code provided in one embodiment of this specification. The execution subject of the method can be a device with processing capabilities: a server or a system or a device. Figure 1 As shown, the method may specifically include:
[0063] Step 102: determine a rectangular area.
[0064] The rectangular area may include blocks to be filled arranged in a grid shape. The blocks here may correspond to a number of pixels. It should be noted that in the initially determined rectangular area, the pixel values of these pixels are still uncertain, so the color values of each block in the rectangular area are empty.
[0065] It should be noted that the size (or area) of the rectangular area generated above can be N*M, where N is the width of the rectangular area and M is the length of the rectangular area. In this specification, the above M can be greater than N. For example, in one example, N can be 6 and M can be 23. In another example, N can be 7 and M can be 20. It should be noted that in order to ensure that the narrow bar QR code generated subsequently can store enough data, the size of the rectangular area can be set to be greater than 120, that is, N*M>120.
[0066] Step 104: Use two positioning patterns to fill two square areas at two vertices in the rectangular area respectively.
[0067] The two vertices here may be two vertices at both ends of a diagonal line of the rectangular region, or may be two vertices at both ends of a long side of the rectangular region.
[0068] Each positioning pattern may include a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block. The first color block here may refer to a white block or a black block. It is understood that when the first color block is a white block, the second color block is a black block; and when the first color block is a black block, the second color block is a white block.
[0069] In addition, the width ratio of the square structure and the frame structure of the positioning pattern may be 1:1, that is, in the horizontal and / or vertical directions, the width ratio of the second color block, the first color block and the second color block of the positioning pattern may be 1:1:1.
[0070] In one example, the positioning pattern can be as follows: Figure 2a shown. Figure 2a In the example, the central square structure of the positioning pattern is composed of one white block, and the frame structure surrounding the square structure is composed of eight black blocks. In addition, in the horizontal and / or vertical directions, the width ratio of the black block, the white block, and the black block of the positioning pattern is 1:1:1.
[0071] In another example, the positioning pattern can be as follows Figure 2b shown. Figure 2bIn the example, the central square structure of the positioning pattern is composed of 4 white blocks, and the frame structure surrounding the square structure is composed of 32 black blocks. In addition, in the horizontal and / or vertical directions, the width ratio of the black block, the white block and the black block of the positioning pattern is 2:2:2, that is, the width ratio is also 1:1:1.
[0072] Of course, in practical applications, Figure 2a and Figure 2b The white blocks in the figure can also be replaced by black blocks, and the black blocks can also be replaced by white blocks, which is not limited in this specification.
[0073] It can be seen that the positioning pattern in the narrow bar two-dimensional code generated by this specification occupies a smaller area than the traditional large pile point structure. In addition, this specification only generates two positioning patterns, which can reserve more area for the data area, that is, the narrow bar two-dimensional code can store more two-dimensional code data.
[0074] Step 106: In the rectangular area, for each positioning pattern, fill the area surrounding the positioning pattern with the first color block to form a corresponding isolation area.
[0075] The width of the isolation area can be the width of a block. Figure 2a Taking the positioning pattern in as an example, the corresponding isolation area can be as follows Figure 3 shown.
[0076] Step 108: Fill the data area with a first color block and a second color block corresponding to the two-dimensional code data.
[0077] The data area here may be the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0078] After completing the above filling steps, a narrow bar QR code can be obtained. In one example, the generated narrow bar QR code can be as follows: Figure 4 shown. Figure 4 In the embodiment, the length of the narrow bar two-dimensional code is greater than the width, and it may include: two positioning patterns, the two positioning patterns are respectively located at two vertices at both ends of the diagonal of the rectangular area, wherein each positioning pattern includes a white square located in the center and composed of white blocks, and a black frame surrounding the white square and composed of black blocks. For each of the above positioning patterns, the width ratio of the black blocks, the white blocks and the black blocks in the horizontal and / or vertical directions is: 1:1:1. In addition, the narrow bar two-dimensional code may also include two isolation areas and a data area for forming two-dimensional code data. Each isolation area is formed by a white block surrounding a positioning pattern in a rectangular area. The data area includes the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0079] It should be noted that Figure 4 Only one shape structure of the narrow bar QR code is shown. In other examples, the two positioning patterns may also be located at the vertex of the lower left corner and the vertex of the upper right corner of the rectangular area; or, located at the two vertices at both ends of the long side of the rectangular area. In addition, the length of the narrow bar QR code may also be smaller than the width, which is not limited in this specification.
[0080] In summary, the narrow bar two-dimensional code generated by the embodiments of this specification can occupy a smaller area while ensuring the data capacity, so it can be conveniently used in situations where the available space is relatively small.
[0081] It should be noted that, for the narrow bar two-dimensional code generated above, this specification also provides a corresponding recognition method, as follows.
[0082] Figure 5 The flowchart of the method for recognizing a narrow barcode provided in one embodiment of this specification. The execution subject of the method can be a device with processing capabilities: a server or a system or a device. Figure 5 As shown, the method may specifically include:
[0083] Step 502: Acquire an image of a narrow barcode.
[0084] The narrow barcode here may refer to a QR code whose length is greater than its width, or a QR code whose length is less than its width.
[0085] Step 504: Detect the positioning pattern in the image.
[0086] The positioning pattern may include a square structure composed of a first color block at the center, and a frame structure composed of a second color block surrounding the square structure. The positioning pattern may have an isolation area formed by the first color block at the periphery. In one example, the positioning pattern and the corresponding isolation area may be as follows: Figure 3 shown.
[0087] In addition, the width ratio of the second color block, the first color block and the second color block in the horizontal and / or vertical directions of the positioning pattern may be 1:1:1. Therefore, the positioning pattern may be detected in the image based on this structural feature.
[0088] Step 506: When two positioning patterns are detected, a target area including a rectangular area corresponding to the narrow bar two-dimensional code is determined in the image based on the center positions of the two positioning patterns.
[0089] Specifically, in the case where the two positioning patterns are located at two vertices at both ends of the diagonal of the rectangular area, the target area determination process may be as follows: based on the center positions of the two positioning patterns, the diagonal of the rectangular area corresponding to the narrow bar QR code is determined. Based on the diagonal, the target area containing the rectangular area is determined in the image.
[0090] If two positioning patterns are located at two vertices at both ends of the long side of the rectangular area, the target area can be determined based on the center positions of the two positioning patterns and other positioning patterns. The other positioning patterns here can be, for example, Figure 4 There are two black blocks in the lower left and upper right corners.
[0091] Step 508: determine the data region to be identified from the target region.
[0092] It should be noted that the target area determined by step 506 is only the approximate position of the narrow bar two-dimensional code in the image. In order to improve the recognition efficiency of the narrow bar two-dimensional code, the corresponding rectangular area can be further located in the target area. For example, the outline of the rectangular area can be extracted from the target area based on the corrosion algorithm. Then, the data area to be recognized is determined based on the extracted outline.
[0093] In one implementation, the above process of determining the data area to be identified based on the extracted contour can be: scanning the extracted contour, and in the scanning process, repeatedly performing the following steps: selecting two points from the contour, and calculating the slope of the line constructed through the two points. After scanning the extracted contour once, the number of occurrences of each calculated slope is counted. Based on the slope with the largest number of occurrences, the lateral direction of the narrow bar two-dimensional code is determined. Afterwards, based on the center positions of the two positioning patterns, a center line is constructed. Determine the angle of the center line relative to the lateral direction. According to the center positions and angles of the two positioning patterns, determine the four vertices of the narrow bar two-dimensional code. Based on the four vertices, determine the data area to be identified.
[0094] Step 510: Identify the two-dimensional code data in the data area.
[0095] The recognition process may specifically include: determining the perspective transformation relationship based on the coordinates of the four determined vertices and the preset standard code coordinates, then sampling the two-dimensional code data in the data area based on the perspective transformation relationship, and finally decoding the sampled two-dimensional code data.
[0096] It should be noted that, since the two-dimensional code recognition method provided in the embodiment of this specification only detects two positioning patterns and the area of the identified narrow-bar two-dimensional code is small, the solution provided in this specification has a higher recognition efficiency.
[0097] Corresponding to the above-mentioned method for generating a narrow bar two-dimensional code, an embodiment of the present specification also provides a device for generating a narrow bar two-dimensional code, such as Figure 6 As shown, the device may include:
[0098] The determining unit 602 is used to determine a rectangular area, where the rectangular area includes blocks to be filled arranged in a grid shape.
[0099] The length of the rectangular area can be greater than its width.
[0100] The filling unit 604 is used to fill two square areas at two vertices in the rectangular area determined by the determination unit 602 with two positioning patterns, wherein each positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block.
[0101] The two vertices may be two vertices at both ends of a diagonal line of the rectangular region, or the two vertices may be two vertices at both ends of a long side of the rectangular region.
[0102] The filling unit 604 is further configured to fill the area surrounding each positioning pattern with the first color block in the rectangular area determined by the determining unit 602 to form a corresponding isolation area.
[0103] The filling unit 604 is further used to fill the data area with the first color block and the second color block corresponding to the two-dimensional code data. The data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0104] Optionally, the ratio of the width of the square structure to the width of the frame structure is 1:1.
[0105] The functions of the functional modules of the device in the above-mentioned embodiment of this specification can be implemented through the steps of the above-mentioned method embodiment. Therefore, the specific working process of the device provided by one embodiment of this specification will not be repeated here.
[0106] A narrow-bar two-dimensional code generation device provided in an embodiment of the present specification can generate a small two-dimensional code, so that it can be conveniently used in a situation where the use space is small.
[0107] Corresponding to the above-mentioned narrow bar two-dimensional code recognition method, an embodiment of this specification also provides a narrow bar two-dimensional code recognition device, such as Figure 7 As shown, the device may include:
[0108] The acquisition unit 702 is used to acquire the image of the narrow bar two-dimensional code.
[0109] The detection unit 704 is used to detect a positioning pattern in the image acquired by the acquisition unit 702. The positioning pattern may include a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block, and the periphery of the positioning pattern has an isolation area formed by the first color block.
[0110] The detection unit 704 can be specifically used for:
[0111] A positioning pattern is detected in the image where the ratio of the width of the square structure to the width of the frame structure is 1:1.
[0112] The determination unit 706 is configured to determine, when the detection unit 704 detects two positioning patterns, a target area including a rectangular area corresponding to the narrow bar two-dimensional code in the image based on the center positions of the two positioning patterns.
[0113] The determining unit 706 may be specifically configured to:
[0114] Based on the center positions of the two positioning patterns, the diagonal line of the rectangular area corresponding to the narrow bar two-dimensional code is determined.
[0115] According to the diagonal line, a target area containing a rectangular area is determined in the image.
[0116] The determination unit 706 is further configured to determine a data region to be identified from the target region.
[0117] The determining unit 706 may be specifically configured to:
[0118] Based on the erosion algorithm, the outline of the rectangular area is extracted from the target area.
[0119] Based on the extracted contours, the data region to be identified is determined.
[0120] The identification unit 708 is used to identify the two-dimensional code data of the data area determined by the determination unit 706.
[0121] Optionally, the determining unit 706 may be further specifically configured to:
[0122] Iteratively select two points from the extracted contour and calculate the slope of the line constructed through the two points.
[0123] After scanning the extracted contour once, the number of occurrences of each slope is counted.
[0124] Based on the slope with the highest number of occurrences, the horizontal direction of the narrow barcode is determined.
[0125] The four vertices of the narrow bar two-dimensional code are determined according to the center positions and the lateral directions of the two positioning patterns.
[0126] Based on the determined four vertices, a data region to be identified is determined.
[0127] Optionally, the determining unit 706 may be further specifically configured to:
[0128] Construct a center line based on the center positions of the two positioning figures.
[0129] Determine the angle of the centerline relative to the transverse direction.
[0130] The four vertices of the narrow bar QR code are determined according to the center positions and the included angles of the two positioning patterns.
[0131] A narrow-bar two-dimensional code recognition device provided by an embodiment of the present specification can quickly and accurately recognize a narrow-bar two-dimensional code.
[0132] Corresponding to the above-mentioned method for generating a narrow bar two-dimensional code, the embodiment of this specification also provides a device for generating a narrow bar two-dimensional code, such as Figure 8 As shown, the device may include: a memory 802, one or more processors 804, and one or more programs. The one or more programs are stored in the memory 802 and are configured to be executed by the one or more processors 804. When the program is executed by the processor 804, the following steps are implemented:
[0133] A rectangular area is determined, where the rectangular area includes blocks to be filled arranged in a grid.
[0134] Two square areas at two vertices in the rectangular area are filled with two positioning patterns respectively, wherein each positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block.
[0135] In the rectangular area, for each positioning pattern, the area surrounding the positioning pattern is filled with the first color block to form a corresponding isolation area.
[0136] The first color block and the second color block corresponding to the two-dimensional code data are filled in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
[0137] A narrow bar two-dimensional code generation device provided in an embodiment of the present specification can generate a small two-dimensional code, thereby facilitating the use of users.
[0138] Corresponding to the above-mentioned narrow bar two-dimensional code recognition method, the embodiment of this specification also provides a narrow bar two-dimensional code recognition device, such as Fig. 9As shown, the device may include: a memory 902, one or more processors 904, and one or more programs. The one or more programs are stored in the memory 902 and are configured to be executed by the one or more processors 904. When the program is executed by the processor 904, the following steps are implemented:
[0139] Get an image of a narrow barcode.
[0140] A positioning pattern is detected in the image. The positioning pattern includes a square structure located in the center and composed of first color blocks, and a frame structure surrounding the square structure and composed of second color blocks. The periphery of the positioning pattern has an isolation area formed by the first color block.
[0141] When two positioning patterns are detected, a target area including a rectangular area corresponding to the narrow bar two-dimensional code is determined in the image based on the center positions of the two positioning patterns.
[0142] A data area to be identified is determined from the target area.
[0143] Identify the QR code data in the data area.
[0144] A narrow-bar two-dimensional code recognition device provided by an embodiment of the present specification can quickly and accurately recognize a narrow-bar two-dimensional code.
[0145] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0146] The steps of the method or algorithm described in conjunction with the disclosure of this specification can be implemented in hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, mobile hard disk, CD-ROM or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a server. Of course, the processor and the storage medium can also exist in the server as discrete components.
[0147] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the present invention may be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, the functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium may be any available medium that a general or special-purpose computer can access.
[0148] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0149] The specific implementation methods described above further illustrate the purpose, technical solutions and beneficial effects of this specification. It should be understood that the above description is only the specific implementation method of this specification and is not intended to limit the protection scope of this specification. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of this specification should be included in the protection scope of this specification.
Claims
1. A method for generating a narrow barcode, comprising: Determine a rectangular area, wherein the rectangular area includes blocks to be filled arranged in a grid shape; Two positioning patterns are formed in two square areas at two vertices of the rectangular area, the positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block, and the periphery of the positioning pattern has an isolation area formed by the first color block surrounding the positioning pattern; the ratio of the width of the square structure to the width of the frame structure is 1:1; The first color block and the second color block corresponding to the two-dimensional code data are filled in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area.
2. The method according to claim 1, wherein: The two vertices are two vertices at both ends of a diagonal line of the rectangular area.
3. The method according to claim 1, wherein: The two vertices are two vertices at both ends of the rectangular long side of the rectangular area; the method further includes: Two other positioning patterns are formed at the other two vertices of the rectangular area, and the width of the other positioning patterns is the width of a color block.
4. The method according to claim 1, wherein: The width of the isolation area is the width of a color block.
5. A method for recognizing a narrow bar two-dimensional code, comprising: Get the QR code; Detecting a positioning pattern in the two-dimensional code, the positioning pattern comprising a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block; the periphery of the positioning pattern has an isolation area formed by the first color block; When two positioning patterns are detected, a target area is determined in the two-dimensional code based on the center positions of the two positioning patterns; Determining a data area to be identified from the target area; Identify the two-dimensional code data of the data area; The detecting and positioning pattern in the two-dimensional code comprises: A positioning pattern in which the ratio of the width of the square structure to the width of the surrounding frame structure is 1:1 is detected in the two-dimensional code.
6. A narrow bar two-dimensional code, comprising: Two positioning patterns, the two positioning patterns are respectively located at two vertices of a rectangular area, each positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block, and the periphery of the positioning pattern has an isolation area formed by the first color block surrounding the positioning pattern, and the ratio of the width of the square structure to the frame structure is 1:
1.
7. The two-dimensional code according to claim 6, wherein: The two vertices are two vertices at both ends of a diagonal line of the rectangular area.
8. The two-dimensional code according to claim 6, wherein: The two vertices are two vertices at both ends of the rectangular long side of the rectangular area; the two-dimensional code also includes: Two other positioning patterns, the two other positioning patterns are respectively located at the other two vertices of the rectangular area, and the width of the other positioning patterns is the width of one color block.
9. The two-dimensional code according to claim 6, wherein: The width of the isolation area is the width of a color block.
10. A device for generating a narrow bar two-dimensional code, comprising: A determination unit, used to determine a rectangular area, wherein the rectangular area includes blocks to be filled arranged in a grid shape; A filling unit, used to form two positioning patterns in two square areas at two vertices of the rectangular area, wherein the positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block, and the periphery of the positioning pattern has an isolation area formed by the first color block surrounding the positioning pattern; The filling unit is also used to fill the first color block and the second color block corresponding to the two-dimensional code data in the data area, and the data area is the area in the rectangular area except the two positioning patterns and the corresponding isolation area. The ratio of the width of the square structure and the width of the frame structure is 1:
1.
11. The device according to claim 10, wherein: The two vertices are two vertices at both ends of a diagonal line of the rectangular area.
12. The device according to claim 10, wherein: The two vertices are two vertices at both ends of the rectangular long side of the rectangular area; The forming unit is further used to form two other positioning patterns at the other two vertices of the rectangular area, and the width of the other positioning patterns is the width of a color block.
13. The device according to claim 10, wherein: The width of the isolation area is the width of a color block.
14. A narrow bar two-dimensional code recognition device, comprising: An acquisition unit, used for acquiring a QR code; A detection unit, configured to detect a positioning pattern in the two-dimensional code, wherein the positioning pattern includes a square structure located in the center and composed of a first color block, and a frame structure surrounding the square structure and composed of a second color block; and an isolation area formed by the first color block is provided on the periphery of the positioning pattern; a determination unit, configured to determine a target area in the two-dimensional code based on the center positions of the two positioning patterns when the two positioning patterns are detected; The determining unit is further used to determine a data area to be identified from the target area; The recognition unit is used to recognize the two-dimensional code data in the data area; the detection unit is specifically used to: A positioning pattern in which the ratio of the width of the square structure to the width of the surrounding frame structure is 1:1 is detected in the two-dimensional code.
