WO2022166619A1 - 二维码识别方法及相关装置 - Google Patents

二维码识别方法及相关装置 Download PDF

Info

Publication number
WO2022166619A1
WO2022166619A1 PCT/CN2022/073210 CN2022073210W WO2022166619A1 WO 2022166619 A1 WO2022166619 A1 WO 2022166619A1 CN 2022073210 W CN2022073210 W CN 2022073210W WO 2022166619 A1 WO2022166619 A1 WO 2022166619A1
Authority
WO
WIPO (PCT)
Prior art keywords
dimensional code
circle
area
symbol
electronic device
Prior art date
Application number
PCT/CN2022/073210
Other languages
English (en)
French (fr)
Inventor
王浩任
于德权
任亿
高昊昇
柳春良
宋平
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP22748898.8A priority Critical patent/EP4276680A4/en
Priority to US18/264,551 priority patent/US20240046055A1/en
Publication of WO2022166619A1 publication Critical patent/WO2022166619A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record 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/06009Record 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/06037Record 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record 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/06009Record 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/06046Constructional details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record 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/06009Record 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/06046Constructional details
    • G06K19/06168Constructional details the marking being a concentric barcode

Definitions

  • the present application relates to the field of electronic technologies, and in particular, to a two-dimensional code identification method and related devices.
  • the traditional square QR code is unsightly and has no guiding information; for QR codes that require special guidance, the method of adding the surrounding logo in the middle QR code often takes up a large space; or in the center of the QR code Place a small logo to cover part of the data area and affect the identification of the QR code.
  • the square two-dimensional code can be read out by a standard decoding program, and the confidentiality is relatively poor.
  • the content scanned by the square QR code can be a URL including unsafe content, such as a link including a Trojan virus, which has poor security and average user experience.
  • the embodiments of the present application provide a two-dimensional code identification method and a related device, which increase the diversity of the two-dimensional code and can realize the identification of the two-dimensional code.
  • an embodiment of the present application provides a method for recognizing a two-dimensional code.
  • the two-dimensional code includes an image area located in the middle and an annular area surrounding the image area.
  • the annular area includes a coding area, a first interval area, and a second Two spaced regions
  • the encoding region includes a plurality of symbols
  • the encoding region includes a first encoding region and a second encoding region, and a first spaced region and a second spaced region are arranged between the first encoding region and the second encoding region;
  • the Methods include:
  • the electronic device obtains the two-dimensional code to be identified, and determines the values corresponding to multiple symbols in the coding area of the two-dimensional code to be identified;
  • the electronic device identifies the first information corresponding to the two-dimensional code to be identified according to the values corresponding to the plurality of symbols in the coding area.
  • the electronic device acquires the two-dimensional code to be identified, and identifies the first information corresponding to the two-dimensional code to be identified.
  • the coding area, the first spacing area and the second spacing area in the two-dimensional code to be identified just form a circle, and the coding area is divided into the first coding area and the second spacing area by the first spacing area and the second spacing area. coding area. That is, the embodiment of the present application provides a two-dimensional code style in which the coding area is disconnected by using the spacer area.
  • the first interval area and the second interval area are partial rings with the same width.
  • a partial ring here refers to a part of a complete ring.
  • the areas occupied by the first coding region and the second coding region are the same.
  • the first coding region and the second coding region are regions with the same size, and the symmetrical distribution improves the aesthetics.
  • the ratio of the width of the image area in the horizontal direction to the width of the two-dimensional code in the horizontal direction is 1:3.
  • the embodiments of the present application do not limit the scale of the image area.
  • multiple symbols in the coding area are distributed on at least two concentric circles, and the centers of the at least two concentric circles are the centers of the two-dimensional code, wherein the symbols include Dot-shaped symbol.
  • the arc distance between the centers of adjacent dot-shaped symbols on the same concentric circle in the coding area is (2r+b)*k, where k is positive Integer, r is the radius of the dot-shaped symbol, and b is a fixed value; the perimeter of the same concentric circle is N*(2r+b), and N is a positive integer greater than k.
  • the distance between the centers of the dot-shaped symbols is defined here.
  • the minimum distance between adjacent dot-shaped symbols is 2r+b, and the distance between any two dot-shaped symbols is 2r+b. integer multiples of .
  • the arc distance between the circle centers of three consecutive dot-shaped symbols is greater than (2r+b)*2. That is to say, for example, there is no situation where the distances between three consecutive dot-shaped symbols are all the minimum distance 2r+b, and the aesthetics of the two-dimensional code can be maintained.
  • the radii of the dot-shaped symbols on different concentric circles in the two-dimensional code are different.
  • the radius of the dot-shaped symbols in the outer concentric circles in the two-dimensional code is larger than the radius of the dot-shaped symbols in the inner concentric circles.
  • the symbols also include arc-shaped symbols, and the arc length of the arc-shaped symbols on the concentric circles is (2r+b)*M, where M is a positive integer. It is described here that multiple dot-shaped symbols can be connected into an arc-shaped symbol. If the arc-shaped symbols are connected by M+1 dot-shaped symbols, the length of the arc-shaped symbol is (2r+b)*M.
  • the arc distance between an arc-shaped symbol and its adjacent symbols is greater than or equal to (2r+b)*2. Since the arc-shaped symbols are connected by consecutive dot-shaped symbols, the distance between the arc-shaped symbols and its adjacent symbols (dot-shaped symbols or arc-shaped symbols) is at least spaced apart. a dot-shaped symbol.
  • the electronic device obtains the two-dimensional code to be identified, determines the values corresponding to multiple symbols in the coding area of the two-dimensional code to be identified, and identifies the two-dimensional code to be identified.
  • the first information corresponding to the two-dimensional code includes: the electronic device obtains the two-dimensional code to be recognized; the electronic device determines the target version of the two-dimensional code to be recognized, and the target version indicates each storage in the coding area of the two-dimensional code to be recognized.
  • the specific implementation of the electronic device identifying the two-dimensional code is described here. After the electronic device recognizes the target version of the two-dimensional code, it obtains encoding information based on the position coordinates contained in the target version, and implements decoding through decoding rules. In this way, the decoding of the two-dimensional code of the two-dimensional code structure of the target version is completed.
  • each storage location is in the shape of a dot, and the coordinate information includes center coordinate information and radius information of the storage location.
  • the electronic device determines the target version of the two-dimensional code to be recognized, which includes: the electronic device determines the position of the locator in the image to be recognized; the electronic device determines the position of the locator in the image to be recognized based on the position of the locator The vertex position of the two-dimensional code; the electronic device corrects the two-dimensional code in the image to be recognized based on the vertex position, so as to obtain the two-dimensional code to be recognized.
  • the process of positioning and correcting the two-dimensional code by the electronic device is described here.
  • the type of the first information includes one or more of the following: character, text, picture, audio, video, and link address.
  • an embodiment of the present application provides a method for generating a two-dimensional code, the method comprising:
  • the electronic device obtains the first information
  • the electronic device generates a two-dimensional code based on the first information, and the two-dimensional code indicates the first information;
  • the two-dimensional code includes an image area in the middle and an annular area surrounding the image area, the annular area includes a coding area, a first space area and a second space area, the code area includes a plurality of symbols, and the code area includes the first code area and the second coding area, and a first space area and a second space area are arranged between the first code area and the second code area.
  • the electronic device acquires the first information, and generates a two-dimensional code based on the first information.
  • the coding area, the first interval area and the second interval area in the two-dimensional code just form a circle, and the encoding area is divided into the first encoding area and the second encoding area by the first interval area and the second interval area. That is, the embodiment of the present application provides a two-dimensional code style in which the coding area is disconnected by using the spacer area.
  • multiple symbols in the coding area are distributed on at least two concentric circles, and the center of the at least two concentric circles is the center of the two-dimensional code, wherein multiple symbols Include dot symbols.
  • generating the two-dimensional code based on the first information by the electronic device includes: the electronic device encodes the first information into a binary string; the electronic device determines the two-dimensional code to be generated according to the length of the binary string.
  • the target version of the dimensional code indicates the coordinate information of each storage location in the encoding area; the electronic device assigns the binary string to the storage location of the encoding area according to the coordinate information of each storage location; wherein, the storage location includes The first storage location and the second storage location, the first storage location stores the first value in the binary string and the second storage location stores the second value in the binary string; the electronic device draws the first value based on the coordinate information of the first storage location.
  • a symbol a two-dimensional code is generated based on the first symbol; the first symbol is one symbol in a plurality of symbols in the coding area of the two-dimensional code.
  • the electronic device first obtains the corresponding binary string by bitizing the first information of the two-dimensional code to be generated; the target version of the two-dimensional code to be generated is determined according to the length of the binary string, wherein different Versions vary in the amount of data they can store. After the electronic device determines the target version, it allocates the binary string to each storage location in the encoding area of the target version, and then draws the symbols,
  • the coordinate information of the storage location includes the center coordinate information and radius information of the storage location; the first symbol is a dot-shaped symbol, and the dot-shaped symbol is based on the first The center coordinate information and radius information of the storage location are drawn.
  • the number of concentric circles of the coding region in different target versions is different. Among them, different numbers of concentric circles can store different amounts of data.
  • the electronic device draws the first symbol on the first storage location based on the coordinate information of the first storage location, including: the electronic device passes the coordinate information of the center of the circle of the first storage location and the radius information to determine the value range of the first symbol on the Y axis, the minimum value of the value range of the first symbol on the Y axis is the center ordinate minus the radius in the center coordinate information, and the maximum value range The value is the ordinate of the circle center in the circle center coordinate information plus the radius; each Y value within the value range of the electronic device determines a left X value and a right X value through a preset formula, and assigns a left X value to the The pixels between the X value and a right end are drawn as the first color, the drawing of the first symbol is completed, and all the pixels of the first symbol are the first color.
  • the method further includes: the first symbol further includes a circular arc symbol, and the circular arc symbol occupies at least two adjacent first storage positions, and at least two adjacent first storage locations are located on the same concentric circle.
  • the preset conditions are met, arc-shaped symbols can also be drawn, which increases the diversity and aesthetics of the two-dimensional code.
  • the first symbol occupies at least two storage locations, wherein the storage locations at the left and right ends of the at least two storage locations are the third storage location and the fourth storage location;
  • the center points of the third storage position and the fourth storage position are on the same side of the center line of the two-dimensional code, and the center line of the two-dimensional code is a straight line passing through the center point of the two-dimensional code and perpendicular to the X-axis; the electronic device is based on the first storage position.
  • the coordinate information of the first symbol is drawn, including: the electronic device determines the value range of the first symbol on the Y-axis through the center coordinate information and radius information of the third storage position and the fourth storage position, when the third storage position
  • the ordinate of the circle center is greater than the ordinate of the circle center of the fourth storage location
  • the minimum value of the value range of the first symbol on the Y axis is the ordinate of the point with the shortest distance from the center of the two-dimensional code in the third storage location
  • the maximum value of the value range of the element on the Y axis is the ordinate of the point at the fourth storage location that is the longest from the center of the QR code; each Y value of the electronic device within the value range is determined by a preset formula.
  • the X value of the left end and the X value of the right end, and the pixels between the X value of the left end and the X value of the right end are drawn as the first color, and the drawing of the first symbol is completed. All pixels of the first symbol Point is the first color. The process of drawing a circular arc-shaped symbol is described here.
  • the first symbol occupies at least two storage locations, wherein the storage locations at the left and right ends of the at least two storage locations are the third storage location and the fourth storage location;
  • the center points of the third storage position and the fourth storage position are respectively on both sides of the center line of the two-dimensional code.
  • the center line of the two-dimensional code is a straight line passing through the center point of the two-dimensional code and perpendicular to the X-axis, and the first symbol is on the left side of the center line.
  • the part on the side is the first part, and the part of the first symbol on the right side of the center line is the second part; the electronic device draws the first symbol based on the coordinate information of the first storage position, including: the electronic device draws the first symbol respectively.
  • One part and the second part; the minimum value of the value range of the first part on the Y-axis is the ordinate of the point with the shortest distance from the center of the QR code in the third storage location, and the maximum value of the value range on the Y-axis is The maximum ordinate in the concentric circle where the third storage position is located; the minimum value of the value range of the second part on the Y-axis is the ordinate of the point with the shortest distance from the center of the QR code in the fourth storage position, on the Y-axis The maximum value of the value range of is the maximum ordinate in the concentric circle where the fourth storage location is located.
  • the process of drawing another arc-shaped symbol is described here.
  • the present application provides an electronic device, comprising: one or more processors and one or more memories; the one or more memories are coupled with the one or more processors; the one or more memories are used for
  • the computer program code is stored in the computer program code, and the computer program code includes computer instructions; when the computer instructions are executed on the processor, the electronic device executes the two-dimensional code identification method in any possible implementation manner of the first aspect.
  • the present application provides an electronic device, comprising: one or more processors and one or more memories; the one or more memories are coupled with the one or more processors; the one or more memories are used for
  • the computer program code is stored in the computer program code, and the computer program code includes computer instructions; when the computer instructions are executed on the processor, the electronic device executes the two-dimensional code generation method in any possible implementation manner of the second aspect.
  • an embodiment of the present application provides a computer storage medium, including computer instructions, which, when the computer instructions are executed on an electronic device, cause a communication apparatus to perform actions in any possible implementation manner of any of the foregoing aspects.
  • the embodiments of the present application provide a computer program product, which, when the computer program product runs on a computer, enables the computer to perform actions in any possible implementation manner of any of the foregoing aspects.
  • FIG. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • FIG. 2 is a software architecture diagram of an electronic device provided by an embodiment of the present application.
  • 3A is a schematic structural diagram of a two-dimensional code provided by an embodiment of the present application.
  • 3B is a schematic structural diagram of an image area and an encoding area of a two-dimensional code according to an embodiment of the application;
  • 3C is a schematic structural diagram of a main locator of a two-dimensional code according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a method for generating a two-dimensional code according to an embodiment of the present application
  • 5A to 5H are schematic structural diagrams of different versions of a two-dimensional code provided by an embodiment of the present application.
  • 6A to 6F are schematic structural diagrams of two-dimensional codes generated based on different versions provided by an embodiment of the present application.
  • FIG. 7A is a schematic structural diagram of a dot-shaped symbol provided by an embodiment of the present application.
  • FIG. 7B is a schematic diagram of a storage method of a data stream of a drawing symbol provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of a circular arc symbol provided by an embodiment of the present application.
  • 9A to 9H are schematic schematic diagrams of circular arc symbols drawn under different conditions provided by the embodiments of the present application.
  • FIG. 10A to FIG. 10H are schematic diagrams of the principles of circular arc symbols drawn under different conditions provided by the embodiments of the present application;
  • 11 is a method flowchart of a two-dimensional code identification method provided by an embodiment of the present application.
  • 12A to 12B are schematic structural diagrams of still another two-dimensional code provided by an embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more. The orientation or positional relationship indicated by the terms “middle”, “left”, “right”, “upper”, “lower”, etc.
  • the embodiment of the present application provides a method for generating a two-dimensional code, and the method is applied to the electronic device 100 .
  • the method can generate a circular two-dimensional code, the coding area of the circular two-dimensional code is composed of at least two concentric circle areas, and the code elements include dot-shaped code elements and circular arc-shaped code elements.
  • the data storage capacity of the two-dimensional code can be increased by increasing the number of circles and the number of symbols in the concentric circle area.
  • the electronic device 100 encrypts the character string during the encoding process, and a decryption algorithm corresponding to the encryption algorithm needs to be used for decoding to obtain a complete character string, which improves the security of the two-dimensional code.
  • the electronic device 100 firstly obtains the corresponding binary string by performing bitization processing on the string to be generated in the two-dimensional code; the target version of the two-dimensional code to be generated is determined according to the length of the binary string, wherein different Versions vary in the amount of data they can store. After the electronic device 100 determines the target version, it allocates the binary string to each concentric circle area in the coding area of the target version to obtain the two-dimensional code information; uses the mask to perform mask superposition processing on the two-dimensional code information to adjust the two-dimensional code information. The layout of the QR code information, and finally draw the final QR code. In this way, the coding of the two-dimensional code conforming to the two-dimensional code structure of the target version can be completed, and the symbols in the generated two-dimensional code are evenly distributed, which is more beautiful.
  • the electronic device 100 may be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (ultra-mobile personal computer) computer, UMPC), netbooks, and cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) device, wearable device, vehicle-mounted device, smart home device and/or smart city device, the electronic device 100 may also be a network device such as a cloud server, a virtual server, a background server, a component server, and a data processing server.
  • the specific type of the electronic device is not particularly limited.
  • FIG. 1 shows a schematic structural diagram of an exemplary electronic device 100 provided by an embodiment of the present application.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including UWB, wireless local area networks (WLAN) (such as wireless fidelity (WiFi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system, GLONASS
  • Beidou navigation satellite system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system, QZSS
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the display screen 194 displays the interface content currently output by the system.
  • the interface content is an interface provided by an instant messaging application.
  • the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
  • RAM random access memories
  • NVM non-volatile memories
  • Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as fifth-generation DDR SDRAM is generally called DDR5 SDRAM), etc.;
  • SRAM static random-access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • fifth-generation DDR SDRAM is generally called DDR5 SDRAM
  • Non-volatile memory may include magnetic disk storage devices, flash memory.
  • Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cell (SLC), multi-level memory cell (multi-level memory cell, SLC) according to the level of storage cell potential.
  • cell, MLC multi-level memory cell
  • TLC triple-level cell
  • QLC quad-level cell
  • UFS universal flash storage
  • eMMC embedded multimedia memory card
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • executable programs eg, machine instructions
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • the non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the air pressure sensor 180C is used to measure air pressure.
  • the magnetic sensor 180D includes a Hall sensor.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • Distance sensor 180F for measuring distance.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the temperature sensor 180J is used to detect the temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen”.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. Touch buttons are also possible.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate a charging state, a change in power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiments of the present invention take the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 as an example.
  • FIG. 2 is a block diagram of a software structure of an electronic device 100 according to an embodiment of the present invention.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
  • a window manager is used to manage window programs.
  • the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
  • Content providers are used to store and retrieve data and make these data accessible to applications.
  • the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
  • a display interface can consist of one or more views.
  • the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
  • the phone manager is used to provide the communication function of the electronic device 100 .
  • the management of call status including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
  • the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
  • Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
  • the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
  • the application layer and the application framework layer run in virtual machines.
  • the virtual machine executes the java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
  • a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
  • surface manager surface manager
  • media library Media Libraries
  • 3D graphics processing library eg: OpenGL ES
  • 2D graphics engine eg: SGL
  • the Surface Manager manages the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
  • FIG. 3A shows a schematic structural diagram of a two-dimensional code 30 provided by an embodiment of the present application.
  • the two-dimensional code 30 is circular as a whole, and the two-dimensional code 30 includes an image area 301 located in the middle and a coding area 302 surrounding the image area 301 .
  • the ratio of the width of the image area in the horizontal direction to the width of the two-dimensional code in the horizontal direction may be 1:3. The position ratio is not limited. in,
  • Image area 301 is used to place user-defined images.
  • it may be an official identifying picture of the application platform using the two-dimensional code technology, or a user-defined image registered with the application platform using the two-dimensional code technology, and so on.
  • setting the picture of the user of the application platform can improve the recognition degree of the user of the two-dimensional code.
  • the image area in the middle portion of the two-dimensional code 30 may be a circular area, a rectangular area, or other shapes, and this embodiment does not specifically limit the shape of the image area.
  • the electronic device 100 performs circularization processing on the input picture in the image area 301 , that is, when a third-party picture is input, the area outside the circle (marginalized portion) is transparentized.
  • the coding area 302 is formed by gathering the code elements 303 of the two-dimensional code 30.
  • the code elements 303 are distributed on at least two concentric circles.
  • the code elements 303 are used for recording or storing codewords.
  • a codeword is a bit sequence obtained by encoding the original data, and the codeword may include a data code or an error correction code.
  • Common encoding methods of QR codes include digital encoding, character encoding, etc.
  • the concentric circle area of the coding area 302 includes a plurality of positions for storing code words, wherein the position occupied by the symbol 303 stores the first value (for example, binary 1 or 0), and the concentric circle area is not occupied by the symbol 303.
  • the second value (eg binary 0 or 1) is stored in the position.
  • the electronic device 100 can obtain a series of binary character strings by identifying the encoding area 302, and then decode the binary character strings through a decoding algorithm to obtain corresponding information.
  • the symbols 303 include circular arc symbols and dot symbols.
  • the radius of each dot symbol is the same.
  • each arc-shaped symbol includes two or three or more dot-shaped symbols, that is, the arc-shaped symbol is composed of two or three or more than three circles. composed of dotted symbols.
  • the information capacity that the circular arc symbol can store is an integer multiple of that of the circular dot symbol.
  • the radius of each dot-shaped symbol in the coding area of the two-dimensional code may be different, for example, as shown in FIG. 12A .
  • the radii of the dot-shaped symbols in the same concentric circle region are the same, and the radii of the dot-shaped symbols in different concentric circle regions are different.
  • the coding area of the two-dimensional code may only include dot-shaped symbols, such as shown in FIG. 12B .
  • the coding area of the two-dimensional code may only include circular arc symbols.
  • the number of concentric circle areas included in the coding area 302 can be adjusted according to the size of the data volume of the two-dimensional code. Expand the information capacity of the QR code.
  • the encoding area 302 of the two-dimensional code includes four concentric circle areas as an example for illustration, and this embodiment does not specifically limit the number of concentric circle areas in the encoding area.
  • each concentric circle area in the coding area 302 may be divided into an upper half area and a lower half area, and the upper half area and the lower half area are separated by a certain distance.
  • the upper half region and the lower half region may also be referred to as a first coding region and a second coding region.
  • the space area between the upper half area and the lower half area is divided into a left space area and a right space area, wherein the left space area and the right space area may also be referred to as a first space area and a second space area.
  • FIGS. 5A to 5F exemplarily show different versions of the two-dimensional code provided by the embodiments of the present application
  • FIG. 5A includes four concentric circle areas, and each concentric circle area in the coding area is divided into an upper half area and a The lower half area, the upper half area and the lower half area are separated by a diameter distance of 5 dot-shaped symbols.
  • 5F includes 13 concentric circle areas, each concentric circle area in the coding area is divided into an upper half area and a lower half area, and the upper half area and the lower half area are separated by a diameter distance of 7 dot-shaped symbols.
  • each concentric circle area in the coding area 302 may not be divided, that is, in different versions of the two-dimensional code, the dot-shaped symbols in each concentric circle area are evenly distributed at the same interval.
  • the image area 301 and the encoding area 302 of the two-dimensional code 30 do not overlap each other, so that the image inserted in the image area 301 will not block the symbols 303 in the encoding area 301 of the two-dimensional code.
  • a first interval exists between the image area 301 and the encoding area 302 , and a second interval exists between every two adjacent concentric circle areas in the encoding area 302 .
  • the area of the two-dimensional code 30 other than the image area 301 also includes a locator, and the locator is used to identify the coding area 302 of the two-dimensional code, and the to-be-recognized picture is filtered and screened.
  • the structure of the two-dimensional code 30 includes three main locators 304 and one auxiliary locator 305 , and the three main locators 304 and the one auxiliary locator 305 are all circular areas.
  • the outer contour of the main locator 304 of the two-dimensional code 30 may be a circle, and each main locator 304 includes a black circular area at the center, a black circular area at the outer side, and a black circular area and The white circular area between the black circular areas.
  • each main locator 304 includes a black circular area at the center, a black circular area at the outer side, and a black circular area and The white circular area between the black circular areas.
  • the main locator 304 of the two-dimensional code can adopt a ratio of approximately 1:1:2:1:1, that is, the radius of the black circular area, the width of the white circular area and the black circular area in the main locator 304 maintain an approximate 1:1:1 ratio between the widths of the shaped regions.
  • the radius of the black circular area in the main locator is 1
  • the width of the white circular area is 1
  • the width of the black circular area is 1.
  • the preset geometric shape in the auxiliary locator 305 may be a relatively unique geometric shape to distinguish it from the geometric shapes in other areas of the two-dimensional code such as the main locator 304 .
  • the shape of the auxiliary locator 305 can also be the same as that of the main locator 304 , that is, the auxiliary locator 305 can also adopt a ratio of approximately 1:1:2:1:1, but the auxiliary locator 305 and the main locator 304 are different in size.
  • the auxiliary locator 305 can be a circular area, so that the auxiliary locator 305 has a relatively stable structure.
  • the overall structure of the two-dimensional code 30 is a circle, and the sub-elements therein are also circles, and the circle
  • the shape has the characteristics of center symmetry, and the rotation is still symmetrical no matter what, the two-dimensional code 30 has a relatively stable geometric structure, and the whole two-dimensional code looks more beautiful.
  • the preset geometric shape in the auxiliary locator 305 can be set by a technician according to whether it is required, which is not specifically limited in this embodiment.
  • This embodiment of the present application does not limit the position and ratio of each area.
  • the image area 301 and the coding area 302 may adopt a 1:1 ratio in the horizontal direction, and the spacing between the concentric circles may be the same or different.
  • the radius of the elements can be the same or different.
  • an embodiment of the present application provides a method for generating a two-dimensional code, as shown in FIG.
  • Step S101 acquiring a character string of the two-dimensional code to be generated.
  • the electronic device 100 obtains the character string of the two-dimensional code to be generated, which can be a string of numbers, a sentence, a link, etc., such as "abcd”, such as "I love Beijing”, such as "http://www. xxxx.xxxx” etc.
  • Step S102 According to the obtained character string, select an encoding mode to perform data encoding on the character string.
  • the electronic device 100 selects the most suitable encoding mode according to the acquired character string, and the encoding mode includes numeric encoding, character encoding, byte encoding, Japanese encoding, and the like.
  • the numeric code can correspond to decimal digits 0-9; the character code can include decimal digits 0-9, uppercase letters, and $%*+-./: and characters such as spaces; byte codes can correspond to ISO -8859-1 character set; Japanese encoding can correspond to double-byte encoding from Shift JIS character set (Japanese coded character set).
  • Each encoding mode encodes text (a string of QR codes to be generated) into a string of binary bits consisting of 0s and 1s, but uses different encoding conversion methods.
  • all characters supported by character encoding can correspond to an index value.
  • index value For example, in the base_45 table, numbers 0-9 correspond to index values 0-9, letters A-Z correspond to index values 10-35, and space characters correspond to index values The value is 36, the character "$" corresponds to an index value of 37, the character "%” corresponds to an index value of 38, the character ".” corresponds to an index value of 42, the character "/" corresponds to an index value of 43, and so on.
  • the electronic device 100 encodes the string according to the selected encoding mode, and adds functional encoding information (including encoding mode indication information, character count information, padding information, etc.), and the electronic device 100 converts the string into the corresponding binary String (for example: 1010101111001101), determine the length of the string converted into a binary string after encoding.
  • functional encoding information including encoding mode indication information, character count information, padding information, etc.
  • step S103 encrypt and compress the binary string.
  • the electronic device 100 encrypts and compresses the binary character string by using the encryption algorithm and the compression algorithm, so as to improve the security of the character string and increase the storage space of the character string.
  • the encryption algorithms include, for example, MD5 Message-Digest Algorithm (MD5 Message-Digest Algorithm), Secure Hash Algorithm (SHA), Hash-based Message Authentication Code (HMAC), data encryption standard ( Data Encryption Standard, DES), 3DES, Advanced Encryption Standard (Advanced Encryption Standard, AES), RSA algorithm, etc.
  • Compression algorithms include, for example, optimized encoding compression algorithms based on stored data, and the like.
  • Step S104 Determine the target version of the two-dimensional code to be generated according to the length of the binary string.
  • the electronic device 100 determines the target version of the two-dimensional code to be generated according to the length of the binary string.
  • the six versions of the two-dimensional code in the embodiments of the present application are exemplarily introduced below. It should be noted that when the dot-shaped symbols in the six versions of the two-dimensional code are described below, the dot-shaped symbols here are all storage locations and cannot be equivalent to the codes in the generated two-dimensional code. Yuan.
  • the coding area of the QR code includes 4 concentric circles.
  • the image area 401 of the two-dimensional code 40 indicates the brand type of the two-dimensional code 40 (Hongmeng system, harmony OS). It can be seen that in FIG. 5A , the image area 401 is a circle.
  • the coding area 402 includes four concentric circle areas, dot-shaped symbols are evenly arranged in each concentric circle area, and two adjacent circle-dot-shaped symbols in each concentric circle area
  • the distance between the centers of the circles is the same.
  • Each dot-shaped symbol can store information, and the information stored in each dot-shaped symbol can be indicated in the form of color.
  • a dot-shaped symbol stores the first information (for example, it can be binary 1) , then the dot-shaped symbol is set to the first color (for example, black), and if a dot-shaped symbol stores the second information (for example, it can be binary 0), then the dot-shaped symbol is set to Either a second color (eg white, eg clear) or not.
  • a first interval exists between the image area 401 and the encoding area 402, and a second interval exists between every two adjacent concentric circle areas in the encoding area 402, wherein each concentric circle area is composed of an inner circle and an outer circle.
  • the width of the concentric circle area is the difference between the radii of the inner circle and the outer circle, and the second interval is the outer circle of the small concentric circle area and the inner circle of the large concentric circle area in the two adjacent concentric circle areas.
  • the diameter of a dot-shaped symbol is 1, the radius of the image area 401 is 10, and the interval between the image area 401 and the coding area 402 is 1, that is, the first interval is 1 or a
  • the arc, that is, the third interval can be 0, and can be an arc with the same central angle.
  • the four concentric circle regions are equally divided into an upper half region and a lower half region, and a fourth interval exists between the upper half region and the lower half region.
  • a dot-shaped symbol The diameter of 1 is 1, and the interval between the upper and lower half regions is 5.
  • the locator area is in the two-dimensional code.
  • it includes three main locators 403 and one auxiliary locator 404.
  • the outer contours of the three main locators 403 and one auxiliary locator 404 are all circular.
  • the centers of the locators 403 are all in the penultimate peripheral concentric circle area, the diameter of one dot-shaped symbol is 1, and the diameters of the three main locators 403 are 5.
  • the coding area of the QR code includes 5 concentric circle areas.
  • the image area 411 of the two-dimensional code 41 indicates the brand type (Hongmeng system, harmony OS) of the two-dimensional code 41 .
  • the coding area 412 includes 5 concentric circle areas, dot-shaped symbols are evenly arranged in each concentric circle area, and two adjacent dot-shaped symbols in each concentric circle area The distance between the centers of the circles (it may also be the length of the arc formed by the centers of every two adjacent dot-shaped symbols) is the same.
  • a first interval exists between the image area 411 and the encoding area 412
  • a second interval exists between every two adjacent concentric circle areas in the encoding area 412, and between two adjacent dot-shaped symbols in each concentric circle area
  • There is a third interval For example, in FIG.
  • the diameter of a dot-shaped symbol is 1, the radius of the image area 411 is 10, and the interval between the image area 411 and the coding area 412 is 2, that is, the first interval is 2 or two
  • the diameter of a dot-shaped symbol the interval between every two adjacent concentric circle regions in the coding area 412 is 1, that is, the second interval is 1 or the diameter of a dot-shaped symbol; each concentric circle region
  • the interval between two adjacent dot-shaped symbols can be 0, or can be a segment of circular arc with the same central angle, that is, the third interval can be 0, and can be a segment of circular arc with the same central angle.
  • the four concentric circle areas are equally divided into an upper half area and a lower half area, and a fourth interval exists between the upper half area and the lower half area.
  • a dot-shaped symbol The diameter of 1 is 1, and the interval between the upper and lower half regions is 5.
  • the locator area is in the two-dimensional code.
  • it includes three main locators 413 and one auxiliary locator 414.
  • the outer contours of the three main locators 413 and one auxiliary locator 414 are all circular,
  • the centers of the locators 413 are all in the penultimate peripheral concentric circle area, the diameter of one dot-shaped symbol is 1, and the diameters of the three main locators 413 are 5.
  • the coding area of the QR code includes 8 concentric circles.
  • the image area 421 of the two-dimensional code 42 indicates the brand type (Harmony OS, Harmony OS) of the two-dimensional code 42 .
  • the coding area 422 includes 8 concentric circle areas, dot-shaped symbols are evenly arranged in each concentric circle area, and two adjacent dot-shaped symbols in each concentric circle area The distance between the centers of the circles (it may also be the length of the arc formed by the centers of every two adjacent dot-shaped symbols) is the same.
  • a first interval exists between the image area 421 and the encoding area 422, a second interval exists between every two adjacent concentric circle areas in the encoding area 422, and between two adjacent dot-shaped symbols in each concentric circle area There is a third interval. For example, in FIG.
  • the diameter of a dot-shaped symbol is 1, the radius of the image area 421 is 10, and the interval between the image area 421 and the coding area 422 is 2, that is, the first interval is 2 or two
  • the diameter of a dot-shaped symbol the interval between every two adjacent concentric circle areas in the coding area 422 is less than 1, that is, the second interval may be between 0 and 1; two adjacent concentric circle areas in each concentric circle area
  • the interval between the dot-shaped symbols may be 0, or may be a segment of circular arcs with the same central angle, that is, the third interval may be 0, or may be a segment of circular arcs with the same central angle.
  • the 8 concentric circle areas are equally divided into an upper half area and a lower half area, and a fourth interval exists between the upper half area and the lower half area.
  • a dot-shaped symbol The diameter of 1 is 1, and the interval between the upper and lower half regions is 5.
  • the locator area is in the two-dimensional code.
  • it includes three main locators 423 and one auxiliary locator 424.
  • the outer contours of the three main locators 423 and one auxiliary locator 424 are all circular.
  • the centers of the locators 423 are all in the penultimate peripheral concentric circle area, the diameter of one dot-shaped symbol is 1, and the diameters of the three main locators 423 are 5.
  • the coding area of the QR code includes 10 concentric circles.
  • the image area 431 of the two-dimensional code 43 indicates the brand type (Hongmeng system, harmony OS) of the two-dimensional code 43 .
  • the coding area 432 includes 10 concentric circle areas, dot-shaped symbols are evenly arranged in each concentric circle area, and two adjacent circle-dot-shaped symbols in each concentric circle area The distance between the centers of the circles (it may also be the length of the arc formed by the centers of every two adjacent dot-shaped symbols) is the same.
  • a first interval exists between the image area 431 and the encoding area 432, a second interval exists between every two adjacent concentric circle areas in the encoding area 432, and between two adjacent dot-shaped symbols in each concentric circle area There is a third interval. For example, in FIG.
  • the diameter of a dot-shaped symbol is 1, the radius of the image area 431 is 10, and the interval between the image area 431 and the coding area 432 is 2, that is, the first interval is 2 or two
  • the diameter of a dot-shaped symbol the interval between every two adjacent concentric circle areas in the coding area 432 is less than 1, that is, the second interval may be between 0 and 1; two adjacent concentric circle areas in each concentric circle area
  • the interval between the dot-shaped symbols may be 0, or may be a segment of circular arcs with the same central angle, that is, the third interval may be 0, or may be a segment of circular arcs with the same central angle.
  • the four concentric circle areas are equally divided into an upper half area and a lower half area, and a fourth interval exists between the upper half area and the lower half area.
  • a dot-shaped symbol The diameter of 1 is 1, and the interval between the upper and lower half regions is 5.
  • the locator area is in the two-dimensional code.
  • FIG. 5D it includes three main locators 433 and one auxiliary locator 434.
  • the outer contours of the three main locators 433 and one auxiliary locator 434 are all circular,
  • the centers of the locators 433 are all in the penultimate peripheral concentric circle area, the diameter of one dot-shaped symbol is 1, and the diameters of the three main locators 433 are 5.
  • the coding area of the QR code includes 11 concentric circles.
  • the image area 441 of the two-dimensional code 44 indicates the brand type (Hongmeng system, harmony OS) of the two-dimensional code 44 .
  • the coding area 442 includes 11 concentric circle areas, dot-shaped symbols are evenly arranged in each concentric circle area, and two adjacent dot-shaped symbols in each concentric circle area The distance between the centers of the circles (it may also be the length of the arc formed by the centers of every two adjacent dot-shaped symbols) is the same.
  • a first interval exists between the image area 441 and the encoding area 442, a second interval exists between every two adjacent concentric circle areas in the encoding area 442, and between two adjacent dot-shaped symbols in each concentric circle area There is a third interval. For example, in FIG.
  • the diameter of a dot-shaped symbol is 1, the radius of the image area 441 is 10, and the interval between the image area 441 and the coding area 442 is 1, that is, the first interval is 1 or a
  • the interval between the dot-shaped symbols may be 0, or may be a segment of circular arc with the same central angle, that is, the third interval may be 0, or may be a segment of circular arc with the same central angle.
  • the 11 concentric circle regions are equally divided into an upper half region and a lower half region, and a fourth interval exists between the upper half region and the lower half region.
  • a dot-shaped symbol The diameter of 1 is 1, and the interval between the upper and lower half regions is 5.
  • the locator area is in the two-dimensional code.
  • FIG. 5E it includes three main locators 443 and one auxiliary locator 444.
  • the outer contours of the three main locators 443 and one auxiliary locator 444 are all circular.
  • the centers of the locators 443 are all in the penultimate peripheral concentric circle area, the diameter of one dot-shaped symbol is 1, and the diameters of the three main locators 443 are 5.
  • the coding area of the QR code includes 13 concentric circles.
  • the image area 451 of the two-dimensional code 45 indicates the brand type (Hongmeng system, harmony OS) of the two-dimensional code 45 .
  • the coding area 452 includes 13 concentric circle areas, dot-shaped symbols are evenly arranged in each concentric circle area, and two adjacent dot-shaped symbols in each concentric circle area The distance between the centers of the circles (it may also be the length of the arc formed by the centers of every two adjacent dot-shaped symbols) is the same.
  • a first interval exists between the image area 451 and the encoding area 452
  • a second interval exists between every two adjacent concentric circle areas in the encoding area 452, and between two adjacent dot-shaped symbols in each concentric circle area
  • There is a third interval For example, in FIG.
  • the diameter of a dot-shaped symbol is 1, the radius of the image area 451 is 13, and the interval between the image area 451 and the coding area 452 is 3, that is, the first interval is 3 or 3
  • the interval between the dot-shaped symbols may be 0, or may be a segment of circular arcs with the same central angle, that is, the third interval may be 0, or may be a segment of circular arcs with the same central angle.
  • the four concentric circle areas are equally divided into an upper half area and a lower half area, and a fourth interval exists between the upper half area and the lower half area.
  • a dot-shaped symbol The diameter of 1 is 1, and the interval between the upper and lower half regions is 7.
  • the locator area is in the two-dimensional code.
  • it includes three main locators 453 and one auxiliary locator 454.
  • the outer contours of the three main locators 453 and one auxiliary locator 454 are all circular.
  • the centers of the locators 453 are all in the penultimate peripheral concentric circle area, the diameter of one dot-shaped symbol is 1, and the diameters of the three main locators 453 are 5.
  • the number of concentric circle areas of the two-dimensional code and the number of dot-shaped symbols in each concentric circle area may have other configurations, which are not limited in this application.
  • the present application also provides a version of a two-dimensional code, as shown in Figure 5G and Figure 5H, which is different from the styles from Version 1 to Version 6.
  • the dot-shaped symbols in Figure 5G and Figure 5H are arranged in a emitting shape. , the number of dot-shaped symbols on each concentric circle is the same.
  • Figure 5G includes 6 concentric circles.
  • the ray formed by connecting the center of any dot-shaped symbol with the center of the QR code as the starting point can pass through a dot-shaped code on the other 5 concentric circles. Yuan's center.
  • Figure 5H includes 7 concentric circles.
  • the ray formed by connecting the center of any dot-shaped symbol with the center of the QR code as the starting point can pass through a dot-shaped ray on the other 6 concentric circles.
  • the center of the symbol is arranged in a emitting shape. , the number of dot-shaped symbols on each concentric circle is the same.
  • Figure 5G includes 6 concentric circles.
  • the electronic device 100 After the electronic device 100 determines the target version of the two-dimensional code to be generated according to the length of the binary string, it can obtain the coordinates of the circle center of the dot-shaped symbol of the stored information in the target version, the radius information of the dot-shaped symbol, and the size of the image area. Center coordinates and radius information, locator related coordinate information, etc.
  • Step S105 according to the position of the image area, the coding area and the locator in the target version of the QR code to be generated, assign the binary string to each concentric circle area in the coding area to obtain the QR code information.
  • the electronic device 100 divides the binary character string according to the position of the image area, the coding area, and the locator in the structure of the target version of the two-dimensional code to be generated, and assigns the binary character string to each concentric circle area in the coding area. In the dot-shaped symbol, the two-dimensional code information is obtained.
  • the binary string can be split into For the substrings corresponding to each concentric circle area, each substring is allocated to a dot-shaped symbol in the corresponding concentric circle area for storage.
  • the two-dimensional code information includes information stored corresponding to each dot-shaped symbol, for example, the dot-shaped symbol in the first position stores the first information, and the dot-shaped symbol in the second position stores the second information,
  • the first position and the second position indicate the center coordinates and radius information of the dot-shaped symbol.
  • the first information may be 1 in the binary string
  • the second information may be 0 in the binary string.
  • the two-dimensional code information may also include a display form corresponding to each dot-shaped symbol.
  • the dot-shaped symbol that stores the first information is correspondingly set to the first color
  • the dot-shaped symbol that stores the second information is set to the first color
  • the dot-shaped symbol is correspondingly set to the second color.
  • the first color may be black
  • the second color may be white, or transparent, or not colored.
  • the electronic device 100 further splits a substring corresponding to a concentric circle area into two substrings, and the two substrings are respectively stored in the upper half area and the lower half area of the concentric circle area. ; It is also possible to further split the substring corresponding to a concentric circle area into four substrings, and the four substrings are correspondingly stored by the areas within the four quadrants of the concentric circle area.
  • the electronic device 100 fills the binary string into the dot-shaped symbols in the concentric circle area of the target version of the two-dimensional code, and the filling direction may be to fill the innermost concentric circle area first, and then slowly move toward the outer concentric circle area. Area filling; it can also be to fill the outermost concentric circle area first, and then slowly fill the inner concentric circle area; it can also be from left to right, from top to bottom, etc., which is not limited in this embodiment of the present application.
  • the reserved area such as the area for reserved format information, the area for reserved version information
  • the functional module area such as the locator area, the calibration module area, and the time module area
  • Step S106 select a mask mode, and add mask information.
  • Masking refers to a strategy to change the value of the code element in the coding area of the two-dimensional code according to specific rules.
  • the purpose of using the mask is to adjust the display effect of the code elements in the two-dimensional code (for example, to avoid large blanks or black blocks in the two-dimensional code, which will affect the scanning recognition), so that the code reader can read the information as easily as possible.
  • the masking mode includes, for example, that all even-numbered concentric circle areas in the two-dimensional code are masked; for example, some dot-shaped symbols in each concentric circle area of the two-dimensional code are masked.
  • the electronic device 100 uses the mask mode to perform mask superposition processing on the two-dimensional code information to adjust the layout of the two-dimensional code information, so that the distribution of symbols in the two-dimensional code information is more uniform, thereby making the generated two-dimensional code more beautiful.
  • using a mask to perform mask superposition processing on the two-dimensional code information can be implemented by performing an exclusive OR operation on the binary string of the two-dimensional code information and the mask.
  • the electronic device 100 fills the coding area with the two-dimensional code information added with the mask information, and the electronic device 100 verifies whether the target version satisfies the capacity requirement of the two-dimensional code to be generated, and if so, adds the version information.
  • Step S107 generating a two-dimensional code according to a drawing algorithm.
  • the electronic device 100 may encode the coding area of the two-dimensional code in a manner that the unavailable area is vacant. information, by drawing the dot-shaped symbols storing the first information in the coding area as a first color, and drawing the dot-shaped symbols storing the second information as a second color by a drawing algorithm, the coding area is drawn. And the electronic device 100 fills the corresponding image area, locator area and other areas in the target version, so as to obtain a complete two-dimensional code picture.
  • the unavailable area includes the image area, the locator area, and the blank area in the coding area in the target version of the QR code (as shown in FIG. 5A , the blank area between the upper half area and the lower half area is 5) ,and many more.
  • the electronic device 100 connects and draws circular dot-shaped symbols that meet preset conditions into arc-shaped symbols, wherein the preset conditions include, if there are two or more consecutive phase symbols in a concentric circle area
  • the adjacent dot-shaped symbols all store the first information, and the two or more adjacent dot-shaped symbols are connected and drawn into an arc-shaped symbol, and the arc-shaped symbol is drawn as a first color.
  • the part of the arc-shaped code element connecting the dot-shaped code element is also filled with the first color, which can enhance the aesthetics of the two-dimensional code.
  • the two or more adjacent dot-shaped symbols are connected and drawn into an arc shape. symbol, the arc-shaped symbol is drawn in the second color.
  • Figure 6A includes 4 concentric circle areas, based on version 1, some dot-shaped symbols in version 1 are drawn in black, and some dot-shaped symbols are drawn in white or transparent color or no color, and are continuously adjacent to each other. The black dot symbols are connected and drawn as arc symbols.
  • FIG. 6B When the target version is version two, the generated exemplary two-dimensional code is shown in FIG. 6B .
  • Figure 6B includes 5 concentric circle areas. Based on version 2, some dot-shaped symbols in version 2 are drawn in black, and some dot-shaped symbols are drawn in white or transparent color or no color, and are continuously adjacent to each other. Dot symbols drawn as black are connected and drawn as arc symbols.
  • Figure 6C includes 8 concentric circle areas. Based on version three, some dot-shaped symbols in version three are drawn in black, and some dot-shaped symbols are drawn in white or transparent color or no color, and are continuously adjacent to each other. Dot symbols drawn as black are connected and drawn as arc symbols.
  • Figure 6D includes 10 concentric circle areas, based on version four, some dot-shaped symbols in version four are drawn in black, and some dot-shaped symbols are drawn in white or transparent color or no color, and are continuously adjacent to each other. Dot symbols drawn as black are connected and drawn as arc symbols.
  • FIG. 6E When the target version is version five, the generated exemplary two-dimensional code is shown in FIG. 6E .
  • Figure 6E includes 11 concentric circle areas. Based on version five, some dot-shaped symbols in version five are drawn in black, and some dot-shaped symbols are drawn in white or transparent color or no color, and are continuously adjacent to each other. Dot symbols drawn as black are connected and drawn as arc symbols.
  • Figure 6F When the target version is version 6, the generated exemplary QR code is shown in Figure 6F.
  • Figure 6F includes 13 concentric circle areas, based on version six, some dot-shaped symbols in version six are drawn in black, and some dot-shaped symbols are drawn in white or transparent color or no color, and are continuously adjacent to each other. Dot symbols drawn as black are connected and drawn as arc symbols.
  • An embodiment of the present application provides a method for generating a two-dimensional code.
  • the electronic device 100 obtains a corresponding binary character string by performing a bitization process on a character string to be generated in the two-dimensional code; the target version is determined according to the length of the binary character string, Allocate the binary string to each concentric circle area in the coding area of the target version to obtain the two-dimensional code information; use the mask to perform mask overlay processing on the two-dimensional code information to adjust the layout of the two-dimensional code information, and finally draw the The final QR code.
  • the coding of the two-dimensional code conforming to the two-dimensional code structure of the target version can be completed, and the symbols in the generated two-dimensional code are evenly distributed, which is more beautiful.
  • the version of the two-dimensional code provided by the embodiment of the present application is a circular two-dimensional code
  • the coding area is composed of at least two concentric circle areas
  • the code element includes a dot-shaped code element and a circular arc-shaped code element.
  • the data storage capacity of the two-dimensional code can be increased by increasing the number of circles and the number of symbols in the concentric circle area.
  • the electronic device 100 encrypts the character string during the encoding process, and a decryption algorithm corresponding to the encryption algorithm needs to be used for decoding to obtain a complete character string, which improves the security of the two-dimensional code.
  • the electronic device 100 uses a drawing algorithm to draw the dots storing the first information in the coding area based on the two-dimensional code information. Shape symbols are drawn in the first color.
  • the two-dimensional code information includes the information stored corresponding to each dot-shaped symbol, for example, the dot-shaped symbol in the first position stores the first information, wherein the first position indicates the circle center coordinates (cen_x) of the dot-shaped symbol. , cen_y) and radius information 0.5h.
  • the electronic device 100 draws the dot-shaped symbol as a first color, and the position and outline of the dot-shaped symbol of the first color can be determined through the center coordinates and radius information.
  • the drawing algorithm is as follows:
  • the horizontal rightward is defined as the positive x direction
  • the vertical downward direction is defined as the positive y direction.
  • Drawing from top to bottom, with the y-axis as a variable, at each position y, the x_left and x_right (coordinates of the left and right boundaries) of the position are determined by the analytical equation of the circle.
  • the electronic device 100 draws the dot-shaped symbol storing the first information as a first color based on the two-dimensional code information.
  • the coordinates of the center of the dot-shaped symbol obtained by the electronic device 100 are (cen_x, cen_y), the diameter is h, and the radius is 0.5h. in,
  • x_left can be obtained based on the analytical equation of the left arc, namely:
  • x_right can be derived based on the analytical equation of the arc on the right, namely:
  • the electronic device 100 stores the information of the two-dimensional code in an array of 3000 bits.
  • int32 can be used as the basic unit of data storage, that is, 32 bits are used to represent an integer, and x_left and x_right are corresponding to the 32-bit integers.
  • the realization image information is stored in the bit stream.
  • each 32bit of the array corresponds to a set of x_left and x_right, and the points other than x_left and x_right in the 32bit are set to zero (the white part in Figure 7B), and the The point between x_left and x_right in this 32bit is set to be non-zero (as shown in the part of the upper dark color (the first color) in FIG. 7B ).
  • each group of x_left and x_right can draw a row of pixels of the first color, and draw from top to bottom.
  • the drawing direction or order of the symbols is not limited. For example, it can also be drawn from left to right, with the x-axis as a variable, and at each position x, the y_left and y_right of the position are determined by the analytical equation of the circle ( coordinates of the upper and lower boundaries). Another example is to draw from the inside to the outside (the innermost concentric circle is drawn first, and then the concentric circles are continuously drawn outward) and so on.
  • the drawing method of the dot-shaped symbol has been described above.
  • the following describes the drawing method of the arc-shaped symbol in the embodiments of the present application.
  • the arc-shaped symbol is based on the dot-shaped symbol. More than one dot-shaped symbol is connected by an arc, thereby forming a circular arc symbol. That is to say, each arc-shaped symbol is formed by connecting two or more dot-shaped symbols, and each arc-shaped symbol in the embodiment of the present application may be composed of two arcs and Two line segments are enclosed, and the two arcs belong to a large circle and a small circle respectively.
  • the large circle and the small circle are concentric circles, and the coordinates of the center of the concentric circle are O1 (org_x, org_y).
  • the structure of two arc-shaped symbols is exemplarily shown in FIG. 8.
  • the electronic device 100 connects and draws the circular-arc-shaped symbols that meet the preset conditions into arc-shaped symbols.
  • the dot-shaped symbol that forms the leftmost arc-shaped symbol is called circle 1, and the coordinates of the center of circle 1 obtained by the electronic device 100 based on the two-dimensional code information are (cen_x1, cen_y1);
  • the dot-shaped symbol of is called circle 2, and the center coordinates of circle 2 are obtained as (cen_x2, cen_y2).
  • h represents the height of the circumscribed square of circle 1 and circle 2 (that is, the diameter of circle 1 and circle 2), and the radius of the arc formed by the center of circle 1 and circle 2 is radius.
  • the radius can be obtained by calculating the distance between the center coordinates (cen_x1, cen_y1) of circle 1 and O1 (org_x, org_y).
  • ⁇ 1 is the angle between the line connecting the center of circle 1 and the great circle and the x-axis (the value of ⁇ 1 is between 0 and ⁇ )
  • ⁇ 2 is the angle between the line connecting the center of circle 2 and the great circle and the x-axis ( ⁇ 1 is between 0 and ⁇ ).
  • the value of 2 is between 0 and ⁇ ).
  • the point of circle 1 farthest from O1 is called the vertex of circle 1 (x 1_up , y 1_up ), and the point of circle 1 closest to O1 is called the bottom point of circle 1 (x 1_down , y 1_down ),
  • the point of circle 2 farthest from O1 is called the vertex of circle 2 (x 2_up , y 2_up )
  • the point of circle 2 closest to O1 is called the bottom point of circle 2 (x 2_down , y 2_down ).
  • the coordinates of the vertex and bottom of circle 1 can be obtained by calculation, that is,
  • the horizontal rightward is the positive x direction
  • the vertical downward direction is the positive y direction.
  • Drawing from top to bottom, with the y-axis as a variable, at each position y, the x_left and x_right (coordinates of the left and right boundaries) of the position are determined by the analytical equation of the circle.
  • the arc is drawn from top to bottom, so it is necessary to consider different analytical equations for the left and right boundaries. Due to the different positions of the arcs, the arcs have different piecewise analytical equations on the upper left, lower left, upper right and lower right of the center line, which are divided into the following eight cases:
  • Case 1 As shown in Figure 9A, the arc is on the upper left side of the center line, in the positive direction of the y-axis, the vertex of circle 2 ⁇ base of circle 2 ⁇ vertex of circle 1 ⁇ base of circle 1, that is, y 2_up ⁇ y 2_down ⁇ y 1_up ⁇ y 1_down .
  • x_right can be obtained based on the analytical equation of the right circle 2 diagonal line, namely:
  • x_right can be derived based on the analytical equation of the small arc on the right, namely;
  • x_right can be obtained based on the analytical equation of the small arc on the right (same formula 5), namely:
  • the electronic device 100 can draw an arc as shown in FIG. 9A .
  • the electronic device 100 determines, based on the two-dimensional code information, that the dot-shaped symbols that meet the preset conditions are connected as arc-shaped symbols, and then determines the dot-shaped symbols (circle 1 and circle 2) at both ends in an arc-shaped symbol.
  • the electronic device 100 corresponds x_left and x_right to corresponding bits in the 32-bit integer, sets the points outside x_left and x_right in the 32 bits to zero, and sets the points between x_left and x_right in the 32 bits to non-zero.
  • each group of x_left and x_right can draw a line of pixels, drawn from top to bottom, according to the above formula 3456, you can continuously get x_left and x_right, so as to draw a complete picture arc-shaped symbol.
  • Case 2 As shown in Figure 9B, the arc is on the upper left side of the center line, and in the y-axis direction, the vertex of circle 2 ⁇ vertex of circle 1 ⁇ base of circle 2 ⁇ base of circle 1, that is, y 2_up ⁇ y 1_up ⁇ y 2_down ⁇ y 1_down .
  • x_left can be obtained based on the analytic equation of the great circle arc on the left, refer to formula 3; x_right can be obtained based on the analytical equation of the circle 2 on the right, refer to formula 4.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytic equation of the right circle 2 oblique line, refer to formula 4.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the small arc on the right, refer to formula 5.
  • Case 3 As shown in Fig. 9C, the arc is on the lower left side of the center line, and in the y-axis direction, the bottom point of circle 1 ⁇ top of circle 1 ⁇ bottom point of circle 2 ⁇ top of circle 2, that is, y 1_down ⁇ y 1_up ⁇ y 2_down ⁇ y 2_up .
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the small arc on the right, refer to formula 5.
  • x_left can be obtained based on the analytical equation of the large arc on the left, refer to formula 3; x_right can be obtained based on the analytical equation of the small arc on the right, refer to formula 5.
  • x_left can be obtained based on the analytic equation of the great circle arc on the left, refer to formula 3; x_right can be obtained based on the analytical equation of the circle 2 on the right, refer to formula 4.
  • Case 4 As shown in Figure 9D, the arc is on the lower left side of the center line, and in the y-axis direction, the bottom point of circle 1 ⁇ bottom point of circle 2 ⁇ top of circle 1 ⁇ top of circle 2, that is, y 1_down ⁇ y 2_down ⁇ y 1_up ⁇ y 2_up .
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the small arc on the right, refer to formula 5.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytic equation of the right circle 2 oblique line, refer to formula 4.
  • x_left can be obtained based on the analytic equation of the great circle arc on the left, refer to formula 3; x_right can be obtained based on the analytical equation of the circle 2 on the right, refer to formula 4.
  • Case 5 As shown in Figure 9E, the arc is on the lower right side of the center line, and in the y-axis direction, the bottom point of circle 2 ⁇ the bottom point of circle 1 ⁇ the vertex of circle 2 ⁇ the vertex of circle 1, that is, y 2_down ⁇ y 1_down ⁇ y 2_up ⁇ y 1_up .
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytic equation of the right circle 2 oblique line, refer to formula 4.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the large circle arc on the right, refer to formula 3.
  • Case 6 As shown in Figure 9F, the arc is on the lower right side of the center line, and in the y-axis direction, the bottom point of circle 2 ⁇ top of circle 2 ⁇ bottom point of circle 1 ⁇ top of circle 1, that is, y 1_down ⁇ y 2_down ⁇ y 1_up ⁇ y 2_up .
  • x_left can be obtained based on the analytical equation of the small arc on the left, with reference to formula 5; x_right can be obtained based on the analytical equation of the circle 2 on the right, with reference to formula 4.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the large circle arc on the right, refer to formula 3.
  • Case 7 As shown in Figure 9G, the arc is on the upper right side of the center line, and in the y-axis direction, the vertex of circle 1 ⁇ base of circle 1 ⁇ vertex of circle 2 ⁇ base of circle 2, that is, y 1_up ⁇ y 1_down ⁇ y 2_up ⁇ y 2_down .
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the large circle arc on the right, refer to formula 3.
  • x_left can be obtained based on the analytical equation of the small arc on the left, refer to formula 5; x_right can be obtained based on the analytical equation of the large arc on the right, refer to formula 3.
  • x_left can be obtained based on the analytical equation of the small arc on the left, with reference to formula 5; x_right can be obtained based on the analytical equation of the circle 2 on the right, with reference to formula 4.
  • Case 8 As shown in Figure 9H, the arc is on the upper right side of the center line, and in the y-axis direction, the vertex of circle 1 ⁇ vertex of circle 2 ⁇ base of circle 1 ⁇ base of circle 2, that is, y 1_up ⁇ y 2_up ⁇ y 1_down ⁇ y 2_down .
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytical equation of the large circle arc on the right, refer to formula 3.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6; x_right can be obtained based on the analytic equation of the right circle 2 oblique line, refer to formula 4.
  • the arc-shaped symbols may pass through the center line (a straight line passing through the O1 point and perpendicular to the y-axis direction), and the arc-shaped symbols may be distributed in the second and third quadrants, or distributed in the The cases in the first quadrant and the fourth quadrant, these cases may correspond to one of the above cases 1 to 8.
  • the arc-shaped symbols may pass through the center line (a straight line passing through point O1 and perpendicular to the x-axis direction), and the arc-shaped symbols appear on both sides of the center line, that is, the arc-shaped symbols are distributed on the first In the case of the first quadrant and the second quadrant, or in the case of the third quadrant and the fourth quadrant, the analytical equations from top to bottom may be completely different.
  • the center line is the boundary, and an arc-shaped symbol is divided into two. First, draw the arc-shaped symbol on the left side of the center line, and then draw the arc-shaped symbol on the right side of the center line. happening.
  • the way of judging whether a segment of arc-shaped symbol passes through the midline may be, if the abscissa of the center of circle 1 and the abscissa of the center of circle 2 in the arc-shaped symbol include the abscissa of the center of the great circle Coordinates, that is, the abscissa of the center of circle 1 ⁇ org_y ⁇ the abscissa of the center of circle 2, then it is judged that the arc passes through the center line.
  • Case 9 As shown in FIG. 10A , the arc involves the upper left side and the upper right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • the left side is the circle 1 oblique line
  • the right side is the small circle arc.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6
  • x_right can be obtained based on the analytical equation of the small arc on the right, refer to formula 5.
  • Case 10 As shown in Fig. 10B, the arc involves the upper left side and the upper right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • the left side is the circle 1 oblique line
  • the right side is the small circle arc.
  • x_left can be obtained based on the analytic equation of the left circle 1 oblique line, refer to formula 6
  • x_right can be obtained based on the analytical equation of the small arc on the right, refer to formula 5.
  • Case 11 As shown in Fig. 10C, the arc involves the upper left side and the upper right side of the center line, and the center line divides a segment of the arc into two segments of left and right segments.
  • Case 12 As shown in Figure 10D, the arc involves the upper left side and the upper right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • Case 13 As shown in Figure 10E, the arc involves the lower left side and the lower right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • Case 14 As shown in Fig. 10F, the arc involves the lower left side and the lower right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • Case 15 As shown in Fig. 10G, the arc involves the lower left side and the lower right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • Case 16 As shown in Figure 10H, the arc involves the lower left side and the lower right side of the midline, and the midline divides a segment of the arc into two left and right segments.
  • the electronic device 100 can draw arcs of any shape.
  • the electronic device 100 obtains the coordinates of the center of the circle 1 and the circle 2, then determines the y-axis coordinate points of the apex and the bottom of the circle 1 and the circle 2, and the electronic device determines the apex of the circle 2, the bottom point of the circle 2,
  • the size of the vertex of circle 1 and the base of circle 1 can determine which of the above sixteen cases belongs to, and then draw the arc based on the analytical equation in the corresponding case.
  • each group of x_left and x_right can draw a line of pixels, drawn from top to bottom, and according to the formula in the corresponding situation, x_left and x_right can be continuously obtained, thereby drawing A complete arc-shaped code element is obtained.
  • both the generation of the two-dimensional code and the identification of the two-dimensional code use a 32-bit bit stream, which can improve the encoding and decoding speed of the two-dimensional code.
  • the embodiment of the present application also provides a corresponding two-dimensional code identification method. As shown in FIG. 11 , this method Specific steps are as follows:
  • step S201 the electronic device 100 acquires a picture to be recognized.
  • the to-be-recognized picture includes the to-be-recognized two-dimensional code.
  • the electronic device 100 after acquiring the image to be recognized, performs operations such as contrast adjustment, grayscale processing, binarization processing, and smoothing processing on the image to be recognized, so as to facilitate subsequent two-dimensional code recognition.
  • Step S202 the electronic device 100 determines the position of the locator in the picture to be recognized.
  • the electronic device 100 obtains the picture to be recognized, and when recognizing the two-dimensional code in the picture to be recognized, searches for the locator in the picture to be recognized according to the characteristics of the locator, and determines the position of the locator in the input picture.
  • the locators include three locators and one auxiliary locator, which are distributed on the upper left, upper right, lower left and lower right of the two-dimensional code.
  • the electronic device 100 searches the input picture for the three locators according to the characteristics of the three locators, and determines the positions of the three locators in the input picture. Using a variety of combination methods, combined with the position positioning of the three locators, the accurate and fast positioning of the two-dimensional code is realized.
  • the pattern of the locator is generally a pattern with a fixed ratio (as shown in Figure 3C, the pattern of the locator is a black and white concentric circular pattern, and the ratio of the black and white symbols of the main locator is 1:1:2:1:1, The ratio of black and white code elements of the auxiliary locator is 1:1:2:1:1).
  • the positioning pattern of the two-dimensional code is generally searched based on this fixed ratio to determine the size of the two-dimensional code. direction.
  • the electronic device 100 can quickly locate the position of the main locator by combining the relative positional relationship between the main locator and the auxiliary locator, which can improve the accuracy of QR code positioning. efficiency.
  • the positions of three main locators and one auxiliary locator can be located respectively, according to the positions of the located main locators and auxiliary locators, combined with the relative positional relationship between the main locators and the auxiliary locators in the two-dimensional code structure, Position calibration of the QR code coding area can improve the accuracy of QR code positioning.
  • Step S203 the electronic device 100 identifies the two-dimensional code picture in the to-be-recognized picture based on the position of the locator, identifies the version information in the two-dimensional code picture, and determines the target version of the to-be-identified two-dimensional code.
  • the electronic device 100 determines the target version of the two-dimensional code to be recognized, it can obtain the (dot-shaped) center coordinates and radius information of each storage location in the target version, the center coordinates and radius information of the image area, and the correlation of the locator. Coordinate information, etc.
  • the electronic device 100 may determine the vertex position of the two-dimensional code in the image to be recognized based on the position of the locator, and then correct the two-dimensional code based on the vertex position.
  • Perspective transformation for obtaining non-oblique QR code images Due to the problem of the shooting angle, the two-dimensional code in the obtained two-dimensional code picture is linearly deformed in most cases. That is, a non-slanted QR code image.
  • Step S204 Identify the code element in the two-dimensional code to be identified by using the coordinate information of each storage location in the target version to realize decoding.
  • the coordinate information of each storage location in the target version includes the center coordinates and radius information of the storage location, wherein the target version can also indicate the center coordinates and radius information of the image area, the relative coordinate information of the locator, and so on.
  • the electronic device 100 obtains the coordinate information of each storage location in the target version, including the center coordinates and radius information of the storage location, and then based on the symbols for identification.
  • the electronic device 100 identifies, in the two-dimensional code image, the value stored corresponding to each storage location based on the coordinate information of each storage location, optionally, in the encoding area of the two-dimensional code to be identified
  • the value corresponding to the storage position occupied by the symbol is the first value
  • the value corresponding to the storage position not occupied by the symbol is the second value.
  • the electronic device 100 obtains the coordinates and radii of the center of a circle with 100 storage locations, and the electronic device 100 scans the 100 storage locations in the two-dimensional code image based on the coordinates of the center of the circle and the radius, and there are corresponding storage locations occupied by symbols. If the value is 1, and the value corresponding to the storage location occupied by no symbol is 0, a string of binary strings can be identified, and the electronic device 100 decodes based on the binary strings to obtain information corresponding to the two-dimensional code.
  • the electronic device 100 identifies the dot-shaped symbols in the two-dimensional code image, determines the position of each dot-shaped symbol and the value corresponding to each dot-shaped symbol, and determines the first value, and the electronic device 100 Based on the coordinate information of the storage location indicated in the target version of the two-dimensional code image, the device 100 determines that the value corresponding to the storage location not occupied by the symbol is the second value. For example, the electronic device 100 recognizes the two-dimensional code image, and recognizes that there are 60 positions (including the coordinates of the center of the circle and the radius) with symbols, and the corresponding value is 1; the electronic device 100 corresponds to the 60 positions to the two-dimensional code.
  • the electronic device 100 recognizes a string of binary strings, and the electronic device 100 decodes the binary strings to obtain information corresponding to the two-dimensional code.
  • the electronic device 100 identifies the dot-shaped symbol in the two-dimensional code image, determines the position of the dot-shaped symbol of the first color and the corresponding value of the first value, and determines the second color of the dot-shaped symbol.
  • the position of the dot-shaped symbol and the corresponding value are the second value.
  • the electronic device 100 recognizes the two-dimensional code image, and recognizes that the symbols with 60 positions (including the coordinates of the center of the circle and the radius) are the first color, the corresponding value is 1, and there are 40 symbols in the positions. is the second color, and the corresponding value is 0; then the electronic device 100 identifies a string of binary strings, and the electronic device 100 decodes the binary strings to obtain information corresponding to the two-dimensional code.
  • the electronic device 100 identifies an arc-shaped symbol in the two-dimensional code image, and based on the length of the arc-shaped symbol, it can be determined that the arc-shaped symbol is composed of several dot-shaped symbols , and the center coordinates of each dot-shaped symbol can be determined.
  • the electronic device 100 determines the position of each dot-shaped symbol and the value corresponding to each dot-shaped symbol as the first value, and the electronic device 100 is based on the coordinate information of the storage location indicated in the target version of the two-dimensional code image, It is determined that the value corresponding to the storage location not occupied by the symbol is the second value.
  • the above describes the steps of identifying a two-dimensional code in the embodiment of the present application.
  • the embodiment of the present application provides a method for identifying a two-dimensional code.
  • the electronic device 100 performs digital image processing on a picture to be identified, and determines the locator in the picture to be identified by determining the locator.
  • the location of the QR code is determined, and after identifying the target version of the QR code, encoding information is obtained based on the location coordinates of the target version, and decoding is implemented through decoding rules. In this way, the decoding of the two-dimensional code with the two-dimensional code structure of the target version is completed.
  • the two-dimensional code is identified by using a 32-bit bit stream, which can improve the decoding speed of the two-dimensional code.
  • the embodiments of the present application also provide other versions of the two-dimensional code.
  • 12A and 12B illustrate two possible two-dimensional code versions.
  • the two-dimensional code is circular as a whole, including an image area in the middle and a coding area surrounding the image area.
  • the coding area of the two-dimensional code includes at least two concentric circles formed by gathering the symbols of the two-dimensional code, and the symbols include dot-shaped symbols.
  • the radii of the dot-shaped symbols in the same concentric circle area are the same, and the radii of the dot-shaped symbols in different concentric circle regions are different, wherein the radius of the dot-shaped symbols in the innermost concentric circle region The smallest, the outer concentric circle area, the larger the radius of the dot-shaped symbol in it.
  • FIG. 12A further includes 3 main locators and 3 auxiliary locators, and the 3 main locators and the 1 auxiliary locator are all circular areas.
  • the number and style of the main locator and the auxiliary locator are not limited in this embodiment of the present application.
  • the coding area of the two-dimensional code includes 5 concentric circle areas.
  • the number of concentric circle areas included in the coding area can be adjusted according to the size of the data volume of the two-dimensional code, and the information capacity of the two-dimensional code can be expanded by expanding the number of concentric circle areas in the encoding area.
  • the two-dimensional code is circular as a whole, including an image area in the middle and a coding area surrounding the image area.
  • the coding area of the two-dimensional code includes at least two concentric circles formed by gathering the symbols of the two-dimensional code, and the symbols include dot-shaped symbols. Each dot-shaped symbol has the same radius.
  • the difference from FIG. 3A is that the two-dimensional code version shown in FIG. 12B does not include arc-shaped symbols.
  • FIG. 12B further includes 3 main locators and 3 auxiliary locators, and the 3 main locators and the 1 auxiliary locator are all circular areas.
  • the number and style of the main locator and the auxiliary locator are not limited in this embodiment of the present application.
  • the coding area of the two-dimensional code includes four concentric circle areas.
  • the number of concentric circle areas included in the coding area can be adjusted according to the size of the data volume of the two-dimensional code, and the information capacity of the two-dimensional code can be expanded by expanding the number of concentric circle areas in the encoding area.
  • the embodiment of the present application uses a novel two-dimensional code structure, the two-dimensional code is circular, the two-dimensional code includes an image area located in the middle and an encoding area surrounding the image area, and the encoding area includes a collection of code elements of the two-dimensional code. At least two concentric circle areas in the code element, the code element includes a dot-shaped code element and an arc-shaped code element, and by expanding the number of concentric circle areas in the coding area, the information capacity of the two-dimensional code can be quickly expanded; further, the two-dimensional code
  • the area other than the image area also includes main locator and auxiliary locator.
  • a combination of positioning can be achieved in various ways. , to achieve accurate and rapid positioning of the two-dimensional code, thereby improving the accuracy and efficiency of the two-dimensional code recognition.
  • Embodiments of the present application also provide a computer-readable storage medium. All or part of the processes in the above method embodiments may be completed by a computer program instructing relevant hardware, the program may be stored in the above computer storage medium, and when executed, the program may include the processes in the above method embodiments.
  • the computer-readable storage medium includes: read-only memory (ROM) or random access memory (random access memory, RAM), magnetic disk or optical disk and other media that can store program codes.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • software it can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server, or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.
  • the modules in the apparatus of the embodiment of the present application may be combined, divided and deleted according to actual needs.

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

