CN113408314A - Bar code identification method and related equipment - Google Patents

Bar code identification method and related equipment Download PDF

Info

Publication number
CN113408314A
CN113408314A CN202010183928.3A CN202010183928A CN113408314A CN 113408314 A CN113408314 A CN 113408314A CN 202010183928 A CN202010183928 A CN 202010183928A CN 113408314 A CN113408314 A CN 113408314A
Authority
CN
China
Prior art keywords
decoding
image
decoding method
success rate
target
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202010183928.3A
Other languages
Chinese (zh)
Inventor
饶夫阳
吴花精灵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010183928.3A priority Critical patent/CN113408314A/en
Priority to PCT/CN2021/080986 priority patent/WO2021185232A1/en
Publication of CN113408314A publication Critical patent/CN113408314A/en
Pending legal-status Critical Current

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

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

The application discloses a bar code identification method, which is applied to the field of image identification and comprises the following steps: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting different decoding strategies for multi-frame images, the method and the device can solve the problems of long time consumption and large calculation power of a single frame caused by complex attempts.

Description

Bar code identification method and related equipment
Technical Field
The present application relates to the field of image recognition, and in particular, to a barcode recognition method and related device.
Background
The real-time code scanning function is a function of identifying the commodity bar code and the two-dimensional code picture, for example, reading a one-dimensional code on a common commodity package, receiving and paying a two-dimensional code and the like, supporting a wide code pattern, supporting a complex scene, and quickly responding is a target to be achieved by real-time code scanning.
The barcode reader may sequentially capture a plurality of frames of images based on the image capture parameters and decode the acquired frames of images using a plurality of decoding methods in series until a decoding result is obtained. However, in the prior art, a fixed serial decoding strategy is adopted for each frame of image, which results in high computational effort and time overhead.
Disclosure of Invention
The embodiment of the application provides a barcode identification method and related equipment, and the problems of long time consumption and high calculation power of a single frame caused by complex attempts can be solved by adopting different decoding strategies for a plurality of frames of images.
In a first aspect, an embodiment of the present application provides a barcode identification method, where the method includes: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
In an embodiment of the present application, the first target barcode in the first image may include a one-dimensional code or a two-dimensional code. Exemplary, one-dimensional Code categories 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 barcodes, Code 128 one-dimensional barcodes, and ITF one-dimensional barcodes. The kind of the two-dimensional Code may include, but is not limited to, PDF417, Aztec, PDF417 two-dimensional barcode, Datamatrix two-dimensional barcode, Maxicode two-dimensional barcode, Code 49, Code 16K, Code one.
In the embodiment of the application, the first decoding method can perform feature detection on an image, position and size of a bar code or a two-dimensional code, convert a brightness image into a binary image by using a global binarization method, and attempt decoding one by one in series by using various code type decoders, and has low computational cost, and the first decoding method has a good effect on normal illumination, normal distance and normal shape of conventional bar code scenes, but has a low decoding success rate on long distance, abnormal exposure (over exposure, over darkness) and other complex scenes.
In the embodiment of the application, compared with the first decoding method, the second decoding method can improve the detection rate of the two-dimensional code feature positioning mark by additionally trying different binarization methods, such as a self-adaptive binarization method and a local binarization method. These extra attempts have an enhanced effect on the decoding location of the barcode, and thus make the amplification determination easier, but bring extra calculation and time overhead compared to the first decoding method, and do not conform to the location of fast decoding, so it is set as the second decoding method. Meanwhile, the second decoding method can also additionally calculate the brightness of the detection area for exposure adjustment judgment and amplification adjustment judgment.
In this embodiment, the third decoding method may attempt to solve other difficult examples and inverse two-dimensional codes by attempting a plurality of image processing methods, such as gaussian blur noise reduction, scaling of image size, Gamma brightening, contrast enhancement, and inversion of binary images. Most of the attempts need to introduce considerable extra computational power and time consumption, and the corresponding applicable scenes are rare and are not suitable for being tried every frame, so that the third decoding method with low priority can be selected.
The embodiment of the application provides a barcode identification method, which comprises the following steps: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
In an optional design of the first aspect, for a same barcode in which the number of pixels occupied by the barcode in the image is smaller than a preset number, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
In an optional design of the first aspect, for a same barcode in the image with a luminance smaller than a first preset luminance, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the first aspect, for a same barcode in the image with a brightness greater than a second preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the first aspect, after the coding the second target image by the first coding method, the method further comprises:
and if the ratio of the number of pixels of the second target bar code in the second image to the number of pixels of the second image is smaller than a preset value, determining an amplification adjustment parameter according to the ratio, and adjusting the parameters of the camera according to the amplification adjustment parameter.
In an optional design of the first aspect, after the coding the second target image by the first coding method, the method further comprises:
and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
In an optional design of the first aspect, after the coding the second target image by the second coding method, the method further comprises:
and if the decoding result is not obtained, decoding the second target image by a third decoding method, wherein the decoding success rate of the third decoding method is higher than that of the second decoding method for the bar codes with the same image characteristics.
In an optional design of the first aspect, for a same barcode with a color characteristic of a reverse color, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the first aspect, for a same barcode with a integrity smaller than a preset value in an image, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the first aspect, for a same barcode in which a difference between a shape in the image and a preset shape is greater than a preset difference, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the first aspect, the first image and the second image are different image frames obtained in a process that a terminal scans the same barcode.
In a second aspect, the present application provides a barcode identification method, including:
acquiring a first image, wherein the first image comprises a first target bar code;
determining a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods comprises a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method.
In an optional design of the second aspect, for a same barcode in which the number of pixels occupied by the barcode in the image is smaller than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the second aspect, the set of coding methods further includes: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In an optional design of the second aspect, for the same barcode with a reversed color characteristic, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In a third aspect, the present application provides a barcode identification apparatus, comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image, and the first image comprises a first target bar code;
a first decoding module for decoding the first image by a first decoding method;
if the decoding result is not obtained, the obtaining module is further configured to obtain 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;
and the second decoding module is used for decoding the second target image through the first decoding method, and if the decoding result is not obtained, decoding the second target image through a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the bar codes with the same image characteristics.
In an optional design of the third aspect, for a same barcode whose number of pixels occupied by the barcode in the image is less than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the third aspect, for a same barcode in the image with a luminance smaller than a first preset luminance, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the third aspect, for a same barcode in which the brightness of the image is greater than a second preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an alternative design of the third aspect, the apparatus further includes:
and the determining module is used for determining an amplification adjusting parameter according to the proportion if the proportion of the number of pixels occupied by the second target bar code in the second image to the number of pixels of the second image is less than a preset value, and adjusting the parameter of the camera according to the amplification adjusting parameter.
In an optional design of the third aspect, the determining module is further to: and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
In an optional design of the third aspect, if a decoding result is not obtained, the second target image is decoded by a third decoding method, where for barcodes with the same image characteristics, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the third aspect, for a same barcode with a color characteristic of a reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In an optional design of the third aspect, for a same barcode with a integrity smaller than a preset value in an image, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the third aspect, for a same barcode in which a difference between a shape in the image and a preset shape is greater than a preset difference, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the third aspect, the first image and the second image are different image frames obtained in a process that a terminal scans the same barcode.
In a fourth aspect, the present application provides a barcode identification device, the device comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image, and the first image comprises a first target bar code;
a determining module, configured to determine a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods includes a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method;
and the decoding module is used for decoding the first image by utilizing the target decoding method.
In an optional design of the fourth aspect, for a same barcode in which the number of pixels occupied by the barcode in the image is smaller than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the fourth aspect, the set of coding methods further includes: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In an optional design of the fourth aspect, for the same barcode with a reversed color characteristic, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In a fifth aspect, the present application provides a terminal device, including: one or more processors; one or more memories; a plurality of application programs; and one or more programs, wherein the one or more programs are stored in the memory, which when executed by the processor, cause the terminal device to perform the steps of:
acquiring a first image, wherein the first image comprises a first target bar code;
coding the first image by a first coding method;
if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code;
and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
In an optional design of the fifth aspect, for a same barcode in which the number of pixels occupied by the barcode in the image is smaller than a preset number, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
In an optional design of the fifth aspect, for a same barcode in the image with a luminance smaller than a first preset luminance, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the fifth aspect, for a same barcode in the image with a brightness greater than a second preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the fifth aspect, after the coding of the second target image by the first coding method, the method further comprises:
and if the ratio of the number of pixels of the second target bar code in the second image to the number of pixels of the second image is smaller than a preset value, determining an amplification adjustment parameter according to the ratio, and adjusting the parameters of the camera according to the amplification adjustment parameter.
In an optional design of the fifth aspect, after the coding of the second target image by the first coding method, the method further comprises:
and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
In an optional design of the fifth aspect, after the coding the second target image by the second coding method, the method further comprises:
and if the decoding result is not obtained, decoding the second target image by a third decoding method, wherein the decoding success rate of the third decoding method is higher than that of the second decoding method for the bar codes with the same image characteristics.
In an optional design of the fifth aspect, for a same barcode with a color characteristic of a reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In an optional design of the fifth aspect, for a same barcode with a integrity smaller than a preset value in an image, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the fifth aspect, for a same barcode in which a difference between a shape in the image and a preset shape is greater than a preset difference, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In an optional design of the fifth aspect, the first image and the second image are different image frames obtained in a process that a terminal scans the same barcode.
The terminal device may further perform the steps of:
acquiring a first image, wherein the first image comprises a first target bar code;
determining a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods comprises a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method;
coding the first image using the target coding method.
In an optional design of the fifth aspect, for a same barcode in which the number of pixels occupied by the barcode in the image is smaller than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In an optional design of the fifth aspect, the set of coding methods further includes: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In an optional design of the fifth aspect, for the same barcode with a reversed color characteristic, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In a sixth aspect, the present application provides a server, comprising: one or more processors; one or more memories; and one or more programs, wherein the one or more programs are stored in the memory, which when executed by the processor, cause the server to perform the steps of any of the above-described first aspect and possible implementations of the first aspect, or any of the above-described second aspect and possible implementations of the second aspect.
In a seventh aspect, the present application provides an apparatus, included in a terminal device, that has a function of implementing a behavior of a terminal device in any of the possible implementations of the first aspect, or a function of implementing a behavior of a terminal device in any of the possible implementations of the second aspect. The functions may be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions.
In an eighth aspect, the present application provides a computer storage medium, which includes computer instructions, when the computer instructions are executed on an electronic device or a server, the electronic device executes the steps described in any one of the above first aspect and possible implementation manners of the first aspect, or the steps described in any one of the above second aspect and possible implementation manners of the second aspect.
In a ninth aspect, the present application provides a computer program product, which, when run on an electronic device or a server, causes the electronic device to perform the steps of any one of the possible implementations of the first aspect and the first aspect described above, or any one of the possible implementations of the second aspect and the second aspect described above.
The embodiment of the application provides a barcode identification method, which comprises the following steps: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
Drawings
Fig. 1 is a schematic structure of a terminal device provided in an embodiment of the present application;
fig. 2 is a block diagram of a software structure of a terminal device according to an embodiment of the present application;
fig. 3a is a schematic diagram of an embodiment of a barcode identification method according to an embodiment of the present application;
fig. 3b is a schematic view of an identification scenario provided in an embodiment of the present application;
fig. 3c is a schematic view of an identification scenario provided in an embodiment of the present application;
fig. 4 is a schematic diagram of an embodiment of a barcode identification method according to an embodiment of the present application;
fig. 5 is a schematic diagram of an embodiment of a barcode identification method according to an embodiment of the present application;
fig. 6 is a schematic diagram of an embodiment of a barcode identification method according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a barcode identification apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a barcode identification apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 11 is a schematic diagram of an embodiment of a barcode identification method according to an embodiment of the present application.
Detailed Description
The embodiments of the present invention will be described below with reference to the drawings. The terminology used in the description of the embodiments of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
The terms "first," "second," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and are merely descriptive of the various embodiments of the application and how objects of the same nature can be distinguished. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
For ease of understanding, the structure of the terminal device 100 provided in the embodiments of the present application will be described below by way of example. Referring to fig. 1, fig. 1 is a schematic structural diagram of a terminal device 100 provided in an embodiment of the present application.
As shown in fig. 1, 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, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. 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 light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It is to be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation to the terminal device 100. In other embodiments of the present application, terminal device 100 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be a neural center and a command center of the terminal device 100, among others. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I1C) interface, an integrated circuit built-in audio (I1S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
It should be understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is only an exemplary illustration, and does not constitute a limitation on the structure of the terminal device 100. In other embodiments of the present application, the terminal device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is configured to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger via 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 charge management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like.
The wireless communication function of the terminal device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in terminal device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including wireless communication of 1G/3G/4G/5G, etc. 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 may receive the electromagnetic wave from the antenna 1, filter, amplify, etc. the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 2 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. 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. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the terminal device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. 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, performs frequency modulation and filtering processing on electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive a signal to be transmitted from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into electromagnetic waves through the antenna 2 to radiate the electromagnetic waves.
In some embodiments, the antenna 1 of the terminal device 100 is coupled to the mobile communication module 150 and the antenna 2 is coupled to 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 (code division multiple access, CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), Long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The terminal device 100 implements a display function by the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the terminal device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
In some possible implementations, the display screen 194 may be used to display various interfaces of the system output of the terminal device 100. The interfaces output by the terminal device 100 can refer to the relevant description of the subsequent embodiments.
The terminal device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image visible to naked eyes. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the terminal device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process digital image signals and 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 video in a plurality of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG1, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. The NPU can implement applications such as intelligent recognition of the terminal device 100, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to extend the storage capability of the terminal device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music, video, etc. are saved in an external memory card.
The internal memory 121 may be used to store computer-executable program code, which includes instructions. The processor 110 executes various functional applications of the terminal device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, a phonebook, etc.) created during use of the terminal device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like.
The terminal device 100 may implement an audio function through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor. Such as music playing, recording, etc. In some possible implementations, the audio module 170 may be used to play sound corresponding to video. For example, when the display screen 194 displays a video playing screen, the audio module 170 outputs the sound of the video playing.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals.
The headphone interface 170D is used to connect a wired headphone. The headset interface 170D may be the USB interface 130, or may be an Open Mobile Terminal Platform (OMTP) standard interface of 3.5mm, or a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used for sensing a pressure signal, and converting the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The gyro sensor 180B may be used to determine the motion attitude 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 acceleration of the terminal device 100 in various directions (generally, three axes). The magnitude and direction of gravity can be detected when the terminal device 100 is stationary. The method can also be used for recognizing the posture of the terminal equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance.
The ambient light sensor 180L is used to sense the ambient light level.
The fingerprint sensor 180H is used to collect a fingerprint.
The temperature sensor 180J is used to detect temperature.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on the surface of the terminal device 100, different from the position of the display screen 194.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The terminal device 100 may receive a key input, and generate a key signal input related to user setting and function control of the terminal device 100.
The motor 191 may generate a vibration cue.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card.
The above is a description of the structure of the terminal device 100, and next, a description is given of the software structure of the terminal device. The software system of the terminal device 100 may adopt a hierarchical architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes an Android system with a layered architecture as an example, and exemplarily illustrates a software structure of the terminal device 100.
Fig. 2 is a block diagram of a software configuration of the terminal device 100 according to the embodiment of the present application.
As shown in fig. 2, the layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library, and a kernel layer from top to bottom. The application layer may include a series of application packages.
As shown in fig. 2, the application package may include applications such as camera, gallery, calendar, phone call, map, navigation, WLAN, bluetooth, music, video, short message, etc.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions.
As shown in FIG. 2, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like.
The window manager is used for managing window programs. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider is used to store and retrieve data and make it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
The view system includes visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The interface content may be composed of one or more views. For example, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
The phone manager is used to provide a communication function of the terminal apparatus 200. Such as management of call status (including on, off, etc.).
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, text information is prompted in the status bar, a prompt tone is given, the terminal device vibrates, an indicator light flickers, and the like.
The Android runtime comprises a core library and a virtual machine. The Android runtime is responsible for scheduling and managing an Android system.
The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The system library may include a plurality of functional modules. For example: surface managers (surface managers), media libraries (media libraries), three-dimensional graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), and the like.
The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.
The media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. The media library may support a variety of audio-video encoding formats, such as MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, and the like.
The three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like.
The 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
For convenience of understanding, in the following embodiments of the present application, an electronic device having a structure shown in fig. 1 and fig. 2 is taken as an example, and a barcode identification method provided in the embodiments of the present application is specifically described in conjunction with the accompanying drawings and application scenarios.
Referring to fig. 3a, fig. 3a is a schematic view of an embodiment of a barcode identification method provided in an embodiment of the present application, and as shown in fig. 3a, the barcode identification method provided in the present application includes:
301. a first image is acquired, the first image including a first target barcode.
In the embodiment of the application, the terminal device may acquire a first image including a first target barcode, and the first image may be an image frame in a video.
The terminal equipment can acquire the first image through shooting by a camera carried by the terminal equipment.
In an embodiment, a user may open a barcode recognition function on some application programs, select a barcode to scan a barcode, and call a camera on a terminal device, so that the user may shoot a certain area through the camera of the terminal device, where the area is provided with the barcode, the terminal device may control the camera to collect a preview stream, so that the terminal device may obtain an image frame in the preview stream as a first image, where the first image includes a first target barcode.
In an embodiment of the present application, the first target barcode in the first image may include a one-dimensional code or a two-dimensional code.
Exemplary, one-dimensional Code types may include, but are not limited to, EAN-8 one-dimensional bar Code, EAN-13, UPC-A one-dimensional bar Code, UPC-E one-dimensional bar Code, Codabar one-dimensional bar Code, Code 39 one-dimensional bar Code, Code 93 one-dimensional bar Code, Code 128 one-dimensional bar Code, and ITF one-dimensional bar Code, referring to FIG. 3b, which is an illustration of a first image when the first target bar Code is a one-dimensional Code.
The kind of the two-dimensional Code may include, but is not limited to, PDF417, Aztec, PDF417 two-dimensional barcode, Datamatrix two-dimensional barcode, Maxicode two-dimensional barcode, Code 49, Code 16K, Code one. Referring to fig. 3c, fig. 3c is a schematic diagram of a first image when the first target barcode is a two-dimensional code.
In addition, the terminal can acquire the first image from a local album or a cloud album.
In an embodiment, a user may open a barcode recognition function on some applications and select an image from a local album or a cloud album, where the function opens the local album or the cloud album on the terminal device, the user may select a first image to be barcode-recognized from the local album or the cloud album on the terminal device, the first image may include a first target barcode, and the terminal device may obtain the first image including the first target barcode from the local album or the cloud album.
In the embodiment of the application, after the terminal device acquires the first image, the terminal device may decode the first image.
Specifically, the decoding process may be divided into a plurality of priority flows (including the first decoding method, the second decoding method, and the third decoding method described below), and each priority flow is relatively independent and has a respective emphasis. Illustratively, the first priority flow emphasizes fast decoding; the second priority flow focuses on amplification, exposure adjustment, and other camera parameter adjustments, and the third priority flow focuses on decoding for a particular pattern.
Optionally, in this embodiment of the application, after receiving the first image, the terminal device may determine which priorities the first image needs to activate.
In one embodiment, it is determined that the first image is the picture of the frame that enters the algorithm, and it is determined which decoding methods need to be activated for the current frame. For example, a first frame picture activates a first decoding method, a second frame picture activates the first decoding method and a second decoding method, a third frame picture activates the first decoding method and a third decoding method, and so on. Next, it can be determined which decoding methods need to be performed according to the active decoding method.
302. The first image is coded by a first coding method.
In this embodiment, if it is determined that the activated decoding method of the first image is the first decoding method, the first image may be decoded by using the first decoding method.
In the embodiment of the application, the first decoding method can perform feature detection on an image, position and size of a bar code or a two-dimensional code, convert a brightness image into a binary image by using a global binarization method, and attempt decoding one by one in series by using various code type decoders, and has low computational cost, and the first decoding method has a good effect on normal illumination, normal distance and normal shape of conventional bar code scenes, but has a low decoding success rate on long distance, abnormal exposure (over exposure, over darkness) and other complex scenes.
303. And if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code.
In the embodiment of the application, if the decoding result is not obtained after the first image is decoded by the first decoding method, a second image is obtained, and the second image comprises a second target bar code.
In this embodiment of the application, the first image and the second image may be different image frames obtained in the process of scanning the same barcode by the terminal, due to a change in the photographing angle of view or a change in the photographing position, the pixel position of the first target barcode in the first image may be different from the pixel position of the second target barcode in the second image, due to the difference in image sharpness or the difference in integrity of the barcodes in the images, the image characteristics of the first target barcode in the first image may be different from the image characteristics of the second target barcode in the second image, but the first target barcode and the second target barcode include the same resolution information, that is, if the first target barcode and the second target barcode are complete barcodes in the image, the analytic information included in the first target barcode and the second target barcode are the same, and the analysis results obtained after the first target bar code and the second target bar code are successfully decoded are the same. In this embodiment of the application, the first image and the second image are different image frames obtained by a terminal in a scanning process for the same barcode.
304. And decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
In the embodiment of the application, after the terminal device acquires the second image, the second target image can be decoded by the first decoding method, and if the decoding result is not obtained, the second target image is decoded by the second decoding method, wherein for the barcodes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method.
In the embodiment of the application, for the bar codes with the same image characteristics, the decoding success rate of the second decoding method is higher than that of the first decoding method; the decoding success rate may represent the comprehensive performance of the decoding method, may represent the overall result of the decoding success rate after the barcode is decoded for multiple times in different scenes, may be a comprehensive probability result obtained through statistics of multiple code scanning tests, and is not limited to the success rate of a certain code scanning. For example, for some barcodes with similar characteristics, decoding is performed for multiple times or different environments, and the decoding success rate of the second decoding method is higher than that of the first decoding method.
Specifically, the specific cases that the decoding success rate of the second decoding method is higher than that of the first decoding method may include, but are not limited to, the following:
in this embodiment of the application, for the same barcode in which the number of pixels occupied by the barcode in the image is smaller than the preset number, the decoding success rate of the second decoding method may be higher than that of the first decoding method.
In the embodiment of the application, when the distance between the shooting point and the barcode is too large, the size of the barcode in the image is very small, that is, the number of pixels occupied by the barcode in the image is very small, and for the same barcode of which the number of pixels occupied by the barcode in the image is less than the preset number, the decoding success rate of the second decoding method may be higher than that of the first decoding method, wherein the preset number may be selected according to actual conditions, and is not limited here.
In this embodiment of the application, for a barcode in an image with a brightness smaller than a first preset brightness, a decoding success rate of the second decoding method may be higher than a decoding success rate of the first decoding method, where the first preset brightness may be selected according to an actual situation, and is not limited herein.
In this embodiment of the application, for a barcode in an image with a brightness greater than a second preset brightness, a decoding success rate of the second decoding method may be higher than a decoding success rate of the first decoding method, where the second preset brightness may be selected according to an actual situation, and is not limited herein.
In the embodiment of the application, compared with the first decoding method, the second decoding method can improve the detection rate of the two-dimensional code feature positioning mark by additionally trying different binarization methods, such as a self-adaptive binarization method and a local binarization method. These extra attempts have an enhanced effect on the decoding location of the barcode, and thus make the amplification determination easier, but bring extra calculation and time overhead compared to the first decoding method, and do not conform to the location of fast decoding, so it is set as the second decoding method. Meanwhile, the second decoding method can also additionally calculate the brightness of the detection area for exposure adjustment judgment and amplification adjustment judgment.
It should be noted that the first decoding method and the second decoding method in this embodiment may be implemented by a neural network, where training samples and/or convergence conditions adopted by a neural network model corresponding to the second decoding method in a training process may be different from training samples and/or convergence conditions adopted by the first decoding method (for example, a training sample of the second decoding method is a barcode having a certain brightness characteristic or integrity characteristic, or the convergence condition of the second decoding method requires higher requirements and the decoding accuracy is higher), so that the decoding success rate of the trained second decoding method is higher than the decoding success rate of the first decoding method.
And if the ratio of the number of pixels of the second target bar code in the second image to the number of pixels of the second image is smaller than a preset value, determining an amplification adjustment parameter according to the ratio, and adjusting the parameters of the camera according to the amplification adjustment parameter. In another expression, when the ratio of the area of the detected area of the barcode in the image to the area of the image is lower than a certain value, the camera magnification factor is adjusted according to the ratio, and the barcode area is magnified to a proper level.
For example, if the second image is obtained by the camera based on the first magnification level, and if the ratio of the number of pixels occupied by the second target barcode in the second image to the number of pixels of the second image is smaller than the preset value, the magnification adjustment parameter is determined to be the third magnification level according to the ratio, and the camera may adjust the magnification level to the third magnification level, so as to improve the ratio of the number of pixels occupied by the barcode in the image frame obtained by the camera to the number of pixels of the image.
And if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter. In the embodiment of the application, when the average brightness of the bar code detection area is lower than or higher than a certain range, the exposure level of the camera is adjusted to correct the brightness level of the area to a certain range.
For example, if the second image is obtained by the camera based on the camera exposure level 1, and if the brightness of the second target barcode in the second image is smaller than a certain preset value, the exposure adjustment parameter is determined to be the camera exposure level 2 according to the brightness, that is, the camera exposure level is increased, and then the brightness of the barcode in the image frame obtained by the camera is increased.
For example, if the second image is obtained by the camera based on the camera exposure level 2, and if the brightness of the second target barcode in the second image is greater than a certain preset value, the exposure adjustment parameter is determined to be the camera exposure level 1 according to the brightness, that is, the camera exposure level is reduced, and then the brightness of the barcode in the image frame obtained by the camera is reduced.
In this embodiment of the application, if a decoding result is not obtained, the second target image may also be decoded by a third decoding method, where for barcodes with the same image characteristics, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
In the embodiment of the present application, for the same barcode with the color characteristic of the reverse color, the decoding success rate of the third decoding method may be higher than that of the second decoding method.
In the embodiment of the application, the barcodes in the image can be reverse color barcodes, and at this time, the decoding success rate of the third decoding method can be higher than that of the second decoding method.
In the embodiment of the present application, for the same barcode with integrity smaller than a preset value in the image, the decoding success rate of the third decoding method may be higher than that of the second decoding method.
In the embodiment of the application, the integrity of the barcode in the image can be smaller than a preset value due to stain or other shielding objects or due to damage of the barcode, and at this time, the decoding success rate of the third decoding method can be higher than that of the second decoding method.
In the embodiment of the present application, for a same barcode in which a difference between a shape in an image and a preset shape is greater than a preset difference, a decoding success rate of the third decoding method may be higher than a decoding success rate of the second decoding method.
In this embodiment of the application, the preset shape may be a regular pattern such as a rectangle or a circle, the barcode in the image may be some special shapes, such as a pentagon, a trapezoid, and the like, and the difference between the barcode in the image and the preset shape is greater than the preset difference, which may be understood as not being a rectangle or not a circle, or similar to a rectangle or a circle, but has a certain deformation compared to a mathematical rectangle, and the deformation degree exceeds the preset difference, at this time, the decoding success rate of the third decoding method may be higher than the decoding success rate of the second decoding method.
In this embodiment, the third decoding method may attempt to solve other difficult examples and inverse two-dimensional codes by attempting a plurality of image processing methods, such as gaussian blur noise reduction, scaling of image size, Gamma brightening, contrast enhancement, and inversion of binary images. Most of the attempts need to introduce considerable extra computational power and time consumption, and the corresponding applicable scenes are rare and are not suitable for being tried every frame, so that the third decoding method with low priority can be selected.
It should be noted that the second decoding method and the third decoding method in this embodiment may be implemented by a neural network, where training samples and/or convergence conditions adopted by a neural network model corresponding to the third decoding method in a training process may be different from training samples and/or convergence conditions adopted by the second decoding method (for example, a training sample of the third decoding method is a barcode with a certain color feature or shape feature, or the convergence condition of the third decoding method requires higher requirements and the decoding accuracy is higher), 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.
In the embodiment of the present application, different decoding strategy combinations may be adopted for different image frames, and the following details are described:
the example first, the first image adopts a first decoding method, the second image adopts the first decoding method and a second decoding method, the third image adopts the first decoding method, and the fourth image adopts the first decoding method and the second decoding method.
In the embodiment of the application, a first image can be acquired, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method; if the decoding result is not obtained, acquiring a third image, wherein the third image comprises a third target bar code, and the first target bar code and the third target bar code correspond to the same bar code; coding the third image by a first coding method; if the decoding result is not obtained, acquiring a fourth image, wherein the fourth image comprises a fourth target bar code, and the first target bar code and the fourth target bar code correspond to the same bar code; and decoding the fourth target image by the first decoding method, and if the decoding result is not obtained, decoding the fourth target image by a second decoding method.
The specific process of the first image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, the specific process of the second image decoding by using the first decoding method and the second decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again, the specific process of the third image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, and the specific process of the fourth image decoding by using the first decoding method and the second decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again.
In the embodiment of the present application, since the computational overhead of the second decoding method is greater than that of the first decoding method, the time overhead of the second decoding method is greater than that of the first decoding method, therefore, during the process of decoding a frame of picture (first picture), the first decoding method is adopted for decoding, and if the decoding is not successful, another frame of picture (second picture) is decoded using the first decoding method, and if the decoding is not successful, the second image is decoded using a second decoding method, which is different from the same decoding method used for each frame of image, in this embodiment, by adopting different flow strategies for continuous multi-frame images and periodically adjusting the length of a single-frame code scanning flow, the problem of single-frame length and time consumption caused by complex attempts can be effectively reduced, the images can be refreshed in time, and the expectation of code scanning success is improved.
For the first decoding method, the second decoding method, and the third decoding method, reference may be made to the description in the foregoing embodiments, and details are not repeated here.
Example two, the first image employs a first decoding method, the second image employs the first decoding method and a third decoding method, the third image employs the first decoding method, and the fourth image employs the first decoding method and the third decoding method.
In the embodiment of the application, a first image can be acquired, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a third decoding method; if the decoding result is not obtained, acquiring a third image, wherein the third image comprises a third target bar code, and the first target bar code and the third target bar code correspond to the same bar code; coding the third image by a first coding method; if the decoding result is not obtained, acquiring a fourth image, wherein the fourth image comprises a fourth target bar code, and the first target bar code and the fourth target bar code correspond to the same bar code; and decoding the fourth target image by the first decoding method, and if the decoding result is not obtained, decoding the fourth target image by a third decoding method.
The specific process of the first image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, the specific process of the second image decoding by using the first decoding method and the third decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again, the specific process of the third image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, and the specific process of the fourth image decoding by using the first decoding method and the third decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again.
In the embodiment of the present application, since the computational overhead of the third decoding method is greater than that of the first decoding method, the time overhead of the third decoding method is greater than that of the first decoding method, therefore, during the process of decoding a frame of picture (first picture), the first decoding method is adopted for decoding, and if the decoding is not successful, another frame of picture (second picture) is decoded using the first decoding method, and if the decoding is not successful, the second image is decoded using a third decoding method, which is different from the same decoding method used for each frame of image, in this embodiment, by adopting different flow strategies for continuous multi-frame images and periodically adjusting the length of a single-frame code scanning flow, the problem of single-frame length and time consumption caused by complex attempts can be effectively reduced, the images can be refreshed in time, and the expectation of code scanning success is improved.
For the first decoding method, the second decoding method, and the third decoding method, reference may be made to the description in the foregoing embodiments, and details are not repeated here.
Example three, the first image employs a first decoding method, the second image employs the first decoding method, the second decoding method, and the third decoding method, the third image employs the first decoding method, and the fourth image employs the first decoding method, the second decoding method, and the third decoding method.
In the embodiment of the application, a first image can be acquired, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method; if the decoding result is not obtained, decoding the second target image by a third decoding method; if the decoding result is not obtained, acquiring a third image, wherein the third image comprises a third target bar code, and the first target bar code and the third target bar code correspond to the same bar code; coding the third image by a first coding method; if the decoding result is not obtained, acquiring a fourth image, wherein the fourth image comprises a fourth target bar code, and the first target bar code and the fourth target bar code correspond to the same bar code; decoding the fourth target image by the first decoding method, and if the decoding result is not obtained, decoding the fourth target image by a second decoding method; and if the decoding result is not obtained, decoding the fourth target image by a third decoding method.
The specific process of the first image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, the specific process of the second image decoding by using the first decoding method, the second decoding method, and the third decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again, the specific process of the third image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, and the specific process of the fourth image decoding by using the first decoding method, the second decoding method, and the third decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again.
In the embodiment of the present application, since the computation overhead of the second decoding method and the third decoding method is greater than the computation overhead of the first decoding method, and the time overhead of the second decoding method and the third decoding method is greater than the time overhead of the first decoding method, in the process of decoding one frame of image (first image), the first decoding method is adopted to decode the other frame of image (second image) if the decoding is not successful, and the second decoding method and the third decoding method are adopted to decode the second image if the decoding is not successful, compared with the case where each frame of image adopts the same decoding method, in this embodiment, different flow strategies are adopted to consecutive multi-frame images, the length of a single-frame scan stream is periodically adjusted to be short, so that the problem of the time consumption of a single frame caused by complicated attempts can be effectively reduced, and the image is refreshed in time, and the code scanning success expectation is improved.
For the first decoding method, the second decoding method, and the third decoding method, reference may be made to the description in the foregoing embodiments, and details are not repeated here.
Example four, the first image employs a first decoding method, the second image employs the first decoding method and a second decoding method, the third image employs the first decoding method, the second decoding method and a third decoding method, and the fourth image employs the first decoding method and the third decoding method.
The specific process of the first image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the above embodiment, and is not described herein again, the specific process of the second image decoding by using the first decoding method and the second decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again, the specific process of the third image decoding by using the first decoding method, the second decoding method, and the third decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again, and the specific process of the fourth image decoding by using the first decoding method and the third decoding method may refer to the description corresponding to step 303 and step 304 in the above embodiment, and is not described herein again.
Example five, the first image employs a first decoding method, the second image employs the first decoding method and a second decoding method, the third image employs the first decoding method, the fourth image employs the first decoding method and a third decoding method, the fifth image employs the first decoding method, the sixth image employs the first decoding method and the second decoding method, the seventh image employs the first decoding method, and the eighth image employs the first decoding method and the third decoding method.
The specific process of the first image decoding by using the first decoding method may refer to the description corresponding to step 301 and step 302 in the foregoing embodiment, which is not described herein again, the specific process of the second image decoding by using the first decoding method and the second decoding method may refer to the description corresponding to step 303 and step 304 in the foregoing embodiment, which is not described herein again, the specific process of the third image decoding by using the first decoding method may refer to the description corresponding to step 303 and step 304 in the foregoing embodiment, which is not described herein again, the specific process of the fourth image decoding by using the first decoding method and the third decoding method may refer to the description corresponding to step 303 and step 304 in the foregoing embodiment, which is not described herein again, the specific process of the fifth image decoding by using the first decoding method may refer to the description corresponding to step 303 and step 304 in the foregoing embodiment, which is not described herein again, and the specific process of the sixth image decoding by using the first decoding method and the second decoding method may refer to the description of the foregoing embodiment The description of step 303 and step 304 in the above description is not repeated here, the specific process of the seventh image using the first decoding method may refer to the description of step 301 and step 302 in the above embodiment, and is not repeated here, and the specific process of the eighth image using the first decoding method and the third decoding method may refer to the description of step 303 and step 304 in the above embodiment, and is not repeated here.
It should be noted that the above decoding strategy is only an illustration, and in practical application, the decoding strategy can be flexibly selected according to requirements, and the present application is not limited thereto.
The first decoding method, the second decoding method, and the third decoding method in the embodiment of the present application may be implemented by a neural network, and the present application is not limited thereto.
The embodiment of the application provides a barcode identification method, which comprises the following steps: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
Referring to fig. 4, fig. 4 is a schematic diagram of a barcode identification method provided in an embodiment of the present application, and as shown in fig. 4, the barcode identification method provided in the embodiment of the present application includes:
401. acquiring a first image, wherein the first image comprises a first target bar code;
the description of step 401 may refer to the description of step 301 in the above embodiment, and is not repeated here.
402. Determining a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods comprises a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method.
In the embodiment of the present application, the probability value may indicate a possibility that the corresponding decoding method is selected as the current image frame.
In the embodiment of the present application, for the same barcode in which the number of pixels occupied by the barcode in the image is smaller than the preset number, the decoding success rate of the second decoding method may be higher than the decoding success rate of the first decoding method; and/or, for the bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method may be higher than that of the first decoding method; and/or, for the bar code with the brightness larger than the second preset brightness in the image, the decoding success rate of the second decoding method may be higher than that of the first decoding method.
In this embodiment of the present application, the set of decoding methods may further include: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
In the embodiment of the present application, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method may be higher than that of the second decoding method; and/or, for the same barcode with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method may be higher than that of the second decoding method; and/or, for the same barcode in which the difference between the shape in the image and the preset shape is greater than the preset difference, the decoding success rate of the third decoding method may be higher than that of the second decoding method.
For example, in the embodiment of the present application, 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, and the probability value of the third decoding method may be set to 0.1.
403. Coding the first image using the target coding method.
Referring to fig. 5, fig. 5 is a schematic diagram of a barcode identification method provided in an embodiment of the present application, and as shown in fig. 5, the barcode identification method provided in the embodiment of the present application includes:
501. the terminal equipment acquires a first image, wherein the first image comprises a first target bar code.
The detailed description of step 501 may refer to the description of step 301 in the above embodiment, and is not repeated here.
502. The terminal equipment sends the first image to a server;
for the detailed description of step 502, reference may be made to the description of step 301 in the foregoing embodiment, which is not described herein again.
503. The server decodes the first image through a first decoding method;
the detailed description of step 503 may refer to the description of step 302 in the above embodiment, and is not repeated here.
504. If the server does not obtain a decoding result, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code;
the detailed description of step 504 may refer to the description of step 303 in the above embodiment, and is not repeated here.
505. And the server decodes the second target image through the first decoding method, and if the decoding result is not obtained, the server decodes the second target image through a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
The detailed description of step 505 may refer to the description of step 304 in the above embodiment, and is not repeated here.
The embodiment of the application provides a barcode identification method, which comprises the following steps: the method comprises the steps that terminal equipment obtains a first image, wherein the first image comprises a first target bar code; the terminal equipment sends the first image to a server; the server decodes the first image through a first decoding method; if the server does not obtain a decoding result, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and the server decodes the second target image through the first decoding method, and if the decoding result is not obtained, the server decodes the second target image through a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
Referring to fig. 6, fig. 6 is a schematic diagram of a barcode identification method provided in an embodiment of the present application, and as shown in fig. 6, the barcode identification method provided in the embodiment of the present application includes:
601. the current image frame is acquired as a first image.
For the detailed description of step 601, reference may be made to the detailed description of step 301, which is not described herein again.
Specifically, step 601 can be implemented as follows:
the image data is captured by the camera 193 of the terminal device 100 shown in fig. 1, and a processor in the terminal may call code in the memory to process the image data captured by the camera into a first image. Alternatively, the processor in the terminal may call the code in the memory to control a hardware device such as a video codec in the terminal device 100 to process the image data into the first image.
602. The first image is decoded by a first decoding method.
The detailed description of step 602 may refer to the detailed description of step 302, which is not described herein again.
In this embodiment of the present application, step 602 may be implemented as follows:
the processor 110 of the terminal device 100 shown in fig. 1 calls the code related to the first decoding method in the memory 121, thereby implementing the function of decoding the first image by the first decoding method.
6031. If the decoding result is obtained, the decoding is successful, and the current bar code identification process is ended.
6032. And if the decoding result is not obtained, acquiring the current image frame as a second image.
The detailed description of step 6032 may refer to the detailed description of step 303, which is not described here again.
In the embodiment of the present application, if the decoding result is not obtained, the image data is obtained by shooting through the camera 193 of the terminal device 100 shown in fig. 1, and the processor in the terminal may call the code in the memory to process the image data obtained by shooting through the camera into the second image.
604. The second image is decoded by a first decoding method.
In this embodiment, the terminal device may further implement a function of decoding the first image by using the first decoding method by calling a code related to the first decoding method in the memory 121.
6051. If the decoding result is obtained, the decoding is successful, and the current bar code identification process is ended.
6052. And if the decoding result is not obtained, decoding the second image by a second decoding method.
The detailed description of step 604, step 6051, and step 6052 may refer to the detailed description of step 304, and will not be described here again.
In the embodiment of the present application, the function of decoding the second target image by using the first decoding method may be further implemented by calling a code in the internal memory 121, which is related to the first decoding method, and if the decoding result is not obtained, the function of decoding the second target image is further implemented by calling a code in the internal memory 121, which is related to the second decoding method.
606. If the decoding result is obtained, the decoding is successful, and the current bar code identification process is ended.
607. If the decoding result is not obtained, judging whether the camera parameters need to be adjusted, and if the camera parameters need to be adjusted, adjusting the camera parameters.
In the embodiment of the present application, the function of determining whether the camera parameters need to be adjusted or not can be implemented by calling the relevant codes in the internal memory 121, and if the camera parameters need to be adjusted, the camera parameters are adjusted.
608. The current image frame is acquired as a third image.
An embodiment of the present application further provides a barcode identification apparatus, please refer to fig. 7, fig. 7 is a schematic structural diagram of the barcode identification apparatus provided in the embodiment of the present application, and the barcode identification apparatus 700 includes:
the acquiring module 701 is configured to acquire a first image, where the first image includes a first target barcode.
Specifically, the obtaining module 701 may execute the step corresponding to the step 301 in the foregoing embodiment.
In this embodiment, the obtaining module 701 may obtain image data by shooting through the camera 193 of the terminal device 100 shown in fig. 1, and a processor in the terminal may call a code in a memory to process the image data obtained by shooting through the camera into a first image.
Alternatively, the processor in the terminal may call the code in the memory to control a hardware device such as a video codec in the terminal device 100 to process the image data into the first image.
A first coding module 702 for coding the first image by a first coding method.
In this embodiment, the first decoding module 702 may be implemented as a part of functions implemented in the processor 110, and may further implement a function of decoding the first image by the first decoding method by calling a code related to the first decoding method in the internal memory 121. Specifically, the first decoding module 702 may perform the steps corresponding to the step 302 in the above embodiment.
If the decoding result is not obtained, the obtaining module 701 is further configured to obtain 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.
Specifically, the obtaining module 701 may execute the step corresponding to the step 303 in the foregoing embodiment.
In this embodiment, the obtaining module 701 may obtain image data through capturing by the camera 193 of the terminal device 100 shown in fig. 1, and a processor in the terminal may call a code in a memory to process the image data obtained through capturing by the camera into a second image.
A second decoding module 703 is configured to decode the second target image by using the first decoding method, and if a decoding result is not obtained, decode the second target image by using a second decoding method, where a decoding success rate of the second decoding method is higher than a decoding success rate of the first decoding method for barcodes with the same image characteristics.
In this embodiment, the second decoding module 703 may be used as a part of functions implemented in the processor 110, and call a code related to the first decoding method in the internal memory 121, so as to further implement a function of decoding the second target image by the first decoding method, and if a decoding result is not obtained, call a code related to the second decoding method in the internal memory 121, so as to further implement a function of decoding the second target image. Specifically, the second decoding module 703 may execute the steps corresponding to the step 304 in the above embodiment.
Optionally, for the same barcode with the number of pixels occupied by the barcode in the image being less than the preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, for the same barcode in the image with a brightness smaller than a first preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, for the same barcode in the image with a brightness greater than a second preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, the apparatus further comprises:
and the determining module is used for determining an amplification adjusting parameter according to the proportion if the proportion of the number of pixels occupied by the second target bar code in the second image to the number of pixels of the second image is less than a preset value, and adjusting the parameter of the camera according to the amplification adjusting parameter.
Optionally, the determining module is further configured to: and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
Optionally, if a decoding result is not obtained, decoding the second target image by a third decoding method, where for barcodes with the same image characteristics, a decoding success rate of the third decoding method is higher than a decoding success rate of the second decoding method.
Optionally, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode with integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode in which the difference between the shape in the image and the preset shape is greater than the preset difference, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, the first image and the second image are different image frames obtained in a process that the terminal scans the same barcode.
The embodiment of the application provides a bar code identification device, wherein an acquisition module acquires a first image, and the first image comprises a first target bar code; the first decoding module decodes the first image through a first decoding method; if the decoding result is not obtained, the acquisition module acquires a second image, the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and the second decoding module decodes the second target image through the first decoding method, and decodes the second target image through a second decoding method if the decoding result is not obtained, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
The embodiment of the application provides a bar code recognition device, includes: the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image, and the first image comprises a first target bar code; a first decoding module for decoding the first image by a first decoding method; if the decoding result is not obtained, the obtaining module is further configured to obtain 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; and the second decoding module is used for decoding the second target image through the first decoding method, and if the decoding result is not obtained, decoding the second target image through a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the bar codes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a barcode recognition device provided in an embodiment of the present application, where the barcode recognition device 800 includes:
an obtaining module 801, configured to obtain a first image, where the first image includes a first target barcode;
a determining module 802, configured to determine a target coding method for the first image from a set of coding methods according to a probability value, where the set of coding methods includes a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method;
a decoding module 803 for decoding the first image by the target decoding method.
Optionally, for the same barcode with the number of pixels occupied by the barcode in the image being less than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, the set of coding methods further includes: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a terminal device provided in an embodiment of the present application, and the terminal device 900 may be embodied as a virtual reality VR device, a mobile phone, a tablet, a notebook computer, an intelligent wearable device, and the like, which is not limited herein. Specifically, the terminal apparatus 900 includes: a receiver 901, a transmitter 902, a processor 903 and a memory 904 (wherein the number of the processors 903 in the terminal device 900 may be one or more, and one processor is taken as an example in fig. 9), wherein the processors 903 may include an application processor 9031 and a communication processor 9032. In some embodiments of the present application, the receiver 901, the transmitter 902, the processor 903, and the memory 904 may be connected by a bus or other means.
The memory 904 may include both read-only memory and random-access memory, and provides instructions and data to the processor 903. A portion of memory 904 may also include non-volatile random access memory (NVRAM). The memory 904 stores the processor and the operating instructions, executable modules or data structures, or a subset thereof, or an expanded set thereof, wherein the operating instructions may include various operating instructions for performing various operations.
The processor 903 controls the operation of the terminal device. In a specific application, the various components of the terminal device are coupled together by a bus system, wherein the bus system may include a power bus, a control bus, a status signal bus, etc., in addition to a data bus. For clarity of illustration, the various buses are referred to in the figures as a bus system.
The method disclosed in the embodiments 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 having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 903. The processor 903 may be a general-purpose processor, a Digital Signal Processor (DSP), a microprocessor or a microcontroller, and may further include an Application Specific Integrated Circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The processor 903 may implement or perform the methods, steps, and logic blocks disclosed in the embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 904, and the processor 903 reads information in the memory 904 and performs the steps of the above method in combination with hardware thereof.
The receiver 901 may be used to receive input numeric or character information and generate signal inputs related to relevant settings and function control of the terminal device. The transmitter 902 may be configured to output numeric or character information through the first interface; the transmitter 902 is also operable to send instructions to the disk group via the first interface to modify data in the disk group; the transmitter 902 may also include a display device such as a display screen.
In this embodiment, in one case, the processor 903 is configured to execute the steps described in fig. 3a and the corresponding embodiment in the foregoing embodiment. Specifically, the processor 903 may be configured to perform the following steps:
acquiring a first image, wherein the first image comprises a first target bar code;
coding the first image by a first coding method;
if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code;
and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
Optionally, for the same barcode with the number of pixels occupied by the barcode in the image being less than the preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, for the same barcode in the image with a brightness smaller than a first preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, for the same barcode in the image with a brightness greater than a second preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, after the coding of the second target image by the first coding method, the method further includes:
and if the ratio of the number of pixels of the second target bar code in the second image to the number of pixels of the second image is smaller than a preset value, determining an amplification adjustment parameter according to the ratio, and adjusting the parameters of the camera according to the amplification adjustment parameter.
Optionally, after the coding of the second target image by the first coding method, the method further includes:
and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
Optionally, after the coding of the second target image by the second coding method, the method further includes:
and if the decoding result is not obtained, decoding the second target image by a third decoding method, wherein the decoding success rate of the third decoding method is higher than that of the second decoding method for the bar codes with the same image characteristics.
Optionally, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode with integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode in which the difference between the shape in the image and the preset shape is greater than the preset difference, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, the first image and the second image are different image frames obtained in a process that the terminal scans the same barcode.
The embodiment of the application provides a barcode identification method, which comprises the following steps: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
In this embodiment, in one case, the processor 903 is configured to:
acquiring a first image, wherein the first image comprises a first target bar code;
determining a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods comprises a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method.
Optionally, for the same barcode with the number of pixels occupied by the barcode in the image being less than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, the set of coding methods further includes: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a server provided in the embodiment of the present application, which may have large differences due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1022 (e.g., one or more processors) and a memory 1032, and one or more storage media 1030 (e.g., one or more mass storage devices) storing an application 1042 or data 1044. Memory 1032 and storage medium 1030 may be, among other things, transient or persistent storage. The program stored on storage medium 1030 may include one or more modules (not shown), each of which may include a sequence of instructions for operating on the exercise device. Still further, a central processor 1022 may be disposed in communication with the storage medium 1030, and configured to 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-output interfaces 1058, and/or one or more operating systems 1041, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and so forth.
In the embodiment of the present application, the central processing unit 1022 is configured to execute the multiple code identification method described in the foregoing embodiment.
Also provided in embodiments of the present application is a computer program product that, when executed on a computer, causes the computer to perform the steps of the multiple code identification method.
An embodiment of the present application further provides a computer-readable storage medium, in which a program for signal processing is stored, and when the program runs on a computer, the computer is caused to execute the steps described in fig. 3a and the corresponding embodiments in the foregoing embodiments. Specifically, the computer may be configured to perform the steps of:
acquiring a first image, wherein the first image comprises a first target bar code;
coding the first image by a first coding method;
if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code;
and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
Optionally, for the same barcode with the number of pixels occupied by the barcode in the image being less than the preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, for the same barcode in the image with a brightness smaller than a first preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, for the same barcode in the image with a brightness greater than a second preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, after the coding of the second target image by the first coding method, the method further includes:
and if the ratio of the number of pixels of the second target bar code in the second image to the number of pixels of the second image is smaller than a preset value, determining an amplification adjustment parameter according to the ratio, and adjusting the parameters of the camera according to the amplification adjustment parameter.
Optionally, after the coding of the second target image by the first coding method, the method further includes:
and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
Optionally, after the coding of the second target image by the second coding method, the method further includes:
and if the decoding result is not obtained, decoding the second target image by a third decoding method, wherein the decoding success rate of the third decoding method is higher than that of the second decoding method for the bar codes with the same image characteristics.
Optionally, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode with integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode in which the difference between the shape in the image and the preset shape is greater than the preset difference, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, the first image and the second image are different image frames obtained in a process that the terminal scans the same barcode.
There is also provided in an embodiment of the present application a computer-readable storage medium having a program stored therein for signal processing, which when run on a computer, causes the computer to perform:
acquiring a first image, wherein the first image comprises a first target bar code;
determining a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods comprises a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method.
Optionally, for the same barcode with the number of pixels occupied by the barcode in the image being less than a preset number, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
Optionally, the set of coding methods further includes: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
Optionally, for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
The embodiment of the application provides a barcode identification method, which comprises the following steps: acquiring a first image, wherein the first image comprises a first target bar code; coding the first image by a first coding method; if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code; and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics. By adopting the mode, the problem of long time consumption of a single frame caused by complex attempts can be effectively reduced by adopting different decoding strategies for multiple frames of images, the images can be refreshed in time, and the expectation of code scanning success is improved.
Referring to fig. 11, fig. 11 is a schematic application scenario of a barcode identification method provided in the embodiment of the present application, and as shown in fig. 11, the barcode identification method provided in the embodiment includes:
1101. and receiving a bar code identification instruction of a user.
In the embodiment of the application, a user can open the barcode recognition function on some application programs and select barcode scanning, for example, when the user wants to add a friend of an application program, the user can click a code scanning control corresponding to the application program, and correspondingly, the terminal can receive a barcode recognition instruction of the user.
Specifically, a sensor (e.g., the pressure sensor in fig. 1) of the terminal may recognize a click operation of the user, and if the click operation is directed to the barcode scanning function, the processor may call the code in the memory to recognize that the barcode identification instruction of the user is received.
1102. And responding to the bar code identification instruction, and calling the function of the camera.
In the embodiment of the application, the terminal responds to the bar code identification instruction and calls the function of the camera, and then a user can shoot a certain area through the camera of the terminal, wherein the area comprises the bar code.
Specifically, the processor of the terminal may call a code in the memory to respond to the barcode identification instruction and call the camera function.
1103. Shooting an area including a bar code to obtain a preview stream;
in the embodiment of the application, the terminal can shoot the area including the bar code to obtain the preview stream.
Specifically, the processor of the terminal may call a code in the memory to process image data captured by the camera, so as to obtain the preview stream.
1104. Acquiring a first image comprising a first target barcode from the preview stream;
in this embodiment of the application, the terminal may obtain a frame of image from the preview stream as the first image, and refer to the description of step 301 in the foregoing embodiment specifically, which is not described herein again.
In particular, the processor of the terminal may invoke code in the memory to obtain a first image including a first target barcode from the preview stream.
1105. And decoding the first image by a first decoding method, and if the decoding result is not obtained, acquiring a second image comprising a second target bar code from the preview stream.
In this embodiment of the application, if a decoding result is not obtained, the terminal may obtain a frame image from the preview stream as the second image, which specifically refers to the description of step 302 and step 303 in the foregoing embodiment, and details are not described here.
Specifically, 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.
1106. And decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method.
Specifically, reference may be made to the description of step 304 in the foregoing embodiment, which is not described herein again.
Specifically, 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 terms "first," "second," and the like in the description and in the claims of the present application and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Moreover, the terms "comprises," "comprising," and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not expressly listed or inherent to such process, method, article, or apparatus. The naming or numbering of the steps appearing in the present application does not mean that the steps in the method flow have to be executed in the chronological/logical order indicated by the naming or numbering, and the named or numbered process steps may be executed in a modified order depending on the technical purpose to be achieved, as long as the same or similar technical effects are achieved. The division of the modules presented in this application is a logical division, and in practical applications, there may be another division, for example, multiple modules may be combined or integrated into another system, or some features may be omitted, or not executed, and in addition, the shown or discussed coupling or direct coupling or communication connection between each other may be through some interfaces, and the indirect coupling or communication connection between the modules may be in an electrical or other similar form, which is not limited in this application. The modules described as separate parts may or may not be physically separate, may or may not be physical modules, or may be distributed in a plurality of circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present disclosure.
It should be noted that the above-described embodiments of the apparatus are merely schematic, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiments of the apparatus provided in the present application, the connection relationship between the modules indicates that there is a communication connection therebetween, and may be implemented as one or more communication buses or signal lines.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus necessary general-purpose hardware, and certainly can also be implemented by special-purpose hardware including special-purpose integrated circuits, special-purpose CPUs, special-purpose memories, special-purpose components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions may be various, such as analog circuits, digital circuits, or dedicated circuits. However, for the present application, the implementation of a software program is more preferable. Based on such understanding, the technical solutions of the present application may be substantially embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, an exercise device, or a network device) to execute the method according to the embodiments of the present application.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, training device, or data center to another website site, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device, such as a training device, a data center, etc., that incorporates one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.

