WO2021185232A1 - 一种条码识别方法以及相关设备 - Google Patents

一种条码识别方法以及相关设备 Download PDF

Info

Publication number
WO2021185232A1
WO2021185232A1 PCT/CN2021/080986 CN2021080986W WO2021185232A1 WO 2021185232 A1 WO2021185232 A1 WO 2021185232A1 CN 2021080986 W CN2021080986 W CN 2021080986W WO 2021185232 A1 WO2021185232 A1 WO 2021185232A1
Authority
WO
WIPO (PCT)
Prior art keywords
decoding
image
decoding method
success rate
barcode
Prior art date
Application number
PCT/CN2021/080986
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 华为技术有限公司
Publication of WO2021185232A1 publication Critical patent/WO2021185232A1/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/14131D bar codes
    • 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
    • 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
    • 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/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • 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/146Methods for optical code recognition the method including quality enhancement steps

Definitions

  • This application relates to the field of image recognition, in particular to a barcode recognition method and related equipment.
  • the real-time scan code function is the function of recognizing product barcodes and QR code pictures, such as reading one-dimensional codes on ordinary product packaging, QR codes for payment, etc., supports a wide range of code types, supports complex scenarios, and fast Response is the goal that needs to be achieved when scanning the code in real time.
  • the barcode reader can sequentially capture multiple frames of images based on the image capture parameters, and serially decode the acquired image frames using multiple decoding methods until the decoding result is obtained.
  • a fixed-mode serial decoding strategy is adopted for each frame of image, and the computational power and time overhead are relatively large.
  • the embodiments of the present application provide a barcode recognition method and related equipment. By adopting different decoding strategies for multiple frames of images, it can reduce the time-consuming and large computing power problems of a single frame caused by complicated attempts.
  • an embodiment of the present application provides a barcode recognition method, the method includes: acquiring a first image, the first image includes a first target barcode; performing a first decoding method on the first image Decoding; if the decoding result is not obtained, obtain a second image, the second image includes a second target barcode, the first target barcode and the second target barcode correspond to the same barcode; through the first A decoding method decodes the second target image, and if the decoding result is not obtained, the second target image is decoded by the second decoding method, wherein the barcode is for barcodes with the same image characteristics ,
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the first target barcode in the first image may include a one-dimensional code or a two-dimensional code.
  • the types of one-dimensional codes may include, but are not limited to, EAN-8 one-dimensional barcodes, EAN-13, UPC-A one-dimensional barcodes, UPC-E one-dimensional barcodes, Codabar one-dimensional barcodes, Code 39 one-dimensional barcodes, Code 93 one-dimensional barcode, Code 128 one-dimensional barcode and ITF one-dimensional barcode.
  • the types of QR codes can include but are not limited to PDF417, Aztec, PDF417 two-dimensional barcode, Datamatrix two-dimensional barcode, Maxicode two-dimensional barcode, Code 49, Code 16K, Code one.
  • the first decoding method can perform feature detection on the image, locate the position and size of the barcode or two-dimensional code, and use the global binarization method to convert the brightness image into a binary image, and use each code type to decode
  • the decoders try to decode serially one by one.
  • the computational overhead of the first decoding method is relatively small, and the first decoding method has better results for normal light, normal distance, and normal shape bar code scenes. However, the first decoding method has better results. For barcodes in complex scenes such as long distances and abnormal exposure (overexposure, overdarkness), the first decoding method has a low decoding success rate.
  • the second decoding method can increase the detection rate of two-dimensional code feature positioning marks by adding different binarization methods, such as adaptive binarization, localization Binarization methods, etc. These additional attempts have an enhanced effect on the decoding and positioning of the barcode, and thus make the amplification and judgment easier, but compared with the first decoding method, it will bring additional computing power and time overhead, which does not meet the positioning of fast decoding, so it is Set to the second decoding method.
  • the second decoding method can additionally calculate the brightness of the detection area for exposure adjustment judgment and magnification adjustment judgment.
  • the third decoding method can try to solve other difficult cases and inverted color QR codes by trying a variety of image processing methods, such as Gaussian blur and noise reduction, image size scaling, Gamma brightening, and contrast enhancement And the inversion of the binary graph, etc. Most of these attempts require the introduction of considerable additional computing power and time consumption. At the same time, the corresponding applicable scenes are relatively rare, and it is not suitable for trying every frame, so you can choose to put it into the third decoding method with low priority.
  • image processing methods such as Gaussian blur and noise reduction, image size scaling, Gamma brightening, and contrast enhancement And the inversion of the binary graph, etc.
  • the embodiment of the application provides a barcode recognition method, the method includes: acquiring a first image, the first image includes a first target barcode; decoding the first image by a first decoding method; if If the decoding result is not obtained, a second image is obtained, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode; by the first decoding method
  • the second target image is decoded, and if the decoding result is not obtained, the second target image is decoded by a second decoding method, wherein, for barcodes with the same image characteristics, the first
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding The decoding success rate of the method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method. Decoding success rate.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method. Decoding success rate.
  • the method further includes:
  • the zoom-in adjustment parameter is determined according to the ratio and adjusted according to the zoom-in Parameter to adjust the parameters of the camera.
  • the method further includes:
  • the exposure adjustment parameter is determined according to the brightness, and the camera parameter adjustment is performed according to the exposure adjustment parameter.
  • the method further includes:
  • the second target image is decoded by a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose color feature is inverted color .
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose integrity is less than a preset value in the image. Code success rate.
  • the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the first image and the second image are different image frames obtained in a process of scanning the same barcode by the terminal.
  • the present application provides a barcode recognition method, the method includes:
  • the target decoding method for the first image is determined from the decoding method set, where the decoding method set includes the first decoding method and the second decoding method;
  • the decoding success rate of the second decoding method is higher than that of the first decoding method, and the probability value of the first decoding method being invoked is greater than that of the second decoding method.
  • the probability value of the code method being called.
  • the decoding success rate of the second decoding method is higher than that of the first decoding
  • the set of decoding methods further includes: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is It is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose color feature is inverted color And/or, for the same barcode whose integrity is less than a preset value in the image, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method; and/or , For the same barcode with the difference degree between the shape and the preset shape in the image greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method Rate.
  • this application provides a barcode recognition device, including:
  • An obtaining module configured to obtain a first image, the first image including a first target barcode
  • the first decoding module is configured to decode the first image by the first decoding method
  • the acquisition module is further configured to acquire a second image, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode ;
  • the second decoding module is used to decode the second target image by the first decoding method, and if the decoding result is not obtained, then decode the second target image by the second decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding The decoding success rate of the method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method. Decoding success rate.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method. Decoding success rate.
  • the device further includes:
  • the determining module is configured to determine the magnification adjustment parameter according to the ratio if the ratio of the number of pixels occupied by the second target barcode in the second image to the number of pixels in the second image is less than a preset value, and The parameter adjustment of the camera is performed according to the zoom adjustment parameter.
  • the determining module is further configured to: if the brightness of the second target barcode in the second image is not within a preset range, determine the exposure adjustment according to the brightness Parameters, and adjust the camera parameters according to the exposure adjustment parameters.
  • the second target image is decoded by a third decoding method, wherein, for barcodes with the same image characteristics, the The decoding success rate of the third decoding method is higher than that of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose color feature is inverted color .
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method for the same barcode whose integrity is less than the preset value in the image. Code success rate.
  • the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the first image and the second image are different image frames obtained in a process of scanning the same barcode by the terminal.
  • the present application provides a barcode recognition device, the device includes:
  • An obtaining module configured to obtain a first image, the first image including a first target barcode
  • the determining module is configured to determine a target decoding method for the first image from a set of decoding methods according to the probability value, wherein the set of decoding methods includes a first decoding method and a second decoding method; wherein For barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method, and the probability value of the first decoding method being invoked is greater than The probability value of the second decoding method being invoked;
  • the decoding module is configured to decode the first image by using the target decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding
  • the set of decoding methods further includes: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is It is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose color feature is inverted color And/or, for the same barcode whose integrity is less than a preset value in the image, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method; and/or , For the same barcode with the difference degree between the shape and the preset shape in the image greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method Rate.
  • this application provides a terminal device, including: one or more processors; one or more memories; multiple application programs; and one or more programs, wherein the one or more programs are stored In the memory, when the one or more programs are executed by the processor, the terminal device is caused to execute the following steps:
  • the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode;
  • the second target image is decoded by the first decoding method. If the decoding result is not obtained, the second target image is decoded by the second decoding method. For barcodes with image characteristics, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding The decoding success rate of the method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method. Decoding success rate.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method. Decoding success rate.
  • the method further includes:
  • the zoom-in adjustment parameter is determined according to the ratio and adjusted according to the zoom-in Parameter to adjust the parameters of the camera.
  • the method further includes:
  • the exposure adjustment parameter is determined according to the brightness, and the camera parameter adjustment is performed according to the exposure adjustment parameter.
  • the method further includes:
  • the second target image is decoded by a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose color feature is inverted color .
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose integrity is less than the preset value in the image. Code success rate.
  • the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the first image and the second image are different image frames obtained in a process of scanning the same barcode by the terminal.
  • the terminal device can also perform the following steps:
  • the target decoding method for the first image is determined from the decoding method set, where the decoding method set includes the first decoding method and the second decoding method;
  • the decoding success rate of the second decoding method is higher than that of the first decoding method, and the probability value of the first decoding method being invoked is greater than that of the second decoding method.
  • the probability value of the code method being called is the probability value of the code method being called;
  • the first image is decoded using the target decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding
  • the set of decoding methods further includes: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is It is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode whose color feature is inverted color And/or, for the same barcode whose integrity is less than a preset value in the image, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method; and/or , For the same barcode with the difference degree between the shape and the preset shape in the image greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method Rate.
  • the present application provides a server, including: one or more processors; one or more memories; and one or more programs, wherein the one or more programs are stored in the memory,
  • the server is caused to execute the steps described in any one of the foregoing first aspect and the possible implementation manners of the first aspect, or the foregoing second aspect and second aspect The steps described in any one of the possible implementation manners of the aspect.
  • this application provides a device included in a terminal device, and the device has the function of realizing any of the terminal device behaviors in the possible implementation manners of any aspect of the first aspect, or the second aspect described above
  • the function of any terminal device behavior in the possible implementation manners of any aspect can be realized by hardware, or the corresponding software can be executed by hardware.
  • the hardware or software includes one or more modules or units corresponding to the above-mentioned functions.
  • the present application provides a computer storage medium, including computer instructions, which when the computer instructions run on an electronic device or a server, cause the electronic device to execute any one of the foregoing first aspect and the possible implementation of the first aspect.
  • this application provides a computer program product, which when the computer program product runs on an electronic device or a server, causes the electronic device to execute the above-mentioned first aspect and any one of the possible implementations of the first aspect Steps, or steps described in any one of the foregoing second aspect and possible implementation manners of the second aspect.
  • the embodiment of the application provides a barcode recognition method, the method includes: acquiring a first image, the first image includes a first target barcode; decoding the first image by a first decoding method; if If the decoding result is not obtained, a second image is obtained, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode; by the first decoding method
  • the second target image is decoded, and if the decoding result is not obtained, the second target image is decoded by a second decoding method, wherein, for barcodes with the same image characteristics, the first
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • FIG. 1 is a schematic diagram of the structure of a terminal device provided by an embodiment of the application.
  • FIG. 2 is a block diagram of the software structure of a terminal device according to an embodiment of the application.
  • Fig. 3a is a schematic diagram of an embodiment of a barcode recognition method provided by an embodiment of the application.
  • FIG. 3b is a schematic diagram of a recognition scenario provided by an embodiment of this application.
  • FIG. 3c is a schematic diagram of a recognition scenario provided by an embodiment of this application.
  • FIG. 4 is a schematic diagram of an embodiment of a barcode recognition method provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of an embodiment of a barcode recognition method provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of an embodiment of a barcode recognition method provided by an embodiment of the application.
  • FIG. 7 is a schematic diagram of the structure of a barcode recognition device provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of the structure of a barcode recognition device provided by an embodiment of the application.
  • FIG. 9 is a schematic diagram of the structure of a terminal device provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of a structure of a server provided by an embodiment of this application.
  • FIG. 11 is a schematic diagram of an embodiment of a barcode recognition method provided by an embodiment of the application.
  • Fig. 1 is a schematic structural diagram of a terminal device 100 provided by an embodiment of the present application.
  • the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193 , Display screen 194, subscriber identification module (subscriber identification module, SIM) card interface 195, etc.
  • a processor 110 an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, and a battery 142 , Antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, earphone interface 170D, sensor module 180, button 190, motor
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity 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 structure illustrated in the embodiment of the present application does not constitute a specific limitation on the terminal device 100.
  • the terminal device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or arrange different components.
  • the illustrated components can be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), and 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.
  • AP application processor
  • modem processor modem processor
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the different processing units may be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the terminal device 100.
  • the controller can generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
  • a memory may also be provided in the processor 110 to store instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory can store 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 directly called from the memory. Repeated accesses are avoided, the waiting time of the processor 110 is reduced, and the efficiency of the system is improved.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I1C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I1S) interface, a pulse code modulation (pulse code modulation, PCM) interface, and a universal asynchronous transmitter (universal asynchronous transmitter) interface.
  • I1C integrated circuit
  • I1S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB Universal Serial Bus
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is merely a schematic description, and does not constitute a structural limitation of the terminal device 100.
  • the terminal device 100 may also adopt different interface connection modes in the foregoing embodiments, or a combination of multiple interface connection modes.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger can be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130.
  • the power management module 141 is used to connect 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 wireless communication function of the terminal device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • the antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in the terminal device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be multiplexed as a diversity antenna of a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the mobile communication module 150 may provide a wireless communication solution including 1G/3G/4G/5G and the like applied to the terminal device 100.
  • the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), and the like.
  • the mobile communication module 150 can receive electromagnetic waves by the antenna 1, and perform processing such as filtering, amplifying and transmitting the received electromagnetic waves to the modem processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modem processor, and convert it into electromagnetic wave radiation via the antenna 2.
  • 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 and at least part of the modules of the processor 110 may be provided in the same device.
  • 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.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194.
  • the modem processor may be an independent device.
  • the modem processor may be independent of the processor 110 and 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 terminal device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), and global navigation satellites. System (global navigation satellite system, GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • 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 1, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110.
  • the wireless communication module 160 may also receive a signal to be sent from the processor 110, perform frequency modulation, amplify, and convert it into electromagnetic waves to radiate through the antenna 2.
  • the antenna 1 of the terminal 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 terminal 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 (wideband 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 (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite-based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite-based augmentation systems
  • the terminal device 100 implements a display function through a GPU, a display screen 194, and an application processor.
  • the GPU is an image processing microprocessor, which is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations and is used for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the display screen 194 is used to display images, videos, and the like.
  • the display screen 194 includes a display panel.
  • the display panel can use liquid crystal display (LCD), organic light-emitting diode (OLED), active matrix organic light-emitting diode or active-matrix organic light-emitting diode (active-matrix organic light-emitting diode).
  • LCD liquid crystal display
  • OLED organic light-emitting diode
  • active-matrix organic light-emitting diode active-matrix organic light-emitting diode
  • AMOLED flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (QLED), etc.
  • the terminal device 100 may include one or N display screens 194, and N is a positive integer greater than one.
  • the display screen 194 may be used to display various interfaces output by the system of the terminal device 100. For each interface output by the terminal device 100, reference may be made to related descriptions in subsequent embodiments.
  • the terminal device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
  • the ISP is used to process the data fed back from the camera 193. For example, when taking a picture, the shutter is opened, the light is transmitted to the photosensitive element of the camera through the lens, the light signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing and is converted into an image visible to the naked eye.
  • ISP can also optimize the image noise, brightness, and skin color. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object generates an optical image through the lens and is projected to 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 transfers the electrical signal to the ISP to convert it into a digital image signal.
  • ISP outputs digital image signals to DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the terminal device 100 may include one or N cameras 193, and N is a positive integer greater than one.
  • Digital signal processors are used to process digital signals. In addition to digital image signals, they can also process other digital signals.
  • Video codecs are used to compress or decompress digital video.
  • the terminal device 100 may support one or more video codecs. In this way, the terminal device 100 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG1, MPEG3, MPEG4, and so on.
  • MPEG moving picture experts group
  • NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • applications such as intelligent cognition of the terminal device 100 can be implemented, such as image recognition, face recognition, voice recognition, text understanding, and so on.
  • the external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, so as to expand the storage capacity of the terminal 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, save music, video and other files in an external memory card.
  • the internal memory 121 may be used to store computer executable program code, where the executable program code includes instructions.
  • the processor 110 executes various functional applications and data processing of the terminal device 100 by running instructions stored in the internal memory 121.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store an operating system, an application program (such as a sound playback function, an image playback function, etc.) required by at least one function, and the like.
  • the data storage area can store data (such as audio data, phone book, etc.) created during the use of the terminal device 100.
  • the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.
  • UFS universal flash storage
  • the terminal device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. For example, music playback, recording, etc.
  • the audio module 170 may be used to play the sound corresponding to the video. For example, when the display screen 194 displays a video playback screen, the audio module 170 outputs the sound of the video playback.
  • the audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal.
  • the speaker 170A also called “speaker” is used to convert audio electrical signals into sound signals.
  • the receiver 170B also called “earpiece” is used to convert audio electrical signals into sound signals.
  • the microphone 170C also called “microphone”, “microphone”, is used to convert sound signals into electrical signals.
  • the earphone interface 170D is used to connect wired earphones.
  • the earphone interface 170D may be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A may be provided on the display screen 194.
  • the gyro sensor 180B may be used to determine the movement posture of the terminal device 100.
  • the air pressure sensor 180C is used to measure air pressure.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). When the terminal device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the terminal device, and it can be used in applications such as horizontal and vertical screen switching, pedometer and so on.
  • Distance sensor 180F used to measure distance.
  • the ambient light sensor 180L is used to sense the brightness of the ambient light.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the temperature sensor 180J is used to detect temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194, and the touch screen is composed of the touch sensor 180K and the display screen 194, which is also called a “touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • the visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the terminal device 100, which is different from the position of the display screen 194.
  • the button 190 includes a power-on button, a volume button, and so on.
  • the button 190 may be a mechanical button. It can also be a touch button.
  • the terminal device 100 may receive key input, and generate key signal input related to user settings and function control of the terminal device 100.
  • the motor 191 can generate vibration prompts.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power change, or to indicate messages, missed calls, notifications, and so on.
  • the SIM card interface 195 is used to connect to the SIM card.
  • the software system of the terminal device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of the present application takes an Android system with a layered architecture as an example to illustrate the software structure of the terminal device 100 by way of example.
  • FIG. 2 is a block diagram of the software structure of the terminal device 100 according to an embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Communication between layers through software interface.
  • the Android system is divided into four layers, from top to bottom, the application layer, the application framework layer, the Android runtime and system library, and the 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, etc.
  • 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 can include a window manager, a content provider, a view system, a phone manager, a resource manager, and a notification manager.
  • the window manager is used to manage window programs.
  • the window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, take a screenshot, etc.
  • the content provider is used to store and retrieve data and make these data accessible to applications.
  • the data may include video, image, audio, phone calls made and received, browsing history and bookmarks, phone book, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, and so on.
  • the view system can be used to build applications.
  • the interface content can be composed of one or more views.
  • a display interface that includes a short message notification icon may include a view that displays text and a view that displays pictures.
  • the phone manager is used to provide the communication function of the terminal device 100. For example, the management of the call status (including connecting, hanging up, etc.).
  • the resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and so on.
  • the notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages, and it can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, and so on.
  • the notification manager can also be a notification that appears in the status bar at the top of the system in the form of a chart or a scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window.
  • prompt text messages in the status bar sound a prompt tone, terminal equipment vibration, flashing indicator lights, etc.
  • Android runtime includes core libraries and virtual machines. Android runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function functions that the java language needs to call, and the other part is the core library of Android.
  • the application layer and application framework layer run in a virtual machine.
  • 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 life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library can include multiple functional modules. For example: surface manager (surface manager), media library (media libraries), 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), etc.
  • surface manager surface manager
  • media library media libraries
  • 3D graphics processing library for example: OpenGL ES
  • 2D graphics engine for example: SGL
  • the surface manager is used to manage the display subsystem and provides a combination 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 multiple 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, synthesis, and layer processing.
  • the 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 driver, camera driver, audio driver, and sensor driver.
  • Fig. 3a is a schematic diagram of an embodiment of a barcode recognition method provided by an embodiment of the application. As shown in Fig. 3a, the barcode recognition method provided by this application includes:
  • the terminal device may obtain the first image including the first target barcode, and the first image may be an image frame in the video.
  • the terminal device can obtain the first image through the camera carried by itself.
  • the user can turn on the barcode recognition function on some applications and select the barcode scan code. This function will call the camera on the terminal device. Furthermore, the user can shoot a certain area through the camera of the terminal device. A barcode is set in this area, and the terminal device can control the camera to collect the preview stream, so that the terminal device can obtain an image frame in the preview stream as the first image, and the first image includes the first target barcode.
  • the first target barcode in the first image may include a one-dimensional code or a two-dimensional code.
  • the types of one-dimensional codes may include, but are not limited to, EAN-8 one-dimensional barcodes, EAN-13, UPC-A one-dimensional barcodes, UPC-E one-dimensional barcodes, Codabar one-dimensional barcodes, Code 39 one-dimensional barcodes, Code 93 one-dimensional bar code, Code 128 one-dimensional bar code and ITF one-dimensional bar code, refer to Fig. 3b, Fig. 3b is an illustration of the first image when the first target bar code is a one-dimensional code.
  • QR codes can include but are not limited to PDF417, Aztec, PDF417 two-dimensional barcode, Datamatrix two-dimensional barcode, Maxicode two-dimensional barcode, Code 49, Code 16K, Code one.
  • FIG. 3c is a schematic diagram of the first image when the first target barcode is a two-dimensional code.
  • the terminal can obtain the first image in a local album or a cloud album.
  • the user can turn on the barcode recognition function on some applications and choose to select an image from a local album or cloud album. This function will open the local album or cloud album on the terminal device.
  • the user can Select a first image for barcode recognition from the local album or cloud album on the device.
  • the first image may include the first target barcode.
  • the terminal device may obtain the first target in the local album or cloud album. The first image of the barcode.
  • the terminal device may decode the first image.
  • the decoding process can be divided into multiple priority processes (including the first decoding method, the second decoding method, and the third decoding method described below).
  • Each priority process is relatively independent and has its own focus.
  • the first priority process focuses on fast decoding; the second priority process focuses on adjustment of camera parameters such as zooming and exposure adjustment, and the third priority process focuses on decoding a special code pattern.
  • the terminal device after receiving the first image, the terminal device will determine which priority levels the first image needs to be activated.
  • the first frame image activates the first decoding method
  • the second frame image activates the first decoding method and the second decoding method
  • the third frame image activates the first decoding method and the third decoding method, and so on.
  • the first decoding method may be used to decode the first image.
  • the first decoding method can perform feature detection on the image, locate the position and size of the barcode or two-dimensional code, and use the global binarization method to convert the brightness image into a binary image, and use each code type to decode
  • the decoders try to decode serially one by one.
  • the computational overhead of the first decoding method is relatively small, and the first decoding method has better results for normal light, normal distance, and normal shape bar code scenes. However, the first decoding method has better results. For barcodes in complex scenes such as long distances and abnormal exposure (overexposure, overdarkness), the first decoding method has a low decoding success rate.
  • the decoding result is not obtained, a second image is obtained, and the second image includes the second target barcode.
  • the first image and the second image may be different image frames obtained by the terminal in the process of scanning the same barcode. Due to the change of the shooting angle of view or the change of the shooting position, the first target barcode is in the first The pixel position in an image can be different from the pixel position of the second target barcode in the second image. Due to the difference in image definition or the completeness of the barcode in the image, the position of the first target barcode in the first image is different.
  • the image feature can be different from the image feature of the second target barcode in the second image, but the analysis information included in the first target barcode and the second target barcode is the same, that is, if the first target barcode and the second target barcode are in the image If the barcode is a complete barcode, the analysis information included in the first target barcode and the second target barcode is the same, and the analysis results obtained after the first target barcode and the second target barcode are successfully decoded are the same.
  • the first image and the second image are different image frames obtained in the process of scanning the same barcode by the terminal.
  • the terminal device may decode the second target image by the first decoding method, and if the decoding result is not obtained, the second decoding method may be used
  • the second target image is decoded, wherein, for barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method; wherein, the decoding success rate can be expressed as
  • the comprehensive performance of the decoding method can represent the overall result of the decoding success rate of the barcode after multiple decodings in different scenarios, and it can be the comprehensive probability result obtained through statistics of multiple scanning tests, but not Limited to the success rate of a certain scan code.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • the specific situations in which the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method may include but are not limited to the following:
  • the decoding success rate of the second decoding method may be higher than that of the first decoding method Rate.
  • the decoding success rate of the second decoding method may be higher than the decoding success rate of the first decoding method.
  • the preset number can be selected according to the actual situation. Not limited.
  • the decoding success rate of the second decoding method may be higher than the decoding success rate of the first decoding method, where:
  • the first preset brightness can be selected according to actual conditions, which is not limited here.
  • the decoding success rate of the second decoding method may be higher than the decoding success rate of the first decoding method, where:
  • the second preset brightness can be selected according to actual conditions, which is not limited here.
  • the second decoding method can increase the detection rate of two-dimensional code feature positioning marks by adding different binarization methods, such as adaptive binarization, localization Binarization methods, etc. These additional attempts have an enhanced effect on the decoding and positioning of the barcode, and thus make the amplification and judgment easier, but compared with the first decoding method, it will bring additional computing power and time overhead, which does not meet the positioning of fast decoding, so it is Set to the second decoding method.
  • the second decoding method can additionally calculate the brightness of the detection area for exposure adjustment judgment and magnification adjustment judgment.
  • the first decoding method and the second decoding method in the embodiments of the present application can be implemented by a neural network, where the neural network model corresponding to the second decoding method uses training samples and/or
  • the convergence conditions may be different from the training samples and/or convergence conditions used in the first decoding method (for example, the training samples of the second decoding method are barcodes with certain brightness characteristics or integrity characteristics, or the convergence of the second decoding method) The requirements are higher and the decoding accuracy is higher), so that the decoding success rate of the second decoding method obtained by training is higher than the decoding success rate of the first decoding method.
  • the zoom-in adjustment parameter is determined according to the ratio and adjusted according to the zoom-in Parameter to adjust the parameters of the camera.
  • the camera magnification factor is adjusted according to the ratio to enlarge the barcode area to an appropriate level.
  • the magnification adjustment parameter is determined to be the third magnification level according to the ratio, and the camera can adjust the magnification level to the third magnification level, thereby increasing the number of pixels occupied by the barcode in the image and the image in the image frame captured by the camera.
  • the ratio of the number of pixels is determined to be the third magnification level according to the ratio, and the camera can adjust the magnification level to the third magnification level, thereby increasing the number of pixels occupied by the barcode in the image and the image in the image frame captured by the camera.
  • the exposure adjustment parameter is determined according to the brightness, and the camera parameter adjustment is performed according to the exposure adjustment parameter.
  • the camera exposure level is adjusted to correct the brightness level of the area to a certain range.
  • the exposure adjustment is determined according to the brightness
  • the parameter is the camera exposure level 2, which means that the camera exposure level is increased, thereby increasing the brightness of the barcode in the image frame captured by the camera.
  • the exposure adjustment is determined according to the brightness
  • the parameter is the camera exposure level 1, which means that the camera exposure level is reduced, thereby reducing the brightness of the barcode in the image frame captured by the camera.
  • the second target image can also be decoded by a third decoding method, wherein, for barcodes with the same image characteristics, the third decoding The decoding success rate of the method is higher than that of the second decoding method.
  • the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method.
  • the barcode in the image may be some inverted color barcode.
  • the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method.
  • the barcode in the image may be due to stains or other obstructions, or due to the damage of the barcode itself, and its integrity may be less than the preset value.
  • the decoding success rate of the third decoding method may be higher than The decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method may be higher than that of the second translation.
  • the decoding success rate of the code method may be higher than that of the second translation.
  • the preset shape can be a regular pattern such as a rectangle or a circle
  • the barcode in the image can be some special shapes, such as pentagons, trapezoids, etc., between the barcode in the image and the preset shape.
  • the degree of difference greater than the preset degree of difference can be understood as not a rectangle or a circle, etc., or, similar to a rectangle or a circle, but compared to a mathematical rectangle, it has a certain deformation, and the degree of deformation exceeds the preset
  • the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method.
  • the third decoding method can try to solve other difficult cases and inverted color QR codes by trying a variety of image processing methods, such as Gaussian blur and noise reduction, image size scaling, Gamma brightening, and contrast enhancement And the inversion of the binary graph, etc. Most of these attempts require the introduction of considerable additional computing power and time consumption. At the same time, the corresponding applicable scenes are relatively rare, and it is not suitable for trying every frame, so you can choose to put it into the third decoding method with low priority.
  • image processing methods such as Gaussian blur and noise reduction, image size scaling, Gamma brightening, and contrast enhancement And the inversion of the binary graph, etc.
  • the second decoding method and the third decoding method in the embodiments of the present application can be implemented by a neural network, where the neural network model corresponding to the third decoding method uses training samples and/or during the training process.
  • the convergence conditions may be different from the training samples and/or convergence conditions used in the second decoding method (for example, the training samples of the third decoding method are barcodes with certain color or shape characteristics, or the convergence conditions of the third decoding method Higher requirements and higher decoding accuracy), so that the decoding success rate of the third decoding method obtained by training is higher than the decoding success rate of the second decoding method.
  • Example 1 The first image uses the first decoding method, the second image uses the first decoding method and the second decoding method, the third image uses the first decoding method, and the fourth image uses the first decoding method and the first decoding method. 2. Decoding method.
  • a first image can be obtained, and the first image includes a first target barcode; the first image is decoded by the first decoding method; if the decoding result is not obtained, the second image is obtained.
  • An image the second image includes a second target barcode, the first target barcode and the second target barcode correspond to the same barcode; the second target image is decoded by the first decoding method If the decoding result is not obtained, the second target image is decoded by the second decoding method; if the decoding result is not obtained, the third image is obtained, and the third image includes the third target barcode, The first target barcode and the third target barcode correspond to the same barcode; the third image is decoded by the first decoding method; if the decoding result is not obtained, the fourth image is acquired, the The fourth image includes a fourth target barcode, and the first target barcode and the fourth target barcode correspond to the same barcode; the fourth target image is decoded by the first decoding method, if not obtained As
  • the second image uses the first decoding method and the second decoding method.
  • the specific process of the coding method please refer to the corresponding description of step 303 and step 304 in the above embodiment, which will not be repeated here.
  • the specific process of decoding the third image using the first decoding method refer to step 301 and step in the above embodiment.
  • the description corresponding to 302 will not be repeated here.
  • the specific process of using the first decoding method and the second decoding method for the fourth image can refer to the corresponding descriptions of step 303 and step 304 in the foregoing embodiment, and will not be repeated here.
  • the time overhead of the second decoding method is greater than that of the first decoding method. Time overhead, so in the process of decoding one frame of image (the first image), the first decoding method is used for decoding. If the decoding is not successful, the first decoding method is used to decode another frame of image (the first image). The second image) is decoded. If the decoding is not successful, the second decoding method is used to decode the second image. In contrast, each frame image uses the same decoding method.
  • Adopting different process strategies for continuous multi-frame images and periodically adjusting the length of the single-frame scanning process can effectively reduce the time-consuming problem of single-frame length caused by complicated attempts, refresh the image in time, and increase the expectation of successful scanning.
  • Example 2 The first image uses the first decoding method, the second image uses the first decoding method and the third decoding method, the third image uses the first decoding method, and the fourth image uses the first decoding method and the first decoding method. Three decoding methods.
  • a first image can be obtained, and the first image includes a first target barcode; the first image is decoded by the first decoding method; if the decoding result is not obtained, the second image is obtained.
  • An image the second image includes a second target barcode, the first target barcode and the second target barcode correspond to the same barcode; the second target image is decoded by the first decoding method If the decoding result is not obtained, the second target image is decoded by the third decoding method; if the decoding result is not obtained, the third image is obtained, and the third image includes the third target barcode, The first target barcode and the third target barcode correspond to the same barcode; the third image is decoded by the first decoding method; if the decoding result is not obtained, the fourth image is acquired, the The fourth image includes a fourth target barcode, and the first target barcode and the fourth target barcode correspond to the same barcode; the fourth target image is decoded by the first decoding method, if not obtained As
  • the second image uses the first decoding method and the third decoding method.
  • the specific process of the coding method please refer to the corresponding description of step 303 and step 304 in the above embodiment, which will not be repeated here.
  • the specific process of decoding the third image using the first decoding method refer to step 301 and step in the above embodiment.
  • the description corresponding to 302 will not be repeated here.
  • the specific process of using the first decoding method and the third decoding method for the fourth image please refer to the corresponding description of step 303 and step 304 in the foregoing embodiment, and will not be repeated here.
  • the time overhead of the third decoding method is greater than that of the first decoding method. Time overhead, so in the process of decoding one frame of image (the first image), the first decoding method is used for decoding. If the decoding is not successful, the first decoding method is used to decode another frame of image (the first image). The second image) is decoded. If the decoding is not successful, the third decoding method is used to decode the second image.
  • Adopting different process strategies for continuous multi-frame images and periodically adjusting the length of the single-frame scanning process can effectively reduce the time-consuming problem of single-frame length caused by complicated attempts, refresh the image in time, and increase the expectation of successful scanning.
  • Example 3 The first image uses the first decoding method, the second image uses the first, second, and third decoding methods, the third image uses the first decoding method, and the fourth image uses the first decoding method.
  • a first image can be obtained, and the first image includes a first target barcode; the first image is decoded by the first decoding method; if the decoding result is not obtained, the second image is obtained.
  • An image the second image includes a second target barcode, the first target barcode and the second target barcode correspond to the same barcode; the second target image is decoded by the first decoding method If the decoding result is not obtained, the second target image is decoded by the second decoding method; if the decoding result is not obtained, the second target image is decoded by the third decoding method If the decoding result is not obtained, obtain a third image, the third image includes a third target barcode, the first target barcode and the third target barcode correspond to the same barcode; by the first decoding method The third image is decoded; if the decoding result is not obtained, a fourth image is obtained.
  • the fourth image includes a fourth target barcode, and the first target barcode and the fourth target barcode correspond to the same A barcode; the fourth target image is decoded by the first decoding method, if the decoding result is not obtained, the fourth target image is decoded by the second decoding method; if the fourth target image is not obtained As a result of the decoding, the fourth target image is decoded by the third decoding method.
  • the second image uses the first decoding method and the second decoding method.
  • the specific process of the encoding method and the third decoding method please refer to the corresponding descriptions of step 303 and step 304 in the above embodiment, which will not be repeated here.
  • the specific process of decoding the third image using the first decoding method refer to the above implementation.
  • the corresponding description of step 301 and step 302 in the example will not be repeated here.
  • the specific process of using the first decoding method, the second decoding method and the third decoding method for the fourth image please refer to the step 303 and step in the above-mentioned embodiment.
  • the description corresponding to 304 will not be repeated here.
  • the time overhead of the second decoding method and the third decoding method is greater than The time overhead of the first decoding method. Therefore, in the process of decoding a frame of image (the first image), the first decoding method is used for decoding. If the decoding is not successful, the first decoding is used. The method decodes another frame of image (the second image). If the decoding is not successful, the second decoding method and the third decoding method are used to decode the second image. Compared with each frame of image Both adopt the same decoding method. In this embodiment, different process strategies are adopted for continuous multi-frame images, and the length of the single-frame scanning code is periodically adjusted, which can effectively reduce the time-consuming problem of single frame length caused by complicated attempts. Refresh the image to increase the expectation of successful scanning.
  • Example 4 The first image uses the first decoding method, the second image uses the first decoding method and the second decoding method, and the third image uses the first decoding method, the second decoding method, and the third decoding method. , The fourth image adopts the first decoding method and the third decoding method.
  • the second image uses the first decoding method and the second decoding method.
  • the specific process of using the first decoding method, the second decoding method and the third decoding method for the third image can be Refer to the descriptions corresponding to step 303 and step 304 in the foregoing embodiment, which will not be repeated here.
  • the specific process of using the first decoding method and the third decoding method for the fourth image refer to the corresponding description of step 303 and step 304 in the foregoing embodiment. Description, I won’t repeat it here.
  • Example 5 The first image uses the first decoding method, the second image uses the first decoding method and the second decoding method, the third image uses the first decoding method, and the fourth image uses the first decoding method and the first decoding method.
  • Three decoding methods the fifth image uses the first decoding method, the sixth image uses the first decoding method and the second decoding method, the seventh image uses the first decoding method, and the eighth image uses the first decoding method And the third decoding method.
  • the second image uses the first decoding method and the second decoding method.
  • the specific process of the coding method please refer to the description corresponding to step 303 and step 304 in the above embodiment, and will not be repeated here.
  • the specific process of using the first decoding method for the third image refer to the corresponding description of step 303 and step 304 in the above embodiment. The description will not be repeated here.
  • the specific process of using the first decoding method and the third decoding method for the fourth image please refer to the corresponding description of step 303 and step 304 in the above-mentioned embodiment.
  • step 303 and step 304 For the specific process of a decoding method, refer to the corresponding descriptions of step 303 and step 304 in the above embodiment, which will not be repeated here.
  • first decoding method and the second decoding method for the sixth image refer to the above embodiment.
  • the descriptions corresponding to step 303 and step 304 in step 303 and step 304 will not be repeated here.
  • first decoding method for the seventh image refer to the description corresponding to step 301 and step 302 in the above-mentioned embodiment, which will not be repeated here.
  • step 303 and step 304 For the specific process of adopting the first decoding method and the third decoding method, reference may be made to the corresponding description of step 303 and step 304 in the foregoing embodiment, which will not be repeated here.
  • first decoding method, the second decoding method, and the third decoding method in the embodiments of the present application can be implemented by a neural network, which is not limited in the present application.
  • the embodiment of the application provides a barcode recognition method, the method includes: acquiring a first image, the first image includes a first target barcode; decoding the first image by a first decoding method; if If the decoding result is not obtained, a second image is obtained, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode; by the first decoding method
  • the second target image is decoded, and if the decoding result is not obtained, the second target image is decoded by a second decoding method, wherein, for barcodes with the same image characteristics, the first
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • FIG. 4 is a schematic diagram of a barcode recognition method provided by an embodiment of the present application.
  • a barcode recognition method provided by an embodiment of the present application includes:
  • step 401 For the description of step 401, reference may be made to the description of step 301 in the foregoing embodiment, which will not be repeated here.
  • a target decoding method for the first image from a set of decoding methods according to the probability value, where the set of decoding methods includes a first decoding method and a second decoding method; For barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method, and the probability value of the first decoding method being invoked is greater than the first decoding method. 2. The probability value of the decoding method being invoked.
  • the probability value may indicate the possibility that the corresponding decoding method is selected as the current image frame.
  • the decoding success rate of the second decoding method may be higher than that of the first decoding method And/or, for barcodes with brightness less than the first preset brightness in the image, the decoding success rate of the second decoding method may be higher than the decoding success rate of the first decoding method; and/or Or, for a barcode with a brightness greater than a second preset brightness in an image, the decoding success rate of the second decoding method may be higher than the decoding success rate of the first decoding method.
  • the set of decoding methods may further include: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the first decoding method. Second, the decoding success rate of the decoding method.
  • the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method; and/or, For the same barcode whose integrity is less than the preset value in the image, the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method; and/or, for the image
  • the difference between the middle shape and the preset shape is greater than the same barcode with the preset difference, and the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method.
  • the probability value of the first decoding method may be set to 0.7
  • the probability value of the second decoding method may be set to 0.2
  • the probability value of the third decoding method may be set to 0.1.
  • FIG. 5 is a schematic diagram of a barcode recognition method provided by an embodiment of the present application.
  • a barcode recognition method provided by an embodiment of the present application includes:
  • the terminal device acquires a first image, where the first image includes a first target barcode.
  • step 501 For the specific description of step 501, reference may be made to the description of step 301 in the foregoing embodiment, which will not be repeated here.
  • the terminal device sends the first image to the server.
  • step 502 For the specific description of step 502, reference may be made to the description of step 301 in the foregoing embodiment, which will not be repeated here.
  • the server decodes the first image by using the first decoding method.
  • step 503 For the specific description of step 503, reference may be made to the description of step 302 in the foregoing embodiment, which will not be repeated here.
  • the server does not obtain the decoding result, acquire a second image, where the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode;
  • step 504 For the specific description of step 504, reference may be made to the description of step 303 in the foregoing embodiment, which will not be repeated here.
  • the server decodes the second target image through the first decoding method, and if the decoding result is not obtained, decodes the second target image through the second decoding method, where For barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • step 505 For the specific description of step 505, reference may be made to the description of step 304 in the foregoing embodiment, which will not be repeated here.
  • the embodiment of the present application provides a barcode recognition method, the method includes: a terminal device acquires a first image, the first image includes a first target barcode; the terminal device sends the first image to a server; the server passes the first image A decoding method decodes the first image; if the server does not obtain the decoding result, it acquires a second image, the second image includes a second target barcode, the first target barcode and the second The target barcode corresponds to the same barcode; the server decodes the second target image by the first decoding method, and if the decoding result is not obtained, the second target image is decoded by the second decoding method.
  • the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • FIG. 6 is a schematic diagram of a barcode recognition method provided by an embodiment of the present application.
  • a barcode recognition method provided by an embodiment of the present application includes:
  • step 601 For the specific description of step 601, reference may be made to the specific description of step 301, which will not be repeated here.
  • step 601 can be implemented in the following manner:
  • the image data obtained by the camera 193 of the terminal device 100 shown in FIG. 1 is captured, and the processor in the terminal can call the code in the memory to process the image data captured by the camera into the first image.
  • the processor in the terminal may call the code in the memory to control hardware devices such as the video codec in the terminal device 100 to process the image data into the first image.
  • step 602 For the specific description of step 602, reference may be made to the specific description of step 302, which will not be repeated here.
  • step 602 can be implemented in the following manner:
  • the code related to the first decoding method in the memory 121 is called by the processor 110 of the terminal device 100 shown in FIG. 1 to realize the function of decoding the first image by the first decoding method.
  • step 6032 For the specific description of step 6032, reference may be made to the specific description of step 303, which will not be repeated here.
  • the image data is captured by the camera 193 of the terminal device 100 shown in FIG. 1, and the processor in the terminal can call the code in the memory to capture the image captured by the camera.
  • the data is processed into a second image.
  • the terminal device may use the code related to the first decoding method in the memory 121 to realize the function of decoding the first image by the first decoding method.
  • step 604 For specific descriptions of step 604, step 6051, and step 6052, reference may be made to the specific description of step 304, which will not be repeated here.
  • the code related to the first decoding method in the internal memory 121 can be called to realize the function of decoding the second target image by the first decoding method, and if it is not available As a result of the decoding, the code related to the second decoding method in the internal memory 121 is called to further realize the function of decoding the second target image.
  • the decoding result is not obtained, it is determined whether the camera parameter needs to be adjusted, and if the camera parameter needs to be adjusted, the camera parameter is adjusted.
  • the relevant code in the internal memory 121 can be called to further realize the function of judging whether the camera parameters need to be adjusted, and if the camera parameters need to be adjusted, the function of adjusting the camera parameters is implemented.
  • FIG. 7 is a schematic structural diagram of the barcode recognition device provided by an embodiment of the application.
  • the barcode recognition device 700 includes:
  • the obtaining module 701 is configured to obtain a first image, where the first image includes a first target barcode.
  • the obtaining module 701 may execute the steps corresponding to step 301 in the above-mentioned embodiment.
  • the acquisition module 701 can obtain image data through the camera 193 of the terminal device 100 shown in FIG. One image.
  • the processor in the terminal may call the code in the memory to control hardware devices such as the video codec in the terminal device 100 to process the image data into the first image.
  • the first decoding module 702 is configured to decode the first image by a first decoding method.
  • the first decoding module 702 can be used as a part of the functions implemented in the processor 110. By calling the codes related to the first decoding method in the internal memory 121, the The function of decoding the first image. Specifically, the first decoding module 702 can execute the steps corresponding to step 302 in the foregoing embodiment.
  • the obtaining module 701 is further configured to obtain a second image, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same Barcode.
  • the obtaining module 701 can execute the steps corresponding to step 303 in the above-mentioned embodiment.
  • the acquisition module 701 can obtain image data through the camera 193 of the terminal device 100 shown in FIG. Two images.
  • the second decoding module 703 is configured to decode the second target image through the first decoding method, and if the decoding result is not obtained, perform the second decoding method on the second target image. Decoding, wherein, for barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • the second decoding module 703 can be used as a part of the functions implemented in the processor 110, and by calling the codes related to the first decoding method in the internal memory 121, the second decoding module 703 can be used to perform the first decoding method.
  • the second decoding module 703 can execute the steps corresponding to step 304 in the foregoing embodiment.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the device further includes:
  • the determining module is configured to determine the magnification adjustment parameter according to the ratio if the ratio of the number of pixels occupied by the second target barcode in the second image to the number of pixels in the second image is less than a preset value, and The parameter adjustment of the camera is performed according to the zoom adjustment parameter.
  • the determining module is further configured to: if the brightness of the second target barcode in the second image is not within a preset range, determine the exposure adjustment parameter according to the brightness, and adjust the exposure according to the exposure Parameter to adjust the parameters of the camera.
  • the second target image is decoded by a third decoding method, wherein for barcodes with the same image characteristics, the decoding of the third decoding method The success rate is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method.
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method Decoding success rate.
  • the first image and the second image are different image frames obtained in a process of scanning the same barcode by the terminal.
  • An embodiment of the present application provides a barcode recognition device, wherein an acquisition module acquires a first image, and the first image includes a first target barcode; the first decoding module performs a first decoding method on the first image Decoding; if the decoding result is not obtained, the acquisition module acquires a second image, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode; The second decoding module decodes the second target image by the first decoding method, and if the decoding result is not obtained, decodes the second target image by the second decoding method, wherein For barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • An embodiment of the present application provides a barcode recognition device, which includes: an acquisition module for acquiring a first image, the first image including a first target barcode; a first decoding module, for performing a first decoding method The first image is decoded; if the decoding result is not obtained, the acquisition module is also used to acquire a second image, the second image includes a second target barcode, the first target barcode and the The second target barcode corresponds to the same barcode; the second decoding module is used to decode the second target image by the first decoding method, and if the decoding result is not obtained, then the second decoding The method decodes the second target image, wherein, for barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • FIG. 8 is a schematic structural diagram of the barcode recognition device provided by an embodiment of the application.
  • the barcode recognition device 800 includes:
  • the obtaining module 801 is configured to obtain a first image, where the first image includes a first target barcode;
  • the determining module 802 is configured to determine a target decoding method for the first image from a set of decoding methods according to the probability value, wherein the set of decoding methods includes a first decoding method and a second decoding method; Wherein, for barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method, and the probability value of the first decoding method being invoked Greater than the probability value of the second decoding method being invoked;
  • the decoding module 803 is configured to decode the first image by using the target decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and /Or, for the same barcode in the image whose brightness is less than the first preset brightness, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and/or, For the same barcode with a brightness greater than a second preset brightness in an image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • the set of decoding methods further includes: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding The decoding success rate of the method.
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method for the same barcode whose color feature is inverted color; and/or, for the image For the same barcode with a middle completeness less than a preset value, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method; Assuming that the degree of difference between shapes is greater than the same barcode with a preset degree of difference, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
  • FIG. 9 is a schematic structural diagram of a terminal device provided by an embodiment of this application. Tablets, laptops, smart wearable devices, etc., are not limited here.
  • the terminal device 900 includes: a receiver 901, a transmitter 902, a processor 903, and a memory 904 (the number of processors 903 in the terminal device 900 may be one or more, and one processor is taken as an example in FIG. 9) , Where the processor 903 may include an application processor 9031 and a communication processor 9032.
  • the receiver 901, the transmitter 902, the processor 903, and the memory 904 may be connected by a bus or other methods.
  • the memory 904 may include a read-only memory and a random access memory, and provides instructions and data to the processor 903. A part of the memory 904 may also include a non-volatile random access memory (NVRAM).
  • NVRAM non-volatile random access memory
  • the memory 904 stores a processor and operating instructions, executable modules or data structures, or a subset of them, or an extended set of them.
  • the operating instructions may include various operating instructions for implementing various operations.
  • the processor 903 controls the operation of the terminal device.
  • the various components of the terminal device are coupled together through a bus system.
  • the bus system may also include a power bus, a control bus, and a status signal bus.
  • various buses are referred to as bus systems in the figure.
  • the method disclosed in the foregoing embodiment of the present application may be applied to the processor 903 or implemented by the processor 903.
  • the processor 903 may be an integrated circuit chip with signal processing capability. In the implementation process, the steps of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 903 or instructions in the form of software.
  • the above-mentioned processor 903 may be a general-purpose processor, a digital signal processing (digital signal processing, DSP), a microprocessor or a microcontroller, and may further include an application specific integrated circuit (ASIC), field programmable Field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • DSP digital signal processing
  • FPGA field programmable Field-programmable gate array
  • the processor 903 can implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of the present application.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory 904, and the processor 903 reads the information in the memory 904, and completes the steps of the foregoing method in combination with its hardware.
  • the receiver 901 can be used to receive input digital or character information, and to generate signal input related to the relevant settings and function control of the terminal device.
  • the transmitter 902 can be used to output digital or character information through the first interface; the transmitter 902 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 902 can also include display devices such as a display screen .
  • the processor 903 is configured to execute the steps described in FIG. 3a in the foregoing embodiment and the corresponding embodiment. Specifically, the processor 903 may be configured to execute the following steps:
  • the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode;
  • the second target image is decoded by the first decoding method. If the decoding result is not obtained, the second target image is decoded by the second decoding method. For barcodes with image characteristics, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the method further includes:
  • the zoom-in adjustment parameter is determined according to the ratio and adjusted according to the zoom-in Parameter to adjust the parameters of the camera.
  • the method further includes:
  • the exposure adjustment parameter is determined according to the brightness, and the camera parameter adjustment is performed according to the exposure adjustment parameter.
  • the method further includes:
  • the second target image is decoded by a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method.
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method Decoding success rate.
  • the first image and the second image are different image frames obtained in a process of scanning the same barcode by the terminal.
  • the embodiment of the application provides a barcode recognition method, the method includes: acquiring a first image, the first image includes a first target barcode; decoding the first image by a first decoding method; if If the decoding result is not obtained, a second image is obtained, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode; by the first decoding method
  • the second target image is decoded, and if the decoding result is not obtained, the second target image is decoded by a second decoding method, wherein, for barcodes with the same image characteristics, the first
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the processor 903 is configured to:
  • the target decoding method for the first image is determined from the decoding method set, where the decoding method set includes the first decoding method and the second decoding method;
  • the decoding success rate of the second decoding method is higher than that of the first decoding method, and the probability value of the first decoding method being invoked is greater than that of the second decoding method.
  • the probability value of the code method being called.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and /Or, for the same barcode in the image whose brightness is less than the first preset brightness, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and/or, For the same barcode with a brightness greater than a second preset brightness in an image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • the set of decoding methods further includes: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding The decoding success rate of the method.
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method for the same barcode whose color feature is inverted color; and/or, for the image For the same barcode with a middle completeness less than a preset value, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method; Assuming that the degree of difference between shapes is greater than the same barcode with a preset degree of difference, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
  • FIG. 10 is a schematic diagram of a structure of the server provided by the embodiment of the present application.
  • One or more central processing units (CPU) 1022 e.g., one or more processors
  • memory 1032 e.g., one or more storage media 1030 for storing application programs 1042 or data 1044 (e.g., one or one storage medium for storing data 1044) equipment).
  • the memory 1032 and the storage medium 1030 may be short-term storage or permanent storage.
  • the program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the training device.
  • the central processing unit 1022 may be configured to communicate with the storage medium 1030, and execute a series of instruction operations in the storage medium 1030 on the server 1000.
  • the server 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058, and/or one or more operating systems 1041, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • operating systems 1041 such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
  • the central processing unit 1022 is configured to execute the multiple barcode identification method described in the foregoing embodiment.
  • the embodiment of the present application also provides a product including a computer program, which when running on a computer, causes the computer to execute the steps of the method for identifying multiple barcodes.
  • An embodiment of the present application also provides a computer-readable storage medium, which stores a program for signal processing, and when it runs on a computer, the computer executes Figure 3a and the corresponding The steps described in the example. Specifically, the computer can be used to perform the following steps:
  • the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode;
  • the second target image is decoded by the first decoding method. If the decoding result is not obtained, the second target image is decoded by the second decoding method. For barcodes with image characteristics, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • the method further includes:
  • the zoom-in adjustment parameter is determined according to the ratio and adjusted according to the zoom-in Parameter to adjust the parameters of the camera.
  • the method further includes:
  • the exposure adjustment parameter is determined according to the brightness, and the camera parameter adjustment is performed according to the exposure adjustment parameter.
  • the method further includes:
  • the second target image is decoded by a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than The decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method.
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
  • the decoding success rate of the third decoding method is higher than that of the second decoding method Decoding success rate.
  • the first image and the second image are different image frames obtained in a process of scanning the same barcode by the terminal.
  • the embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium stores a program for signal processing, and when it runs on a computer, the computer executes:
  • the target decoding method for the first image is determined from the decoding method set, where the decoding method set includes the first decoding method and the second decoding method;
  • the decoding success rate of the second decoding method is higher than that of the first decoding method, and the probability value of the first decoding method being invoked is greater than that of the second decoding method.
  • the probability value of the code method being called.
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and /Or, for the same barcode in the image whose brightness is less than the first preset brightness, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and/or, For the same barcode with a brightness greater than a second preset brightness in an image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
  • the set of decoding methods further includes: a third decoding method, wherein, for barcodes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding The decoding success rate of the method.
  • the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method for the same barcode whose color feature is inverted color; and/or, for the image For the same barcode with a middle completeness less than a preset value, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method; Assuming that the degree of difference between shapes is greater than the same barcode with a preset degree of difference, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
  • the embodiment of the application provides a barcode recognition method, the method includes: acquiring a first image, the first image includes a first target barcode; decoding the first image by a first decoding method; if If the decoding result is not obtained, a second image is obtained, the second image includes a second target barcode, and the first target barcode and the second target barcode correspond to the same barcode; by the first decoding method
  • the second target image is decoded, and if the decoding result is not obtained, the second target image is decoded by a second decoding method, wherein, for barcodes with the same image characteristics, the first
  • the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
  • FIG. 11 is a schematic diagram of an application scenario of a barcode recognition method provided by an embodiment of the application.
  • the barcode recognition method provided in this embodiment includes:
  • the user can open the barcode recognition function on some applications and select the barcode scan code. For example, when the user wants to add a friend of a certain application, he can click the scan code control corresponding to the application.
  • the terminal can receive the user's barcode recognition instruction.
  • the sensor of the terminal can recognize the user's click operation. If the click operation is for the barcode scanning function, the processor can call the code in the memory to recognize the barcode received from the user Identify instructions.
  • the terminal invokes the camera function in response to the barcode recognition instruction, and further, the user can photograph a certain area through the camera of the terminal, and the area includes the barcode.
  • the processor of the terminal may call the code in the memory to call the camera function in response to the barcode recognition instruction.
  • the terminal may photograph the area including the barcode to obtain the preview stream.
  • the processor of the terminal may call the code in the memory to process the image data captured by the camera to obtain the preview stream.
  • the terminal may obtain a frame of image from the preview stream as the first image.
  • the terminal may obtain a frame of image from the preview stream as the first image.
  • the processor of the terminal may call the code in the memory to obtain the first image including the first target barcode from the preview stream.
  • the terminal can obtain a frame of image from the preview stream as the second image.
  • the terminal can obtain a frame of image from the preview stream as the second image.
  • the processor of the terminal may call the code in the memory to decode the first image by the first decoding method, and if the decoding result is not obtained, obtain the second image including the second target barcode from the preview stream .
  • step 304 in the foregoing embodiment, which will not be repeated here.
  • the processor of the terminal may call the code in the memory to decode the first image by the first decoding method, and if the decoding result is not obtained, obtain the second image including the second target barcode from the preview stream .
  • the naming or numbering of the steps appearing in this application does not mean that the steps in the method flow must be executed in the time/logical order indicated by the naming or numbering.
  • the named or numbered process steps can be implemented according to the The technical purpose changes the execution order, as long as the same or similar technical effects can be achieved.
  • the division of modules appearing in this application is a logical division. In actual applications, there can be other divisions. For example, multiple modules can be combined or integrated in another system, or some features can be ignored , Or not to execute, in addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, and the indirect coupling or communication connection between the modules may be electrical or other similar forms. There are no restrictions in the application.
  • the modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed to multiple circuit modules, and some or all of the modules can be selected according to actual needs. The purpose of this application program.
  • the device embodiments described above are only illustrative, and the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physically separate.
  • the physical unit can be located in one place or distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the connection relationship between the modules indicates that they have a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
  • this application can be implemented by means of software plus necessary general hardware.
  • it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, dedicated memory, Dedicated components and so on to achieve.
  • all functions completed by computer programs can be easily implemented with corresponding hardware.
  • the specific hardware structures used to achieve the same function can also be diverse, such as analog circuits, digital circuits or special-purpose circuits. Circuit etc.
  • software program implementation is a better implementation in more cases.
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including several instructions to make a computer device (which can be a personal computer, training device, or network device, etc.) execute the various embodiments described in this application method.
  • a computer device which can be a personal computer, training device, or network device, etc.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, training device, or data.
  • the center uses wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) to transmit to another website, computer, training equipment, or data center.
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a training device or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).