公开了一种二维码识别方法及相关装置,其特征在于,该二维码包括位于中部的图像区域和围绕图像区域的圆环区域,圆环区域包括编码区域、第一间隔区域和第二间隔区域,编码区域中包括多个码元,编码区域包括第一编码区域和第二编码区域,第一编码区域和第二编码区域之间设置有第一间隔区域和第二间隔区域;该二维码识别方法包括:电子设备获取待识别的二维码,识别该待识别二维码对应的第一信息。本申请实施例,提供了一种使用间隔区域将编码区域断开的二维码样式,增加了二维码的多样性和美观性,并且基于该二维码样式能够实现该二维码的识别。

Description

二维码识别方法及相关装置
本申请要求于2021年2月7日提交中国专利局、申请号为202110169337.5、申请名称为“二维码识别方法及相关装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及电子技术领域,尤其涉及一种二维码识别方法及相关装置。
背景技术
近年来,随二维码技术日益成熟,越来越多的厂商开始投入自定义非标准二维码的研究和商业化,例如微信小程序码等。
然而,传统的方形二维码不美观,没有引导信息;需要特殊引导的二维码,采用在中间二维码增加周围logo的方式,往往需要占用较大的空间;或者在二维码的中心放置一个小型的商标,遮盖住部分数据区域,影响二维码的识别。此外方形二维码由于解码的通用性,通过标准解码程序读出,保密性比较差。方形二维码扫码的内容可以是包括不安全内容的网址,例如包括木马病毒的链接,安全性差,用户体验一般。
发明内容
本申请实施例提供了一种二维码识别方法及相关装置,增加了二维码的多样性,可以实现对该二维码的识别。
第一方面,本申请实施例提供了一种二维码识别方法,该二维码包括位于中部的图像区域和围绕图像区域的圆环区域,圆环区域包括编码区域、第一间隔区域和第二间隔区域,编码区域中包括多个码元,编码区域包括第一编码区域和第二编码区域,第一编码区域和第二编码区域之间设置有第一间隔区域和第二间隔区域;该方法包括:
电子设备获取待识别的二维码,确定待识别的二维码的编码区域中多个码元对应的取值;
电子设备根据编码区域中的多个码元对应的取值,识别待识别的二维码对应的第一信息。
本申请实施例中,电子设备获取待识别的二维码,识别该待识别二维码对应的第一信息。其中该待识别的二维码中的编码区域、第一间隔区域和第二间隔区域刚好围成一个圆环,编码区域被第一间隔区域和第二间隔区域分为了第一编码区域和第二编码区域。即本申请实施例提供了一种使用间隔区域将编码区域断开的二维码样式。
结合第一方面,在一种可能的实现方式中,第一间隔区域和第二间隔区域为宽度相同的部分圆环。这里的部分圆环指的是一个完整圆环的一部分。
结合第一方面,在一种可能的实现方式中,第一编码区域和第二编码区域所占面积相同。第一编码区域和第二编码区域是面积大小均相同的区域,对称分布提高了美观性。
结合第一方面,在一种可能的实现方式中,图像区域在水平方向上的宽度和二维码在水平方向上的宽度的比例为1:3。其中,本申请实施例对图像区域的比例大小不做限制。
结合第一方面,在一种可能的实现方式中,编码区域中的多个码元分布在至少两个同心圆上,至少两个同心圆的圆心为二维码的中心,其中码元中包括圆点形码元。
结合第一方面,在一种可能的实现方式中,在编码区域的同一个同心圆上相邻圆点形码元的圆心之间的圆弧距离为(2r+b)*k,k为正整数,r为圆点形码元的半径,b为固定值;同一个同心圆的周长为N*(2r+b),N为大于k的正整数。这里限定了圆点形码元的圆心之间的 距离,相邻圆点形码元之间的最小距离为2r+b,则任意两个圆点形码元之间的距离都是2r+b的整数倍。
在一种可能的实现方式中,在编码区域的同一个同心圆中,连续三个圆点形码元的圆心之间的圆弧距离大于(2r+b)*2。也就是说,例如不会出现连续3个圆点形码元之间的距离都为最小距离2r+b的情况,可以保持二维码的美观性。
在一种可能的实现方式中,在二维码的两个不同的同心圆上分别存在圆点形码元a、b,圆点形码元a和圆点形码元b的圆心的连线穿过二维码的中心。这里提供了一种可能的样式,即放射状的样式。
在一种可能的实现方式中,二维码中不同同心圆上的圆点形码元的半径不同。
在一种可能的实现方式中,二维码中外部的同心圆中圆点形码元的半径大于内部的同心圆中圆点形码元的半径。
在一种可能的实现方式中,码元中还包括圆弧形码元,圆弧形码元在同心圆上的圆弧长度为(2r+b)*M,M为正整数。这里描述了多个圆点形码元可以连接为一个圆弧形码元,则若圆弧形码元是由M+1个圆点形码元连接起来的,则圆弧形码元的长度为(2r+b)*M。
在一种可能的实现方式中,在同一个同心圆上,一个圆弧形码元和其相邻码元之间的圆弧距离大于或等于(2r+b)*2。由于圆弧形码元是由连续的圆点形码元连接而成的,所以圆弧形码元和其相邻的码元(圆点形码元或圆弧形码元)的距离至少间隔了一个圆点形码元。
结合第一方面,在一种可能的实现方式中,电子设备获取待识别的二维码,确定待识别的二维码的编码区域中多个码元对应的取值,并识别待识别的二维码对应的第一信息,包括:电子设备获取待识别的二维码;电子设备确定待识别的二维码的目标版本,目标版本指示了待识别的二维码的编码区域中每个存储位置的坐标信息;电子设备基于每个存储位置的坐标信息,确定待识别的二维码的编码区域中的多个码元中每个码元占据的存储位置对应为第一值;根据第一值识别待识别的二维码对应的第一信息。这里描述了电子设备识别二维码的具体实现方式,电子设备识别出二维码的目标版本后,基于目标版本中包含的位置坐标获得编码信息,通过解码规则实现解码。这样,完成了目标版本的二维码结构的二维码的解码。
在一种可能的实现方式中,每个存储位置为圆点形,坐标信息包括存储位置的圆心坐标信息和半径信息。
在一种可能的实现方式中,电子设备确定待识别的二维码的目标版本,之前包括:电子设备确定待识别图像中的定位符的位置;电子设备基于定位符的位置确定待识别图像中的二维码的顶点位置;电子设备基于顶点位置对待识别图像中的二维码进行校正,以获取待识别的二维码。这里描述了电子设备对二维码进行定位和校正的过程。
结合第一方面,在一种可能的实现方式中,第一信息的类型包括以下中的一项或多项:字符、文字、图片、音频、视频、链接地址。
第二方面,本申请实施例提供了一种二维码生成方法,该方法包括:
电子设备获取第一信息;
电子设备基于第一信息生成二维码,二维码指示了第一信息;
二维码包括位于中部的图像区域和围绕图像区域的圆环区域,圆环区域包括编码区域、第一间隔区域和第二间隔区域,编码区域中包括多个码元,编码区域包括第一编码区域和第二编码区域,第一编码区域和第二编码区域之间设置有第一间隔区域和第二间隔区域。
本申请实施例中,电子设备获取第一信息,基于第一信息生成二维码。其中该二维码中的编码区域、第一间隔区域和第二间隔区域刚好围成一个圆环,编码区域被第一间隔区域和 第二间隔区域分为了第一编码区域和第二编码区域。即本申请实施例提供了一种使用间隔区域将编码区域断开的二维码样式。
结合第二方面,在一种可能的实现方式中,编码区域中的多个码元分布在至少两个同心圆上,至少两个同心圆的圆心为二维码的中心,其中多个码元中包括圆点形码元。
结合第二方面,在一种可能的实现方式中,电子设备基于第一信息生成二维码包括:电子设备将第一信息编码为二进制字符串;电子设备根据二进制字符串的长度确定待生成二维码的目标版本,目标版本指示了编码区域中每个存储位置的坐标信息;电子设备根据每个存储位置的坐标信息,将二进制字符串分配到编码区域的存储位置中;其中,存储位置包括第一存储位置及第二存储位置,第一存储位置存储二进制字符串中的第一值和第二存储位置存储二进制字符串中的第二值;电子设备基于第一存储位置的坐标信息绘制第一码元,基于第一码元生成二维码;第一码元为二维码的编码区域的多个码元中的一个码元。该方式中,电子设备通过将待生成二维码的第一信息进行比特化处理,首先得到对应的二进制字符串;根据二进制字符串的长度确定待生成二维码的目标版本,其中,不同的版本所能够存储的数据量不同。电子设备确定了目标版本后,将二进制字符串分配到目标版本的编码区域中的各个存储位置中,然后绘制码元,
结合第二方面,在一种可能的实现方式中,存储位置的坐标信息包括存储位置的圆心坐标信息和半径信息;第一码元为圆点形码元,圆点形码元是基于第一存储位置的圆心坐标信息和半径信息绘制的。
结合第二方面,在一种可能的实现方式中,不同的目标版本中编码区域的同心圆的数量不同。其中,不同的同心圆数量能够存储的数据量不同。
结合第二方面,在一种可能的实现方式中,电子设备基于第一存储位置的坐标信息,在第一存储位置上绘制第一码元,包括:电子设备通过第一存储位置的圆心坐标信息和半径信息确定第一码元在Y轴上的取值范围,第一码元在Y轴上的取值范围的最小值为圆心坐标信息中的圆心纵坐标减去半径,取值范围的最大值为圆心坐标信息中的圆心纵坐标加上半径;电子设备在取值范围内的每一个Y值通过预设公式确定一个左端的X值和一个右端的X值,并将一个左端的X值和一个右端的X值之间的像素点绘制为第一颜色,完成第一码元的绘制,第一码元的所有像素点为第一颜色。这里描述了绘制圆点形码元的过程,其中,不仅是可以以Y轴为自变量,确定两个X轴端点,也可以以X轴为自变量,确定两个Y轴端点。
结合第二方面,在一种可能的实现方式中,方法还包括:第一码元还包括圆弧形码元,圆弧形码元占据了至少两个相邻的第一存储位置,至少两个相邻的第一存储位置位于同一个同心圆上。当满足预设条件的情况下还可以绘制圆弧形码元,增加了二维码的多样性和美观性。
结合第二方面,在一种可能的实现方式中,第一码元占据了至少两个存储位置,其中至少两个存储位置的左右两端的存储位置为第三存储位置和第四存储位置;第三存储位置和第四存储位置的圆心点均在二维码的中线的同一侧,二维码的中线为经过二维码的中心点且垂直于X轴的直线;电子设备基于第一存储位置的坐标信息绘制第一码元,包括:电子设备通过第三存储位置和第四存储位置的圆心坐标信息和半径信息确定第一码元在Y轴上的取值范围,当第三存储位置的圆心纵坐标大于第四存储位置的圆心纵坐标,第一码元在Y轴上的取值范围的最小值为第三存储位置上距离二维码的中心最短的点的纵坐标,第一码元在Y轴上的取值范围的最大值为第四存储位置上距离二维码的中心最长的点的纵坐标;电子设备在取值范围内的每一个Y值通过预设公式确定一个左端的X值和一个右端的X值,并将一个左 端的X值和一个右端的X值之间的像素点绘制为第一颜色,完成第一码元的绘制,第一码元的所有像素点为第一颜色。这里描述了绘制一种圆弧形码元的过程。
结合第二方面,在一种可能的实现方式中,第一码元占据了至少两个存储位置,其中至少两个存储位置的左右两端的存储位置为第三存储位置和第四存储位置;第三存储位置和第四存储位置的圆心点分别在二维码的中线的两侧,二维码的中线为经过二维码的中心点且垂直于X轴的直线,第一码元在中线左侧的部分为第一部分,第一码元在中线右侧的部分为第二部分;电子设备基于第一存储位置的坐标信息绘制第一码元,包括:电子设备分别绘制第一码元的第一部分和第二部分;第一部分在Y轴上的取值范围的最小值为第三存储位置上距离二维码的中心最短的点的纵坐标,在Y轴上的取值范围的最大值为第三存储位置所在同心圆中的最大纵坐标;第二部分在Y轴上的取值范围的最小值为第四存储位置上距离二维码的中心最短的点的纵坐标,在Y轴上的取值范围的最大值为第四存储位置所在同心圆中的最大纵坐标。这里描述了绘制另一种圆弧形码元的过程。
第三方面,本申请提供了一种电子设备,包括:一个或多个处理器、一个或多个存储器;该一个或多个存储与一个或多个处理器耦合;该一个或多个存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令;当该计算机指令在该处理器上运行时,使得该电子设备执行上述第一方面任一种可能的实现方式中的二维码识别方法。
第四方面,本申请提供了一种电子设备,包括:一个或多个处理器、一个或多个存储器;该一个或多个存储与一个或多个处理器耦合;该一个或多个存储器用于存储计算机程序代码,该计算机程序代码包括计算机指令;当该计算机指令在该处理器上运行时,使得该电子设备执行上述第二方面任一种可能的实现方式中的二维码生成方法。
第五方面,本申请实施例提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得通信装置执行上述任一方面任一项可能的实现方式中的动作。
第六方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行上述任一方面任一项可能的实现方式中的动作。
附图说明
图1为本申请实施例提供的一种电子设备的结构示意图;
图2为本申请实施例提供的一种电子设备的软件架构图;
图3A为本申请实施例提供的一种二维码的结构示意图;
图3B为本申请实施例提供的一种二维码的图像区域和编码区域的结构示意图;
图3C为本申请实施例提供的一种二维码的主定位符的结构示意图;
图4为本申请实施例提供的一种二维码生成方法的流程示意图;
图5A至图5H为本申请实施例提供的二维码的不同版本的结构示意图;
图6A至图6F为本申请实施例提供的基于不同版本生成的二维码的结构示意图;
图7A为本申请实施例提供的一种圆点形码元的结构示意图;
图7B为本申请实施例提供的一种绘制码元的数据流的保存方式的示意图;
图8为本申请实施例提供的一种圆弧形码元的结构示意图;
图9A至图9H为本申请实施例提供的不同情况下绘制的圆弧形码元的原理示意图;
图10A至图10H为本申请实施例提供的不同情况下绘制的圆弧形码元的原理示意图;
图11为本申请实施例提供的一种二维码识别方法的方法流程图;
图12A至图12B为本申请实施例提供的又一种二维码的结构示意图。
具体实施方式
下面将结合附图对本申请实施例中的技术方案进行地描述。其中,在本申请实施例的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;文本中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况,另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。术语“中间”、“左”、“右”、“上”、“下”等指示的方位或位置关系为基于附图所示的方位或位置关系,仅是为了便于描述本申请和简化描述,而不是指示或暗示所指的装置或元件必须具有特定的方位、以特定的方位构造和操作,因此不能理解为对本申请的限制。
本申请实施例提供了一种二维码生成方法,该方法应用在电子设备100。该方法可以生成一种圆形二维码,该圆形二维码的编码区域由至少两个同心圆区域组成,码元包括圆点形码元和圆弧形码元。本申请实施例可以通过增加同心圆区域的圈数和码元的个数增加二维码的数据存储量。并且,电子设备100在编码过程中对字符串进行加密,解码则需要采用与加密算法对应的解密算法,才能获得完整的字符串,提高了二维码的安全性。
该方法中,电子设备100通过将待生成二维码的字符串进行比特化处理,首先得到对应的二进制字符串;根据二进制字符串的长度确定待生成二维码的目标版本,其中,不同的版本所能够存储的数据量不同。电子设备100确定了目标版本后,将二进制字符串分配到目标版本的编码区域中的各个同心圆区域,得到二维码信息;使用掩码对二维码信息进行掩码叠加处理,以调整二维码信息的布局,最后绘制出最终的二维码。这样,可以完成符合目标版本的二维码结构的二维码的编码,并且生成的二维码内的码元分布均匀,更加美观。
下面首先介绍本申请实施例中涉及的电子设备100。
本申请对提及的电子设备100的类型不做具体限定,电子设备100可以是手机、平板电脑、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、人工智能(artificial intelligence,AI)设备、可穿戴式设备、车载设备、智能家居设备和/或智慧城市设备,电子设备100也可以是云服务器、虚拟服务器、后台服务器、组件服务器、数据处理服务器等网络设备,本申请实施例对该电子设备的具体类型不作特殊限制。
参见图1,图1示出了本申请实施例提供的示例性电子设备100的结构示意图。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器 170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单 个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括UWB,无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,WiFi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的, AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
在本申请的一些实施例中,显示屏194中显示有系统当前输出的界面内容。例如,界面内容为即时通讯应用提供的界面。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5SDRAM)等;
非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。陀螺仪传感器180B可以用于确定电子设备100的运动姿态。气压传感器180C用于测量气压。磁传感器180D包括霍尔传感器。加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。距离传感器180F,用于测量距离。接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。环境光传感器180L用于感知环境光亮度。指纹传感器180H用于采集指纹。温度传感器180J用于检测温度。触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。骨传导传感器180M可以获取振动信号。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。
电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图2是本发明实施例的电子设备100的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融 合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
图3A示出了本申请实施例提供的一种二维码30的结构示意图。如图3A所示,二维码30整体为圆形,二维码30包括位于中部的图像区域301和围绕图像区域301的编码区域302。示例性的,如图3B所示,所述图像区域在水平方向上的宽度和所述二维码在水平方向上的宽度的比例可以为1:3,本申请实施例对图像区域和编码区域的位置比例不作限制。其中,
图像区域301用于放置用户自定义图像。例如可以是使用该二维码技术的应用平台的官方标识性图片,或者是使用该二维码技术的应用平台注册的用户定义的图像等等。这样,在二维码30的中间部分,也就是二维码最重要的视觉敏感区,设置应用平台使用者的图片,可以提高二维码使用方的辨识度。
本申请实施例中,二维码30中间部分的图像区域可以为圆形区域、矩形区域或者其他形状,本实施例对于图像区域的形状不做具体限定。在一些实施例中,电子设备100对于图像区域301中的输入图片会进行圆形化处理,即当输入第三方图片时,圆形以外的区域(边缘化部分)会被透明化处理。
编码区域302由二维码30的码元303聚集而成,码元303分布在至少两个同心圆上,码元303用于记录或存储码字(codeword)。码字是对原始数据进行数据编码后得到的比特序列,码字可以包括数据码(data code),还可以包括纠错码(error correction code)。二维码的常见编码方式包括数字编码、字符编码等。
编码区域302的同心圆区域中包括多个存储码字的位置,其中,被码元303占用的位置存储了第一值(例如二进制的1或0),同心圆区域中不被码元303占用的位置存储了第二值(例如二进制的0或1)。电子设备100通过对编码区域302识别可以获取一串二进制字符串,进而通过解码算法对二进制字符串进行解码获取对应的信息。
本申请实施例中码元303包括圆弧形码元和圆点形码元,在一些实施例中,每个圆点形码元的半径相同。在一些实施例中,每一个圆弧形码元中包括两个或三个或三个以上的圆点形码元,即圆弧形码元是由两个或三个或三个以上的圆点形码元组成的。圆弧形码元能够存储的信息容量是圆点形码元的整数倍。
在一些实施例中,二维码的编码区域中每个圆点形码元的半径可以不同,例如图12A所示。在图12A中,同一个同心圆区域中的圆点形码元的半径相同,不同的同心圆区域中的圆点形码元的半径不同。
在一些实施例中,二维码的编码区域中可以仅包括圆点形码元,例如图12B所示。
在一些实施例中,二维码的编码区域中可以仅包括圆弧形码元。
本申请实施例中,编码区域302包括的同心圆区域的数量可以根据二维码数据量的大小进行调整,通过扩展编码区域302的同心圆区域的数量以及同心圆区域中码元的数量,可以扩展二维码的信息容量。图1中仅以二维码的编码区域302中包括4个同心圆区域为例进行示例性地说明,本实施例对于编码区域中同心圆区域的数量不做具体限定。
在一些实施例中,编码区域302中每个同心圆区域可以分为上半区域和下半区域,上半区域和下半区域之间间隔了一定距离。本申请实施例中,该上半区域和下半区域也可称为第一编码区域和第二编码区域。上半区域和下半区域之间的间隔区域分为左边的间隔区域和右边的间隔区域,其中该左边的间隔区域和右边的间隔区域也可称为第一间隔区域和第二间隔区域。
例如,图5A至图5F示例性的示出了本申请实施例提供的二维码的不同版本,图5A中包括4个同心圆区域,编码区域中每个同心圆区域分为上半区域和下半区域,上半区域和下半区域之间间隔了5个圆点形码元的直径距离。图5F中包括13个同心圆区域,编码区域中每个同心圆区域分为上半区域和下半区域,上半区域和下半区域之间间隔了7个圆点形码元的直径距离。
在一些实施例中,编码区域302中的每个同心圆区域可以不做任何划分,即在二维码的不同版本中,每一个同心圆区域中的圆点形码元以相同间隔均匀分布。
另外,二维码30的图像区域301和编码区域302互不重叠,这样图像区域301中插入的图像不会遮挡二维码编码区域301中的码元303。图像区域301和编码区域302之间存在第一间隔,编码区域302中每两个相邻同心圆区域之间存在第二间隔。
进一步的,如图1所示,二维码30的除图像区域301之外的区域还包括定位符,定位符用于标识二维码的编码区域302,对待识别的图片进行过滤和筛选。如图3A所示,二维码30的结构中包括3个主定位符304和1个辅助定位符305,3个主定位符304和1个辅助定位符305均为圆形区域。
其中,二维码30的主定位符304的外轮廓可以为圆形,每个主定位符304包括位于中心的黑色圆形区域、位于外侧的黑色圆环形区域、以及位于黑色圆形区域和黑色圆环形区域之间的白色圆环形区域。这样,即使在旋转、扭曲等情况下也能够保持同心圆的宽度的相对稳定,从而使定位符具有相对稳定的几何特征,提高定位符的定位和识别的准确性,保证二维码在倾斜的情况下也能定位到信息。
另外,二维码的主定位符304可以采用近似1:1:2:1:1的比例,也就是主定位符304中黑色圆形区域的半径与白色圆环形区域的宽度和黑色圆环形区域的宽度之间保持近似1:1:1的比例。例如,如图3C所示,主定位符中黑色圆形区域的半径为1,白色圆环形区域的宽度为1,黑色圆环形区域的宽度为1。
辅助定位符305中预设的几何形状可以为较为独特的几何形状,以与主定位符304等二维码其他区域中的几何形状进行区分。辅助定位符305的形状也可以与主定位符304相同,即辅助定位符305也可以采用近似1:1:2:1:1的比例,但辅助定位符305与主定位符304的大小不同。
在一些实施例中,辅助定位符305可以为圆形区域,使辅助定位符305具有相对稳定的结构,这样,二维码30整体结构是圆形,并且其中的子元素也是圆形,而圆形具有中心对称的特点,无论如何旋转依然是对称的,二维码30具有相对稳定的几何结构,并且整个二维码看起来更加美观。辅助定位符305中预设的几何形状可以由技术人员根据是否需要进行设定,本实施例此处不做具体限定。
本申请实施例对各个区域的位置、比例不作限定,例如图像区域301和编码区域302在水平方向上可以采用1:1的比例,同心圆之间的间距可以相同也可以不同,圆点形码元的半径可以相同也可以不同。
基于上述二维码的结构,本申请实施例提供了一种二维码生成方法,如图4所示,图4示出了一种二维码生成方法流程,具体步骤如下:
步骤S101、获取待生成二维码的字符串。
电子设备100获取待生成二维码的字符串,该字符串可以是一串数字、一句话、一个链接等等,例如“abcd”,例如“我爱北京”,例如“http://www.xxxx.xxxx”等。
步骤S102、根据获取到的字符串,选择编码模式对该字符串进行数据编码。
电子设备100根据获取到的字符串,选择最适合的编码模式,编码模式包括数字编码、字符编码、字节编码、日文编码等等。
在一些实施例中,数字编码可以对应十进制数字0-9;字符编码可以包含十进制数字0-9、大写字母、以及$%*+-./:还有空格等字符;字节编码可以对应ISO-8859-1字符集;日文编码可以对应由Shift JIS字符集(日文编码字符集)而来的双字节编码。
每种编码模式都将文本(待生成二维码的字符串)编码为一串由0和1组成的二进制位,但采用的编码转换方法不同。例如对于字符编码来说,字符编码支持的所有字符可以对应一个索引值,例如在base_45表中数字0-9对应索引值为0-9,字母A-Z对应索引值为10-35,空格字符对应索引值为36,字符“$”对应索引值为37,字符“%”对应索引值为38,字符“.”对应索引值为42,字符“/”对应索引值为43,等等。
电子设备100根据选择好的编码模式对字符串进行编码,并加入功能性编码信息(包括编码模式指示信息、字符计数信息、填充信息等等),电子设备100将该字符串转换为对应的二进制字符串(例如:1010101111001101),确定该字符串经过编码后转化为二进制字符串的长度。
可选的,步骤S103、对二进制字符串进行加密和压缩。
电子设备100通过加密算法和压缩算法对二进制字符串进行加密和压缩,提升字符串的安全性,并且提升字符串的存储空间。
其中,加密算法包括例如MD5信息摘要算法(MD5Message-Digest Algorithm)、安全散列算法(Secure Hash Algorithm,SHA)、哈希运算消息认证码(Hash-based Message Authentication Code,HMAC)、数据加密标准(Data Encryption Standard,DES)、3DES、高级加密标准(Advanced Encryption Standard,AES)、RSA算法等等。压缩算法包括例如基于存储的数据优化编码压缩算法等等。
步骤S104、根据二进制字符串的长度确定待生成二维码的目标版本。
不同的版本提供了不同的存储数据量。二进制字符串越长,则存储需要的数据量就越大。电子设备100根据二进制字符串的长度确定待生成二维码的目标版本。
下面示例性的介绍本申请实施例中二维码的六种版本。需要说明的是,以下对二维码的六种版本中的圆点形码元进行描述时,这里的圆点形码元均为一个存储位置,并不能等同于生成的二维码中的码元。
版本一,二维码的编码区域中包括4个同心圆区域。
如图5A所示,二维码40的图像区域401指示了该二维码40的品牌类型(鸿蒙系统,harmony OS),可以看出在图5A中,该图像区域401为圆形。
以图像区域401的中心点为圆心,编码区域402包括4个同心圆区域,每个同心圆区域中均匀排列着圆点形码元,每个同心圆区域中两个相邻圆点形码元的圆心之间的距离(也可 以是每两个相邻圆点形码元的圆心构成的圆弧长度)相同。每个圆点形码元都能够存储信息,每个圆点形码元存储的信息可以指示在颜色形式上,若一个圆点形码元上存储了第一信息(例如可以为二进制的1),则将该圆点形码元置为第一颜色(例如黑色),若一个圆点形码元上存储了第二信息(例如可以为二进制的0),则将该圆点形码元置为第二颜色(例如白色,例如透明色)或者不上色。
图像区域401和编码区域402之间存在第一间隔,编码区域402中每两个相邻同心圆区域之间存在第二间隔,其中,每个同心圆区域都由一个内圆环和一个外圆环组成,同心圆区域的宽度为内圆环和外圆环的半径之差,该第二间隔为相邻两个同心圆区域中,小同心圆区域的外圆环和大同心圆区域的内圆环之间的间隔;每个同心圆区域中两个相邻圆点形码元之间存在第三间隔。例如在图5A中,若一个圆点形码元的直径为1,则图像区域401的半径为10,图像区域401和编码区域402之间的间隔为1,即第一间隔为1或者为一个圆点形码元的直径;编码区域402中每个同心圆区域的宽度都为1,即一个圆点形码元的直径;编码区域402中每两个相邻同心圆区域之间的间隔为1,即第二间隔为1或者为一个圆点形码元的直径;每个同心圆区域中两个相邻圆点形码元之间的间隔可以为0,可以为一段圆心角相同的圆弧,即第三间隔可以为0,可以为一段圆心角相同的圆弧。
在一些实施例中,该4个同心圆区域均分为上半区域和下半区域,上半区域和下半区域之间存在第四间隔,例如在图5A中,若一个圆点形码元的直径为1,上半区域和下半区域之间的间隔为5。
定位符区域在二维码之中,例如在图5A中包括三个主定位符403和一个辅助定位符404,三个主定位符403和一个辅助定位符404的外轮廓均为圆形,主定位符403的圆心均在外围倒数第二个同心圆区域中,一个圆点形码元的直径为1,则三个主定位符403的直径为5。
版本二,二维码的编码区域中包括5个同心圆区域。
如图5B所示,二维码41的图像区域411指示了该二维码41的品牌类型(鸿蒙系统,harmony OS)。以图像区域411的中心点为圆心,编码区域412包括5个同心圆区域,每个同心圆区域中均匀排列着圆点形码元,每个同心圆区域中两个相邻圆点形码元的圆心之间的距离(也可以是每两个相邻圆点形码元的圆心构成的圆弧长度)相同。
图像区域411和编码区域412之间存在第一间隔,编码区域412中每两个相邻同心圆区域之间存在第二间隔,每个同心圆区域中两个相邻圆点形码元之间存在第三间隔。例如在图5B中,若一个圆点形码元的直径为1,则图像区域411的半径为10,图像区域411和编码区域412之间的间隔为2,即第一间隔为2或者为两个圆点形码元的直径;编码区域412中每两个相邻同心圆区域之间的间隔为1,即第二间隔为1或者为一个圆点形码元的直径;每个同心圆区域中两个相邻圆点形码元之间的间隔可以为0,可以为一段圆心角相同的圆弧,即第三间隔可以为0,可以为一段圆心角相同的圆弧。
在一些实施例中,该4个同心圆区域均分为上半区域和下半区域,上半区域和下半区域之间存在第四间隔,例如在图5B中,若一个圆点形码元的直径为1,上半区域和下半区域之间的间隔为5。
定位符区域在二维码之中,例如在图5B中包括三个主定位符413和一个辅助定位符414,三个主定位符413和一个辅助定位符414的外轮廓均为圆形,主定位符413的圆心均在外围倒数第二个同心圆区域中,一个圆点形码元的直径为1,则三个主定位符413的直径为5。
版本三,二维码的编码区域中包括8个同心圆区域。
如图5C所示,二维码42的图像区域421指示了该二维码42的品牌类型(鸿蒙系统, harmony OS)。以图像区域421的中心点为圆心,编码区域422包括8个同心圆区域,每个同心圆区域中均匀排列着圆点形码元,每个同心圆区域中两个相邻圆点形码元的圆心之间的距离(也可以是每两个相邻圆点形码元的圆心构成的圆弧长度)相同。
图像区域421和编码区域422之间存在第一间隔,编码区域422中每两个相邻同心圆区域之间存在第二间隔,每个同心圆区域中两个相邻圆点形码元之间存在第三间隔。例如在图5C中,若一个圆点形码元的直径为1,则图像区域421的半径为10,图像区域421和编码区域422之间的间隔为2,即第一间隔为2或者为两个圆点形码元的直径;编码区域422中每两个相邻同心圆区域之间的间隔小于1,即第二间隔可以在0和1之间;每个同心圆区域中两个相邻圆点形码元之间的间隔可以为0,可以为一段圆心角相同的圆弧,即第三间隔可以为0,可以为一段圆心角相同的圆弧。
在一些实施例中,该8个同心圆区域均分为上半区域和下半区域,上半区域和下半区域之间存在第四间隔,例如在图5C中,若一个圆点形码元的直径为1,上半区域和下半区域之间的间隔为5。
定位符区域在二维码之中,例如在图5C中包括三个主定位符423和一个辅助定位符424,三个主定位符423和一个辅助定位符424的外轮廓均为圆形,主定位符423的圆心均在外围倒数第二个同心圆区域中,一个圆点形码元的直径为1,则三个主定位符423的直径为5。
版本四,二维码的编码区域中包括10个同心圆区域。
如图5D所示,二维码43的图像区域431指示了该二维码43的品牌类型(鸿蒙系统,harmony OS)。以图像区域431的中心点为圆心,编码区域432包括10个同心圆区域,每个同心圆区域中均匀排列着圆点形码元,每个同心圆区域中两个相邻圆点形码元的圆心之间的距离(也可以是每两个相邻圆点形码元的圆心构成的圆弧长度)相同。
图像区域431和编码区域432之间存在第一间隔,编码区域432中每两个相邻同心圆区域之间存在第二间隔,每个同心圆区域中两个相邻圆点形码元之间存在第三间隔。例如在图5D中,若一个圆点形码元的直径为1,则图像区域431的半径为10,图像区域431和编码区域432之间的间隔为2,即第一间隔为2或者为两个圆点形码元的直径;编码区域432中每两个相邻同心圆区域之间的间隔小于1,即第二间隔可以在0和1之间;每个同心圆区域中两个相邻圆点形码元之间的间隔可以为0,可以为一段圆心角相同的圆弧,即第三间隔可以为0,可以为一段圆心角相同的圆弧。
在一些实施例中,该4个同心圆区域均分为上半区域和下半区域,上半区域和下半区域之间存在第四间隔,例如在图5D中,若一个圆点形码元的直径为1,上半区域和下半区域之间的间隔为5。
定位符区域在二维码之中,例如在图5D中包括三个主定位符433和一个辅助定位符434,三个主定位符433和一个辅助定位符434的外轮廓均为圆形,主定位符433的圆心均在外围倒数第二个同心圆区域中,一个圆点形码元的直径为1,则三个主定位符433的直径为5。
版本五,二维码的编码区域中包括11个同心圆区域。
如图5E所示,二维码44的图像区域441指示了该二维码44的品牌类型(鸿蒙系统,harmony OS)。以图像区域441的中心点为圆心,编码区域442包括11个同心圆区域,每个同心圆区域中均匀排列着圆点形码元,每个同心圆区域中两个相邻圆点形码元的圆心之间的距离(也可以是每两个相邻圆点形码元的圆心构成的圆弧长度)相同。
图像区域441和编码区域442之间存在第一间隔,编码区域442中每两个相邻同心圆区域之间存在第二间隔,每个同心圆区域中两个相邻圆点形码元之间存在第三间隔。例如在图 5E中,若一个圆点形码元的直径为1,则图像区域441的半径为10,图像区域441和编码区域442之间的间隔为1,即第一间隔为1或者为一个圆点形码元的直径;编码区域442中每两个相邻同心圆区域之间的间隔小于1,即第二间隔可以在0和1之间;每个同心圆区域中两个相邻圆点形码元之间的间隔可以为0,可以为一段圆心角相同的圆弧,即第三间隔可以为0,可以为一段圆心角相同的圆弧。
在一些实施例中,该11个同心圆区域均分为上半区域和下半区域,上半区域和下半区域之间存在第四间隔,例如在图5E中,若一个圆点形码元的直径为1,上半区域和下半区域之间的间隔为5。
定位符区域在二维码之中,例如在图5E中包括三个主定位符443和一个辅助定位符444,三个主定位符443和一个辅助定位符444的外轮廓均为圆形,主定位符443的圆心均在外围倒数第二个同心圆区域中,一个圆点形码元的直径为1,则三个主定位符443的直径为5。
版本六,二维码的编码区域中包括13个同心圆区域。
如图5F所示,二维码45的图像区域451指示了该二维码45的品牌类型(鸿蒙系统,harmony OS)。以图像区域451的中心点为圆心,编码区域452包括13个同心圆区域,每个同心圆区域中均匀排列着圆点形码元,每个同心圆区域中两个相邻圆点形码元的圆心之间的距离(也可以是每两个相邻圆点形码元的圆心构成的圆弧长度)相同。
图像区域451和编码区域452之间存在第一间隔,编码区域452中每两个相邻同心圆区域之间存在第二间隔,每个同心圆区域中两个相邻圆点形码元之间存在第三间隔。例如在图5F中,若一个圆点形码元的直径为1,则图像区域451的半径为13,图像区域451和编码区域452之间的间隔为3,即第一间隔为3或者为三个圆点形码元的直径;编码区域452中每两个相邻同心圆区域之间的间隔小于1,即第二间隔可以在0和1之间;每个同心圆区域中两个相邻圆点形码元之间的间隔可以为0,可以为一段圆心角相同的圆弧,即第三间隔可以为0,可以为一段圆心角相同的圆弧。
在一些实施例中,该4个同心圆区域均分为上半区域和下半区域,上半区域和下半区域之间存在第四间隔,例如在图5F中,若一个圆点形码元的直径为1,上半区域和下半区域之间的间隔为7。
定位符区域在二维码之中,例如在图5F中包括三个主定位符453和一个辅助定位符454,三个主定位符453和一个辅助定位符454的外轮廓均为圆形,主定位符453的圆心均在外围倒数第二个同心圆区域中,一个圆点形码元的直径为1,则三个主定位符453的直径为5。
可以理解的,同心圆区域的数量越多、圆点形码元的数量越多,则该版本的存储数据量越大。不限于上述六个版本,二维码的同心圆区域的数量和每个同心圆区域中圆点形码元数量可以有其他的配置,本申请对此不作限制。
例如,本申请还提供了一种二维码的版本,如图5G和图5H所示,不同于版本一至版本六的样式,图5G和图5H的圆点形码元的排布呈发射状,每一个同心圆上的圆点形码元的数量相同。其中,图5G中包括6个同心圆,以二维码的中心为起点,连接任意一个圆点形码元的圆心所形成的射线,可以在其他5个同心圆上都经过一个圆点形码元的圆心。图5H中包括7个同心圆,同理,以二维码的中心为起点,连接任意一个圆点形码元的圆心所形成的射线,可以在其他6个同心圆上都经过一个圆点形码元的圆心。
电子设备100根据二进制字符串的长度确定待生成二维码的目标版本后,可以得到该目 标版本中存储信息的圆点形码元的圆心坐标、圆点形码元的半径信息、图像区域的圆心坐标和半径信息、定位符的相关坐标信息等等。
步骤S105、根据待生成二维码的目标版本中的图像区域、编码区域、定位符的位置,将二进制字符串分配到编码区域中的各个同心圆区域,得到二维码信息。
电子设备100根据待生成二维码的目标版本的结构中图像区域、编码区域、定位符的位置,将二进制字符串进行分环处理,将二进制字符串分配到编码区域中的各个同心圆区域的圆点形码元中,得到二维码信息。
具体的,可以根据二维码结构中编码区域中的同心圆区域的数量,以及每个同心圆区域的信息容量(与圆点形码元的数量正相关),将二进制字符串拆分为与各个同心圆区域对应的子字符串,将每个子字符串分配给对应的同心圆区域中的圆点形码元存储。
其中,二维码信息包括每个圆点形码元对应存储的信息,例如处于第一位置的圆点形码元存储第一信息,处于第二位置的圆点形码元存储第二信息,其中第一位置和第二位置指示了圆点形码元的圆心坐标和半径信息。示例性的,第一信息可以为二进制字符串中的1,第二信息可以为二进制字符串中的0。
在一些实施例中,二维码信息还可以包括每个圆点形码元对应的显示形式,例如将存储第一信息的圆点形码元对应置为第一颜色,将存储第二信息的圆点形码元对应置为第二颜色。示例性的,第一颜色可以为黑色,第二颜色可以为白色、或者透明色、或者不上色。
在一些实施例中,电子设备100将一个同心圆区域对应的子字符串进一步地拆分为两个子字符串,这两个子字符串分别由该同心圆区域的上半区域和下半区域对应存储;还可以将一个同心圆区域对应的子字符串进一步地拆分为四个子字符串,这四个子字符串分别由该同心圆区域的四个象限内的区域对应存储。
电子设备100将二进制字符串填充到目标版本的二维码的同心圆区域中的圆点形码元中,填充的方向可以是先填充最内部的同心圆区域,然后慢慢向外部的同心圆区域填充;也可以是先填充最外部的同心圆区域,然后慢慢向内部的同心圆区域填充;也可以是从左到右、从上到下等方向,本申请实施例对此不作限制。
如果遇到预留区域(例如预留格式信息的区域,预留版本信息的区域)和功能模块区域(例如定位符区域、校准模块区域、时间模块区域)时,不对该处码元进行填充,一直到下一个闲置码元才继续进行填充。
步骤S106、选择掩码模式,增加掩码信息。
掩码是指根据特定规则将二维码的编码区域内的码元的值改变的一种策略。采用掩码的目的是调整二维码内码元的展示效果(例如避免二维码内大面积空白或黑块,影响扫码识别),方便读码器尽可能更容易地读取信息。
掩码模式包括例如二维码中所有偶数同心圆区域被掩码处理;又例如,二维码中每个同心圆区域中的部分圆点形码元被掩码处理。电子设备100使用掩码模式对二维码信息进行掩码叠加处理,以调整二维码信息的布局,使得二维码信息中码元的分布更加均匀,从而使得生成的二维码更加美观。
具体的,使用掩码对二维码信息进行掩码叠加处理,可以通过将二维码信息的二进制字符串与掩码进行异或运算实现。
在一些实施例中,电子设备100将增加了掩码信息的二维码信息填充到编码区域,电子 设备100验证该目标版本是否满足待生成二维码的容量要求,若满足,添加版本信息。
步骤S107、根据绘制算法生成二维码。
本申请实施例中,电子设备100可以采用不可用区域空置的方式进行二维码的编码区域的编码,在完成二维码编码区域的编码得到二维码信息之后,电子设备100基于二维码信息,通过绘制算法将编码区域中的存储第一信息的圆点形码元绘制为第一颜色,将存储第二信息的圆点形码元绘制为第二颜色,完成编码区域的绘制。并且电子设备100将目标版本中对应的图像区域、定位符区域等区域进行填充,即可得到完整的二维码图片。其中,不可用区域包括二维码的目标版本中的图像区域、定位符区域,以及编码区域中的空白区域(如图5A中上半区域和下半区域之间的间隔为5的空白区域),等等。
在一些实施例中,电子设备100将满足预设条件的圆点形码元连接并绘制成圆弧形码元,其中预设条件包括,若在一个同心圆区域中存在连续两个以上的相邻圆点形码元均存储了第一信息,将该两个以上的相邻圆点形码元连接并绘制成一个圆弧形码元,该圆弧形码元绘制为第一颜色。可选的,该圆弧形码元中连接圆点形码元的部分也填充为第一颜色,可以增强二维码的美观性。同理若在一个同心圆区域中存在连续两个以上的相邻圆点形码元均存储了第二信息,将该两个以上的相邻圆点形码元连接并绘制成一个圆弧形码元,该圆弧形码元绘制为第二颜色。
下面对分别对上述六个版本的二维码,生成的二维码图像进行示例性的描述。
目标版本为版本一时,生成的示例性的二维码如图6A所示。图6A中包括4个同心圆区域,基于版本一,版本一中部分圆点形码元绘制为黑色,部分圆点形码元绘制为白色或者透明色或者不上色,并且连续相邻被绘制为黑色的圆点形码元连接并绘制为圆弧形码元。
目标版本为版本二时,生成的示例性的二维码如图6B所示。图6B中包括5个同心圆区域,基于版本二,版本二中部分圆点形码元被绘制为黑色,部分圆点形码元绘制为白色或者透明色或者不上色,并且连续相邻被绘制为黑色的圆点形码元连接并绘制为圆弧形码元。
目标版本为版本三时,生成的示例性的二维码如图6C所示。图6C中包括8个同心圆区域,基于版本三,版本三中部分圆点形码元被绘制为黑色,部分圆点形码元绘制为白色或者透明色或者不上色,并且连续相邻被绘制为黑色的圆点形码元连接并绘制为圆弧形码元。
目标版本为版本四时,生成的示例性的二维码如图6D所示。图6D中包括10个同心圆区域,基于版本四,版本四中部分圆点形码元被绘制为黑色,部分圆点形码元绘制为白色或者透明色或者不上色,并且连续相邻被绘制为黑色的圆点形码元连接并绘制为圆弧形码元。
目标版本为版本五时,生成的示例性的二维码如图6E所示。图6E中包括11个同心圆区域,基于版本五,版本五中部分圆点形码元被绘制为黑色,部分圆点形码元绘制为白色或者透明色或者不上色,并且连续相邻被绘制为黑色的圆点形码元连接并绘制为圆弧形码元。
目标版本为版本六时,生成的示例性的二维码如图6F所示。图6F中包括13个同心圆区域,基于版本六,版本六中部分圆点形码元被绘制为黑色,部分圆点形码元绘制为白色或者透明色或者不上色,并且连续相邻被绘制为黑色的圆点形码元连接并绘制为圆弧形码元。
本申请实施例提供了一种二维码的生成方法,电子设备100通过将待生成二维码的字符串进行比特化处理,得到对应的二进制字符串;根据二进制字符串的长度确定目标版本,将二进制字符串分配到目标版本的编码区域中的各个同心圆区域,得到二维码信息;使用掩码对二维码信息进行掩码叠加处理,以调整二维码信息的布局,最后绘制出最终的二维码。这 样,可以完成符合目标版本的二维码结构的二维码的编码,并且生成的二维码内的码元分布均匀,更加美观。
本申请实施例提供的二维码的版本为圆形二维码,编码区域由至少两个同心圆区域组成,码元包括圆点形码元和圆弧形码元。本申请实施例可以通过增加同心圆区域的圈数和码元的个数增加二维码的数据存储量。并且,电子设备100在编码过程中对字符串进行加密,解码则需要采用与加密算法对应的解密算法,才能获得完整的字符串,提高了二维码的安全性。
下面描述本申请实施例的二维码中圆点形码元的绘制方法,在上述步骤S107中,电子设备100基于二维码信息,通过绘制算法将编码区域中的存储第一信息的圆点形码元绘制为第一颜色。二维码信息中包括每个圆点形码元对应存储的信息,例如处于第一位置的圆点形码元存储第一信息,其中第一位置指示了圆点形码元的圆心坐标(cen_x,cen_y)和半径信息0.5h。电子设备100将该圆点形码元绘制为第一颜色,通过圆心坐标和半径信息即可确定出第一颜色的圆点形码元的位置和轮廓。其中绘制算法具体如下,
如图7A所示,规定水平向右为x正方向,竖直向下为y正方向。从上往下绘制,以y轴为变量,在每一个位置y,通过圆的解析方程确定该位置的x_left和x_right(左右边界的坐标)。电子设备100基于二维码信息,将存储第一信息的圆点形码元绘制为第一颜色。电子设备100获取到该圆点形码元的圆心坐标为(cen_x,cen_y),直径为h,则半径为0.5h。其中,
x_left可以基于左边圆弧的解析方程得出,即为:
Figure PCTCN2022073210-appb-000001
x_right可以基于右边圆弧的解析方程得出,即为:
Figure PCTCN2022073210-appb-000002
在一些实施例中,电子设备100将二维码的信息存储在3000bits的数组中,例如可以采用int32作为数据存储的基本单位,即采用32bit表示一个整数,将x_left和x_right对应到32bit整数中的对应位中,实现图像信息存储在bit流中。
如图7B所示,在数组的每一个32bit中,对应了一组x_left和x_right,将取在该32bit中x_left和x_right之外的点置零(如图7B中上白色的部分),将取在该32bit中x_left和x_right之间的点置非零(如图7B中上深色(第一颜色)的部分)。这样,在绘制圆点形码元时,每一组x_left和x_right即可以绘制出一行第一颜色的像素点,从上往下绘制,根据上述公式①和公式②,即可不断的得出x_left和x_right,从而绘制出完整的第一颜色的圆点形码元。
本申请实施例中,码元的绘制方向或顺序不作限制,例如还可以从左到右绘制,以x轴为变量,在每一个位置x,通过圆的解析方程确定该位置的y_left和y_right(上下边界的坐标)。又例如从里到外绘制(先绘制最内部的同心圆,再向外不断绘制同心圆)等等。
以上描述了关于圆点形码元的画法,下面描述本申请实施例中圆弧形码元的画法,圆弧形码元是在圆点形码元的基础上,将两个或两个以上的圆点形码元通过弧线进行连接,从而形成圆弧形码元。也即是说,每一个圆弧形码元都是由两个或两个以上的圆点形码元连接而成,本申请实施例中每一个圆弧形码元可以由两段弧线和两段线段围成,两段弧线分别属于一个大圆和一个小圆,该大圆和小圆为同心圆,该同心圆的圆心坐标为O1(org_x,org_y)。
如图8所示,图8中示例性的示出了两个圆弧形码元的结构,电子设备100将满足预设条件的圆点形码元连接并绘制成圆弧形码元,本申请实施例将形成一个圆弧形码元最左侧的 圆点形码元称为圆1,电子设备100基于二维码信息获取到圆1的圆心坐标为(cen_x1,cen_y1);最右侧的圆点形码元称为圆2,获取到圆2的圆心坐标为(cen_x2,cen_y2)。h表示圆1和圆2的外接正方形的高度(即为圆1和圆2的直径),圆1和圆2的圆心形成的圆弧所在的半径为radius。其中,radius可以通过计算圆1的圆心坐标(cen_x1,cen_y1)和O1(org_x,org_y)的距离得出。θ 1为圆1和大圆的圆心连线与x轴的夹角(θ 1的取值在0~π之间),θ 2为圆2和大圆的圆心连线与x轴的夹角(θ 2的取值在0~π之间)。
本申请实施例中,将圆1距离O1最远的点称为圆1顶点(x 1_up,y 1_up),将圆1距离O1最近的点称为圆1底点(x 1_down,y 1_down),同理圆2距离O1最远的点称为圆2顶点(x 2_up,y 2_up),圆2距离O1最近的点称为圆2底点(x 2_down,y 2_down)。
示例性的,通过计算即可得出圆1顶点和底点的坐标,即
Figure PCTCN2022073210-appb-000003
圆2同理,通过计算即可得出圆2顶点和底点的坐标,即
Figure PCTCN2022073210-appb-000004
在一些实施例中,规定水平向右为x正方向,竖直向下为y正方向。从上往下绘制,以y轴为变量,在每一个位置y,通过圆的解析方程确定该位置的x_left和x_right(左右边界的坐标)。圆弧绘制的方向为从上到下,因此需要考虑左右边界不同的解析方程。由于圆弧位置的不同,圆弧在中心线左上侧、左下侧、右上侧、右下侧具有不同的分段解析方程,具体分为如下八种情况:
情况一:如图9A所示,圆弧在中心线左上侧,在y轴正方向,圆2顶点<圆2底点<圆1顶点<圆1底点,即y 2_up<y 2_down<y 1_up<y 1_down
当y的取值在【圆2顶点,圆2底点】这个区间内时,左边是大圆圆弧,右边是圆2斜线。其中,x_left可以基于左边大圆弧解析方程得出,即:
Figure PCTCN2022073210-appb-000005
x_right可以基于右边圆2斜线解析方程得出,即:
y len=(y-y 2_up)/sin(θ 2)
x_right=org x-(radius+0.5h-y len)*cos(θ 2)公式④
当y的取值在【圆2底点,圆1顶点】这个区间内时,左边是大圆圆弧,右边是小圆圆弧。其中,x_left可以基于左侧大圆弧解析方程(同公式③)得出,即:
Figure PCTCN2022073210-appb-000006
x_right可以基于右侧小圆弧解析方程得出,即;
Figure PCTCN2022073210-appb-000007
当y的取值在【圆1顶点,圆1底点】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左侧圆1斜线解析方程得出,即:
y len=(y-y 1_up)/sin(θ 1)
x_left=org x-(radius+0.5h-y len)*cos(θ 1)公式⑥
x_right可以基于右侧小圆弧解析方程(同公式⑤)得出,即:
Figure PCTCN2022073210-appb-000008
在本申请实施例中,基于上述公式③④⑤⑥,电子设备100即可绘制出如图9A所示的圆弧。电子设备100基于二维码信息,确定满足预设条件的圆点形码元连接为圆弧形码元, 进而确定一个圆弧形码元中两端的圆点形码元(圆1和圆2),获取圆1和圆2的圆心坐标点,然后确定圆1和圆2的顶点和底点的y轴坐标点,若在y轴方向上圆2顶点<圆2底点<圆1顶点<圆1底点,则确定属于情况一,则基于情况一的解析方程确定x_left和x_right,从而绘制圆弧。
电子设备100将x_left和x_right对应到32bit整数中的对应位中,将取在该32bit中x_left和x_right之外的点置零,将取在该32bit中x_left和x_right之间的点置非零。这样,在绘制圆弧形码元时,每一组x_left和x_right即可以绘制出一行像素点,从上往下绘制,根据上述公式③④⑤⑥,即可不断的得出x_left和x_right,从而绘制出完整的圆弧形码元。
情况二:如图9B所示,圆弧在中心线左上侧,在y轴方向,圆2顶点<圆1顶点<圆2底点<圆1底点,即y 2_up<y 1_up<y 2_down<y 1_down
当y的取值在【圆2顶点,圆1顶点】这个区间内时,左边是大圆圆弧,右边是圆2斜线。其中,x_left可以基于左边大圆弧解析方程得出,参考公式③;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆1顶点,圆2底点】这个区间内时,左边是圆1斜线,右边是圆2斜线。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆1顶点,圆1底点】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
情况三:如图9C所示,圆弧在中心线左下侧,在y轴方向,圆1底点<圆1顶点<圆2底点<圆2顶点,即y 1_down<y 1_up<y 2_down<y 2_up
当y的取值在【圆1底点,圆1顶点】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
当y的取值在【圆1顶点,圆2底点】这个区间内时,左边是大圆圆弧,右边是小圆圆弧。其中,x_left可以基于左边大圆弧解析方程得出,参考公式③;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
当y的取值在【圆2底点,圆2顶点】这个区间内时,左边是大圆圆弧,右边是圆2斜线。其中,x_left可以基于左边大圆弧解析方程得出,参考公式③;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况四:如图9D所示,圆弧在中心线左下侧,在y轴方向,圆1底点<圆2底点<圆1顶点<圆2顶点,即y 1_down<y 2_down<y 1_up<y 2_up
当y的取值在【圆1底点,圆2底点】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
当y的取值在【圆2底点,圆1顶点】这个区间内时,左边是圆1斜线,右边是圆2斜线。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆1顶点,圆2顶点】这个区间内时,左边是大圆圆弧,右边是圆2斜线。其中,x_left可以基于左边大圆弧解析方程得出,参考公式③;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况五:如图9E所示,圆弧在中心线右下侧,在y轴方向,圆2底点<圆1底点<圆2顶点<圆1顶点,即y 2_down<y 1_down<y 2_up<y 1_up
当y的取值在【圆2底点,圆1底点】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆1底点,圆2顶点】这个区间内时,左边是圆1斜线,右边是圆2斜线。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆2顶点,圆1顶点】这个区间内时,左边是圆1斜线,右边是大圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边大圆弧解析方程得出,参考公式③。
情况六:如图9F所示,圆弧在中心线右下侧,在y轴方向,圆2底点<圆2顶点<圆1底点<圆1顶点,即y 1_down<y 2_down<y 1_up<y 2_up
当y的取值在【圆2底点,圆2顶点】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆2顶点,圆1底点】这个区间内时,左边是小圆圆弧,右边是大圆圆弧。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边大圆弧解析方程得出,参考公式③。
当y的取值在【圆1顶点,圆2顶点】这个区间内时,左边是圆1斜线,右边是大圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边大圆弧解析方程得出,参考公式③。
情况七:如图9G所示,圆弧在中心线右上侧,在y轴方向,圆1顶点<圆1底点<圆2顶点<圆2底点,即y 1_up<y 1_down<y 2_up<y 2_down
当y的取值在【圆1顶点,圆1底点】这个区间内时,左边是圆1斜线,右边是大圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边大圆弧解析方程得出,参考公式③。
当y的取值在【圆1底点,圆2顶点】这个区间内时,左边是小圆圆弧,右边是大圆圆弧。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边大圆弧解析方程得出,参考公式③。
当y的取值在【圆2顶点,圆2底点】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况八:如图9H所示,圆弧在中心线右上侧,在y轴方向,圆1顶点<圆2顶点<圆1底点<圆2底点,即y 1_up<y 2_up<y 1_down<y 2_down
当y的取值在【圆1顶点,圆2顶点】这个区间内时,左边是圆1斜线,右边是大圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边大圆弧解析方程得出,参考公式③。
当y的取值在【圆2顶点,圆1底点】这个区间内时,左边是圆1斜线,右边是圆2斜线。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
当y的取值在【圆1底点,圆2底点】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
上述列举出了八种不同位置的圆弧形码元的绘制方式。
在一些实施例中,圆弧形码元可能穿过中心线(过O1点且垂直y轴方向的直线),出现圆弧形码元分布在第二象限和第三象限的情况,或者分布在第一象限和第四象限的情况,这些情况下,可对应上述情况一至情况八中的其中一种。
在一些实施例中,圆弧形码元可能穿过中线(过O1点且垂直x轴方向的直线),出现圆弧形码元在中线两侧的情况,即圆弧形码元分布在第一象限和第二象限的情况,或者分布在第三象限和第四象限的情况,此时从上向下的解析方程可能完全不同,为了避免生成二维码的复杂性,本申请实施例以中线为边界,将一个圆弧形码元分为两个,先画中线左边的圆弧形码元,再画中线右边的圆弧形码元,转化为圆弧形码元在中线同侧的情况。
在一些实施例中,判断一段圆弧形码元是否穿过中线的方式可以是,若该圆弧形码元中圆1的圆心横坐标和圆2的圆心横坐标之间包括大圆的圆心横坐标,即满足圆1的圆心横坐标<org_y<圆2的圆心横坐标,则判断该圆弧穿过中线。
下面详细说明圆弧穿过中线的如下八种情况:
情况九:如图10A所示,圆弧涉及到中线的左上侧和右上侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,(org_y+radius+0.5h)<(org_y+radius-0.5h)<圆1顶点<圆1底点,即(org_y+radius+0.5h)<(org_y+radius-0.5h)<y 1_up<y 1_down
第一部分,当y的取值在【(org_y+radius+0.5h),(org_y+radius-0.5h)】这个区间内时的曲线为大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第二部分,当y的取值在【(org_y+radius-0.5h),y 1_up】这个区间内时,左边是大圆圆弧,右边是小圆圆弧,其中,x_left可以基于左边大圆弧解析方程得出,参考公式③;x_right可以基于右边小圆弧识别方程得出,参考公式⑤。
第三部分,当y的取值在【y 1_up,y 1_down】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
针对右圆弧部分,在y轴方向,(org_y+radius+0.5h)<圆2顶点<(org_y+radius-0.5h)<圆2底点,即(org_y+radius+0.5h)<y 2_up<(org_y+radius-0.5h)<y 2_down
第四部分,当y的取值在【(org_y+radius+0.5h),y 2_up】这个区间内时的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
第五部分,当y的取值在【y 2_up,(org_y+radius-0.5h)】这个区间内时的曲线为圆2斜线,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于圆2斜线解析方 程得出,参考公式④。
第六部分,当y的取值在【(org_y+radius-0.5h),y 2_down】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况十:如图10B所示,圆弧涉及到中线的左上侧和右上侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,(org_y+radius+0.5h)<(org_y+radius-0.5h)<圆1顶点<圆1底点,即(org_y+radius+0.5h)<(org_y+radius-0.5h)<y 1_up<y 1_down
第一部分,当y的取值在【(org_y+radius+0.5h),(org_y+radius-0.5h)】这个区间内时的曲线为大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第二部分,当y的取值在【(org_y+radius-0.5h),y 1_up】这个区间内时,左边是大圆圆弧,右边是小圆圆弧,其中,x_left可以基于左边大圆弧解析方程得出,参考公式③,x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
第三部分,当y的取值在【y 1_up,y 1_down】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
针对右圆弧部分,在y轴方向,(org_y+radius+0.5h)<(org_y+radius-0.5h)<圆2顶点<圆2底点,即(org_y+radius+0.5h)<(org_y+radius-0.5h)<y 2_up<y 2_down
第四部分,当y的取值在【(org_y+radius+0.5h),(org_y+radius-0.5h)】这个区间内时的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
第五部分,当y的取值在【(org_y+radius-0.5h),y 2_up】这个区间内时,左边是小圆圆弧,右边是大圆圆弧。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边大圆弧解析方程得出,参考公式③。
第六部分,当y的取值在【y 2_up,y 2_down】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况十一:如图10C所示,圆弧涉及到中线的左上侧和右上侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,(org_y+radius+0.5h)<圆1顶点<(org_y+radius-0.5h)<圆1底点,即(org_y+radius+0.5h)<y 1_up<(org_y+radius-0.5h)<y 1_down
第一部分,当y的取值在【(org_y+radius+0.5h),y 1_up】这个区间内时的曲线为大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第二部分,当y的取值在【y 1_up,(org_y+radius-0.5h)】这个区间内时的曲线为圆1斜线,x_left可以基于圆1斜线解析方程得出,参考公式⑥;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第三部分,当y的取值在【(org_y+radius-0.5h),y 1_down】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
针对右圆弧部分,在y轴方向,(org_y+radius+0.5h)<圆2顶点<(org_y+radius-0.5h)<圆2底点,即(org_y+radius+0.5h)<y 2_up<(org_y+radius-0.5h)<y 2_down
第四部分,当y的取值在【(org_y+radius+0.5h),y 2_up】这个区间内时的曲线为大圆 圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
第五部分,当y的取值在【y 2_up,(org_y+radius-0.5h)】这个区间内时的曲线为圆2斜线,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于圆2斜线解析方程得出,参考公式④。
第六部分,当y的取值在【(org_y+radius-0.5h),y 2_down】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况十二:如图10D所示,圆弧涉及到中线的左上侧和右上侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,(org_y+radius+0.5h)<圆1顶点<(org_y+radius-0.5h)<圆1底点,即(org_y+radius+0.5h)<y 1_up<(org_y+radius-0.5h)<y 1_down
第一部分,当y的取值在【(org_y+radius+0.5h),y 1_up】这个区间内时的曲线为大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第二部分,当y的取值在【y 1_up,(org_y+radius-0.5h)】这个区间内时的曲线为圆1斜线,x_left可以基于圆1斜线解析方程得出,参考公式⑥;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第三部分,当y的取值在【(org_y+radius-0.5h),y 1_down】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
针对右圆弧部分,在y轴方向,(org_y+radius+0.5h)<(org_y+radius-0.5h)<圆2顶点<圆2底点,即(org_y+radius+0.5h)<(org_y+radius-0.5h)<y 2_up<y 2_down
第四部分,当y的取值在【(org_y+radius+0.5h),(org_y+radius-0.5h)】这个区间内时的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
第五部分,当y的取值在【(org_y+radius-0.5h),y 2_up】这个区间内时,左边是小圆圆弧,右边是大圆圆弧。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边大圆弧解析方程得出,参考公式③。
第六部分,当y的取值在【y 2_up,y 2_down】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
情况十三:如图10E所示,圆弧涉及到中线的左下侧和右下侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,圆1底点<(org_y-radius+0.5h)<圆1顶点<(org_y-radius-0.5h),即y 1_down<(org_y-radius+0.5h)<y 1_up<(org_y-radius-0.5h)。
第一部分,当y的取值在【y 1_down,(org_y-radius+0.5h)】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于圆1斜线解析方程得出,参考公式⑥,x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
第二部分,当y的取值在【(org_y-radius+0.5h),y 1_up】这个区间内时的曲线是圆1斜线,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第三部分,当y的取值在【y 1_up,(org_y-radius-0.5h)】这个区间内时的曲线是大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1 的横坐标org_x。
针对右圆弧部分,在y轴方向,圆2底点<圆2顶点<(org_y-radius+0.5h)<(org_y-radius-0.5h),即y 2_down<y 2_up<(org_y-radius+0.5h)<(org_y-radius-0.5h)。
第四部分,当y的取值在【(y 2_down,y 2_up】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于圆2斜线解析方程得出,参考公式④。
第五部分,当y的取值在【y 2_up,(org_y-radius+0.5h)】这个区间内时,左边是小圆圆弧,右边是大圆圆弧,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边大圆弧解析方程得出,参考公式③。
第六部分,当y的取值在【(org_y-radius+0.5h),(org_y-radius-0.5h)】这个区间内的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
情况十四:如图10F所示,圆弧涉及到中线的左下侧和右下侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,圆1底点<(org_y-radius+0.5h)<圆1顶点<(org_y-radius-0.5h),即y 1_down<(org_y-radius+0.5h)<y 1_up<(org_y-radius-0.5h)。
第一部分,当y的取值在【y 1_down,(org_y-radius+0.5h)】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于圆1斜线解析方程得出,参考公式⑥,x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
第二部分,当y的取值在【(org_y-radius+0.5h),y 1_up】这个区间内时的曲线是圆1斜线,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
第三部分,当y的取值在【y 1_up,(org_y-radius-0.5h)】这个区间内时的曲线是大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
针对右圆弧部分,在y轴方向,圆2底点<(org_y-radius+0.5h)<圆2顶点<(org_y-radius-0.5h),即y 2_down<(org_y-radius+0.5h)<y 2_up<(org_y-radius-0.5h)。
第四部分,当y的取值在【y 2_down,(org_y-radius+0.5h)】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
第五部分,当y的取值在【(org_y-radius+0.5h),y 2_up】这个区间内的曲线是圆2斜线,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于圆2斜线解析方程得出,参考公式④。
第六部分,当y的取值在【y 2_up,(org_y-radius-0.5h)】这个区间内的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
情况十五:如图10G所示,圆弧涉及到中线的左下侧和右下侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,圆1底点<圆1顶点<(org_y-radius+0.5h)<(org_y-radius-0.5h),即y 1_down<y 1_up<(org_y-radius+0.5h)<(org_y-radius-0.5h)。
第一部分,当y的取值在【y 1_down,y 1_up】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
第二部分,当y的取值在【y 1_up,(org_y-radius+0.5h)】这个区间内时,左边是大圆 圆弧,右边是小圆圆弧。其中,x_left可以基于左边大圆弧解析方程得出;x_right可以基于参考公式③,右边小圆弧解析方程得出,参考公式⑤。
第三部分,当y的取值在【(org_y-radius+0.5h),(org_y-radius-0.5h)】这个区间内时的曲线是大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
针对右圆弧部分,在y轴方向,圆2底点<(org_y-radius+0.5h)<圆2顶点<(org_y-radius-0.5h),即y 2_down<(org_y-radius+0.5h)<y 2_up<(org_y-radius-0.5h)。
第四部分,当y的取值在【(y 2_down,y 2_up】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于圆2斜线解析方程得出,参考公式④。
第五部分,当y的取值在【y 2_up,(org_y-radius+0.5h)】这个区间内时,左边是小圆圆弧,右边是大圆圆弧,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边大圆弧解析方程得出,参考公式③。
第六部分,当y的取值在【(org_y-radius+0.5h),(org_y-radius-0.5h)】这个区间内的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
情况十六:如图10H所示,圆弧涉及到中线的左下侧和右下侧,中线将一段圆弧划分为左右两段圆弧部分。
针对左圆弧部分,在y轴方向,圆1底点<圆1顶点<(org_y-radius+0.5h)<(org_y-radius-0.5h),即y 1_down<y 1_up<(org_y-radius+0.5h)<(org_y-radius-0.5h)。
第一部分,当y的取值在【y 1_down,y 1_up】这个区间内时,左边是圆1斜线,右边是小圆圆弧。其中,x_left可以基于左边圆1斜线解析方程得出,参考公式⑥;x_right可以基于右边小圆弧解析方程得出,参考公式⑤。
第二部分,当y的取值在【y 1_up,(org_y-radius+0.5h)】这个区间内时,左边是大圆圆弧,右边是小圆圆弧。其中,x_left可以基于左边大圆弧解析方程得出;x_right可以基于参考公式③,右边小圆弧解析方程得出,参考公式⑤。
第三部分,当y的取值在【(org_y-radius+0.5h),(org_y-radius-0.5h)】这个区间内时的曲线是大圆圆弧,x_left可以基于大圆弧解析方程得出,参考公式③;x_right为大圆的圆心横坐标,即O1的横坐标org_x。
针对右圆弧部分,在y轴方向,圆2底点<(org_y-radius+0.5h)<圆2顶点<(org_y-radius-0.5h),即y 2_down<(org_y-radius+0.5h)<y 2_up<(org_y-radius-0.5h)。
第四部分,当y的取值在【y 2_down,(org_y-radius+0.5h)】这个区间内时,左边是小圆圆弧,右边是圆2斜线。其中,x_left可以基于左边小圆弧解析方程得出,参考公式⑤;x_right可以基于右边圆2斜线解析方程得出,参考公式④。
第五部分,当y的取值在【(org_y-radius+0.5h),y 2_up】这个区间内的曲线是圆2斜线,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于圆2斜线解析方程得出,参考公式④。
第六部分,当y的取值在【y 2_up,(org_y-radius-0.5h)】这个区间内的曲线为大圆圆弧,x_left为大圆的圆心横坐标,即O1的横坐标org_x;x_right可以基于大圆弧解析方程得出,参考公式③。
对于上述十六种情况,电子设备100即可绘制出任意形态的圆弧。电子设备100获取圆1和圆2的圆心坐标点,然后确定圆1和圆2的顶点和底点的y轴坐标点,电子设备判断在y轴方向上的圆2顶点、圆2底点、圆1顶点、圆1底点的大小,则可以确定属于上述十六种情况中的哪一种情况,然后基于对应的情况下的解析方程绘制圆弧。
将x_left和x_right对应到32bit整数中的对应位中,将取在该32bit中x_left和x_right之外的点置零,将取在该32bit中x_left和x_right之间的点置非零。这样,在绘制圆弧形码元时,每一组x_left和x_right即可以绘制出一行像素点,从上往下绘制,根据对应情况中的公式,即可不断的得出x_left和x_right,从而绘制出完整的圆弧形码元。
本申请实施例中生成二维码和识别二维码均采用32位bit流的方式,能够提升二维码的编解码速度。
以上描述了本申请实施例中二维码的生成步骤以及绘制方法,针对于生成的二维码图片,本申请实施例还提供了对应的二维码识别方法,如图11所示,该方法具体步骤如下:
步骤S201、电子设备100获取待识别图片。
该待识别图片中包括待识别二维码。
在一些实施例中,电子设备100获取到待识别图片后,对该待识别图片进行对比度调节、灰度化处理、二值化处理、平滑处理等操作,以便于后续的二维码识别。
步骤S202、电子设备100确定待识别图片中的定位符的位置。
电子设备100获取到待识别图片,在对待识别图片中的二维码进行识别时,根据定位符的特征,在待识别图片中查找定位符,确定输入图片中的定位符的位置。
在一些实施例中,定位符包括三个定位符和一个辅助定位符,分布在二维码的左上方、右上方、左下方、右下方。电子设备100根据三个定位符的特征,在输入图片中查找三个定位符,确定输入图片中的三个定位符的位置。采用多种结合方式,结合三个定位符的位置定位,实现二维码的准确、快速地定位。
定位符的图案一般是具有固定比例的图案(如图3C所示,定位符的图案为黑白相间的同心圆形图案,主定位符黑白码元的比例为1:1:2:1:1,辅助定位符黑白码元的比例为1:1:2:1:1),在扫描二维码的过程中,一般会先基于该固定比例搜寻二维码的定位图案,从而确定二维码的方向。
示例性地,当确定了一个辅助定位符的位置后,电子设备100可以结合主定位符和辅助定位符之间的相对位置关系,快速地定位主定位符的位置,可以提高二维码定位的效率。
示例性地,可以分别定位三个主定位符和一个辅助定位符的位置,根据定位的主定位符和辅助定位的位置,结合二维码结构中主定位符和辅助定位符的相对位置关系,进行二维码编码区域的位置校准,可以提高二维码定位的准确性。
步骤S203、电子设备100基于定位符的位置识别出待识别图片中的二维码图片,并识别二维码图片中的版本信息,确定待识别二维码的目标版本。
电子设备100确定待识别二维码的目标版本后,可以得到该目标版本中每个存储位置的(圆点形)的圆心坐标和半径信息、图像区域的圆心坐标和半径信息、定位符的相关坐标信息等等。
在一些实施例中,电子设备100基于定位符的位置可以确定待识别图片中的二维码的顶点位置,然后基于该顶点位置对二维码进行校正,例如电子设备100对二维码图片进行透视变换,用于获得非倾斜的二维码图像。由于拍摄角度的问题,多数情况下获取的二维码图片中的二维码是产生了线性形变的,电子设备100通过检测二维码的四个角点,根据反透视变换求出校正图形,即非倾斜的二维码图像。
步骤S204、通过目标版本中每个存储位置的坐标信息,对该待识别二维码中的码元进行识别,实现解码。
目标版本中每个存储位置的坐标信息包括存储位置的圆心坐标和半径信息,其中目标版本还可以指示图像区域的圆心坐标和半径信息、定位符的相关坐标信息等等。
电子设备100获取到目标版本中每个存储位置的坐标信息包括存储位置的圆心坐标和半径信息,然后基于非倾斜的二维码图像,对该二维码图像(待识别二维码)中的码元进行识别。
在一些实施例中,电子设备100基于每个存储位置的坐标信息,在二维码图像中识别每个存储位置上对应存储的值,可选的,该待识别的二维码的编码区域中的有码元占据的存储位置对应的值为第一值,没有码元占据的存储位置对应的值为第二值。举例来说,电子设备100获取到有100个存储位置的圆心坐标和半径,电子设备100基于圆心坐标和半径在二维码图像中扫描这100个存储位置,有码元占据的存储位置对应的值为1,没有码元占据的存储位置对应的值为0,则可以识别出一串二进制字符串,电子设备100基于该二进制字符串进行解码,获取该二维码对应的信息。
在一些实施例中,电子设备100识别出二维码图像中的圆点形码元,确定每个圆点形码元的位置以及每个圆点形码元对应的值为第一值,电子设备100基于该二维码图像的目标版本中指示的存储位置的坐标信息,确定出没有码元占据的存储位置对应的值为第二值。举例来说,电子设备100对二维码图像进行识别,识别出有60个位置(包括圆心坐标和半径)有码元,对应的值为1;电子设备100将该60个位置对应到二维码的目标版本中的例如100个存储位置上,则其余40个为存储位置对应的值为0。电子设备100识别出一串二进制字符串,电子设备100基于该二进制字符串进行解码,获取该二维码对应的信息。
在一些实施例中,电子设备100识别出二维码图像中的圆点形码元,确定第一颜色的圆点形码元的位置以及对应的值为第一值,确定出第二颜色的圆点形码元的位置以及对应的值为第二值。可选的,电子设备100对二维码图像进行识别,识别出有60个位置(包括圆心坐标和半径)的码元为第一颜色,对应的值为1,还有40个位置的码元为第二颜色,对应的值为0;则电子设备100识别出一串二进制字符串,电子设备100基于该二进制字符串进行解码,获取该二维码对应的信息。
在一些实施例中,电子设备100识别出二维码图像中的圆弧形码元,基于圆弧形码元的长度可以确定出该圆弧形码元是由几个圆点形码元组成的,以及可以确定出每个圆点形码元的圆心坐标。电子设备100确定每个圆点形码元的位置以及每个圆点形码元对应的值为第一值,电子设备100基于该二维码图像的目标版本中指示的存储位置的坐标信息,确定出没有码元占据的存储位置对应的值为第二值。
以上描述了本申请实施例中二维码的识别步骤,本申请实施例提供了一种二维码的识别方法,电子设备100对待识别图片进行数字图像处理,通过确定待识别图片中的定位符的位置,确定二维码图片,识别出二维码的目标版本后,基于目标版本的位置坐标获得编码信息,通过解码规则实现解码。这样,完成了目标版本的二维码结构的二维码的解码,本申请实施例中识别二维码采用32位bit流的方式,能够提升二维码的解码速度。
本申请实施例还提供了其他版本的二维码。示例性的如图12A和图12B所示,图12A和 图12B示出了两种可能的二维码的版本。
如图12A所示的二维码版本,二维码整体为圆形,包括位于中部的图像区域和围绕图像区域的编码区域。其中,二维码的编码区域包括由二维码的码元聚集而成的至少两个同心圆,码元包括圆点形码元。在同一个同心圆区域中的圆点形码元的半径相同,不同的同心圆区域中的圆点形码元的半径不同,其中,最内部的同心圆区域中的圆点形码元的半径最小,越在外部的同心圆区域,其中的圆点形码元的半径越大。
示例性的,图12A中还包括3个主定位符和3个辅助定位符,3个主定位符和1个辅助定位符均为圆形区域。主定位符和辅助定位符的数量和样式本申请实施例不做限制。
在图12A中,二维码的编码区域包括5个同心圆区域。本申请实施例中,编码区域包括的同心圆区域的数量可以根据二维码数据量的大小进行调整,通过扩展编码区域的同心圆区域的数量,可以扩展二维码的信息容量。
如图12B所示的二维码版本,二维码整体为圆形,包括位于中部的图像区域和围绕图像区域的编码区域。其中,二维码的编码区域包括由二维码的码元聚集而成的至少两个同心圆,码元包括圆点形码元。每个圆点形码元的半径相同。与图3A中不同的是,如图12B所示的二维码版本中不包括圆弧形码元。
示例性的,图12B中还包括3个主定位符和3个辅助定位符,3个主定位符和1个辅助定位符均为圆形区域。主定位符和辅助定位符的数量和样式本申请实施例不做限制。
在图12B中,二维码的编码区域包括4个同心圆区域。本申请实施例中,编码区域包括的同心圆区域的数量可以根据二维码数据量的大小进行调整,通过扩展编码区域的同心圆区域的数量,可以扩展二维码的信息容量。
本申请实施例通过使用新型的二维码结构,二维码为圆形,二维码包括位于中部的图像区域和围绕图像区域的编码区域,编码区域包括由二维码的码元聚集而成的至少两个同心圆区域,码元包括圆点形码元和圆弧形码元,通过扩展编码区域的同心圆区域的数量,可以快速扩展二维码的信息容量;进一步地,二维码的除图像区域之外的区域还包括主定位符和辅助定位符,进行二维码识别时,结合对输入图片中的主定位符和辅助定位符的定位,可以实现多种方式相结合的定位,实现准确快速地定位二维码,从而可以提高二维码识别的准确性和效率。
本申请实施例还提供了一种计算机可读存储介质。上述方法实施例中的全部或者部分流程可以由计算机程序来指令相关的硬件完成,该程序可存储于上述计算机存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。该计算机可读存储介质包括:只读存储器(read-only memory,ROM)或随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可存储程序代码的介质。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进 行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。
本申请实施例方法中的步骤可以根据实际需要进行顺序调整、合并和删减。
本申请实施例装置中的模块可以根据实际需要进行合并、划分和删减。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (27)

  1. 二维码识别方法,其特征在于,所述二维码包括位于中部的图像区域和围绕所述图像区域的圆环区域,所述圆环区域包括编码区域、第一间隔区域和第二间隔区域,所述编码区域中包括多个码元,所述编码区域包括第一编码区域和第二编码区域,所述第一编码区域和所述第二编码区域之间设置有所述第一间隔区域和所述第二间隔区域;
    所述方法包括:
    所述电子设备获取待识别的二维码,确定所述待识别的二维码的编码区域中多个码元对应的取值;
    所述电子设备根据所述编码区域中的多个码元对应的取值,识别所述待识别的二维码对应的第一信息。
  2. 根据权利要求1所述的方法,其特征在于,所述第一间隔区域和所述第二间隔区域为宽度相同的部分圆环。
  3. 根据权利要求1所述的方法,其特征在于,所述第一编码区域和所述第二编码区域所占面积相同。
  4. 根据权利要求1所述的方法,其特征在于,所述图像区域在水平方向上的宽度和所述二维码在水平方向上的宽度的比例为1:3。
  5. 根据权利要求1所述的方法,其特征在于,所述编码区域中的多个码元分布在至少两个同心圆上,所述至少两个同心圆的圆心为所述二维码的中心,其中所述码元中包括圆点形码元。
  6. 根据权利要求5所述的方法,其特征在于,在所述编码区域的同一个同心圆上相邻所述圆点形码元的圆心之间的圆弧距离为(2r+b)*k,k为正整数,r为所述圆点形码元的半径,b为固定值;所述同一个同心圆的周长为N*(2r+b),N为大于k的正整数。
  7. 根据权利要求6所述的方法,其特征在于,在所述编码区域的同一个同心圆中,连续三个圆点形码元的圆心之间的圆弧距离大于(2r+b)*2。
  8. 根据权利要求5所述的方法,其特征在于,在所述二维码的两个不同的同心圆上分别存在圆点形码元a、b,所述圆点形码元a和所述圆点形码元b的圆心的连线穿过所述二维码的中心。
  9. 根据权利要求5所述的方法,其特征在于,所述二维码中不同同心圆上的圆点形码元的半径不同。
  10. 根据权利要求9所述的方法,其特征在于,所述二维码中外部的同心圆中圆点形码元的半径大于内部的同心圆中圆点形码元的半径。
  11. 根据权利要求5所述的方法,其特征在于,所述码元中还包括圆弧形码元,所述圆弧形码元在同心圆上的圆弧长度为(2r+b)*M,M为正整数。
  12. 根据权利要求11所述的方法,其特征在于,在同一个同心圆上,一个圆弧形码元和其相邻码元之间的圆弧距离大于或等于(2r+b)*2。
  13. 根据权利要求1所述的方法,其特征在于,所述电子设备获取待识别的二维码,确定所述待识别的二维码的编码区域中多个码元对应的取值,并识别所述待识别的二维码对应的第一信息包括:
    所述电子设备获取待识别的二维码;
    所述电子设备确定所述待识别的二维码的目标版本,所述目标版本指示了所述待识别的二维码的编码区域中每个存储位置的坐标信息;
    所述电子设备基于所述每个存储位置的坐标信息,确定所述待识别的二维码的编码区域中的多个码元中每个码元占据的存储位置对应为第一值;
    根据所述第一值识别所述待识别的二维码对应的第一信息。
  14. 根据权利要求13所述的方法,其特征在于,所述每个存储位置为圆点形,所述坐标信息包括所述存储位置的圆心坐标信息和半径信息。
  15. 根据权利要求13所述的方法,其特征在于,所述电子设备确定所述待识别的二维码的目标版本,之前包括:
    所述电子设备确定待识别图像中的定位符的位置;
    所述电子设备基于所述定位符的位置确定所述待识别图像中的二维码的顶点位置;
    所述电子设备基于所述顶点位置对所述待识别图像中的二维码进行校正,以获取待识别的二维码。
  16. 根据权利要求1-15任一项所述的方法,其特征在于,所述第一信息的类型包括以下中的一项或多项:字符、文字、图片、音频、视频、链接地址。
  17. 一种二维码生成方法,其特征在于,所述方法包括:
    电子设备获取第一信息;
    所述电子设备基于所述第一信息生成二维码,所述二维码指示了所述第一信息;
    所述二维码包括位于中部的图像区域和围绕所述图像区域的圆环区域,所述圆环区域包括编码区域、第一间隔区域和第二间隔区域,所述编码区域中包括多个码元,所述编码区域包括第一编码区域和第二编码区域,所述第一编码区域和所述第二编码区域之间设置有所述第一间隔区域和所述第二间隔区域。
  18. 根据权利要求17所述的方法,其特征在于,所述编码区域中的多个码元分布在至少两个同心圆上,所述至少两个同心圆的圆心为所述二维码的中心,其中所述多个码元中包括圆点形码元。
  19. 根据权利要求18所述的方法,其特征在于,所述电子设备基于所述第一信息生成二维码包括:
    所述电子设备将所述第一信息编码为二进制字符串;
    所述电子设备根据所述二进制字符串的长度确定所述待生成二维码的目标版本,所述目标版本指示了编码区域中每个存储位置的坐标信息;
    所述电子设备根据所述每个存储位置的坐标信息,将所述二进制字符串分配到编码区域的存储位置中;其中,所述存储位置包括第一存储位置及第二存储位置,所述第一存储位置存储所述二进制字符串中的第一值和所述第二存储位置存储所述二进制字符串中的第二值;
    所述电子设备基于所述第一存储位置的坐标信息绘制第一码元,基于第一码元生成二维码;所述第一码元为所述二维码的编码区域的多个码元中的一个码元。
  20. 根据权利要求19所述的方法,其特征在于,所述存储位置的坐标信息包括所述存储位置的圆心坐标信息和半径信息;所述第一码元为圆点形码元,所述圆点形码元是基于所述第一存储位置的圆心坐标信息和半径信息绘制的。
  21. 根据权利要求19所述的方法,其特征在于,不同的目标版本中编码区域的同心圆的数量不同。
  22. 根据权利要求19所述的方法,其特征在于,所述电子设备基于所述第一存储位置的坐标信息,在所述第一存储位置上绘制第一码元,包括:
    所述电子设备通过所述第一存储位置的圆心坐标信息和半径信息确定所述第一码元在Y轴上的取值范围,所述第一码元在Y轴上的取值范围的最小值为所述圆心坐标信息中的圆心纵坐标减去半径,所述取值范围的最大值为所述圆心坐标信息中的圆心纵坐标加上半径;
    所述电子设备在所述取值范围内的每一个Y值通过预设公式确定一个左端的X值和一个右端的X值,并将所述一个左端的X值和所述一个右端的X值之间的像素点绘制为第一颜色,完成所述第一码元的绘制,所述第一码元的所有像素点为所述第一颜色。
  23. 根据权利要求19所述的方法,其特征在于,所述方法还包括:
    所述第一码元还包括圆弧形码元,所述圆弧形码元占据了至少两个相邻的第一存储位置,所述至少两个相邻的第一存储位置位于同一个同心圆上。
  24. 根据权利要求23所述的方法,其特征在于,所述第一码元占据了至少两个存储位置,其中所述至少两个存储位置的左右两端的存储位置为第三存储位置和第四存储位置;所述第三存储位置和所述第四存储位置的圆心点均在所述二维码的中线的同一侧,所述二维码的中线为经过所述二维码的中心点且垂直于X轴的直线;
    所述电子设备基于所述第一存储位置的坐标信息绘制第一码元,包括:
    所述电子设备通过所述第三存储位置和所述第四存储位置的圆心坐标信息和半径信息确定所述第一码元在Y轴上的取值范围,当所述第三存储位置的圆心纵坐标大于所述第四存储位置的圆心纵坐标,所述第一码元在Y轴上的取值范围的最小值为所述第三存储位置上距离所述二维码的中心最短的点的纵坐标,所述第一码元在Y轴上的取值范围的最大值为所述第 四存储位置上距离所述二维码的中心最长的点的纵坐标;
    所述电子设备在所述取值范围内的每一个Y值通过预设公式确定一个左端的X值和一个右端的X值,并将所述一个左端的X值和所述一个右端的X值之间的像素点绘制为所述第一颜色,完成所述第一码元的绘制,所述第一码元的所有像素点为所述第一颜色。
  25. 根据权利要求23所述的方法,其特征在于,所述第一码元占据了至少两个存储位置,其中所述至少两个存储位置的左右两端的存储位置为第三存储位置和第四存储位置;所述第三存储位置和所述第四存储位置的圆心点分别在所述二维码的中线的两侧,所述二维码的中线为经过所述二维码的中心点且垂直于X轴的直线,所述第一码元在所述中线左侧的部分为第一部分,所述第一码元在所述中线右侧的部分为第二部分;
    所述电子设备基于所述第一存储位置的坐标信息绘制第一码元,包括:
    所述电子设备分别绘制所述第一码元的所述第一部分和所述第二部分;所述第一部分在Y轴上的取值范围的最小值为所述第三存储位置上距离所述二维码的中心最短的点的纵坐标,在Y轴上的取值范围的最大值为所述第三存储位置所在同心圆中的最大纵坐标;所述第二部分在Y轴上的取值范围的最小值为所述第四存储位置上距离所述二维码的中心最短的点的纵坐标,在Y轴上的取值范围的最大值为所述第四存储位置所在同心圆中的最大纵坐标。
  26. 一种电子设备,其特征在于,包括:一个或多个处理器、一个或多个存储器;所述一个或多个存储器分别与所述一个或多个处理器耦合;所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述计算机指令在所述处理器上运行时,使得所述电子设备执行如权利要求1-16或17-25所述的方法。
  27. 一种计算机可读介质,用于存储一个或多个程序,其中所述一个或多个程序被配置为被所述一个或多个处理器执行,所述一个或多个程序包括指令,所述指令用于执行如权利要求1-16或17-25所述的方法。
PCT/CN2022/073210 2021-02-07 2022-01-21 二维码识别方法及相关装置 WO2022166619A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP22748898.8A EP4276680A4 (en) 2021-02-07 2022-01-21 QR CODE RECOGNITION METHOD AND RELATED APPARATUS
US18/264,551 US20240046055A1 (en) 2021-02-07 2022-01-21 Method for recognizing two-dimensional code and related apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110169337.5 2021-02-07
CN202110169337.5A CN114912475A (zh) 2021-02-07 2021-02-07 二维码识别方法及相关装置

Publications (1)

Publication Number Publication Date
WO2022166619A1 true WO2022166619A1 (zh) 2022-08-11

Family

ID=82741938

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/073210 WO2022166619A1 (zh) 2021-02-07 2022-01-21 二维码识别方法及相关装置

Country Status (4)

Country Link
US (1) US20240046055A1 (zh)
EP (1) EP4276680A4 (zh)
CN (1) CN114912475A (zh)
WO (1) WO2022166619A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116225270A (zh) * 2023-02-27 2023-06-06 荣耀终端有限公司 条码图像的获取方法及相关装置
CN116796782A (zh) * 2023-05-04 2023-09-22 北京百度网讯科技有限公司 二维码的生成方法、识别方法、装置、设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809469A (zh) * 2022-11-30 2023-03-17 上海哔哩哔哩科技有限公司 环形二维码的编码方法和解码方法
CN118037884B (zh) * 2024-04-08 2024-06-18 北京睛采智能科技有限公司 包含商标信息的二进制定位码生成方法、系统及设备

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110290878A1 (en) * 2010-06-01 2011-12-01 Fujian Newland Computer Co., Ltd. Matrix-type two-dimensional barcode decoding chip and decoding method thereof
US20160019407A1 (en) * 2012-12-19 2016-01-21 Denso Wave Incorporated Information code, information code producing method, information code reader, and system which uses information code
CN106951812A (zh) * 2017-03-31 2017-07-14 腾讯科技(深圳)有限公司 识别二维码的方法、装置和终端
CN110414644A (zh) * 2018-04-27 2019-11-05 阿里巴巴集团控股有限公司 二维码及其编码和解码方法和装置、存储介质和移动终端
CN110659709A (zh) * 2019-09-18 2020-01-07 颐保医疗科技(上海)有限公司 一种防伪二维码及其生成和检测识别的方法
CN110969042A (zh) * 2018-09-30 2020-04-07 北京微播视界科技有限公司 二维码的识别方法、装置、硬件装置
CN111275152A (zh) * 2020-01-16 2020-06-12 北京迈格威科技有限公司 二维码、二维码的编码方法、解码方法、装置和电子系统
CN112926715A (zh) * 2021-03-23 2021-06-08 支付宝(杭州)信息技术有限公司 一种二维码生成、解码方法、装置及设备

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3600916B2 (ja) * 1993-08-04 2004-12-15 庸良 落合 ビックバンコード読み取り器
EP1422657A1 (en) * 2002-11-20 2004-05-26 Setrix AG Method of detecting the presence of figures and methods of managing a stock of components
DE10320383A1 (de) * 2003-05-06 2004-12-02 Visolution Gmbh Codierung, Verfahren zum Codieren von Objekten und Codierwerkzeug
CN102053249B (zh) * 2009-10-30 2013-04-03 吴立新 基于激光扫描和序列编码图形的地下空间高精度定位方法
CN105487748B (zh) * 2015-11-20 2020-12-18 腾讯科技(深圳)有限公司 显示图标的方法和装置、存储介质以及计算机终端
US10237277B2 (en) * 2016-08-15 2019-03-19 Facebook, Inc. Generating and utilizing digital visual codes to grant privileges via a networking system
CN106447001A (zh) * 2016-09-19 2017-02-22 华南农业大学 一种圆形二维码及其编码方法和应用
BR112020001818A2 (pt) * 2017-07-28 2020-07-21 The Coca-Cola Company método e aparelho para codificar e decodificar códigos simbólicos circulares
CN107590522B (zh) * 2017-08-23 2020-08-21 阿里巴巴集团控股有限公司 一种识别码生成及识别的方法及装置
CN108038529B (zh) * 2017-12-08 2020-10-09 北京中星仝创科技有限公司 一种带图像的圆形二维码生成及读取的方法
CN108764420B (zh) * 2018-04-24 2022-10-21 中钞印制技术研究院有限公司 一种二维码及其编码、识别方法、具有防伪功能的产品
CN110969233A (zh) * 2018-09-30 2020-04-07 北京微播视界科技有限公司 二维码的生成方法、装置、硬件装置
CN110084080B (zh) * 2019-04-28 2021-07-09 上海快仓自动化科技有限公司 二维码识别和生成的方法、装置、二维码和小车
CN110288069B (zh) * 2019-06-26 2023-05-02 百度在线网络技术(北京)有限公司 二维码生成和解析的方法、装置、设备及可读存储介质
CN110610219B (zh) * 2019-08-12 2020-11-06 上海交通大学 一种彩色环形二维码及其生成和解码方法

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110290878A1 (en) * 2010-06-01 2011-12-01 Fujian Newland Computer Co., Ltd. Matrix-type two-dimensional barcode decoding chip and decoding method thereof
US20160019407A1 (en) * 2012-12-19 2016-01-21 Denso Wave Incorporated Information code, information code producing method, information code reader, and system which uses information code
CN106951812A (zh) * 2017-03-31 2017-07-14 腾讯科技(深圳)有限公司 识别二维码的方法、装置和终端
CN110414644A (zh) * 2018-04-27 2019-11-05 阿里巴巴集团控股有限公司 二维码及其编码和解码方法和装置、存储介质和移动终端
CN110969042A (zh) * 2018-09-30 2020-04-07 北京微播视界科技有限公司 二维码的识别方法、装置、硬件装置
CN110659709A (zh) * 2019-09-18 2020-01-07 颐保医疗科技(上海)有限公司 一种防伪二维码及其生成和检测识别的方法
CN111275152A (zh) * 2020-01-16 2020-06-12 北京迈格威科技有限公司 二维码、二维码的编码方法、解码方法、装置和电子系统
CN112926715A (zh) * 2021-03-23 2021-06-08 支付宝(杭州)信息技术有限公司 一种二维码生成、解码方法、装置及设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4276680A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116225270A (zh) * 2023-02-27 2023-06-06 荣耀终端有限公司 条码图像的获取方法及相关装置
CN116796782A (zh) * 2023-05-04 2023-09-22 北京百度网讯科技有限公司 二维码的生成方法、识别方法、装置、设备及存储介质

Also Published As

Publication number Publication date
EP4276680A1 (en) 2023-11-15
CN114912475A (zh) 2022-08-16
US20240046055A1 (en) 2024-02-08
EP4276680A4 (en) 2024-07-10

Similar Documents

Publication Publication Date Title
WO2022166619A1 (zh) 二维码识别方法及相关装置
CN109814766B (zh) 一种应用显示方法及电子设备
CN110597512B (zh) 显示用户界面的方法及电子设备
CN115473957B (zh) 一种图像处理方法和电子设备
WO2022042285A1 (zh) 一种应用程序界面显示的方法及电子设备
WO2022228157A1 (zh) 一种二维码编码、解码方法及电子设备
WO2022007707A1 (zh) 家居设备控制方法、终端设备及计算机可读存储介质
WO2023005715A1 (zh) 快应用处理方法、电子设备与快应用系统
WO2023005900A1 (zh) 一种投屏方法、电子设备及系统
CN113973398A (zh) 无线网络连接方法、电子设备及芯片系统
WO2022206763A1 (zh) 一种显示方法、电子设备和系统
WO2022095906A1 (zh) 一种按键映射方法、电子设备及系统
CN116077943B (zh) 调度系统资源的方法及相关装置
CN112416984A (zh) 一种数据处理方法及其装置
WO2022062902A1 (zh) 一种文件传输方法和电子设备
WO2022143417A1 (zh) 一种二维码生成方法以及相关设备
CN113821130A (zh) 一种确定截图区域的方法及相关装置
CN118153110B (zh) 一种数据处理方法及相关装置
CN114666441B (zh) 一种调用其他设备能力的方法、电子设备、系统和存储介质
CN115619628B (zh) 图像处理方法和终端设备
WO2022022381A1 (zh) 生成涂鸦图案的方法、装置、电子设备及存储介质
CN117689796B (zh) 一种渲染处理方法及电子设备
WO2022166550A1 (zh) 数据传输方法及电子设备
WO2023006035A1 (zh) 一种投屏方法、系统及电子设备
WO2022179327A1 (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: 22748898

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 18264551

Country of ref document: US

ENP Entry into the national phase

Ref document number: 2022748898

Country of ref document: EP

Effective date: 20230808

NENP Non-entry into the national phase

Ref country code: DE