Claims (30)

1. A method of barcode identification, the method comprising:
acquiring a first image, wherein the first image comprises a first target bar code;
coding the first image by a first coding method;
if the decoding result is not obtained, acquiring a second image, wherein the second image comprises a second target bar code, and the first target bar code and the second target bar code correspond to the same bar code;
and decoding the second target image by the first decoding method, and if the decoding result is not obtained, decoding the second target image by a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the barcodes with the same image characteristics.
2. The method of claim 1, wherein for a same barcode having a number of pixels occupied by the barcode in the image smaller than a preset number, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
3. The method according to claim 1 or 2, wherein for the same barcode in the image with a brightness less than a first preset brightness, the decoding success rate of the second decoding method is higher than that of the first decoding method.
4. The method according to any one of claims 1 to 3, wherein for the same barcode in the image with a brightness greater than a second predetermined brightness, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
5. The method according to any one of claims 1 to 4, wherein after said decoding the second target image by the first decoding method, the method further comprises:
and if the ratio of the number of pixels of the second target bar code in the second image to the number of pixels of the second image is smaller than a preset value, determining an amplification adjustment parameter according to the ratio, and adjusting the parameters of the camera according to the amplification adjustment parameter.
6. The method according to any one of claims 1 to 5, wherein after said decoding the second target image by the first decoding method, the method further comprises:
and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
7. The method according to any one of claims 1 to 6, wherein after said decoding the second target image by the second decoding method, the method further comprises:
and if the decoding result is not obtained, decoding the second target image by a third decoding method, wherein the decoding success rate of the third decoding method is higher than that of the second decoding method for the bar codes with the same image characteristics.
8. The method of claim 7, wherein for the same barcode with a color characteristic of a reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
9. The method according to claim 7 or 8, wherein for the same barcode with integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method.
10. The method according to any one of claims 7 to 9, wherein for the same barcode having a difference between a shape and a predetermined shape in the image larger than the predetermined difference, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
11. The method of any one of claims 1 to 9, wherein the first image and the second image are different image frames obtained during a scanning process of the terminal with respect to the same barcode.
12. A method of barcode identification, the method comprising:
acquiring a first image, wherein the first image comprises a first target bar code;
determining a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods comprises a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method;
coding the first image using the target coding method.
13. The method according to claim 12, wherein for the same barcode having a number of pixels occupied by the barcode in the image smaller than a preset number, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
14. The method according to claim 12 or 13, wherein the set of coding methods further comprises: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
15. The method according to claim 14, wherein for the same barcode with the color characteristic of reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
16. A barcode recognition apparatus, comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image, and the first image comprises a first target bar code;
a first decoding module for decoding the first image by a first decoding method;
if the decoding result is not obtained, the obtaining module is further configured to obtain 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;
and the second decoding module is used for decoding the second target image through the first decoding method, and if the decoding result is not obtained, decoding the second target image through a second decoding method, wherein the decoding success rate of the second decoding method is higher than that of the first decoding method for the bar codes with the same image characteristics.
17. The apparatus of claim 16, wherein for a same barcode having a number of pixels occupied by the barcode in the image smaller than a preset number, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
18. The apparatus according to claim 16 or 17, wherein for a same barcode in the image with a brightness less than a first predetermined brightness, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
19. The apparatus according to any one of claims 16 to 18, wherein for a same barcode in the image with a luminance greater than a second predetermined luminance, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method.
20. The apparatus of any one of claims 16 to 19, further comprising:
and the determining module is used for determining an amplification adjusting parameter according to the proportion if the proportion of the number of pixels occupied by the second target bar code in the second image to the number of pixels of the second image is less than a preset value, and adjusting the parameter of the camera according to the amplification adjusting parameter.
21. The apparatus of any of claims 16 to 20, wherein the determining module is further configured to: and if the brightness of the second target bar code in the second image is not within a preset range, determining an exposure adjustment parameter according to the brightness, and adjusting the parameter of the camera according to the exposure adjustment parameter.
22. The apparatus according to any one of claims 16 to 21, wherein if no decoding result is obtained, 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 that of the second decoding method.
23. The apparatus of claim 22, wherein for a same barcode with a color characteristic of a reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method.
24. The apparatus according to claim 22 or 23, wherein the decoding success rate of the third decoding method is higher than that of the second decoding method for the same barcode with integrity smaller than a preset value in the image.
25. The apparatus according to any one of claims 22 to 24, wherein for a same barcode having a difference between a shape in the image and a predetermined shape greater than the predetermined difference, the decoding success rate of the third decoding method is higher than the decoding success rate of the second decoding method.
26. The apparatus of any one of claims 16 to 25, wherein the first image and the second image are different image frames obtained during a scanning process of the terminal with respect to the same barcode.
27. A bar code identification device, the device comprising:
the system comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a first image, and the first image comprises a first target bar code;
a determining module, configured to determine a target coding method for the first image from a set of coding methods according to a probability value, wherein the set of coding methods includes a first coding method and a second coding method; for the bar codes 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 called probability value of the first decoding method is greater than that of the second decoding method;
and the decoding module is used for decoding the first image by utilizing the target decoding method.
28. The apparatus of claim 27, wherein for the same barcode having a number of pixels occupied by the barcode in the image smaller than a preset number, the decoding success rate of the second decoding method is higher than the decoding success rate of the first decoding method; and/or aiming at the same bar code with the brightness smaller than the first preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method; and/or aiming at the same bar code with the brightness larger than a second preset brightness in the image, the decoding success rate of the second decoding method is higher than that of the first decoding method.
29. The apparatus according to claim 27 or 28, wherein the set of coding methods further comprises: and a third decoding method, wherein for the bar codes with the same image characteristics, the decoding success rate of the third decoding method is higher than that of the second decoding method.
30. The apparatus of claim 29, wherein for the same barcode with a color characteristic of a reverse color, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code with the integrity smaller than a preset value in the image, the decoding success rate of the third decoding method is higher than that of the second decoding method; and/or aiming at the same bar code of which the difference degree between the shape and the preset shape in the image is greater than the preset difference degree, the decoding success rate of the third decoding method is higher than that of the second decoding method.
CN202010183928.3A 2020-03-16 2020-03-16 Bar code identification method and related equipment Pending CN113408314A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010183928.3A CN113408314A (en) 2020-03-16 2020-03-16 Bar code identification method and related equipment
PCT/CN2021/080986 WO2021185232A1 (en) 2020-03-16 2021-03-16 Barcode identification method, and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010183928.3A CN113408314A (en) 2020-03-16 2020-03-16 Bar code identification method and related equipment