Landscapes

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

Abstract

一种条码识别方法,应用于图像识别领域,包括:获取第一图像,所述第一图像包括第一目标条码(301);通过第一译码方法对所述第一图像进行译码(302);若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码(303);通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率(304)。通过对多帧图像采取不同的译码策略,可以减少复杂尝试带来的单帧耗时长和算力大的问题。

Description

一种条码识别方法以及相关设备
本申请要求于2020年03月16日提交中国专利局、申请号为202010183928.3、发明名称为“一种条码识别方法以及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及图像识别领域,尤其涉及一种条码识别方法以及相关设备。
背景技术
实时扫码功能是具有识别商品条形码和二维码图片的功能,例如读取普通商品包装上的一维码,收付款的二维码等,支持广泛的码型,支持复杂的场景,以及快速响应是实时扫码需要达成的目标。
条形码读取器可以基于图像捕获参数顺序地捕获多帧图像,并串行利用多种译码方法对获取到的图像帧进行译码,直到得到译码结果。然而,现有技术中,针对于每一帧图像都采用固定方式的串行译码策略,算力和时间开销较大。
发明内容
本申请实施例提供了一种条码识别方法以及相关设备,过对多帧图像采取不同的译码策略,可以减少复杂尝试带来的单帧耗时长和算力大的问题。
第一方面,本申请实施例提供了一种条码识别方法,所述方法包括:获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
本申请实施例中,第一图像中的第一目标条码可以包括一维码或二维码。示例性的,一维码的种类可以包括但不限于EAN-8一维条码,EAN-13,UPC-A一维条码,UPC-E一维条码,Codabar一维条码,Code 39一维条码,Code 93一维条码,Code 128一维条码以及ITF一维条码。二维码的种类可以包括但不限于PDF417,Aztec,PDF 417二维条码,Datamatrix二维条码,Maxicode二维条码,Code 49,Code 16K,Code one。
本申请实施例中,第一译码方法可以对图像进行特征检测,定位条码或二维码的位置及大小,并使用全局二值化方法将亮度图像转化为二值图像,使用各码型解码器逐一串行尝试解码,第一译码方法的算力开销较小,且针对于正常光照、正常距离、正常形状的常规条码场景,第一译码方法具有较好的效果,然而,针对于远距离、曝光异常(过曝、过暗)等复杂场景中的条码,第一译码方法的译码成功率较低。
本申请实施例中,相比于第一译码方法,第二译码方法可以通过增加尝试不同二值化方法,提高二维码特征定位标志检出率,例如,自适应二值化、局部二值化方法等。这些额外的尝试对于条码的译码定位有增强作用,进而使放大判断更加容易,但相对于第一译 码方法会带来额外的算力及时间开销,不符合快速解码的定位,故而将其设定为第二译码方法。同时,第二译码方法还可以额外计算检测区域亮度,用于曝光调节判断和放大调解判断。
本申请实施例中,第三译码方法可以通过尝试多种图像处理方法,尝试解出其他难例和反色二维码,例如,高斯模糊降噪、缩放图像尺寸、Gamma拉亮、对比度增强及二值图取反等。这些尝试大多需要引入相当多的额外算力和时间消耗,同时其对应适用的场景比较少见,不适合每帧都尝试,故可选择将其放入优先度低的第三译码方法。
本申请实施例提供了一种条码识别方法,所述方法包括:获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
在第一方面的一种可选设计中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第一方面的一种可选设计中,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第一方面的一种可选设计中,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第一方面的一种可选设计中,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
在第一方面的一种可选设计中,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
在第一方面的一种可选设计中,所述通过第二译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第一方面的一种可选设计中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第一方面的一种可选设计中,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第一方面的一种可选设计中,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第一方面的一种可选设计中,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
第二方面,本申请提供了一种条码识别方法,所述方法包括:
获取第一图像,所述第一图像包括第一目标条码;
根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值。
在第二方面的一种可选设计中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第二方面的一种可选设计中,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第二方面的一种可选设计中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
第三方面,本申请提供了一种条码识别装置,包括:
获取模块,用于获取第一图像,所述第一图像包括第一目标条码;
第一译码模块,用于通过第一译码方法对所述第一图像进行译码;
若未得到译码结果,则所述获取模块,还用于获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
第二译码模块,用于通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第三方面的一种可选设计中,针对于图像中条码占有的像素数量小于预设数量的同 一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第三方面的一种可选设计中,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第三方面的一种可选设计中,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第三方面的一种可选设计中,所述装置还包括:
确定模块,用于若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
在第三方面的一种可选设计中,所述确定模块还用于:若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
在第三方面的一种可选设计中,若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第三方面的一种可选设计中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第三方面的一种可选设计中,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第三方面的一种可选设计中,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第三方面的一种可选设计中,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
第四方面,本申请提供了一种条码识别装置,所述装置包括:
获取模块,用于获取第一图像,所述第一图像包括第一目标条码;
确定模块,用于根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值;
译码模块,用于利用所述目标译码方法对所述第一图像进行译码。
在第四方面的一种可选设计中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第四方面的一种可选设计中,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第四方面的一种可选设计中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
第五方面,本申请提供了一种终端设备,包括:一个或多个处理器;一个或多个存储器;多个应用程序;以及一个或多个程序,其中所述一个或多个程序被存储在所述存储器中,当所述一个或者多个程序被所述处理器执行时,使得所述终端设备执行如下步骤:
获取第一图像,所述第一图像包括第一目标条码;
通过第一译码方法对所述第一图像进行译码;
若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第五方面的一种可选设计中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第五方面的一种可选设计中,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第五方面的一种可选设计中,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第五方面的一种可选设计中,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
在第五方面的一种可选设计中,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
在第五方面的一种可选设计中,所述通过第二译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对 于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第五方面的一种可选设计中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第五方面的一种可选设计中,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第五方面的一种可选设计中,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第五方面的一种可选设计中,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
终端设备还可以执行如下步骤:
获取第一图像,所述第一图像包括第一目标条码;
根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值;
利用所述目标译码方法对所述第一图像进行译码。
在第五方面的一种可选设计中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
在第五方面的一种可选设计中,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
在第五方面的一种可选设计中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
第六方面,本申请提供了一种服务器,包括:一个或多个处理器;一个或多个存储器;以及一个或多个程序,其中所述一个或多个程序被存储在所述存储器中,当所述一个或者多个程序被所述处理器执行时,使得所述服务器执行上述第一方面及第一方面的可能实现方式中任一项所述的步骤,或者上述第二方面及第二方面的可能实现方式中任一项所述的步骤。
第七方面,本申请提供了一种装置,该装置包含在终端设备中,该装置具有实现上述 第一方面任一方面的可能实现方式中任一项终端装置行为的功能,或者上述第二方面任一方面的可能实现方式中任一项终端装置行为的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块或单元。
第八方面,本申请提供了一种计算机存储介质,包括计算机指令,当计算机指令在电子设备或服务器上运行时,使得电子设备执行上述第一方面及第一方面的可能实现方式中任一项所述的步骤,或者上述第二方面及第二方面的可能实现方式中任一项所述的步骤。
第九方面,本申请提供了一种计算机程序产品,当计算机程序产品在电子设备或服务器上运行时,使得电子设备执行上述第一方面及第一方面的可能实现方式中任一项所述的步骤,或者上述第二方面及第二方面的可能实现方式中任一项所述的步骤。
本申请实施例提供了一种条码识别方法,所述方法包括:获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
附图说明
图1为本申请实施例提供的终端设备的结构示意;
图2为本申请实施例的终端设备的软件结构框图;
图3a为本申请实施例提供的一种条码识别方法的实施例示意图;
图3b为本申请实施例提供的一种识别场景示意;
图3c为本申请实施例提供的一种识别场景示意;
图4为本申请实施例提供的一种条码识别方法的实施例示意图;
图5为本申请实施例提供的一种条码识别方法的实施例示意图;
图6为本申请实施例提供的一种条码识别方法的实施例示意图;
图7为本申请实施例提供的一种条码识别装置的结构示意;
图8为本申请实施例提供的一种条码识别装置的结构示意;
图9为本申请实施例提供的一种终端设备的结构示意;
图10为本申请实施例提供的服务器的一种结构示意图;
图11为本申请实施例提供的一种条码识别方法的实施例示意图。
具体实施方式
下面结合本发明实施例中的附图对本发明实施例进行描述。本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类 似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的术语在适当情况下可以互换,这仅仅是描述本申请的实施例中对相同属性的对象在描述时所采用的区分方式。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,以便包含一系列单元的过程、方法、系统、产品或设备不必限于那些单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它单元。
为便于理解,下面将对本申请实施例提供的终端设备100的结构进行示例说明。参见图1,图1是本申请实施例提供的终端设备100的结构示意图。
如图1所示,终端设备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,I1C)接口,集成电路内置音频(inter-integrated circuit sound,I1S)接口,脉冲编码调制(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)接口等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端设备100的结构限定。在本申请另一些实施例中,终端设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
终端设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。终端设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在终端设备100上的包括1G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线2转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在终端设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线1接收电磁波,将电磁波信号调频以 及滤波处理,将处理后的信号发送到处理器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的系统输出的各个界面。终端设备100输出的各个界面可参考后续实施例的相关描述。
终端设备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可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG1,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现终端设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行终端设备100的各种功能应用以及数据处理。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储终端设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
终端设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。在一些可行的实施方式中,音频模块170可用于播放视频对应的声音。例如,显示屏194显示视频播放画面时,音频模块170输出视频播放的声音。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动终端设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。陀螺仪传感器180B可以用于确定终端设备100的运动姿态。气压传感器180C用于测量气压。
加速度传感器180E可检测终端设备100在各个方向上(一般为三轴)加速度的大小。当 终端设备100静止时可检测出重力的大小及方向。还可以用于识别终端设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。
环境光传感器180L用于感知环境光亮度。
指纹传感器180H用于采集指纹。
温度传感器180J用于检测温度。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于终端设备100的表面,与显示屏194所处的位置不同。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。终端设备100可以接收按键输入,产生与终端设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。
以上是对终端设备100的结构进行的描述,接下来对终端设备的软件结构进行说明。终端设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明终端设备100的软件结构。
图2是本申请实施例的终端设备100的软件结构框图。
如图2所示,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将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绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
为了便于理解,本申请以下实施例将以具有图1和图2所示结构的电子设备为例,结合附图和应用场景,对本申请实施例提供的一种条码识别方法进行具体阐述。
参照图3a,图3a为本申请实施例提供的一种条码识别方法的实施例示意图,如图3a示出的那样,本申请提供的条码识别方法,包括:
301、获取第一图像,所述第一图像包括第一目标条码。
本申请实施例中,终端设备可以获取包括第一目标条码的第一图像,第一图像可以是视频中的一个图像帧。
终端设备可以通过自身携带的摄像头拍摄获取到第一图像。
在一种实施例中,用户可以打开某些应用程序上的条码识别功能,并选择条码扫码,该功能会调用终端设备上的摄像头,进而,用户可以通过终端设备的摄像头拍摄某一区域,该区域设置有条码,终端设备可以控制摄像头采集预览流,进而使得终端设备可以获取预览流中的一个图像帧作为第一图像,该第一图像包括第一目标条码。
本申请实施例中,第一图像中的第一目标条码可以包括一维码或二维码。
示例性的,一维码的种类可以包括但不限于EAN-8一维条码,EAN-13,UPC-A一维条码,UPC-E一维条码,Codabar一维条码,Code 39一维条码,Code 93一维条码,Code 128一维条码以及ITF一维条码,参照图3b,图3b为当第一目标条码为一维码时第一图像的一种示意。
二维码的种类可以包括但不限于PDF417,Aztec,PDF 417二维条码,Datamatrix二维条码,Maxicode二维条码,Code 49,Code 16K,Code one。参照图3c,图3c为当第一目标条码为二维码时第一图像的一种示意。
此外,终端可以在本地相册或者云端相册中获取第一图像。
在一种实施例中,用户可以打开某些应用程序上的条码识别功能,并选择从本地相册或云端相册中选择图像,该功能会打开终端设备上的本地相册或云端相册,用户可以在终端设备上的本地相册或云端相册中选择一幅要进行条码识别的第一图像,该第一图像可以包括第一目标条码,进而,终端设备可以在本地相册或者云端相册中获取到包括第一目标条码的第一图像。
本申请实施例中,终端设备在获取到第一图像之后,可以对第一图像进行译码。
具体的,译码过程可以分为多个优先级流程(包括下文描述的第一译码方法、第二译码方法和第三译码方法),每种优先级流程相对独立,并各有侧重。示例性的,第一优先级流程侧重快速解码;第二优先级流程侧重放大、曝光调节等相机参数调节,第三优先级流程侧重于针对一个特殊的码型进行解码。
可选地,本申请实施例中,终端设备在接收到第一图像之后,会判断第一图像需要激活哪些优先级。
在一种实施例中,会确定第一图像是进入算法的第几帧图片,并判断当前帧需要激活哪些译码方法。例如,第一帧图像激活第一译码方法,第二帧图像激活第一译码方法和第二译码方法,第三帧图像则激活第一译码方法和第三译码方法等等。接下来,可以根据激活的译码方法,确定需要进行哪些译码方法。
302、通过第一译码方法对所述第一图像进行译码。
本申请实施例中,若确定第一图像激活的译码方法为第一译码方法之后,可以采用第一译码方法对第一图像进行译码。
本申请实施例中,第一译码方法可以对图像进行特征检测,定位条码或二维码的位置及大小,并使用全局二值化方法将亮度图像转化为二值图像,使用各码型解码器逐一串行尝试解码,第一译码方法的算力开销较小,且针对于正常光照、正常距离、正常形状的常规条码场景,第一译码方法具有较好的效果,然而,针对于远距离、曝光异常(过曝、过 暗)等复杂场景中的条码,第一译码方法的译码成功率较低。
303、若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码。
本申请实施例中,若通过第一译码方法对所述第一图像进行译码之后,若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码。
本申请实施例中,第一图像和第二图像可以为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧,由于拍摄视角的变化或者拍摄位置的变化,第一目标条码在第一图像中的像素位置可以与第二目标条码在第二图像中的像素位置不同,由于图像清晰度的不同,或者条码在图像中的完整度的不同,第一目标条码在第一图像中的图像特征可以与第二目标条码在第二图像中的图像特征不同,但,第一目标条码和第二目标条码包括的解析信息相同,即,若第一目标条码和第二目标条码在图像中为完整的条码,则第一目标条码和第二目标条码包括的解析信息相同,且对第一目标条码和第二目标条码译码成功后得到的解析结果相同。本申请实施例中,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
304、通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
本申请实施例中,终端设备在获取到第二图像之后,可以通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
本申请实施例中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;其中,译码成功率可以表示译码方法的综合性能,可以表示针对于条码在不同场景下进行多次译码后的译码成功率的总体结果,可以是通过多次扫码试验进行统计得到的综合概率结果,而并不限定于某一次扫码的成功率。例如,针对于某些具有相似特征的条码进行多次或不同环境译码,第二译码方法的译码成功率高于第一译码方法。
具体的,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率的具体情况可以包括但是不限于为如下几种:
本申请实施例中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率。
本申请实施例中,当拍摄点距离条码的距离过大时,图像中的条码的尺寸大小会很小,即图像中的条码占有的像素数量会很少,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率,其中,预设数量可以根据实际情况选择,这里并不限定。
本申请实施例中,针对于图像中亮度小于第一预设亮度的条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率,其中,第一预设亮度可以根据实际 情况选择,这里并不限定。
本申请实施例中,针对于图像中亮度大于第二预设亮度的条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率,其中,第二预设亮度可以根据实际情况选择,这里并不限定。
本申请实施例中,相比于第一译码方法,第二译码方法可以通过增加尝试不同二值化方法,提高二维码特征定位标志检出率,例如,自适应二值化、局部二值化方法等。这些额外的尝试对于条码的译码定位有增强作用,进而使放大判断更加容易,但相对于第一译码方法会带来额外的算力及时间开销,不符合快速解码的定位,故而将其设定为第二译码方法。同时,第二译码方法还可以额外计算检测区域亮度,用于曝光调节判断和放大调解判断。
需要说明的是,本申请实施例中的第一译码方法和第二译码方法可以通过神经网络实现,其中第二译码方法对应的神经网络模型在训练过程中采用的训练样本和/或收敛条件可以与第一译码方法采用的训练样本和/或收敛条件不同(例如,第二译码方法的训练样本为具有一定亮度特征或者完整度特征的条码,或者第二译码方法的收敛条件要求更高,译码精度更高),进而使得训练得到的第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。换一种表述方式,当条码的在图像中的检测区域面积与图像面积比例低于一定值,则依据该比例,调整相机放大系数,放大条码区域至合适水平。
示例性的,若第二图像为相机基于第一放大等级拍摄得到的,若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数为第三放大等级,相机可以将放大等级调整为第三放大等级,进而提高之后相机拍摄得到的图像帧中条码在图像中占有的像素数量与图像的像素数量的比例。
若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。本申请实施例中,当条码检测区域平均亮度低于或高于一定范围,调节相机曝光等级,以矫正该区域亮度水平至一定范围。
示例性的,若第二图像为相机基于相机曝光等级1拍摄得到的,若所述第二目标条码在所述第二图像中的亮度小于某一预设值,则根据所述亮度确定曝光调整参数为相机曝光等级2,即提高相机曝光等级,进而提高之后相机拍摄得到的图像帧中条码的亮度。
示例性的,若第二图像为相机基于相机曝光等级2拍摄得到的,若所述第二目标条码在所述第二图像中的亮度大于某一预设值,则根据所述亮度确定曝光调整参数为相机曝光等级1,即减小相机曝光等级,进而减少之后相机拍摄得到的图像帧中条码的亮度。
本申请实施例中,若未得到译码结果,则还可以通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高 于所述第二译码方法的译码成功率。
本申请实施例中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
本申请实施例中,图像中的条码可以是一些反色条码,此时,第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
本申请实施例中,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
本申请实施例中,图像中的条码可以由于污渍或者其他遮挡物,或者由于条码本身的破损,其完整度可以小于预设值,此时,第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
本申请实施例中,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
本申请实施例中,预设形状可以是矩形或者圆形等规则图形,图像中的条码可以是一些特殊的形状,例如五边形、梯形等等,图像中的条码与预设形状之间的差异度大于预设差异度可以理解为不是矩形或者不是圆形等等,或者,与矩形或者圆形相似,但是相比于数学上的矩形,其具有一定的形变,且形变程度超出预设的差异度,此时,第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
本申请实施例中,第三译码方法可以通过尝试多种图像处理方法,尝试解出其他难例和反色二维码,例如,高斯模糊降噪、缩放图像尺寸、Gamma拉亮、对比度增强及二值图取反等。这些尝试大多需要引入相当多的额外算力和时间消耗,同时其对应适用的场景比较少见,不适合每帧都尝试,故可选择将其放入优先度低的第三译码方法。
需要说明的是,本申请实施例中的第二译码方法和第三译码方法可以通过神经网络实现,其中第三译码方法对应的神经网络模型在训练过程中采用的训练样本和/或收敛条件可以与第二译码方法采用的训练样本和/或收敛条件不同(例如,第三译码方法的训练样本为具有一定颜色特征或者形状特征的条码,或者第三译码方法的收敛条件要求更高,译码精度更高),进而使得训练得到的第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
本申请实施例中,针对于不同的图像帧,可以采用不同的译码策略组合,接下来进行详细说明:
示例一、第一图像采用第一译码方法,第二图像采用第一译码方法和第二译码方法,第三图像采用第一译码方法,第四图像采用第一译码方法和第二译码方法。
本申请实施例中,可以获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码;若未得到译码结果,则获取第三图像,所述第三图像包括第三目标条码,所述第一目标条码和所述第三目标条码对应于同一个条码;通过第一译码方法 对所述第三图像进行译码;若未得到译码结果,则获取第四图像,所述第四图像包括第四目标条码,所述第一目标条码和所述第四目标条码对应于同一个条码;通过所述第一译码方法对所述第四目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第四目标图像进行译码。
其中,第一图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第二图像采用第一译码方法和第二译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第三图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第四图像采用第一译码方法和第二译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述。
本申请实施例中,由于所述第二译码方法的算力开销大于所述第一译码方法的算力开销,所述第二译码方法的时间开销大于所述第一译码方法的时间开销,因此在一帧图像(第一图像)进行译码的过程中,采用第一译码方法进行译码,若没有译码成功,则采用第一译码方法对另一帧图像(第二图像)进行译码,若没有译码成功,则采用第二译码方法对第二图像进行译码,相比于,每一帧图像都采用相同的译码方法,本实施例中,过对连续多帧图像采取不同流程策略,周期性调节单帧扫码流程长短,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
关于第一译码方法、第二译码方法和第三译码方法可以参照上述实施例中的描述,这里不再赘述。
示例二、第一图像采用第一译码方法,第二图像采用第一译码方法和第三译码方法,第三图像采用第一译码方法,第四图像采用第一译码方法和第三译码方法。
本申请实施例中,可以获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码;若未得到译码结果,则获取第三图像,所述第三图像包括第三目标条码,所述第一目标条码和所述第三目标条码对应于同一个条码;通过第一译码方法对所述第三图像进行译码;若未得到译码结果,则获取第四图像,所述第四图像包括第四目标条码,所述第一目标条码和所述第四目标条码对应于同一个条码;通过所述第一译码方法对所述第四目标图像进行译码,若未得到译码结果,则通过第三译码方法对所述第四目标图像进行译码。
其中,第一图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第二图像采用第一译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第三图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第四图像采用第一译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述。
本申请实施例中,由于所述第三译码方法的算力开销大于所述第一译码方法的算力开销,所述第三译码方法的时间开销大于所述第一译码方法的时间开销,因此在一帧图像(第一图像)进行译码的过程中,采用第一译码方法进行译码,若没有译码成功,则采用第一译码方法对另一帧图像(第二图像)进行译码,若没有译码成功,则采用第三译码方法对第二图像进行译码,相比于,每一帧图像都采用相同的译码方法,本实施例中,过对连续多帧图像采取不同流程策略,周期性调节单帧扫码流程长短,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
关于第一译码方法、第二译码方法和第三译码方法可以参照上述实施例中的描述,这里不再赘述。
示例三、第一图像采用第一译码方法,第二图像采用第一译码方法、第二译码方法和第三译码方法,第三图像采用第一译码方法,第四图像采用第一译码方法、第二译码方法和第三译码方法。
本申请实施例中,可以获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码;若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码;若未得到译码结果,则获取第三图像,所述第三图像包括第三目标条码,所述第一目标条码和所述第三目标条码对应于同一个条码;通过第一译码方法对所述第三图像进行译码;若未得到译码结果,则获取第四图像,所述第四图像包括第四目标条码,所述第一目标条码和所述第四目标条码对应于同一个条码;通过所述第一译码方法对所述第四目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第四目标图像进行译码;若未得到译码结果,则通过第三译码方法对所述第四目标图像进行译码。
其中,第一图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第二图像采用第一译码方法、第二译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第三图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第四图像采用第一译码方法、第二译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述。
本申请实施例中,由于第二译码方法和第三译码方法的算力开销大于所述第一译码方法的算力开销,第二译码方法和第三译码方法的时间开销大于所述第一译码方法的时间开销,因此在一帧图像(第一图像)进行译码的过程中,采用第一译码方法进行译码,若没有译码成功,则采用第一译码方法对另一帧图像(第二图像)进行译码,若没有译码成功,则采用第二译码方法和第三译码方法对第二图像进行译码,相比于,每一帧图像都采用相同的译码方法,本实施例中,过对连续多帧图像采取不同流程策略,周期性调节单帧扫码流程长短,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功 期望。
关于第一译码方法、第二译码方法和第三译码方法可以参照上述实施例中的描述,这里不再赘述。
示例四、第一图像采用第一译码方法,第二图像采用第一译码方法和第二译码方法,第三图像采用第一译码方法、第二译码方法和第三译码方法,第四图像采用第一译码方法和第三译码方法。
其中,第一图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第二图像采用第一译码方法和第二译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第三图像采用第一译码方法、第二译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第四图像采用第一译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述。
示例五、第一图像采用第一译码方法,第二图像采用第一译码方法和第二译码方法,第三图像采用第一译码方法,第四图像采用第一译码方法和第三译码方法,第五图像采用第一译码方法,第六图像采用第一译码方法和第二译码方法,第七图像采用第一译码方法,第八图像采用第一译码方法和第三译码方法。
其中,第一图像采用第一译码方法进行译码的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第二图像采用第一译码方法和第二译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第三图像采用第一译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第四图像采用第一译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第五图像采用第一译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第六图像采用第一译码方法和第二译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述,第七图像采用第一译码方法的具体过程可以参照上述实施例中步骤301和步骤302对应的描述,这里不再赘述,第八图像采用第一译码方法和第三译码方法的具体过程可以参照上述实施例中步骤303和步骤304对应的描述,这里不再赘述。
需要说明的是,以上译码策略仅为一种示意,实际应用中,可以根据需求灵活选择,本申请并不限定。
需要说明的是,本申请实施例中的第一译码方法、第二译码方法和第三译码方法可以通过神经网络实现,本申请并不限定。
本申请实施例提供了一种条码识别方法,所述方法包括:获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过 上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
参照图4,图4为本申请实施例提供的一种条码识别方法的示意,如图4中示出的那样,本申请实施例提供的一种条码识别方法包括:
401、获取第一图像,所述第一图像包括第一目标条码;
步骤401的描述可以参照上述实施例中步骤301的描述,这里不再赘述。
402、根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值。
本申请实施例中,概率值可以表示对应的译码方法被选择作为当前图像帧的可能性。
本申请实施例中,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的条码,所述第二译码方法的译码成功率可以高于所述第一译码方法的译码成功率。
本申请实施例中,所述译码方法集合还可以包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
本申请实施例中,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率可以高于所述第二译码方法的译码成功率。
示例性的,本申请实施例中,第一译码方法的概率值可以设置为0.7,第二译码方法的概率值可以设置为0.2,第三译码方法的概率值可以设置为0.1。
403、利用所述目标译码方法对所述第一图像进行译码。
参照图5,图5为本申请实施例提供的一种条码识别方法的示意,如图5中示出的那样,本申请实施例提供的一种条码识别方法包括:
501、终端设备获取第一图像,所述第一图像包括第一目标条码。
步骤501的具体描述可以参照上述实施例中步骤301的描述,这里不再赘述。
502、终端设备将所述第一图像发送至服务器;
步骤502的具体描述可以参照上述实施例中步骤301的描述,这里不再赘述。
503、服务器通过第一译码方法对所述第一图像进行译码;
步骤503的具体描述可以参照上述实施例中步骤302的描述,这里不再赘述。
504、服务器若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
步骤504的具体描述可以参照上述实施例中步骤303的描述,这里不再赘述。
505、服务器通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
步骤505的具体描述可以参照上述实施例中步骤304的描述,这里不再赘述。
本申请实施例提供了一种条码识别方法,所述方法包括:终端设备获取第一图像,所述第一图像包括第一目标条码;终端设备将所述第一图像发送至服务器;服务器通过第一译码方法对所述第一图像进行译码;服务器若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;服务器通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
参照图6,图6为本申请实施例提供的一种条码识别方法的示意,如图6中示出的那样,本申请实施例提供的一种条码识别方法包括:
601、获取当前图像帧作为第一图像。
步骤601的具体描述,可以参照步骤301的具体描述,这里不再赘述。
具体的,步骤601可以通过如下方式实现:
通过图1中示出的终端设备100的摄像头193拍摄得到图像数据,终端中的处理器可以调用存储器中的代码以将摄像头拍摄得到的图像数据处理为第一图像。可选的,终端中的处理器可以调用存储器中的代码来控制终端设备100中的视频编解码器等硬件设备将图像数据处理为第一图像。
602、通过第一译码方法对第一图像进行译码。
步骤602的具体描述,可以参照步骤302的具体描述,这里不再赘述。
本申请实施例中,步骤602可以通过如下方式实现:
通过图1中示出的终端设备100的处理器110调用存储器121中与第一译码方法相关的代码,进而实现通过第一译码方法对所述第一图像进行译码的功能。
6031、若得到译码结果,则译码成功,并结束当前条码识别流程。
6032、若未得到译码结果,则获取当前图像帧作为第二图像。
步骤6032的具体描述,可以参照步骤303的具体描述,这里不再赘述。
本申请实施例中,若未得到译码结果,则通过图1中示出的终端设备100的摄像头193拍摄得到图像数据,终端中的处理器可以调用存储器中的代码以将摄像头拍摄得到的图像数据处理为第二图像。
604、通过第一译码方法对第二图像进行译码。
本申请实施例中,终端设备可以通过调用存储器121中与第一译码方法相关的代码,进而实现通过第一译码方法对所述第一图像进行译码的功能。
6051、若得到译码结果,则译码成功,并结束当前条码识别流程。
6052、若未得到译码结果,则通过第二译码方法对第二图像进行译码。
步骤604、步骤6051和步骤6052的具体描述,可以参照步骤304的具体描述,这里不再赘述。
本申请实施例中,可以通过调用内部存储器121中与第一译码方法相关的代码,进而实现通过所述第一译码方法对所述第二目标图像进行译码的功能,且若未得到译码结果,则通过调用内部存储器121中与第二译码方法相关的代码,进而实现对所述第二目标图像进行译码的功能。
606、若得到译码结果,则译码成功,并结束当前条码识别流程。
607、若未得到译码结果,则判断是否需要调节相机参数,若需要调节相机参数,则调节相机参数。
本申请实施例中,可以通过调用内部存储器121中相关的代码,进而实现判断是否需要调节相机参数,若需要调节相机参数,则调节相机参数的功能。
608、获取当前图像帧作为第三图像。
本申请实施例还提供一种条码识别装置,请参阅图7,图7为本申请实施例提供的条码识别装置的一种结构示意图,条码识别装置700包括:
获取模块701,用于获取第一图像,所述第一图像包括第一目标条码。
具体的,获取模块701可以执行上述实施例中步骤301对应的步骤。
本申请实施例中,获取模块701可以通过图1中示出的终端设备100的摄像头193拍摄得到图像数据,终端中的处理器可以调用存储器中的代码以将摄像头拍摄得到的图像数据处理为第一图像。
可选的,终端中的处理器可以调用存储器中的代码来控制终端设备100中的视频编解码器等硬件设备将图像数据处理为第一图像。
第一译码模块702,用于通过第一译码方法对所述第一图像进行译码。
本申请实施例中,第一译码模块702可以作为处理器110中实现的一部分功能,通过调用内部存储器121中与第一译码方法相关的代码,进而实现通过第一译码方法对所述第一图像进行译码的功能。具体的,第一译码模块702可以执行上述实施例中步骤302对应的步骤。
若未得到译码结果,则所述获取模块701,还用于获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码。
具体的,获取模块701可以执行上述实施例中步骤303对应的步骤。
本申请实施例中,获取模块701可以通过图1中示出的终端设备100的摄像头193拍摄得到图像数据,终端中的处理器可以调用存储器中的代码以将摄像头拍摄得到的图像数 据处理为第二图像。
第二译码模块703,用于通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
本申请实施例中,第二译码模块703可以作为处理器110中实现的一部分功能,通过调用内部存储器121中与第一译码方法相关的代码,进而实现通过所述第一译码方法对所述第二目标图像进行译码的功能,且若未得到译码结果,则通过调用内部存储器121中与第二译码方法相关的代码,进而实现对所述第二目标图像进行译码的功能。具体的,第二译码模块703可以执行上述实施例中步骤304对应的步骤。
可选地,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,所述装置还包括:
确定模块,用于若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
可选地,所述确定模块还用于:若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
可选地,若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
本申请实施例提供了一种条码识别装置,其中,获取模块获取第一图像,所述第一图像包括第一目标条码;第一译码模块通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则所述获取模块获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;第二译码模块通过所述第一译码方法对 所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
本申请实施例提供了一种条码识别装置,包括:获取模块,用于获取第一图像,所述第一图像包括第一目标条码;第一译码模块,用于通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则所述获取模块,还用于获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;第二译码模块,用于通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
本申请实施例还提供一种条码识别装置,请参阅图8,图8为本申请实施例提供的条码识别装置的一种结构示意图,条码识别装置800包括:
获取模块801,用于获取第一图像,所述第一图像包括第一目标条码;
确定模块802,用于根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值;
译码模块803,用于利用所述目标译码方法对所述第一图像进行译码。
可选地,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
接下来介绍本申请实施例提供的一种终端设备,请参阅图9,图9为本申请实施例提供的终端设备的一种结构示意图,终端设备900具体可以表现为虚拟现实VR设备、手机、平板、笔记本电脑、智能穿戴设备等,此处不做限定。具体的,终端设备900包括:接收 器901、发射器902、处理器903和存储器904(其中终端设备900中的处理器903的数量可以一个或多个,图9中以一个处理器为例),其中,处理器903可以包括应用处理器9031和通信处理器9032。在本申请的一些实施例中,接收器901、发射器902、处理器903和存储器904可通过总线或其它方式连接。
存储器904可以包括只读存储器和随机存取存储器,并向处理器903提供指令和数据。存储器904的一部分还可以包括非易失性随机存取存储器(non-volatile random access memory,NVRAM)。存储器904存储有处理器和操作指令、可执行模块或者数据结构,或者它们的子集,或者它们的扩展集,其中,操作指令可包括各种操作指令,用于实现各种操作。
处理器903控制终端设备的操作。具体的应用中,终端设备的各个组件通过总线系统耦合在一起,其中总线系统除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图中将各种总线都称为总线系统。
上述本申请实施例揭示的方法可以应用于处理器903中,或者由处理器903实现。处理器903可以是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器903中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器903可以是通用处理器、数字信号处理器(digital signal processing,DSP)、微处理器或微控制器,还可进一步包括专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。该处理器903可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器904,处理器903读取存储器904中的信息,结合其硬件完成上述方法的步骤。
接收器901可用于接收输入的数字或字符信息,以及产生与终端设备的相关设置以及功能控制有关的信号输入。发射器902可用于通过第一接口输出数字或字符信息;发射器902还可用于通过第一接口向磁盘组发送指令,以修改磁盘组中的数据;发射器902还可以包括显示屏等显示设备。
本申请实施例中,在一种情况下,处理器903,用于执行上述实施例中图3a以及对应的实施例中描述的步骤。具体的,处理器903,可以用于执行如下步骤:
获取第一图像,所述第一图像包括第一目标条码;
通过第一译码方法对所述第一图像进行译码;
若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述 第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
可选地,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
可选地,所述通过第二译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
本申请实施例提供了一种条码识别方法,所述方法包括:获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
本申请实施例中,在一种情况下,处理器903,用于:
获取第一图像,所述第一图像包括第一目标条码;
根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值。
可选地,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
本申请实施例还提供了一种服务器,请参阅图10,图10是本申请实施例提供的服务器的一种结构示意图,服务器可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1022(例如,一个或一个以上处理器)和存储器1032,一个或一个以上存储应用程序1042或数据1044的存储介质1030(例如一个或一个以上海量存储设备)。其中,存储器1032和存储介质1030可以是短暂存储或持久存储。存储在存储介质1030的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对训练设备中的一系列指令操作。更进一步地,中央处理器1022可以设置为与存储介质1030通信,在服务器1000上执行存储介质1030中的一系列指令操作。
服务器1000还可以包括一个或一个以上电源1026,一个或一个以上有线或无线网络接口1050,一个或一个以上输入输出接口1058,和/或,一个或一个以上操作系统1041,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。
本申请实施例中,中央处理器1022,用于执行上述实施例中描述的多条码识别方法。
本申请实施例中还提供一种包括计算机程序产品,当其在计算机上运行时,使得计算机执行多条码识别方法的步骤。
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行上述实施例中图3a以及对应的实施例中描述的步骤。具体的,计算机可以用于执行如下步骤:
获取第一图像,所述第一图像包括第一目标条码;
通过第一译码方法对所述第一图像进行译码;
若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
可选地,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
可选地,所述通过第二译码方法对所述第二目标图像进行译码之后,所述方法还包括:
若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行:
获取第一图像,所述第一图像包括第一目标条码;
根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码, 所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值。
可选地,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
可选地,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
可选地,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
本申请实施例提供了一种条码识别方法,所述方法包括:获取第一图像,所述第一图像包括第一目标条码;通过第一译码方法对所述第一图像进行译码;若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。通过上述方式,过对多帧图像采取不同的译码策略,能够有效减少复杂尝试带来的单帧长耗时问题,及时刷新图像,提高扫码成功期望。
参照图11,图11为本申请实施例提供的一种条码识别方法的应用场景示意,如图11中示出的那样,本实施例提供的条码识别方法包括:
1101、接收用户的条码识别指令。
本申请实施例中,用户可以打开某些应用程序上的条码识别功能,并选择条码扫码,例如,当用户要添加某一应用程序的好友时,可以点击该应用程序对应的扫码控件,相应的,终端可以接收到用户的条码识别指令。
具体的,终端的传感器(例如图1中的压力传感器)可以识别出用户的点击操作,若点击操作针对于条码扫码功能,则处理器可以调用存储器中的代码来识别出接收到用户的条码识别指令。
1102、响应于条码识别指令,调用摄像头功能。
本申请实施例中,终端响应于条码识别指令,调用摄像头功能,进而,用户可以通过终端的摄像头拍摄某一区域,该区域包括条码。
具体的,终端的处理器可以调用存储器中的代码来响应于条码识别指令,调用摄像头功能。
1103、拍摄包括条码的区域,得到预览流;
本申请实施例中,终端可以拍摄包括条码的区域,得到预览流。
具体的,终端的处理器可以调用存储器中的代码来处理摄像头拍摄得到的图像数据,得到预览流。
1104、从预览流中获取包括第一目标条码的第一图像;
本申请实施例中,终端可以从预览流中获取一帧图像作为第一图像,具体可以参照上述实施例中步骤301的描述,这里不再赘述。
具体的,终端的处理器可以调用存储器中的代码来从预览流中获取包括第一目标条码的第一图像。
1105、通过第一译码方法对第一图像进行译码,若未得到译码结果,则从预览流中获取包括第二目标条码的第二图像。
本申请实施例中,若未得到译码结果,终端可以从预览流中获取一帧图像作为第二图像,具体可以参照上述实施例中步骤302和步骤303的描述,这里不再赘述。
具体的,终端的处理器可以调用存储器中的代码来通过第一译码方法对第一图像进行译码,若未得到译码结果,则从预览流中获取包括第二目标条码的第二图像。
1106、通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码。
具体可以参照上述实施例中步骤304的描述,这里不再赘述。
具体的,终端的处理器可以调用存储器中的代码来通过第一译码方法对第一图像进行译码,若未得到译码结果,则从预览流中获取包括第二目标条码的第二图像。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块。在本申请中出现的对步骤进行的命名或者编号,并不意味着必须按照命名或者编号所指示的时间/逻辑先后顺序执行方法流程中的步骤,已经命名或者编号的流程步骤可以根据要实现的技术目的变更执行次序,只要能达到相同或者相类似的技术效果即可。本申请中所出现的模块的划分,是一种逻辑上的划分,实际应用中实现时可以有另外的划分方式,例如多个模块可以结合成或集成在另一个系统中,或一些特征可以忽略,或不执行,另外,所显示的或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,模块之间的间接耦合或通信连接可以是电性或其他类似的形式,本申请中均不作限定。并且,作为分离部件说明的模块可以是也可以不是物理上的分离,可以是也可以不是物理模块,或者可以分布到多个电路模块中,可以根据实际的需要选择其中的部分或全部模块来实现本申请方案的目的。
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、ROM、RAM、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘(Solid State Disk,SSD))等。

