Method and device for hierarchical display and recognition of two-dimensional code
By splitting the QR code into multiple layers and displaying and re-releasing it in time in images or videos, the problem of QR code affecting the overall aesthetics is solved, and the normal use of QR code without affecting the aesthetics is achieved.
Patent Information
- Application Number
- CN202110406764.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-15
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2041-04-15
AI Technical Summary
In the prior art, displaying a complete QR code in an image or video affects the overall aesthetics of the image or video.
The original QR code is split into n layers, placed in n pictures or image frames arranged in time sequence, and recognized and restored through the camera to obtain QR code information.
In images or videos, the impact of QR code on the overall appearance is greatly reduced, and the use effect of QR code is ensured.
Smart Images

Figure CN113011432B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and in particular, to a method and device for hierarchical display and recognition of two-dimensional codes. Background Art
[0002] A two-dimensional code that represents information by separately painting white or black the cells arranged vertically and horizontally can handle more information than a one-dimensional bar code and is used in various scenes of daily life; and the display method of this two-dimensional code is to fixedly display a complete two-dimensional code in a fixed area in an image or video. Such a method has an obvious disadvantage: the two-dimensional code area will have a strong sense of presence and is very obtrusive in the image or video, affecting the overall beauty of the picture or image. Summary of the Invention
[0003] An object of this application is to provide a method and device for hierarchical display and recognition of two-dimensional codes, so as to solve the problem that the display of a complete two-dimensional code in an image or video in the prior art affects the overall beauty of the picture or video.
[0004] According to one aspect of this application, a method for hierarchical display and recognition of two-dimensional codes is provided. The method includes:
[0005] Splitting the original two-dimensional code into n layers, where n≥2;
[0006] Placing the n layers into n pictures or image frames arranged in time sequence, and displaying them in the n pictures or videos at the fixed position corresponding to the two-dimensional code;
[0007] Identifying the pictures or images containing the two-dimensional code layers, and restoring all the identified two-dimensional code layers to obtain two-dimensional code information.
[0008] Optionally, the splitting the original two-dimensional code into n layers includes:
[0009] Preprocessing the original two-dimensional code, cutting the preprocessed original two-dimensional code based on a specified unit length to obtain n blocks of unit length, and putting each block into a layer to obtain n layers.
[0010] Optionally, the preprocessing the original two-dimensional code, cutting the preprocessed original two-dimensional code based on a specified unit length to obtain n blocks of unit length includes:
[0011] Cutting the original two-dimensional code based on color parameters to obtain multiple blocks of different colors, and cutting the multiple blocks of different colors into n blocks of single color of unit length based on the specified unit length.
[0012] Optionally, placing the n layers into n pictures or image frames arranged in sequence includes:
[0013] Dividing a region with the same size as the two-dimensional code in each picture or each image frame of the n pictures or image frames arranged in sequence as a specified region, obtaining n specified regions;
[0014] Placing the n layers into the n specified regions respectively.
[0015] Optionally, identifying a picture or image containing a two-dimensional code layer, and restoring all the identified two-dimensional code layers to obtain two-dimensional code information, including:
[0016] Continuously scanning the picture or video containing the two-dimensional code layer with a camera using an image combination algorithm for placement to obtain multiple two-dimensional code layers;
[0017] Stacking the multiple two-dimensional code layers, restoring to obtain a target two-dimensional code, and identifying the target two-dimensional code to read corresponding information to obtain two-dimensional code information.
[0018] Optionally, splitting an original two-dimensional code into n layers, including:
[0019] Obtaining the original two-dimensional code and the number of code points of the original two-dimensional code;
[0020] Splitting the original two-dimensional code into n layers, where 2 ≤ n ≤ the number of code points.
[0021] According to another aspect of the present application, there is also provided a device for hierarchical display and recognition of two-dimensional codes, where the device includes:
[0022] A two-dimensional code splitting module for splitting an original two-dimensional code into n layers, where n ≥ 2;
[0023] A data processing module for placing the n layers into n pictures or image frames arranged in sequence and displaying them in the n pictures or videos at fixed positions corresponding to the two-dimensional code;
[0024] An identification and restoration module for identifying a picture or image containing a two-dimensional code layer and restoring all the identified two-dimensional code layers to obtain two-dimensional code information.
[0025] According to still another aspect of the present application, there is also provided a computer-readable medium, on which computer-readable instructions are stored, and the computer-readable instructions can be executed by a processor to implement the method as described in any one of the foregoing items.
[0026] According to another aspect of the present application, there is also provided a device for hierarchical display and recognition of two-dimensional codes, wherein the device includes:
[0027] One or more processors; and
[0028] A memory storing computer-readable instructions, which when executed cause the processor to perform the operations of the method described in any of the foregoing items.
[0029] Compared with the prior art, in the present application, the original two-dimensional code is split into n layers, where n≥2; the n layers are respectively placed into n pictures or image frames arranged in time sequence and displayed in the n pictures or videos at the fixed positions corresponding to the two-dimensional code; the pictures or images containing the two-dimensional code layers are recognized, and all the recognized two-dimensional code layers are restored to obtain the two-dimensional code information. Thereby, the influence of the two-dimensional code on the overall visual perception is greatly reduced in the image or video, and the use effect of the two-dimensional code is ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, objects and advantages of the present application will become more apparent:
[0031] Figure 1 Showing a schematic flowchart of a method for hierarchical display and recognition of a two-dimensional code provided according to one aspect of the present application;
[0032] Figure 2 Showing a schematic diagram of a splitting structure of a two-dimensional code in an optional embodiment of the present application;
[0033] Figure 3 Showing a schematic diagram of a splitting structure of a two-dimensional code in an optional embodiment of the present application;
[0034] Figure 4 Showing a schematic diagram of a splitting structure of a two-dimensional code in an optional embodiment of the present application;
[0035] Figure 5 Showing a schematic diagram of a splitting structure of a two-dimensional code in an optional embodiment of the present application;
[0036] Figure 6 Showing a perspective view of a two-dimensional code splitting in an optional embodiment of the present application;
[0037] Figure 7 Showing a schematic flowchart of a method for hierarchical display and recognition of a two-dimensional code provided according to an optional embodiment of the present application;
[0038] Figure 8Schematic diagram of a device framework structure for hierarchical display and recognition of two-dimensional codes provided according to another aspect of the present application.
[0039] Like reference numerals in the drawings denote like or similar components. Detailed implementation manners
[0040] The present application will be further described in detail below with reference to the accompanying drawings.
[0041] In a typical configuration of the present application, the terminal, the devices of the service network, and the trusted party each include one or more processors (CPUs), an input / output interface, a network interface, and a memory.
[0042] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory is an example of the computer-readable medium.
[0043] The computer-readable medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of the computer storage medium include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory, or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD), or other optical storage, magnetic cassette tapes, magnetic disk storage, or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device. As defined herein, the computer-readable medium does not include transitory media, such as modulated data signals and carrier waves.
[0044] Figure 1Schematic diagram of a method for hierarchical display and recognition of a two-dimensional code provided according to an aspect of the present application. The method includes: S100 to S300. Among them, in S100, the original two-dimensional code is split into n layers, where n≥2; in S200, the n layers are respectively placed into n pictures or image frames arranged in time sequence, and are displayed in the n pictures or videos at the fixed position corresponding to the two-dimensional code; in S300, the pictures or images containing the two-dimensional code layers are recognized, and all the recognized two-dimensional code layers are restored to obtain the two-dimensional code information. Thus, the influence of the two-dimensional code on the overall visual perception is greatly reduced in the image or video, and the use effect of the two-dimensional code is ensured.
[0045] Specifically, in S100, the original two-dimensional code is split into n layers, where n≥2. Here, the original two-dimensional code is split into n layers based on a specified method. For example, it is split based on the code points of the two-dimensional code, or the original two-dimensional code is split based on a certain unit length to obtain n blocks, and each block is used as a layer.
[0046] In S200, the n layers are respectively placed into n pictures or image frames arranged in time sequence, and are displayed in the n pictures or videos at the fixed position corresponding to the two-dimensional code. Here, an equal number of layers are placed into an equal number of pictures or image frames. Here, multiple pictures or image frames are arranged along the time axis to form a dynamic picture or video. A fixed position can be selected in the n pictures or image frames to display the two-dimensional code. Among them, the corresponding positions of the blocks in the layer in the two-dimensional code remain unchanged. During the display process, the blocks in the layer will be displayed at the corresponding positions in the two-dimensional code at the fixed position in the picture or image frame. Since only one block in one of the split layers of the two-dimensional code is displayed at the fixed position in each picture or image frame, the display of the two-dimensional code can reduce the influence on the visual perception of the overall picture or video.
[0047] In S300, the pictures or images containing the two-dimensional code layers are recognized, and all the recognized two-dimensional code layers are restored to obtain the two-dimensional code information. Here, a camera or video recorder pre-installed with a two-dimensional code restoration and recognition algorithm can be used to recognize and restore the pictures or images containing the two-dimensional code layers to obtain the information corresponding to the two-dimensional code. Thus, the influence of the two-dimensional code on the overall visual perception is greatly reduced in the image or video, and the use effect of the two-dimensional code is ensured.
[0048] In an optional embodiment of the present application, in S100, the original two-dimensional code is preprocessed. The preprocessed original two-dimensional code is cut based on a specified unit length to obtain n blocks of the unit length, and each block is placed into a layer to obtain n layers. Here, the original two-dimensional code can be subjected to image preprocessing such as pixelization. The preprocessed original two-dimensional code is cut based on a specified unit length to obtain n blocks of the unit length. Among them, the specified unit length can be pixels or millimeters. Each block is placed into a layer to obtain n layers. Here, n is a positive integer. The cutting process of the original two-dimensional code here can be evenly cut according to the number of video frames, and there can also be duplicate blocks, which will not affect the superposition and restoration of the original two-dimensional code.
[0049] In an optional embodiment of the present application, in S200, in each of the n pictures or image frames arranged in time sequence, a region having the same size as the two-dimensional code is divided as a specified region to obtain n specified regions; the n layers are respectively placed into the n specified regions. Here, in each of the n pictures or image frames arranged in time sequence, the specified region is set to a region having the same size as the two-dimensional code, and the n layers are respectively placed into the n specified regions. Among them, the layer is a layer having the same size as the two-dimensional code, and the position of the block in the layer is the same as its corresponding position in the two-dimensional code. When the layers in all the specified regions on the time axis are superimposed, the complete original two-dimensional code can be obtained.
[0050] In an optional embodiment of the present application, in S200, in each of the n pictures or image frames arranged in time sequence, a region having the same size as the two-dimensional code is divided as a specified region to obtain n specified regions; the n layers are respectively placed into the n specified regions. Here, in each of the n pictures or image frames arranged in time sequence, the specified region is set to a region having the same size as the two-dimensional code, and the n layers are respectively placed into the n specified regions. Among them, the layer is a layer having the same size as the two-dimensional code, and the position of the block in the layer is the same as its corresponding position in the two-dimensional code. When the layers in all the specified regions on the time axis are superimposed, the complete original two-dimensional code can be obtained.
[0051] In an optional embodiment of the present application, in S300, a camera embedded with an image combination algorithm is used to continuously scan the picture or video containing the QR code layer to obtain multiple QR code layers; the multiple QR code layers are layered and restored to obtain a target QR code, and the target QR code is identified to read corresponding information to obtain QR code information. Here, by continuously scanning the picture or video containing the QR code layer using a camera embedded with an image combination algorithm, a designated QR code area can be captured from the picture or video containing the QR code layer, and all layers in the designated QR code area can be determined. Then, all QR code layers are layered using a preset image combination algorithm to determine the restored target QR code, and then the target QR code is identified to obtain the corresponding QR code information.
[0052] In an optional embodiment of the present application, in S100, the original two-dimensional code and the number of code points of the original two-dimensional code are obtained; the original two-dimensional code is split into n layers, where 2≤n≤the number of code points. Here, the original two-dimensional code and the number of code points of the original two-dimensional code are obtained, and the original two-dimensional code can be split into at least 2 layers, but the number of code points must be less than or equal to the number of code points, so as to facilitate the subsequent restoration of the two-dimensional code.
[0053] Figure 2 , Figure 3 , Figure 4 and Figure 5 A schematic diagram of a split structure of a two-dimensional code in an optional embodiment of the present application is shown, wherein: Figure 2 is the original QR code, Figure 3 , Figure 4 and Figure 5 for Figure 2 The layer after the QR code is split. Figure 6 A perspective schematic diagram of a two-dimensional code splitting in an optional embodiment of the present application is shown, where the original two-dimensional code is split into three layers according to the code points, and the blocks in each layer are superimposed to obtain the original two-dimensional code.
[0054] Figure 7The figure shows a schematic flowchart of a method for hierarchical display and recognition of a two-dimensional code in an alternative embodiment of the present application. After obtaining the original two-dimensional code, the original two-dimensional code is split into n layers to reduce the impact on the overall display image. According to requirements, the two-dimensional code can be split into n layers, where 2 ≤ n ≤ x, and x is the number of code points of the two-dimensional code. Then, the n split two-dimensional code layers are respectively placed into n different continuously displayed pictures or image frames, such as a short video clip played continuously; or in a series of pictures. The split two-dimensional code layers are displayed in a fixed area and at fixed upper and lower positions (the front and back relationship of the two-dimensional code). Then, a camera using a preset image combination algorithm is used as a two-dimensional code scanning device. The camera of the two-dimensional code recognition device continuously scans the pictures or images containing the two-dimensional code layers, obtains and records all the two-dimensional code layers. Then, the different n two-dimensional code layers are restored to the original two-dimensional code picture through the preset image combination algorithm, and then this two-dimensional code is recognized and the information it contains is read. Thus, the impact of the two-dimensional code on the overall visual perception in the image or video is greatly reduced, and the use effect of the two-dimensional code is ensured.
[0055] An embodiment of the present application also provides a computer-readable medium, on which computer-readable instructions are stored, and the computer-readable instructions can be executed by a processor to implement the foregoing method for hierarchical display and recognition of a two-dimensional code.
[0056] Corresponding to the method described above, the present application also provides a terminal, which includes modules or units capable of executing the method steps described in the above Figure 1 or Figure 2 or Figure 3 or Figure 4 or Figure 5 or Figure 6 or Figure 7 or each of the embodiments. These modules or units can be implemented in a hardware, software, or a combination of hardware and software manner, and the present application does not limit this. For example, in an embodiment of the present application, a device for hierarchical display and recognition of a two-dimensional code is also provided, where the device includes:
[0057] One or more processors; and
[0058] A memory storing computer-readable instructions, and the computer-readable instructions, when executed, cause the processor to perform the operations of the foregoing method for hierarchical display and recognition of a two-dimensional code.
[0059] For example, when the computer-readable instructions are executed, they cause the one or more processors to: split the original two-dimensional code into n layers, where n≥2; place the n layers into n pictures or image frames arranged in time sequence, and display them at the fixed positions corresponding to the two-dimensional code in the n pictures or videos; identify the pictures or images containing the two-dimensional code layers, and restore all the identified two-dimensional code layers to obtain two-dimensional code information.
[0060] Figure 8 FIG. shows a schematic structural diagram of a device framework for hierarchical display and identification of a two-dimensional code provided according to another aspect of the present application. The device includes: a two-dimensional code splitting module 100 that splits the original two-dimensional code into n layers, where n≥2; a data processing module 200 that places the n layers into n pictures or image frames arranged in time sequence and displays them at the fixed positions corresponding to the two-dimensional code in the n pictures or videos; and an identification and restoration module 300 that identifies the pictures or images containing the two-dimensional code layers and restores all the identified two-dimensional code layers to obtain two-dimensional code information. Thereby, the influence of the two-dimensional code on the overall visual perception is greatly reduced in the image or video, and the use effect of the two-dimensional code is ensured.
[0061] It should be noted that the operations performed by the two-dimensional code splitting module 100, the data processing module 200, and the identification and restoration module 300 are respectively the same as or corresponding to the contents in the above steps S100, S200, and S300. For the sake of brevity, they will not be elaborated here.
[0062] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these changes and modifications.
[0063] It should be noted that the present application can be implemented in software and / or a combination of software and hardware. For example, it can be implemented using an application-specific integrated circuit (ASIC), a general-purpose computer, or any other similar hardware device. In one embodiment, the software program of the present application can be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including related data structures) can be stored in a computer-readable recording medium, such as a RAM memory, a magnetic or optical drive, or a floppy disk and the like. In addition, some steps or functions of the present application can be implemented using hardware, for example, as a circuit that cooperates with the processor to execute each step or function.
[0064] In addition, a part of this application can be applied as a computer program product, such as computer program instructions. When executed by a computer, through the operation of this computer, it can call or provide the methods and / or technical solutions according to this application. The program instructions for calling the methods of this application may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in the working memory of a computer device that runs according to the program instructions. Here, an embodiment according to this application includes a device, which includes a memory for storing computer program instructions and a processor for executing the program instructions. When the computer program instructions are executed by the processor, the device is triggered to run based on the methods and / or technical solutions according to the foregoing multiple embodiments of this application.
[0065] For those skilled in the art, it is obvious that this application is not limited to the details of the above exemplary embodiments, and without departing from the spirit or basic characteristics of this application, this application can be implemented in other specific forms. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting. The scope of this application is defined by the appended claims rather than the above description. Therefore, it is intended to cover all changes within the meaning and scope of the equivalent elements of the claims in this application. Any reference signs in the claims should not be regarded as limiting the claims involved. In addition, obviously, the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices stated in the device claims can also be implemented by one unit or device through software or hardware. First, second, etc. are used to indicate names and do not indicate any specific order.
Claims
1. A method for hierarchical display and recognition of two-dimensional codes, wherein, The method includes: Preprocessing the original QR code, cutting the preprocessed original QR code based on a specified unit length to obtain n blocks of unit length, and placing each block into a layer to obtain n layers, where the layer is a layer of the same size as the QR code, and the position of the block in the layer is the same as its corresponding position in the QR code, where n≥2; Placing the n layers into n pictures or image frames arranged in time sequence, and displaying them at the fixed position corresponding to the QR code in the n pictures or videos; Continuously scanning the pictures or videos containing the QR code layer using a camera with an image combination algorithm to obtain multiple QR code layers, stacking the multiple QR code layers, restoring the target QR code, and identifying the target QR code to read the corresponding information to obtain the QR code information.
2. The method according to claim 1, wherein The preprocessing of the original QR code, cutting the preprocessed original QR code based on a specified unit length to obtain n blocks of unit length, includes: Cutting the original QR code based on color parameters to obtain multiple blocks of different colors, and cutting the multiple blocks of different colors into n blocks of single color with unit length based on the specified unit length.
3. The method according to claim 1, wherein The placing the n layers into n pictures or image frames arranged in time sequence includes: Dividing an area of the same size as the QR code in each of the n pictures or image frames arranged in time sequence as a specified area to obtain n specified areas; Placing the n layers into the n specified areas respectively.
4. The method according to claim 1, wherein Splitting the original QR code into n layers includes: Obtaining the original QR code and the number of code points of the original QR code; Splitting the original QR code into n layers, where 2≤n≤the number of code points.
5. A device for hierarchical display and recognition of two-dimensional codes, wherein, The device includes: A QR code splitting module that preprocesses the original QR code, cuts the preprocessed original QR code based on a specified unit length to obtain n blocks of unit length, and places each block into a layer to obtain n layers, where the layer is a layer of the same size as the QR code, and the position of the block in the layer is the same as its corresponding position in the QR code, where n≥2; A data processing module for placing the n layers into n pictures or image frames arranged in time sequence and displaying them at the fixed position corresponding to the QR code in the n pictures or videos; An identification and restoration module that incorporates an image combination algorithm for continuously scanning pictures or videos containing the QR code layer to obtain multiple QR code layers, stacking the multiple QR code layers, restoring the target QR code, and identifying the target QR code to read the corresponding information to obtain the QR code information.
6. A computer-readable medium having computer-readable instructions stored thereon, the computer-readable instructions being executable by a processor to implement the method according to any one of claims 1 to 4.
7. A device for hierarchical display and recognition of two-dimensional codes, wherein, The device includes: One or more processors; and A memory storing computer-readable instructions, the computer-readable instructions when executed cause the processor to perform the operations of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Color-superposition two-dimension code system and application method thereof
CN102184380A
Two-dimensional code and generation method thereof
CN110020702A