Publications (1)

Publication Number Publication Date
CN113408314A true CN113408314A (en) 2021-09-17

Family

ID=77676853

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010183928.3A Pending CN113408314A (en) 2020-03-16 2020-03-16 Bar code identification method and related equipment

Country Status (2)

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

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116306733A (en) * 2023-02-27 2023-06-23 荣耀终端有限公司 Method for amplifying two-dimensional code and electronic equipment
WO2024055817A1 (en) * 2022-09-15 2024-03-21 荣耀终端有限公司 Code scanning method and electronic device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080029602A1 (en) * 2006-08-03 2008-02-07 Nokia Corporation Method, Apparatus, and Computer Program Product for Providing a Camera Barcode Reader
CN102270292A (en) * 2011-05-24 2011-12-07 惠州Tcl移动通信有限公司 Mobile terminal and decoding method thereof
CN103207982A (en) * 2012-01-13 2013-07-17 鸿富锦精密工业(深圳)有限公司 Two-dimensional bar code scanning method and system
CN104850815A (en) * 2015-05-20 2015-08-19 杭州晟元芯片技术有限公司 Decoding method for barcode displayed on mobile phone
CN106951813A (en) * 2017-04-12 2017-07-14 上海汇尔通信息技术有限公司 The coding/decoding method and system of a kind of bar code
CN109376568A (en) * 2018-09-19 2019-02-22 上海商米科技有限公司 Identify the method, apparatus and system of bar code
CN110059519A (en) * 2019-04-23 2019-07-26 福州符号信息科技有限公司 A kind of bar code reading method and apparatus with security level processing
CN110222547A (en) * 2019-04-29 2019-09-10 北京三快在线科技有限公司 Bar code recognition and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7145093B2 (en) * 2002-12-24 2006-12-05 Siemens Energy & Automation, Inc. Method and system for image processing
CN107609448B (en) * 2017-08-28 2020-10-20 苏州佳世达电通有限公司 Bar code decoding method and bar code decoding device
CN110516494B (en) * 2018-05-22 2023-10-10 杭州海康威视数字技术股份有限公司 Two-dimensional code identification method, device, equipment and system
CN109657515B (en) * 2018-12-18 2022-02-11 福州图腾易讯信息技术有限公司 Decoding method and device for one-dimensional bar code

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080029602A1 (en) * 2006-08-03 2008-02-07 Nokia Corporation Method, Apparatus, and Computer Program Product for Providing a Camera Barcode Reader
CN102270292A (en) * 2011-05-24 2011-12-07 惠州Tcl移动通信有限公司 Mobile terminal and decoding method thereof
CN103207982A (en) * 2012-01-13 2013-07-17 鸿富锦精密工业(深圳)有限公司 Two-dimensional bar code scanning method and system
CN104850815A (en) * 2015-05-20 2015-08-19 杭州晟元芯片技术有限公司 Decoding method for barcode displayed on mobile phone
CN106951813A (en) * 2017-04-12 2017-07-14 上海汇尔通信息技术有限公司 The coding/decoding method and system of a kind of bar code
CN109376568A (en) * 2018-09-19 2019-02-22 上海商米科技有限公司 Identify the method, apparatus and system of bar code
CN110059519A (en) * 2019-04-23 2019-07-26 福州符号信息科技有限公司 A kind of bar code reading method and apparatus with security level processing
CN110222547A (en) * 2019-04-29 2019-09-10 北京三快在线科技有限公司 Bar code recognition and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024055817A1 (en) * 2022-09-15 2024-03-21 荣耀终端有限公司 Code scanning method and electronic device
CN116306733A (en) * 2023-02-27 2023-06-23 荣耀终端有限公司 Method for amplifying two-dimensional code and electronic equipment
CN116306733B (en) * 2023-02-27 2024-03-19 荣耀终端有限公司 Method for amplifying two-dimensional code and electronic equipment