Claims (30)

  1. 一种条码识别方法,其特征在于,所述方法包括:
    获取第一图像,所述第一图像包括第一目标条码;
    通过第一译码方法对所述第一图像进行译码;
    若未得到译码结果,则获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
    通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  2. 根据权利要求1所述的方法,其特征在于,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  3. 根据权利要求1或2所述的方法,其特征在于,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  4. 根据权利要求1至3任一所述的方法,其特征在于,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  5. 根据权利要求1至4任一所述的方法,其特征在于,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
    若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
  6. 根据权利要求1至5任一所述的方法,其特征在于,所述通过所述第一译码方法对所述第二目标图像进行译码之后,所述方法还包括:
    若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
  7. 根据权利要求1至6任一所述的方法,其特征在于,所述通过第二译码方法对所述第二目标图像进行译码之后,所述方法还包括:
    若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  8. 根据权利要求7所述的方法,其特征在于,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  9. 根据权利要求7或8所述的方法,其特征在于,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  10. 根据权利要求7至9任一所述的方法,其特征在于,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  11. 根据权利要求1至9任一所述的方法,其特征在于,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
  12. 一种条码识别方法,其特征在于,所述方法包括:
    获取第一图像,所述第一图像包括第一目标条码;
    根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值;
    利用所述目标译码方法对所述第一图像进行译码。
  13. 根据权利要求12所述的方法,其特征在于,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  14. 根据权利要求12或13所述的方法,其特征在于,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  15. 根据权利要求14所述的方法,其特征在于,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  16. 一种条码识别装置,其特征在于,包括:
    获取模块,用于获取第一图像,所述第一图像包括第一目标条码;
    第一译码模块,用于通过第一译码方法对所述第一图像进行译码;
    若未得到译码结果,则所述获取模块,还用于获取第二图像,所述第二图像包括第二目标条码,所述第一目标条码和所述第二目标条码对应于同一个条码;
    第二译码模块,用于通过所述第一译码方法对所述第二目标图像进行译码,若未得到译码结果,则通过第二译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  17. 根据权利要求16所述的装置,其特征在于,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  18. 根据权利要求16或17所述的装置,其特征在于,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  19. 根据权利要求16至18任一所述的装置,其特征在于,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  20. 根据权利要求16至19任一所述的装置,其特征在于,所述装置还包括:
    确定模块,用于若所述第二目标条码在所述第二图像中占有的像素数量与所述第二图像的像素数量的比例小于预设值,则根据所述比例确定放大调整参数,并根据所述放大调整参数进行相机的参数调整。
  21. 根据权利要求16至20任一所述的装置,其特征在于,所述确定模块还用于:若所述第二目标条码在所述第二图像中的亮度不在预设范围内,则根据所述亮度确定曝光调整参数,并根据所述曝光调整参数进行相机的参数调整。
  22. 根据权利要求16至21任一所述的装置,其特征在于,若未得到译码结果,则通过第三译码方法对所述第二目标图像进行译码,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  23. 根据权利要求22所述的装置,其特征在于,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  24. 根据权利要求22或23所述的装置,其特征在于,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  25. 根据权利要求22至24任一所述的装置,其特征在于,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  26. 根据权利要求16至25任一所述的装置,其特征在于,所述第一图像和所述第二图像为终端针对于所述同一个条码进行扫描过程中得到的不同图像帧。
  27. 一种条码识别装置,其特征在于,所述装置包括:
    获取模块,用于获取第一图像,所述第一图像包括第一目标条码;
    确定模块,用于根据概率值从译码方法集合中确定针对于所述第一图像的目标译码方法,其中,所述译码方法集合包括第一译码方法和第二译码方法;其中,针对于具有相同图像特征的条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率,所述第一译码方法被调用的概率值大于所述第二译码方法被调用的概率值;
    译码模块,用于利用所述目标译码方法对所述第一图像进行译码。
  28. 根据权利要求27所述的装置,其特征在于,针对于图像中条码占有的像素数量小于预设数量的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度小于第一预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率;和/或,针对于图像中亮度大于第二预设亮度的同一个条码,所述第二译码方法的译码成功率高于所述第一译码方法的译码成功率。
  29. 根据权利要求27或28所述的装置,其特征在于,所述译码方法集合还包括:第三译码方法,其中,针对于具有相同图像特征的条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
  30. 根据权利要求29所述的装置,其特征在于,针对于颜色特征为反色的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中完整度小于预设值的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率;和/或,针对于图像中形状与预设形状之间的差异度大于预设差异度的同一个条码,所述第三译码方法的译码成功率高于所述第二译码方法的译码成功率。
PCT/CN2021/080986 2020-03-16 2021-03-16 一种条码识别方法以及相关设备 WO2021185232A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010183928.3 2020-03-16
CN202010183928.3A CN113408314A (zh) 2020-03-16 2020-03-16 一种条码识别方法以及相关设备

Publications (1)

Publication Number Publication Date
WO2021185232A1 true WO2021185232A1 (zh) 2021-09-23

Family

ID=77676853

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/080986 WO2021185232A1 (zh) 2020-03-16 2021-03-16 一种条码识别方法以及相关设备

Country Status (2)

Country Link
CN (1) CN113408314A (zh)
WO (1) WO2021185232A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116739014A (zh) * 2022-09-15 2023-09-12 荣耀终端有限公司 一种扫码方法及电子设备
CN116306733B (zh) * 2023-02-27 2024-03-19 荣耀终端有限公司 一种放大二维码的方法及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040120547A1 (en) * 2002-12-24 2004-06-24 Mampe John J. Method and system for image processing
CN107609448A (zh) * 2017-08-28 2018-01-19 苏州佳世达电通有限公司 条码解码方法以及条码解码装置
CN109657515A (zh) * 2018-12-18 2019-04-19 福州图腾易讯信息技术有限公司 一种一维条形码的解码方法及设备
CN110222547A (zh) * 2019-04-29 2019-09-10 北京三快在线科技有限公司 条码识别方法及装置
CN110516494A (zh) * 2018-05-22 2019-11-29 杭州海康威视数字技术股份有限公司 一种二维码识别方法、装置、设备及系统

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7946491B2 (en) * 2006-08-03 2011-05-24 Nokia Corporation Method, apparatus, and computer program product for providing a camera barcode reader
CN102270292B (zh) * 2011-05-24 2015-09-09 惠州Tcl移动通信有限公司 移动终端及其解码方法
CN103207982A (zh) * 2012-01-13 2013-07-17 鸿富锦精密工业(深圳)有限公司 扫描二维条码的方法及系统
CN104850815B (zh) * 2015-05-20 2017-09-19 杭州晟元数据安全技术股份有限公司 手机上所显示条码的解码方法
CN106951813A (zh) * 2017-04-12 2017-07-14 上海汇尔通信息技术有限公司 一种条码的解码方法及系统
CN109376568A (zh) * 2018-09-19 2019-02-22 上海商米科技有限公司 识别条码的方法、装置及系统
CN110059519B (zh) * 2019-04-23 2022-10-11 福州符号信息科技有限公司 一种带有安全等级处理的条码识读方法和装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040120547A1 (en) * 2002-12-24 2004-06-24 Mampe John J. Method and system for image processing
CN107609448A (zh) * 2017-08-28 2018-01-19 苏州佳世达电通有限公司 条码解码方法以及条码解码装置
CN110516494A (zh) * 2018-05-22 2019-11-29 杭州海康威视数字技术股份有限公司 一种二维码识别方法、装置、设备及系统
CN109657515A (zh) * 2018-12-18 2019-04-19 福州图腾易讯信息技术有限公司 一种一维条形码的解码方法及设备
CN110222547A (zh) * 2019-04-29 2019-09-10 北京三快在线科技有限公司 条码识别方法及装置