Also Published As

Publication number Publication date
WO2021185232A1 (en) 2021-09-23

Similar Documents

Publication Publication Date Title
CN115866121B (en) Application interface interaction method, electronic device and computer readable storage medium
CN114650363B (en) Image display method and electronic equipment
EP4020967B1 (en) Photographic method in long focal length scenario, and mobile terminal
CN113887264B (en) Code scanning method, system and related device
CN113641271B (en) Application window management method, terminal device and computer readable storage medium
CN110138999B (en) Certificate scanning method and device for mobile terminal
WO2023056795A1 (en) Quick photographing method, electronic device, and computer readable storage medium
CN113051950B (en) Multi-bar code identification method and related equipment
WO2021185232A1 (en) Barcode identification method, and related device
US11816494B2 (en) Foreground element display method and electronic device
CN117278850A (en) Shooting method and electronic equipment
CN115119048B (en) Video stream processing method and electronic equipment
CN116720533B (en) Code scanning method, electronic equipment and readable storage medium
CN115686182B (en) Processing method of augmented reality video and electronic equipment
CN117009005A (en) Display method, automobile and electronic equipment
CN114971107A (en) Privacy risk feedback method and device and first terminal equipment
CN114527903A (en) Key mapping method, electronic equipment and system
CN116095512B (en) Photographing method of terminal equipment and related device
CN115802144B (en) Video shooting method and related equipment
CN116233599B (en) Video mode recommendation method and electronic equipment
CN116048831B (en) Target signal processing method and electronic equipment
CN115460343B (en) Image processing method, device and storage medium
CN116703689B (en) Method and device for generating shader program and electronic equipment
CN116843708B (en) Image processing method and device
CN117880645A (en) Image processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210917