Also Published As

Publication number Publication date
CN113408314A (zh) 2021-09-17

Similar Documents

Publication Publication Date Title
JP7238115B2 (ja) 写真撮影シナリオおよび電子デバイスで画像を表示するための方法
WO2021136050A1 (zh) 一种图像拍摄方法及相关装置
CN111738122B (zh) 图像处理的方法及相关装置
CN114650363B (zh) 一种图像显示的方法及电子设备
WO2021143269A1 (zh) 一种长焦场景下的拍摄方法及移动终端
WO2021185232A1 (zh) 一种条码识别方法以及相关设备
CN113887264B (zh) 扫码方法、系统及相关装置
CN113051950B (zh) 一种多条码识别方法以及相关设备
WO2023056795A1 (zh) 快速拍照方法、电子设备及计算机可读存储介质
CN116315667B (zh) 数据传输方法、装置、设备及存储介质
CN115119048B (zh) 一种视频流处理方法及电子设备
CN115437601B (zh) 图像排序方法、电子设备、程序产品及介质
WO2023051094A1 (zh) 内存回收方法、装置、电子设备及可读存储介质
CN115686182B (zh) 增强现实视频的处理方法与电子设备
WO2022095906A1 (zh) 一种按键映射方法、电子设备及系统
CN115802144B (zh) 视频拍摄方法及相关设备
CN116703741B (zh) 一种图像对比度的生成方法、装置和电子设备
CN116095512B (zh) 终端设备的拍照方法及相关装置
CN116343247B (zh) 表格图像矫正方法、装置和设备
CN115482143B (zh) 应用的图像数据调用方法、系统、电子设备及存储介质
CN114942741B (zh) 数据传输方法及电子设备
CN115633255B (zh) 视频处理方法和电子设备
CN116703691B (zh) 图像处理方法、电子设备及计算机存储介质
CN117499797B (zh) 图像处理方法及相关设备
CN116055871B (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: 21770752

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21770752

Country of ref document: EP

Kind code of ref document: A1