WO2020034103A1 - One-dimensional code recognition method, terminal and device, and device having storage function - Google Patents

One-dimensional code recognition method, terminal and device, and device having storage function Download PDF

Info

Publication number
WO2020034103A1
WO2020034103A1 PCT/CN2018/100516 CN2018100516W WO2020034103A1 WO 2020034103 A1 WO2020034103 A1 WO 2020034103A1 CN 2018100516 W CN2018100516 W CN 2018100516W WO 2020034103 A1 WO2020034103 A1 WO 2020034103A1
Authority
WO
WIPO (PCT)
Prior art keywords
dimensional code
bars
spaces
length
code
Prior art date
Application number
PCT/CN2018/100516
Other languages
French (fr)
Chinese (zh)
Inventor
韩琨
阳光
Original Assignee
深圳配天智能技术研究院有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳配天智能技术研究院有限公司 filed Critical 深圳配天智能技术研究院有限公司
Priority to PCT/CN2018/100516 priority Critical patent/WO2020034103A1/en
Priority to CN201880088571.1A priority patent/CN111801675A/en
Publication of WO2020034103A1 publication Critical patent/WO2020034103A1/en

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

Definitions

  • the present application relates to the technical field of one-dimensional codes, and in particular, to a one-dimensional code identification method, terminal, device, and device having a storage function.
  • a one-dimensional code is a mark composed of a set of regularly arranged bars, spaces, and corresponding characters.
  • Bar refers to the part with low reflectivity to light, generally black vertical lines
  • empty refers to the part with high reflectivity to light, generally white vertical lines.
  • the combination of bars and spaces expresses certain information, which can be expressed by Device-specific reading and conversion into computer-compatible binary and decimal information.
  • Each different type of one-dimensional code has its own characteristics. For example, some one-dimensional codes support an indefinite number of characters, some one-dimensional code modules combine a lot of character encoding patterns, and some one-dimensional codes support only two types. Width, some support four widths etc.
  • the method is robust to one-dimensional codes with fixed length and fewer coding patterns, and cannot be applied to complex variable-length one-dimensional codes or many coding patterns.
  • Another type of method performs binarization or edge extraction on all one-dimensional codes, and distinguishes between bars and spaces based on the binarization result or the extracted edge, and recognizes on this basis, but this method has poor robustness. High image quality requirements.
  • the technical problem mainly solved by this application is to provide a one-dimensional code recognition method, terminal and device capable of efficiently decoding different one-dimensional codes.
  • a technical solution provided in the present application is to provide a method for identifying a one-dimensional code, including: locating the one-dimensional code; obtaining a total number of bars and spaces in the one-dimensional code; and judging Whether the total number of bars and spaces is greater than a preset value; if the total number of bars and spaces is greater than a preset value: the bars and spaces of the one-dimensional code are selected according to a preset method to reduce The total number of bars and spaces of the one-dimensional code, the selected bars and spaces are used to decode the one-dimensional code; and the one-dimensional code is decoded according to the selected bars and spaces.
  • a one-dimensional code identification terminal including: an image collector and a processor; the image collector is used to collect the one-dimensional code image, and The received one-dimensional code image is sent to the processor; the processor is coupled to the image collector, and the processor executes the following steps when executing the program: positioning the one-dimensional code according to the one-dimensional code image; obtaining the total number of bars and spaces in the one-dimensional code Number; determine whether the total number of bars and spaces is greater than the preset value; if the total number of bars and spaces is greater than the preset value: select the bars and spaces of the one-dimensional code according to a preset method to reduce The total number of bars and spaces of the one-dimensional code. The selected bars and spaces are used to decode the one-dimensional code; then the one-dimensional code is decoded according to the selected bars and spaces.
  • another technical solution provided in the present application is to provide a device with a storage function, which stores program data, and the program data can be executed to implement the steps in the one-dimensional code identification method.
  • the one-dimensional code identification technical solution provided by the present application can optimize the selection of the one-dimensional code and the space, and reduce the input of one-dimensional code decoding, thereby reducing Noise and interference with one-dimensional code input, decoding according to the selected bars and spaces, can increase the efficiency and robustness of decoding, and improve the accuracy and speed of one-dimensional code recognition, and achieve efficient implementation of different one-dimensional codes decoding.
  • FIG. 1 is a schematic flowchart of an embodiment of a one-dimensional code identification method of the present application
  • Figure 2 is an example of a one-dimensional code
  • FIG. 3 is a schematic structural diagram of an embodiment of a one-dimensional code identification terminal of the present application.
  • FIG. 4 is a schematic structural diagram of an embodiment of a one-dimensional code identification device of the present application.
  • FIG. 5 is a schematic structural diagram of an implementation manner of an optimization unit in FIG. 4 of the present application.
  • FIG. 6 is a schematic structural diagram of another embodiment of an optimization unit in FIG. 4 of the present application.
  • FIG. 7 is a schematic structural diagram of another embodiment of a one-dimensional code identification device of the present application.
  • FIG. 8 is a schematic structural diagram of an embodiment of a type determination subunit in FIG. 7 of the present application.
  • FIG. 9 is a schematic structural diagram of an embodiment of a device with a storage function of the present application.
  • FIG. 1 is a schematic flowchart of an embodiment of a one-dimensional code identification method of the present application.
  • the one-dimensional code identification method of this embodiment includes the following steps:
  • Step S101 locate a one-dimensional code.
  • FIG. 2 is an exemplary diagram of a one-dimensional code.
  • the order of the composition of a complete one-dimensional code is: front dead zone 201, start character 202, data character 203, check character 204, terminator 205, and back dead zone 206.
  • the quiet zone refers to a blank area with the same reflectance as the empty outside of the left and right ends of the one-dimensional code, which can make the one-dimensional code reader enter a state ready for reading.
  • the white space is helpful to distinguish them.
  • the width of the white space should usually be no less than 6mm or 10 times the module width.
  • the basic unit that constitutes a one-dimensional code is a module.
  • a module refers to the narrowest bar or space in a one-dimensional code.
  • the width of a module is usually in mm or mil (thousandths of an inch).
  • a bar or space that constitutes a one-dimensional code is called a unit.
  • the number of modules included in a unit is determined by the encoding method. In some code systems, such as the EAN code, all units are composed of one or more modules. System, such as 39 yards, all units have only two widths, that is, wide units and narrow units, where the narrow unit is a module.
  • Start / stop characters refer to a number of blanks at the beginning and end of a one-dimensional code, marking the beginning and end of a one-dimensional code, and providing identification information and reading direction information of the code system.
  • a data character is a bar and empty structure located in the middle of a one-dimensional code. It contains specific information expressed by a one-dimensional code.
  • Check character usually the last unit in a data symbol, is used to verify the correctness of the value or parity expressed by the data symbol.
  • Some one-dimensional codes may not contain check characters.
  • an image of a one-dimensional code is acquired by an image collector, such as a scanner or a camera device, and then the one-dimensional code in the image is located, that is, the position of the one-dimensional code in the image is identified.
  • an image collector such as a scanner or a camera device
  • the one-dimensional code in the image is located, that is, the position of the one-dimensional code in the image is identified.
  • One-dimensional codes in the image can be located using, for example, gradient-based methods or morphological-based methods. Other general positioning methods for images can also be used, which is not limited here.
  • a one-dimensional code quality evaluation system may be added before positioning the effective area of the one-dimensional code. Positioning recognition is not performed on one-dimensional code images that do not meet the criteria such as the set evaluation threshold or set conditions. In order to further eliminate the error situation and improve the accuracy.
  • Step S102 Acquire the total number of bars and spaces in the one-dimensional code.
  • Positioning the one-dimensional code can separate the one-dimensional code from the collected image to further identify and analyze the one-dimensional code. Because of the different colors, different gray levels, and regular shapes of bars and spaces, the bars and spaces of one-dimensional codes can be identified using grayscale recognition or other image feature recognition methods, and the number of identified bars and empty ones can be obtained. Number and the total number of bars and spaces.
  • Step S103 Determine whether the total number of bars and spaces is greater than a preset value.
  • the preset value can be set according to actual needs, or the type of the one-dimensional code can be determined before step S103, and the corresponding preset value is selected according to the type. For example, if it is determined that the obtained one-dimensional code is EAN-13- Dimension code, the preset value can be the total number of bars and spaces of the standard EAN-13 one-dimensional code. For example, if it is determined that the obtained one-dimensional code is the EAN-128 one-dimensional code, the preset value can be the standard EAN- Total number of bars and spaces of 128 one-dimensional codes.
  • Step S104 if the total number of bars and spaces is greater than a preset value, selecting the bars and spaces of the one-dimensional code according to a preset method to reduce the total number of bars and spaces of the one-dimensional code, The selected bars and spaces are used to decode the one-dimensional code.
  • the bar and space of the one-dimensional code is selected according to a preset method, that is, the selection of the bar and space of the one-dimensional code is optimized. Specifically, the bar and space of the one-dimensional code is optimized.
  • the selection may include: classifying the bars and spaces according to the width of the bars and spaces; matching the similarity of the bars and spaces of each category with the reference bars and reference spaces of the same category respectively; selecting the similarity After matching, the bars with similarity greater than or equal to the first preset threshold, and blanks with similarity greater than or equal to the second preset threshold.
  • the widths of the bars and spaces of different types of one-dimensional codes are usually different. You can pre-classify the bars and spaces of existing standard one-dimensional codes to obtain different categories.
  • selecting the bars and spaces of the one-dimensional code according to a preset method may include: The one-dimensional code is similarly matched with the combination of bars and spaces corresponding to the reference character, and the combination of bars and spaces in the one-dimensional code is a combination of consecutively arranged bars and spaces; choose a similarity greater than or A combination of bars and spaces equal to a third preset threshold.
  • different combinations of continuous bars and spaces represent a character, that is, a character corresponds to a combination of a group of bars and spaces.
  • the The character is used as a reference character.
  • the reference character corresponds to a group of bar and space combinations, that is, the reference combination. Then, the continuous bar and space combination in the current one-dimensional code is matched with the reference combination corresponding to the reference character to select the similarity. The combination of three preset threshold bars and spaces is used as the optimization result.
  • it may further include: determining the type of the one-dimensional code; and then determining the type and width of the reference bar and the reference space according to the type of the one-dimensional code, or The type of code determines the reference character. This can reduce the number of similarity matches, improve the recognition efficiency of one-dimensional codes, and reduce misrecognition.
  • determining the type of the one-dimensional code includes: determining whether the one-dimensional code is a fixed-length one-dimensional code; if the one-dimensional code is a fixed-length one-dimensional code, obtaining the length of the one-dimensional code, and determining a one-dimensional code according to the length. The type of the one-dimensional code; if the one-dimensional code is a variable-length one-dimensional code, the start code and the width of the one-dimensional code are obtained, and the type of the one-dimensional code is determined according to the start code and the width.
  • determining whether the one-dimensional code is a fixed-length one-dimensional code includes: obtaining a code system of the one-dimensional code, and determining whether the one-dimensional code is a fixed-length one-dimensional code according to the code system. Or when the number of targeted one-dimensional codes is limited, it can also be determined whether the one-dimensional code is a fixed-length one-dimensional code according to the length of the one-dimensional code. If the length of the one-dimensional code is the same as the length of a fixed-length one-dimensional code The same, it can be determined that the one-dimensional code is a fixed-length one-dimensional code.
  • the values of the first preset threshold, the second preset threshold, and the third preset threshold may be set according to actual conditions, and are not limited herein.
  • the optimized bar and space width are used as input for decoding and recognition of the one-dimensional code to decode the one-dimensional code, thereby improving decoding efficiency.
  • Step S105 Decode the one-dimensional code according to the selected bar and space.
  • the selected bar and space are used as the input for the one-dimensional code decoding.
  • the bar and space gray information can be used to identify the bar code instead of binarizing the one-dimensional code or the information after edge extraction. , Thereby improving the robustness of barcode recognition, especially in the case of blurred images, noise and lighting effects.
  • Decoding the one-dimensional code according to the bar and empty gray information can use existing related technologies.
  • the beneficial effect of this embodiment is: different from the situation of the prior art, a method for identifying a one-dimensional code provided by this embodiment optimizes the selection of bars and spaces of the one-dimensional code, and reduces the number of decoded one-dimensional codes. Input, which can reduce the noise and interference with the one-dimensional code input, and decode according to the selected bar and space, which can increase the efficiency and robustness of decoding, and achieve different one-dimensional codes without being limited by the one-dimensional code type Code for efficient decoding.
  • the present application also provides a one-dimensional code identification terminal.
  • FIG. 3 is a schematic structural diagram of an embodiment of a one-dimensional code identification terminal of the present application.
  • the one-dimensional code recognition terminal 30 includes an image collector 31 and a processor 32.
  • the processor 32 is coupled to the image collector 31.
  • the image collector 31 is configured to collect a one-dimensional code image and send the collected one-dimensional code image to the processor 32.
  • the processor 32 executes the one-dimensional code recognition method described above according to the acquired image when executing the program.
  • the processor 32 executes the following steps when executing the program: positioning the one-dimensional code according to the image; obtaining the total number of bars and spaces in the one-dimensional code; judging whether the total number of bars and spaces is greater than a preset value ; If the total number of bars and spaces is greater than the preset value, select the bars and spaces of the one-dimensional code according to the preset method to reduce the total number of bars and spaces of the one-dimensional code, and the selected bars and spaces Used to decode one-dimensional code; decode one-dimensional code according to the selected bar and space.
  • the image of the one-dimensional code is taken by the image collector 31, and then the one-dimensional code in the image is located, that is, the position of the one-dimensional code in the image is identified, and the non-one-dimensional code is ignored. Positioning the one-dimensional code can separate the one-dimensional code from the collected image to further identify and analyze the one-dimensional code.
  • the processor 32 is specifically configured to execute the step of selecting the bars and spaces of the one-dimensional code according to a preset method: classify the bars and spaces according to the width of the bars and spaces; Each category of bars and spaces is similarly matched with reference bars and reference spaces of the same category, respectively; bars with similarity greater than or equal to the first preset threshold after similarity matching are selected, and similarity greater than or equal to the second preset The threshold is empty.
  • the processor 32 is specifically configured to execute the step of selecting the bars and spaces of the one-dimensional code according to a preset method: corresponding to the combination of the bars and spaces in the one-dimensional code with the reference character
  • the similarity matching is performed for the combination of bars and spaces.
  • the combination of bars and spaces in the one-dimensional code is a combination of consecutively arranged bars and spaces; a combination of bars and spaces with similarity greater than or equal to a third preset threshold is selected.
  • the processor 32 is further configured to execute before selecting the bars and spaces of the one-dimensional code according to a preset method: determining the type of the one-dimensional code; and determining the reference bar according to the type of the one-dimensional code. And the width of the reference space, or the reference character is determined according to the type of the one-dimensional code.
  • the processor 32 is specifically configured to perform the steps of determining the type of the one-dimensional code: determining whether the one-dimensional code is a fixed-length one-dimensional code; if the one-dimensional code is a fixed-length one-dimensional code, Obtain the length of the one-dimensional code and determine the type of the one-dimensional code according to the length; if the one-dimensional code is a variable-length one-dimensional code, obtain the start code and the width of the one-dimensional code, and determine it according to the start code and width The type of one-dimensional code.
  • the processor 32 is specifically configured to perform the steps of determining whether the one-dimensional code is a fixed-length one-dimensional code: obtaining a code system of the one-dimensional code; and determining whether the one-dimensional code is fixed according to the code system.
  • One-dimensional code is specifically configured to perform the steps of determining whether the one-dimensional code is a fixed-length one-dimensional code: obtaining a code system of the one-dimensional code; and determining whether the one-dimensional code is fixed according to the code system.
  • One-dimensional code is specifically configured to perform the steps of determining whether the one-dimensional code is a fixed-length one-dimensional code: obtaining a code system of the one-dimensional code; and determining whether the one-dimensional code is fixed according to the code system.
  • One-dimensional code is specifically configured to perform the steps of determining whether the one-dimensional code is a fixed-length one-dimensional code: obtaining a code system of the one-dimensional code; and determining whether the one-dimensional code is fixed according to the code system.
  • the identification terminal further includes a memory.
  • the memory is coupled to the processor 32, and the memory stores data processed by the processor 32.
  • the present application also provides a one-dimensional code recognition device.
  • FIG. 4 is a schematic structural diagram of an embodiment of a one-dimensional code identification device of the present application.
  • the identification device 40 includes: a positioning unit 41 for positioning a one-dimensional code; and an obtaining unit 42 for obtaining a signal connection with the positioning unit 41 for obtaining a total number of bars and spaces in the one-dimensional code according to the located one-dimensional code.
  • the judging unit 43 is connected to the acquiring unit 42 for receiving the total number of bars and spaces obtained by the acquiring unit 42 and judging whether the total number of bars and spaces is greater than a preset value; the optimizing unit 44
  • the optimization unit 44 is signal-connected to the judgment unit 43.
  • the optimization unit 44 selects the bars and spaces of the one-dimensional code according to a preset method to The total number of bars and spaces of the one-dimensional code is reduced, and the selected bars and spaces are used to decode the one-dimensional code; the decoding unit 45, the decoding unit 45 and the optimization unit 44 are signally connected, and are used according to the bars selected by the optimization unit 44. And empty decoding one-dimensional code.
  • FIG. 5 is a schematic structural diagram of an embodiment of an optimization unit in FIG. 4 of the present application.
  • the optimization unit 44 includes a classification subunit 51 for classifying the bars according to the widths of the bars and spaces. Classify with empty; match sub-unit 52, matching sub-unit 52 is signally connected with classification sub-unit 51, and is used to separate the bars and spaces of each class with reference bars and reference spaces of the same category according to the classification results of classification sub-unit 51 Perform similarity matching; the first selection sub-unit 53, the first selection sub-unit 53 is signal-connected to the matching sub-unit 52, and is used to select the similarity after the similarity matching is greater than or equal to the first prediction according to the matching result of the matching sub-unit 52. Threshold bars and spaces with similarity greater than or equal to the second preset threshold.
  • FIG. 6 is a schematic structural diagram of another embodiment of an optimization unit in FIG. 4 of the present application.
  • the optimization unit 44 includes a combination matching sub-unit 61 for matching the similarity between the combination of bars and spaces in the one-dimensional code and the combination of bars and spaces corresponding to the reference character, and the combination of the bars and spaces in the one-dimensional code is arranged continuously.
  • the combination of the bar and the empty; the second selection sub-unit 62, the second selection sub-unit 62 is signally connected to the combination matching sub-unit 61, and is used to select a similarity greater than or equal to the third prediction according to the matching result of the combination matching sub-unit 61.
  • a combination of threshold bars and spaces are used to select a similarity greater than or equal to the third prediction according to the matching result of the combination matching sub-unit 61.
  • FIG. 7 is a schematic structural diagram of another embodiment of a one-dimensional code identification device of the present application.
  • the identification device 40 further includes a determination unit 86, and the determination unit 86 is signal-connected to the determination unit 43 and the optimization unit 44.
  • the determination unit 86 includes: a type determination subunit 861 for determining the type of the one-dimensional code; a reference quantity determination subunit 862, It is used to determine the width of the reference bar and the reference space according to the type of the one-dimensional code, or determine the reference character according to the type of the one-dimensional code.
  • FIG. 8 is a schematic structural diagram of an embodiment of a type determination subunit in FIG. 7 of the present application.
  • the type determination subunit 861 further includes: a fixed-length determination module 72 for determining whether the one-dimensional code is a fixed-length one-dimensional code; and a first determination module 76 for obtaining a one-dimensional code if the one-dimensional code is a fixed-length one-dimensional code.
  • the length of the code determines the type of the one-dimensional code according to the length.
  • the second determining module 74 is configured to obtain the start code and the width of the one-dimensional code if the one-dimensional code is a variable-length one-dimensional code.
  • the start code and width determine the type of one-dimensional code.
  • the fixed-length judgment module 72 further includes: a code system acquisition sub-module 77 for acquiring the code system of the one-dimensional code; a judgment sub-module 73, the judgment sub-module 73 is signally connected to the code system acquisition sub-module 77, and the judgment sub-module 73 is used for Determine whether the one-dimensional code is a fixed-length one-dimensional code according to the code system acquired by the code system acquisition sub-module 77.
  • the present application provides a device with a storage function to implement the above-mentioned one-dimensional code identification method.
  • FIG. 9 is a schematic structural diagram of an embodiment of a device with a storage function of the present application.
  • At least one program or instruction 901 is stored in the device 90 having a storage function, and the program or instruction 901 is used to execute any one of the foregoing one-dimensional code identification methods.
  • the device having a storage function may be a storage device in a mobile device.
  • the disclosed methods and devices may be implemented in other ways.
  • the device implementations described above are only schematic.
  • the division of modules or units is only a logical function division.
  • multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, which may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit.
  • the above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
  • the integrated unit When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium. It includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods in the embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random access Memory), magnetic disks or optical disks and other media that can store program codes .
  • the one-dimensional code identification technical solution provided by this embodiment can optimize the bar and sum of the one-dimensional code by judging whether the total number of bars and spaces is greater than a preset value.
  • the empty selection excludes one-dimensional codes with low similarity to reduce the total number of bars and spaces in the one-dimensional code, which can improve the accuracy and speed of one-dimensional code recognition, thereby achieving efficient decoding of different one-dimensional codes.

Abstract

A one-dimensional code recognition method, a one-dimensional code recognition terminal, a one-dimensional code recognition device, and a device having a storage function. The method comprises: acquiring the total number of bars and spaces in a one-dimensional code (102); determining whether the total number of bars and spaces is greater than a preset value (103); and if the total number of bars and spaces is greater than the preset value: selecting the bars and spaces of the one-dimensional code according to a preset method so as to reduce the total number of bars and spaces of the one-dimensional code, wherein the selected bars and spaces are used to decode the one-dimensional code (104). In this way, the method can optimize the selection of bars and spaces of a one-dimensional code, exclude bars and spaces with a lower similarity to reduce the amount of input needed to decode the one-dimensional code, and improve the accuracy and speed of one-dimensional code recognition, thereby realizing high-efficient decoding of different one-dimensional codes.

Description

一种一维码识别方法、终端、装置及具有存储功能的装置One-dimensional code recognition method, terminal, device and device with storage function 【技术领域】[Technical Field]
本申请涉及一维码技术领域,特别是涉及一种一维码识别方法、终端、装置及具有存储功能的装置。The present application relates to the technical field of one-dimensional codes, and in particular, to a one-dimensional code identification method, terminal, device, and device having a storage function.
【背景技术】【Background technique】
一维码是由一组规则排列的条、空以及对应的字符组成的标记。“条”指对光线反射率较低的部分,一般为黑色竖线,“空”指对光线反射率较高的部分,一般为白色竖线,条和空的组合表达一定的信息,能够被特定的设备识读,转换成与计算机兼容的二进制和十进制信息。每个不同类型的一维码都有自己本身的特点,比如有些一维码支持的字符数不定长,有些一维码的模块组合出的字符编码图案非常多,有些一维码只支持两种宽度,有些支持四种宽度等。A one-dimensional code is a mark composed of a set of regularly arranged bars, spaces, and corresponding characters. "Bar" refers to the part with low reflectivity to light, generally black vertical lines, and "empty" refers to the part with high reflectivity to light, generally white vertical lines. The combination of bars and spaces expresses certain information, which can be expressed by Device-specific reading and conversion into computer-compatible binary and decimal information. Each different type of one-dimensional code has its own characteristics. For example, some one-dimensional codes support an indefinite number of characters, some one-dimensional code modules combine a lot of character encoding patterns, and some one-dimensional codes support only two types. Width, some support four widths etc.
目前存在的基于图像的一维码识别方法有两类:一类针对定长的,编码图案(或者称之为模板)较少的一维码,在模糊,噪声等等情况下可以达到较高的鲁棒性,但该方法只针对定长且编码图案较少的一维码,不能应用于复杂的变长一维码或者编码图案很多的情况。另外一类方法对所有一维码均进行二值化或边缘提取,根据二值化的结果或提取的边缘区分条和空,并且在该基础上进行识别,但这类方法的鲁棒性差,对图像质量要求高。There are currently two types of image-based one-dimensional code recognition methods: one is for fixed-length one-dimensional codes with fewer coding patterns (or templates), which can reach higher levels in the case of blurring, noise, etc. The method is robust to one-dimensional codes with fixed length and fewer coding patterns, and cannot be applied to complex variable-length one-dimensional codes or many coding patterns. Another type of method performs binarization or edge extraction on all one-dimensional codes, and distinguishes between bars and spaces based on the binarization result or the extracted edge, and recognizes on this basis, but this method has poor robustness. High image quality requirements.
由此可见,目前急需一种能对不同一维码进行高效解码的方法。It can be seen that there is an urgent need for a method that can efficiently decode different one-dimensional codes.
【发明内容】[Summary of the Invention]
本申请主要解决的技术问题是提供一种能够对不同一维码进行高效解码的一维码识别方法、终端及装置。The technical problem mainly solved by this application is to provide a one-dimensional code recognition method, terminal and device capable of efficiently decoding different one-dimensional codes.
为解决上述主要技术问题,本申请提供的一种技术方案是:提供一种一维码的识别方法,包括:定位一维码;获取所述一维码中条和空的总个数;判断所述条和空的总个数是否大于预设值;若所述条和空的总个数大于预设值:按照预设的方法对所述一维码的条和空进行选择,以减少所述一维码的条和空的总个数,所选择的条和空用于解码所述一维码;根据所选择的条和空解码所述一维码。In order to solve the above-mentioned main technical problems, a technical solution provided in the present application is to provide a method for identifying a one-dimensional code, including: locating the one-dimensional code; obtaining a total number of bars and spaces in the one-dimensional code; and judging Whether the total number of bars and spaces is greater than a preset value; if the total number of bars and spaces is greater than a preset value: the bars and spaces of the one-dimensional code are selected according to a preset method to reduce The total number of bars and spaces of the one-dimensional code, the selected bars and spaces are used to decode the one-dimensional code; and the one-dimensional code is decoded according to the selected bars and spaces.
为解决上述主要技术问题,本申请提供的另一种技术方案是:提供一种一维码的识别终端,包括:图像采集器以及处理器;图像采集器用于采集一维码图像,并将采集到的一维码图像发送至处理器;处理器与图像采集器耦合连接,处理器在执行程序时执行以下步骤:根据一维码图像定位一维码;获取一维码中条和空的总个数;判断条和空的总个数是否大于预设值;若条和空的总个数大于预设值:按照预设的方法对所述一维码的条和空进行选择,以减少一维码的条和空的总个数,所选择的条和空用于解码一维码;然后根据所选择的条和空解码一维码。In order to solve the above-mentioned main technical problem, another technical solution provided in the present application is to provide a one-dimensional code identification terminal, including: an image collector and a processor; the image collector is used to collect the one-dimensional code image, and The received one-dimensional code image is sent to the processor; the processor is coupled to the image collector, and the processor executes the following steps when executing the program: positioning the one-dimensional code according to the one-dimensional code image; obtaining the total number of bars and spaces in the one-dimensional code Number; determine whether the total number of bars and spaces is greater than the preset value; if the total number of bars and spaces is greater than the preset value: select the bars and spaces of the one-dimensional code according to a preset method to reduce The total number of bars and spaces of the one-dimensional code. The selected bars and spaces are used to decode the one-dimensional code; then the one-dimensional code is decoded according to the selected bars and spaces.
为解决上述主要技术问题,本申请提供的再一种技术方案是:提供.一种具有存储功能的装置,存储有程序数据,程序数据能够被执行以实现上述一维码识别方法中的步骤。In order to solve the above-mentioned main technical problem, another technical solution provided in the present application is to provide a device with a storage function, which stores program data, and the program data can be executed to implement the steps in the one-dimensional code identification method.
本申请的有益效果是:区别于现有技术的情况,本申请所提供的一维码识别技术方案,能够优化一维码的条和空的选择,减少一维码解码的输入,从而能减少与一维码输入的噪声和干扰,根据选择后的条和空进行解码,能够增加解码的效率和鲁棒性,并且提高一维码识别的精度和速度,实现对不同的一维码进行高效解码。The beneficial effects of the present application are: Different from the situation of the prior art, the one-dimensional code identification technical solution provided by the present application can optimize the selection of the one-dimensional code and the space, and reduce the input of one-dimensional code decoding, thereby reducing Noise and interference with one-dimensional code input, decoding according to the selected bars and spaces, can increase the efficiency and robustness of decoding, and improve the accuracy and speed of one-dimensional code recognition, and achieve efficient implementation of different one-dimensional codes decoding.
【附图说明】[Brief Description of the Drawings]
图1为本申请一维码识别方法的一实施方式的流程示意图;FIG. 1 is a schematic flowchart of an embodiment of a one-dimensional code identification method of the present application;
图2为一一维码示例图;Figure 2 is an example of a one-dimensional code;
图3为本申请一维码识别终端的一实施方式的结构示意图;3 is a schematic structural diagram of an embodiment of a one-dimensional code identification terminal of the present application;
图4为本申请一维码识别装置的一实施方式的结构示意图;4 is a schematic structural diagram of an embodiment of a one-dimensional code identification device of the present application;
图5为本申请图4中优化单元的一实施方式的结构示意图;5 is a schematic structural diagram of an implementation manner of an optimization unit in FIG. 4 of the present application;
图6为本申请图4中优化单元的另一实施方式的结构示意图;6 is a schematic structural diagram of another embodiment of an optimization unit in FIG. 4 of the present application;
图7为本申请一维码识别装置的另一实施方式的结构示意图;7 is a schematic structural diagram of another embodiment of a one-dimensional code identification device of the present application;
图8为本申请图7中类型确定子单元的一实施方式的结构示意图;FIG. 8 is a schematic structural diagram of an embodiment of a type determination subunit in FIG. 7 of the present application; FIG.
图9为本申请一具有存储功能的装置的一实施方式的结构示意图。FIG. 9 is a schematic structural diagram of an embodiment of a device with a storage function of the present application.
【具体实施方式】【detailed description】
下面将结合本申请实施方式中的附图,对本申请实施方式中的技术方案进行清楚、完整地描述,显然,所描述的实施方式仅仅是本申请一部分实施方式,而不是全部的实施方式。基于本申请中的实施方式,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施方式,均属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the implementations in this application, all other implementations obtained by a person of ordinary skill in the art without creative labor shall fall within the protection scope of this application.
参阅图1,图1为本申请一维码识别方法的一实施方式的流程示意图,本实施方式的一维码识别方法包括以下步骤:Referring to FIG. 1, FIG. 1 is a schematic flowchart of an embodiment of a one-dimensional code identification method of the present application. The one-dimensional code identification method of this embodiment includes the following steps:
步骤S101:定位一维码。Step S101: locate a one-dimensional code.
参见图2,图2为一一维码的示例图。一般情况下,一个完整的一维码的组成次序依次为:前静区201、起始符202、数据符203、校验符204、终止符205、后静区206。Referring to FIG. 2, FIG. 2 is an exemplary diagram of a one-dimensional code. In general, the order of the composition of a complete one-dimensional code is: front dead zone 201, start character 202, data character 203, check character 204, terminator 205, and back dead zone 206.
具体地,静区,指一维码左右两端外侧与空的反射率相同的空白区域,它能使一维码阅读器进入准备阅读的状态,当两个一维码相距距离较近时,空白区域则有助于对它们加以区分,空白区域的宽度通常应不小于6mm或10倍模块宽度。Specifically, the quiet zone refers to a blank area with the same reflectance as the empty outside of the left and right ends of the one-dimensional code, which can make the one-dimensional code reader enter a state ready for reading. When two one-dimensional codes are closer to each other, The white space is helpful to distinguish them. The width of the white space should usually be no less than 6mm or 10 times the module width.
构成一维码的基本单位是模块,模块是指一维码中最窄的条或空,模块的宽度通常以mm或mil(千分之一英寸)为单位。构成一维码的一个条或空称为一个单元,一个单元包含的模块数是由编码方式决定的,有些码制中,如EAN码,所有单元由一个或多个模块组成;而另 一些码制,如39码中,所有单元只有两种宽度,即宽单元和窄单元,其中的窄单元即为一个模块。The basic unit that constitutes a one-dimensional code is a module. A module refers to the narrowest bar or space in a one-dimensional code. The width of a module is usually in mm or mil (thousandths of an inch). A bar or space that constitutes a one-dimensional code is called a unit. The number of modules included in a unit is determined by the encoding method. In some code systems, such as the EAN code, all units are composed of one or more modules. System, such as 39 yards, all units have only two widths, that is, wide units and narrow units, where the narrow unit is a module.
起始/终止字符,指位于一维码开始和结束的若干条与空,标志一维码的开始和结束,同时提供了码制识别信息和阅读方向的信息。Start / stop characters refer to a number of blanks at the beginning and end of a one-dimensional code, marking the beginning and end of a one-dimensional code, and providing identification information and reading direction information of the code system.
数据字符,位于一维码中间的条、空结构,它包含一维码所表达的特定信息。校验字符,通常是数据符中的最后一个单元,用来对数据符表达的数值或奇偶进行正确性校验。有些一维码可以不包含校验符。A data character is a bar and empty structure located in the middle of a one-dimensional code. It contains specific information expressed by a one-dimensional code. Check character, usually the last unit in a data symbol, is used to verify the correctness of the value or parity expressed by the data symbol. Some one-dimensional codes may not contain check characters.
在一个具体的实施场景中,通过图像采集器,例如扫描器或摄像设备获取一维码的图像,然后对图像中的一维码进行定位,也就是识别出一维码在图像中的位置,忽略非一维码的部分。可以使用例如基于梯度的方法或者基于形态学的方法定位出图像中的一维码。还可以使用其它针对图像的通用定位方法,在此不做限定。在其它实施场景中,在进行定位一维码的有效区域之前还可以加入一维码质量评估体系,对于不符合标准如设定的评估阈值或设定条件的一维码图像不做定位识别,以进一步排除误码情况,提高准确率。In a specific implementation scenario, an image of a one-dimensional code is acquired by an image collector, such as a scanner or a camera device, and then the one-dimensional code in the image is located, that is, the position of the one-dimensional code in the image is identified. Ignore non-one-dimensional codes. One-dimensional codes in the image can be located using, for example, gradient-based methods or morphological-based methods. Other general positioning methods for images can also be used, which is not limited here. In other implementation scenarios, a one-dimensional code quality evaluation system may be added before positioning the effective area of the one-dimensional code. Positioning recognition is not performed on one-dimensional code images that do not meet the criteria such as the set evaluation threshold or set conditions. In order to further eliminate the error situation and improve the accuracy.
步骤S102:获取所述一维码中条和空的总个数。Step S102: Acquire the total number of bars and spaces in the one-dimensional code.
定位一维码可以将一维码从采集的图像中分离出来,以专门对一维码进行进一步识别与分析。由于条和空的颜色不同、灰度不同且形状规则,一维码的条和空可以使用灰度识别或其他图像特征识别方法识别出来,并能够得到识别出的条的个数、空的个数以及条和空的总个数。Positioning the one-dimensional code can separate the one-dimensional code from the collected image to further identify and analyze the one-dimensional code. Because of the different colors, different gray levels, and regular shapes of bars and spaces, the bars and spaces of one-dimensional codes can be identified using grayscale recognition or other image feature recognition methods, and the number of identified bars and empty ones can be obtained. Number and the total number of bars and spaces.
步骤S103:判断条和空的总个数是否大于预设值。Step S103: Determine whether the total number of bars and spaces is greater than a preset value.
所述预设值可以根据实际情况需要来设定,也可以在步骤S103之前先判断一维码的类型,根据类型选择对应的预设值,例如若确定获取的一维码为EAN-13一维码,则预设值可以为标准EAN-13一维码的条与空的总数目,又例如若确定获取的一维码为EAN-128一维码,则预设值可以为标准EAN-128一维码的条与空的总数目。The preset value can be set according to actual needs, or the type of the one-dimensional code can be determined before step S103, and the corresponding preset value is selected according to the type. For example, if it is determined that the obtained one-dimensional code is EAN-13- Dimension code, the preset value can be the total number of bars and spaces of the standard EAN-13 one-dimensional code. For example, if it is determined that the obtained one-dimensional code is the EAN-128 one-dimensional code, the preset value can be the standard EAN- Total number of bars and spaces of 128 one-dimensional codes.
步骤S104:若条和空的总个数大于预设值,按照预设的方法对所述一维码的条和空进行选择,以减少所述一维码的条和空的总个数,所选择的条和空用于解码一维码。Step S104: if the total number of bars and spaces is greater than a preset value, selecting the bars and spaces of the one-dimensional code according to a preset method to reduce the total number of bars and spaces of the one-dimensional code, The selected bars and spaces are used to decode the one-dimensional code.
按照预设的方法对所述一维码的条和空进行选择,也就是优化对所述一维码的条和空的选择,具体的,所述优化对所述一维码的条和空的选择可以包括:根据所述条和空的宽度对所述条和空进行分类;将每一类的所述条和空分别与相同类别的参考条和参考空进行相似度匹配;选择相似度匹配后相似度大于或等于第一预设阈值的条,以及相似度大于或等于第二预设阈值的空。不同类型的一维码的条和空的宽度通常是不同的,可以对现有的标准的一维码的条和空的宽度预先分类,得到不同类别,预先分类的每一类别中的条或空作为参考条和参考空,然后根据当前一维码的条和空的宽度将当前一维码的条和空参考预先分类的类别进行分类,然后将当前一维码的条与相同类别的参考条进行相似度匹配,同样地将当前一维码的空与相同类别的参考空进行相似度匹配,选择相似度大于第一预设阈值的条和相似度大于第二预设阈值的空作为与优化的结果。The bar and space of the one-dimensional code is selected according to a preset method, that is, the selection of the bar and space of the one-dimensional code is optimized. Specifically, the bar and space of the one-dimensional code is optimized. The selection may include: classifying the bars and spaces according to the width of the bars and spaces; matching the similarity of the bars and spaces of each category with the reference bars and reference spaces of the same category respectively; selecting the similarity After matching, the bars with similarity greater than or equal to the first preset threshold, and blanks with similarity greater than or equal to the second preset threshold. The widths of the bars and spaces of different types of one-dimensional codes are usually different. You can pre-classify the bars and spaces of existing standard one-dimensional codes to obtain different categories. Empty as the reference bar and reference space, and then classify the current one-dimensional code bar and empty reference pre-classified category according to the current one-dimensional code bar and empty width, and then classify the current one-dimensional code bar with the same category of reference The similarity matching is performed on the bars, and the similarity matching of the current one-dimensional code space and the reference space of the same category is similarly performed. Optimized results.
在另一种实施方式中,所述按照预设的方法对所述一维码的条和空进行选择,亦即优化对所述一维码的条和空的选择,可以包括:将所述一维码中条和空的组合与参考字符对应的条和空的组合进行相似度匹配,所述一维码中条和空的组合为连续排列的条和空的组合;选择相似度大于或等于第三预设阈值的条和空的组合。通常一维码的编制中,不同连续条和空的组合代表一个字符,也就是一个字符对应一组条和空的组合,可以先根据现有的标准的一维码的编制,将编制中的字符作为参考字符,参考字符对应一组条和空的组合即参考组合,然后将当前一维码中连续的条和空的组合与参考字符对应的参考组合进行相似度匹配,选择相似度大于第三预设阈值的条和空的组合作为优化结果。In another embodiment, selecting the bars and spaces of the one-dimensional code according to a preset method, that is, optimizing the selection of bars and spaces of the one-dimensional code, may include: The one-dimensional code is similarly matched with the combination of bars and spaces corresponding to the reference character, and the combination of bars and spaces in the one-dimensional code is a combination of consecutively arranged bars and spaces; choose a similarity greater than or A combination of bars and spaces equal to a third preset threshold. Generally, in the compilation of one-dimensional codes, different combinations of continuous bars and spaces represent a character, that is, a character corresponds to a combination of a group of bars and spaces. According to the existing standard one-dimensional code, the The character is used as a reference character. The reference character corresponds to a group of bar and space combinations, that is, the reference combination. Then, the continuous bar and space combination in the current one-dimensional code is matched with the reference combination corresponding to the reference character to select the similarity. The combination of three preset threshold bars and spaces is used as the optimization result.
在一个具体的实施场景中,在优化条和空的选择之前还可以包括:确定一维码的类型;然后可以根据一维码的类型确定参考条和参考空 的类别和宽度,或者根据一维码的类型确定参考字符,这样可以减少相似度匹配的次数,提高一维码识别效率,减少误识别。In a specific implementation scenario, before optimizing the selection of the bar and the space, it may further include: determining the type of the one-dimensional code; and then determining the type and width of the reference bar and the reference space according to the type of the one-dimensional code, or The type of code determines the reference character. This can reduce the number of similarity matches, improve the recognition efficiency of one-dimensional codes, and reduce misrecognition.
不同类型一维码有不同的类型特征,例如,一维码的长度、一维码的起始码、一维码支持的条和空的宽度种类等。在一个具体的实施场景中,确定一维码的类型包括:判断一维码是否为定长一维码;若一维码为定长一维码,获取一维码的长度,根据长度确定一维码的类型;若一维码为可变长一维码,获取一维码的起始码和一维码的宽度,根据起始码和宽度确定一维码的类型。Different types of one-dimensional codes have different types of characteristics, such as the length of one-dimensional codes, the start code of one-dimensional codes, the types of bars and spaces supported by one-dimensional codes, and so on. In a specific implementation scenario, determining the type of the one-dimensional code includes: determining whether the one-dimensional code is a fixed-length one-dimensional code; if the one-dimensional code is a fixed-length one-dimensional code, obtaining the length of the one-dimensional code, and determining a one-dimensional code according to the length. The type of the one-dimensional code; if the one-dimensional code is a variable-length one-dimensional code, the start code and the width of the one-dimensional code are obtained, and the type of the one-dimensional code is determined according to the start code and the width.
在一个具体的实施场景中,判断一维码是否为定长一维码,包括:获取一维码的码制,根据码制判断一维码是否为定长一维码。或者在针对的一维码为限定的几种时,根据一维码的长度也可以确定一维码是否为定长一维码,如果一维码的长度与某种定长一维码的长度相同,则可以确定该一维码为定长一维码。In a specific implementation scenario, determining whether the one-dimensional code is a fixed-length one-dimensional code includes: obtaining a code system of the one-dimensional code, and determining whether the one-dimensional code is a fixed-length one-dimensional code according to the code system. Or when the number of targeted one-dimensional codes is limited, it can also be determined whether the one-dimensional code is a fixed-length one-dimensional code according to the length of the one-dimensional code. If the length of the one-dimensional code is the same as the length of a fixed-length one-dimensional code The same, it can be determined that the one-dimensional code is a fixed-length one-dimensional code.
其中,第一预设阈值、第二预设阈值和第三预设阈值的值可根据实际情况设定,在此处不做限定。将优化后选择的条和空的宽度作为一维码解码识别的输入,对一维码进行解码,从而提高解码效率。The values of the first preset threshold, the second preset threshold, and the third preset threshold may be set according to actual conditions, and are not limited herein. The optimized bar and space width are used as input for decoding and recognition of the one-dimensional code to decode the one-dimensional code, thereby improving decoding efficiency.
步骤S105:根据所选择的条和空解码一维码。Step S105: Decode the one-dimensional code according to the selected bar and space.
所选择的条和空作为一维码解码的输入,结合与一维码的定位,可以使用条和空的灰度信息而不是对一维码二值化或者边缘提取后的信息对条码进行识别,从而提高条码识别的鲁棒性,尤其是在图像模糊、存在噪声和存在打光影响的等情况仍具有较好的鲁棒性。具体根据条和空的灰度信息进行一维码解码可以使用现有的相关技术。The selected bar and space are used as the input for the one-dimensional code decoding. In combination with the positioning of the one-dimensional code, the bar and space gray information can be used to identify the bar code instead of binarizing the one-dimensional code or the information after edge extraction. , Thereby improving the robustness of barcode recognition, especially in the case of blurred images, noise and lighting effects. Decoding the one-dimensional code according to the bar and empty gray information can use existing related technologies.
本实施例的有益效果是:区别于现有技术的情况,本实施例所提供的一种一维码的识别方法,对一维码的条和空的选择进行优化,减少一维码解码的输入,从而能减少与一维码输入的噪声和干扰,根据选择后的条和空进行解码,能够增加解码的效率和鲁棒性,并且不受一维码类型的限制实现对不同的一维码进行高效解码。The beneficial effect of this embodiment is: different from the situation of the prior art, a method for identifying a one-dimensional code provided by this embodiment optimizes the selection of bars and spaces of the one-dimensional code, and reduces the number of decoded one-dimensional codes. Input, which can reduce the noise and interference with the one-dimensional code input, and decode according to the selected bar and space, which can increase the efficiency and robustness of decoding, and achieve different one-dimensional codes without being limited by the one-dimensional code type Code for efficient decoding.
为实现对不同特征的一维码进行高效解码,本申请还提供了一种一维码识别终端。In order to achieve efficient decoding of one-dimensional codes with different features, the present application also provides a one-dimensional code identification terminal.
在具体的实施场景中,请参阅图3,图3为本申请一维码识别终端的一实施方式的结构示意图。一维码识别终端30包括图像采集器31、处理器32,处理器32与图像采集器31耦合连接。图像采集器31用于采集一维码的图像,并将采集到的一维码图像发送至处理器32。处理器32在执行程序时根据所采集的图像执行如上所述的一维码识别方法。In a specific implementation scenario, please refer to FIG. 3, which is a schematic structural diagram of an embodiment of a one-dimensional code identification terminal of the present application. The one-dimensional code recognition terminal 30 includes an image collector 31 and a processor 32. The processor 32 is coupled to the image collector 31. The image collector 31 is configured to collect a one-dimensional code image and send the collected one-dimensional code image to the processor 32. The processor 32 executes the one-dimensional code recognition method described above according to the acquired image when executing the program.
在一实施例中,处理器32在执行程序时执行以下步骤:根据图像定位一维码;获取一维码中条和空的总个数;判断条和空的总个数是否大于预设值;若条和空的总个数大于预设值,按照预设的方法对一维码的条和空进行选择,以减少一维码的条和空的总个数,所选择的条和空用于解码一维码;根据所选择的条和空解码一维码。通过图像采集器31取一维码的图像,然后对图像中的一维码进行定位,也就是识别出一维码在图像中的位置,忽略非一维码的部分。定位一维码可以将一维码从采集的图像中分离出来,以专门对一维码进行进一步识别与分析。In an embodiment, the processor 32 executes the following steps when executing the program: positioning the one-dimensional code according to the image; obtaining the total number of bars and spaces in the one-dimensional code; judging whether the total number of bars and spaces is greater than a preset value ; If the total number of bars and spaces is greater than the preset value, select the bars and spaces of the one-dimensional code according to the preset method to reduce the total number of bars and spaces of the one-dimensional code, and the selected bars and spaces Used to decode one-dimensional code; decode one-dimensional code according to the selected bar and space. The image of the one-dimensional code is taken by the image collector 31, and then the one-dimensional code in the image is located, that is, the position of the one-dimensional code in the image is identified, and the non-one-dimensional code is ignored. Positioning the one-dimensional code can separate the one-dimensional code from the collected image to further identify and analyze the one-dimensional code.
在一实施例中,处理器32在用于执行按照预设的方法对一维码的条和空进行选择的步骤时具体用于执行:根据条和空的宽度对条和空进行分类;将每一类的条和空分别与相同类别的参考条和参考空进行相似度匹配;选择相似度匹配后相似度大于或等于第一预设阈值的条,以及相似度大于或等于第二预设阈值的空。In an embodiment, the processor 32 is specifically configured to execute the step of selecting the bars and spaces of the one-dimensional code according to a preset method: classify the bars and spaces according to the width of the bars and spaces; Each category of bars and spaces is similarly matched with reference bars and reference spaces of the same category, respectively; bars with similarity greater than or equal to the first preset threshold after similarity matching are selected, and similarity greater than or equal to the second preset The threshold is empty.
在一实施例中,处理器32在用于执行按照预设的方法对一维码的条和空进行选择的步骤时具体用于执行:将一维码中条和空的组合与参考字符对应的条和空的组合进行相似度匹配,一维码中条和空的组合为连续排列的条和空的组合;选择相似度大于或等于第三预设阈值的条和空的组合。In an embodiment, the processor 32 is specifically configured to execute the step of selecting the bars and spaces of the one-dimensional code according to a preset method: corresponding to the combination of the bars and spaces in the one-dimensional code with the reference character The similarity matching is performed for the combination of bars and spaces. The combination of bars and spaces in the one-dimensional code is a combination of consecutively arranged bars and spaces; a combination of bars and spaces with similarity greater than or equal to a third preset threshold is selected.
在一实施例中,处理器32在用于执行按照预设的方法对一维码的条和空进行选择之前还用于执行:确定一维码的类型;根据一维码的类型确定参考条和参考空的宽度,或者根据一维码的类型确定参考字符。In an embodiment, the processor 32 is further configured to execute before selecting the bars and spaces of the one-dimensional code according to a preset method: determining the type of the one-dimensional code; and determining the reference bar according to the type of the one-dimensional code. And the width of the reference space, or the reference character is determined according to the type of the one-dimensional code.
在一实施例中,处理器32在用于执行确定一维码的类型的步骤时具体用于执行:判断一维码是否为定长一维码;若一维码为定长一维码,获取一维码的长度,根据长度确定一维码的类型;若一维码为可变长一维码,获取一维码的起始码和一维码的宽度,根据起始码和宽度确定一维码的类型。In an embodiment, the processor 32 is specifically configured to perform the steps of determining the type of the one-dimensional code: determining whether the one-dimensional code is a fixed-length one-dimensional code; if the one-dimensional code is a fixed-length one-dimensional code, Obtain the length of the one-dimensional code and determine the type of the one-dimensional code according to the length; if the one-dimensional code is a variable-length one-dimensional code, obtain the start code and the width of the one-dimensional code, and determine it according to the start code and width The type of one-dimensional code.
在一实施例中,处理器32在用于执行判断一维码是否为定长一维码的步骤时具体用于执行:获取一维码的码制;根据码制判断一维码是否为定长一维码。In an embodiment, the processor 32 is specifically configured to perform the steps of determining whether the one-dimensional code is a fixed-length one-dimensional code: obtaining a code system of the one-dimensional code; and determining whether the one-dimensional code is fixed according to the code system. One-dimensional code.
在一实施例中,识别终端进一步包括存储器,存储器与处理器32耦合连接,存储器存储处理器32处理的数据。In an embodiment, the identification terminal further includes a memory. The memory is coupled to the processor 32, and the memory stores data processed by the processor 32.
为实现对不同特征的一维码进行高效解码,本申请还提供了一种一维码识别装置。In order to achieve efficient decoding of one-dimensional codes with different features, the present application also provides a one-dimensional code recognition device.
在具体的实施场景中,请参阅图4,图4为本申请一维码识别装置的一实施方式的结构示意图。识别装置40包括:定位单元41,用于定位一维码;获取单元42,获取单元42与定位单元41信号连接,用于根据定位到的一维码获取一维码中条和空的总个数;判断单元43,判断单元43与获取单元42信号连接,用于接收获取单元42所获取的条和空的总个数,并判断条和空的总个数是否大于预设值;优化单元44优化单元44与判断单元43信号连接,用于若判断单元43判定条和空的总个数大于预设值,优化单元44按照预设的方法对一维码的条和空进行选择,以减少一维码的条和空的总个数,所选择的条和空用于解码一维码;解码单元45,解码单元45与优化单元44信号连接,用于根据优化单元44所选择的条和空解码一维码。In a specific implementation scenario, please refer to FIG. 4, which is a schematic structural diagram of an embodiment of a one-dimensional code identification device of the present application. The identification device 40 includes: a positioning unit 41 for positioning a one-dimensional code; and an obtaining unit 42 for obtaining a signal connection with the positioning unit 41 for obtaining a total number of bars and spaces in the one-dimensional code according to the located one-dimensional code. The judging unit 43 is connected to the acquiring unit 42 for receiving the total number of bars and spaces obtained by the acquiring unit 42 and judging whether the total number of bars and spaces is greater than a preset value; the optimizing unit 44 The optimization unit 44 is signal-connected to the judgment unit 43. If the judgment unit 43 determines that the total number of bars and spaces is greater than a preset value, the optimization unit 44 selects the bars and spaces of the one-dimensional code according to a preset method to The total number of bars and spaces of the one-dimensional code is reduced, and the selected bars and spaces are used to decode the one-dimensional code; the decoding unit 45, the decoding unit 45 and the optimization unit 44 are signally connected, and are used according to the bars selected by the optimization unit 44. And empty decoding one-dimensional code.
在具体的实施场景中,请参阅图5,图5为本申请图4中优化单元的一实施方式的结构示意图,优化单元44包括:分类子单元51,用于根据条和空的宽度对条和空进行分类;匹配子单元52,匹配子单元52与分类子单元51信号连接,用于根据分类子单元51的分类结果将每一类的条和空分别与相同类别的参考条和参考空进行相似度匹配;第一选择子单元53,第一选择子单元53与匹配子单元52信号连接,用于 根据匹配子单元52的匹配结果,选择相似度匹配后相似度大于或等于第一预设阈值的条,以及相似度大于或等于第二预设阈值的空。In a specific implementation scenario, please refer to FIG. 5. FIG. 5 is a schematic structural diagram of an embodiment of an optimization unit in FIG. 4 of the present application. The optimization unit 44 includes a classification subunit 51 for classifying the bars according to the widths of the bars and spaces. Classify with empty; match sub-unit 52, matching sub-unit 52 is signally connected with classification sub-unit 51, and is used to separate the bars and spaces of each class with reference bars and reference spaces of the same category according to the classification results of classification sub-unit 51 Perform similarity matching; the first selection sub-unit 53, the first selection sub-unit 53 is signal-connected to the matching sub-unit 52, and is used to select the similarity after the similarity matching is greater than or equal to the first prediction according to the matching result of the matching sub-unit 52. Threshold bars and spaces with similarity greater than or equal to the second preset threshold.
在具体的实施场景中,请参阅图6,图6为本申请图4中优化单元的另一实施方式的结构示意图。优化单元44包括:组合匹配子单元61,用于将一维码中条和空的组合与参考字符对应的条和空的组合进行相似度匹配,一维码中条和空的组合为连续排列的条和空的组合;第二选择子单元62,第二选择子单元62与组合匹配子单元61信号连接,用于根据组合匹配子单元61的匹配结果,选择相似度大于或等于第三预设阈值的条和空的组合。In a specific implementation scenario, please refer to FIG. 6, which is a schematic structural diagram of another embodiment of an optimization unit in FIG. 4 of the present application. The optimization unit 44 includes a combination matching sub-unit 61 for matching the similarity between the combination of bars and spaces in the one-dimensional code and the combination of bars and spaces corresponding to the reference character, and the combination of the bars and spaces in the one-dimensional code is arranged continuously. The combination of the bar and the empty; the second selection sub-unit 62, the second selection sub-unit 62 is signally connected to the combination matching sub-unit 61, and is used to select a similarity greater than or equal to the third prediction according to the matching result of the combination matching sub-unit 61. A combination of threshold bars and spaces.
在具体的实施场景中,请参阅图7,图7为本申请一维码识别装置的另一实施方式的结构示意图。识别装置40进一步包括确定单元86,确定单元86与判断单元43及优化单元44信号连接,确定单元86包括:类型确定子单元861,用于确定一维码的类型;参考量确定子单元862,用于根据一维码的类型确定参考条和参考空的宽度,或者根据一维码的类型确定参考字符。In a specific implementation scenario, please refer to FIG. 7, which is a schematic structural diagram of another embodiment of a one-dimensional code identification device of the present application. The identification device 40 further includes a determination unit 86, and the determination unit 86 is signal-connected to the determination unit 43 and the optimization unit 44. The determination unit 86 includes: a type determination subunit 861 for determining the type of the one-dimensional code; a reference quantity determination subunit 862, It is used to determine the width of the reference bar and the reference space according to the type of the one-dimensional code, or determine the reference character according to the type of the one-dimensional code.
在具体的实施场景中,请参阅图8,图8为本申请图7中类型确定子单元的一实施方式的结构示意图。类型确定子单元861进一步包括:定长判断模块72,用于判断一维码是否为定长一维码;第一确定模块76,用于若一维码为定长一维码,获取一维码的长度,根据长度确定一维码的类型;第二确定模块74,用于若一维码为可变长一维码,获取一维码的起始码和一维码的宽度,根据起始码和宽度确定一维码的类型。In a specific implementation scenario, please refer to FIG. 8, which is a schematic structural diagram of an embodiment of a type determination subunit in FIG. 7 of the present application. The type determination subunit 861 further includes: a fixed-length determination module 72 for determining whether the one-dimensional code is a fixed-length one-dimensional code; and a first determination module 76 for obtaining a one-dimensional code if the one-dimensional code is a fixed-length one-dimensional code. The length of the code determines the type of the one-dimensional code according to the length. The second determining module 74 is configured to obtain the start code and the width of the one-dimensional code if the one-dimensional code is a variable-length one-dimensional code. The start code and width determine the type of one-dimensional code.
在具体的实施场景中,请参阅图8,图8为图7中类型确定子单元的一实施方式的结构示意图。定长判断模块72进一步包括:码制获取子模块77,用于获取一维码的码制;判断子模块73,判断子模块73与码制获取子模块77信号连接,判断子模块73用于根据码制获取子模块77获取的码制判断一维码是否为定长一维码。In a specific implementation scenario, please refer to FIG. 8, which is a schematic structural diagram of an embodiment of a type determination subunit in FIG. 7. The fixed-length judgment module 72 further includes: a code system acquisition sub-module 77 for acquiring the code system of the one-dimensional code; a judgment sub-module 73, the judgment sub-module 73 is signally connected to the code system acquisition sub-module 77, and the judgment sub-module 73 is used for Determine whether the one-dimensional code is a fixed-length one-dimensional code according to the code system acquired by the code system acquisition sub-module 77.
为实现对不同特征的一维码进行高效解码,本申请提供了具有存储功能的装置,用以以实现上述一维码识别方法。在一个具体的实施 场景中,请参阅图9,图9为本申请一具有存储功能的装置的一实施方式的结构示意图。具有存储功能的装置90中存储有至少一个程序或指令901,程序或指令901用于执行上述任一一种一维码识别方法。在一个实施例中,具有存储功能的装置可以是移动设备中的存储设备。In order to achieve efficient decoding of one-dimensional codes with different features, the present application provides a device with a storage function to implement the above-mentioned one-dimensional code identification method. In a specific implementation scenario, please refer to FIG. 9, which is a schematic structural diagram of an embodiment of a device with a storage function of the present application. At least one program or instruction 901 is stored in the device 90 having a storage function, and the program or instruction 901 is used to execute any one of the foregoing one-dimensional code identification methods. In one embodiment, the device having a storage function may be a storage device in a mobile device.
在本申请所提供的几个实施例中,应该理解到,所揭露的方法和装置,可以通过其它的方式实现。例如,以上所描述的装置实施方式仅仅是示意性的,例如,模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed methods and devices may be implemented in other ways. For example, the device implementations described above are only schematic. For example, the division of modules or units is only a logical function division. In actual implementation, there may be another division manner. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, which may be electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施方式方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, which may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objective of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each of the units may exist separately physically, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of software functional unit.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器(processor)执行本申请各个实施方式方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only  Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially a part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium. It includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the methods in the embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random access Memory), magnetic disks or optical disks and other media that can store program codes .
本实施例的有益效果是:区别于现有技术,本实施例所提供的一维码识别技术方案,通过判断条和空的总个数是否大于预设值,能够优化一维码的条和空的选择,排除相似度较低的一维码,以减少一维码的条和空的总个数,能够提高一维码识别的精度和速度,从而实现对不同的一维码进行高效解码。The beneficial effect of this embodiment is that, different from the prior art, the one-dimensional code identification technical solution provided by this embodiment can optimize the bar and sum of the one-dimensional code by judging whether the total number of bars and spaces is greater than a preset value. The empty selection excludes one-dimensional codes with low similarity to reduce the total number of bars and spaces in the one-dimensional code, which can improve the accuracy and speed of one-dimensional code recognition, thereby achieving efficient decoding of different one-dimensional codes. .
以上所述仅为本申请的实施方式,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above is only an implementation of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made by using the description and drawings of the present application, or directly or indirectly applied to other related technologies The fields are equally included in the patent protection scope of this application.

Claims (20)

  1. 一种一维码识别方法,其特征在于,包括:A one-dimensional code identification method, comprising:
    定位一维码;Positioning one-dimensional code;
    获取所述一维码中条和空的总个数;Obtaining the total number of bars and spaces in the one-dimensional code;
    判断所述条和空的总个数是否大于预设值;Judging whether the total number of said bars and spaces is greater than a preset value;
    若所述条和空的总个数大于所述预设值,按照预设的方法对所述一维码的条和空进行选择,以减少所述一维码的条和空的总个数,所选择的条和空用于解码所述一维码;If the total number of bars and spaces is greater than the preset value, selecting the bars and spaces of the one-dimensional code according to a preset method to reduce the total number of bars and spaces of the one-dimensional code , The selected bar and space are used to decode the one-dimensional code;
    根据所选择的条和空解码所述一维码。The one-dimensional code is decoded according to the selected bar and space.
  2. 根据权利要求1所述的识别方法,其特征在于,所述按照预设的方法对所述一维码的条和空进行选择包括:The identification method according to claim 1, wherein the selecting the bars and spaces of the one-dimensional code according to a preset method comprises:
    根据所述条和空的宽度对所述条和空进行分类;Classify the bars and spaces according to their widths;
    将每一类的所述条和空分别与相同类别的参考条和参考空进行相似度匹配;Performing similarity matching on the bars and spaces of each category with reference bars and spaces of the same category, respectively;
    选择相似度匹配后相似度大于或等于第一预设阈值的条,以及相似度大于或等于第二预设阈值的空。The bars whose similarity is greater than or equal to the first preset threshold after the similarity matching are selected, and the blank whose similarity is greater than or equal to the second preset threshold are selected.
  3. 根据权利要求1所述的识别方法,其特征在于,所述按照预设的方法对所述一维码的条和空进行选择包括:将所述一维码中条和空的组合与参考字符对应的条和空的组合进行相似度匹配,所述一维码中条和空的组合为连续排列的条和空的组合;The identification method according to claim 1, wherein the selecting the bars and spaces of the one-dimensional code according to a preset method comprises: combining a combination of bars and spaces in the one-dimensional code with a reference character The similarity matching is performed on corresponding combinations of bars and spaces, and the combination of bars and spaces in the one-dimensional code is a combination of bars and spaces arranged continuously;
    选择相似度大于或等于第三预设阈值的条和空的组合。A combination of bars and spaces with a similarity greater than or equal to a third preset threshold is selected.
  4. 根据权利要求1-3中任意一项所述的识别方法,其特征在于,在按照预设的方法对所述一维码的条和空进行选择之前还包括:The identification method according to any one of claims 1-3, further comprising: before selecting the bars and spaces of the one-dimensional code according to a preset method:
    确定所述一维码的类型;Determining the type of the one-dimensional code;
    根据所述一维码的类型确定参考条和参考空的宽度或者根据所述一维码的类型确定参考字符。The width of the reference bar and the reference space is determined according to the type of the one-dimensional code or the reference character is determined according to the type of the one-dimensional code.
  5. 根据权利要求4所述的识别方法,其特征在于,所述确定所述一维码的类型包括:The identification method according to claim 4, wherein the determining the type of the one-dimensional code comprises:
    判断所述一维码是否为定长一维码;Determining whether the one-dimensional code is a fixed-length one-dimensional code;
    若所述一维码为定长一维码,获取所述一维码的长度,根据所述长度确定所述一维码的类型;If the one-dimensional code is a fixed-length one-dimensional code, obtaining the length of the one-dimensional code, and determining the type of the one-dimensional code according to the length;
    若所述一维码为可变长一维码,获取所述一维码的起始码和所述一维码的宽度,根据所述起始码和所述宽度确定所述一维码的类型。If the one-dimensional code is a variable-length one-dimensional code, obtain a start code of the one-dimensional code and a width of the one-dimensional code, and determine a value of the one-dimensional code according to the start code and the width. Types of.
  6. 根据权利要求5所述的识别方法,其特征在于,所述判断所述一维码是否为定长一维码,包括:The identification method according to claim 5, wherein the determining whether the one-dimensional code is a fixed-length one-dimensional code comprises:
    获取所述一维码的码制;Obtaining a coding system of the one-dimensional code;
    根据所述码制判断所述一维码是否为定长一维码。It is determined whether the one-dimensional code is a fixed-length one-dimensional code according to the coding system.
  7. 一种一维码识别终端,其特征在于,包括:图像采集器以及处理器;A one-dimensional code recognition terminal, comprising: an image collector and a processor;
    所述图像采集器用于采集所述一维码的图像,并将采集到的所述一维码的图像发送至所述处理器;The image collector is configured to collect an image of the one-dimensional code, and send the acquired image of the one-dimensional code to the processor;
    所述处理器与所述图像采集器耦合连接,所述处理器在执行程序时执行以下步骤:The processor is coupled to the image collector, and the processor executes the following steps when executing a program:
    根据所述图像定位所述一维码;Positioning the one-dimensional code according to the image;
    获取所述一维码中条和空的总个数;Obtaining the total number of bars and spaces in the one-dimensional code;
    判断所述条和空的总个数是否大于预设值;Judging whether the total number of said bars and spaces is greater than a preset value;
    若所述条和空的总个数大于所述预设值,按照预设的方法对所述一维码的条和空进行选择,以减少所述一维码的条和空的总个数,所选择的条和空用于解码所述一维码;If the total number of bars and spaces is greater than the preset value, selecting the bars and spaces of the one-dimensional code according to a preset method to reduce the total number of bars and spaces of the one-dimensional code , The selected bar and space are used to decode the one-dimensional code;
    根据所选择的条和空解码所述一维码。The one-dimensional code is decoded according to the selected bar and space.
  8. 根据权利要求7所述的终端,其特征在于,所述处理器在用于执行所述按照预设的方法对所述一维码的条和空进行选择的步骤时具体用于执行:The terminal according to claim 7, wherein the processor is specifically configured to execute when performing the step of selecting the bars and spaces of the one-dimensional code according to a preset method:
    根据所述条和空的宽度对所述条和空进行分类;Classify the bars and spaces according to their widths;
    将每一类的所述条和空分别与相同类别的参考条和参考空进行相似度匹配;Performing similarity matching on the bars and spaces of each category with reference bars and spaces of the same category, respectively;
    选择相似度匹配后相似度大于或等于第一预设阈值的条,以及相似度大于或等于第二预设阈值的空。The bars whose similarity is greater than or equal to the first preset threshold after the similarity matching are selected, and the blank whose similarity is greater than or equal to the second preset threshold are selected.
  9. 根据权利要求7所述的终端,其特征在于,所述处理器在用于执行所述按照预设的方法对所述一维码的条和空进行选择的步骤时具体用于执行:The terminal according to claim 7, wherein the processor is specifically configured to execute when performing the step of selecting the bars and spaces of the one-dimensional code according to a preset method:
    将所述一维码中条和空的组合与参考字符对应的条和空的组合进行相似度匹配,所述一维码中条和空的组合为连续排列的条和空的组合;Matching the similarity between the combination of bars and spaces in the one-dimensional code and the combination of bars and spaces corresponding to the reference character, and the combination of bars and spaces in the one-dimensional code is a combination of consecutively arranged bars and spaces;
    选择相似度大于或等于第三预设阈值的条和空的组合。A combination of bars and spaces with a similarity greater than or equal to a third preset threshold is selected.
  10. 根据权利要求7-9中任意一项所述的终端,其特征在于,所述处理器在用于执行按照预设的方法对所述一维码的条和空进行选择之前还用于执行:The terminal according to any one of claims 7-9, wherein the processor is further configured to execute before selecting the bars and spaces of the one-dimensional code according to a preset method:
    确定所述一维码的类型;Determining the type of the one-dimensional code;
    根据所述一维码的类型确定参考条和参考空的宽度,或者根据所述一维码的类型确定参考字符。The width of the reference bar and the reference space is determined according to the type of the one-dimensional code, or the reference character is determined according to the type of the one-dimensional code.
  11. 根据权利要求10所述的终端,其特征在于,所述处理器在用于执行确定所述一维码的类型的步骤时具体用于执行:The terminal according to claim 10, wherein the processor is specifically configured to execute when performing the step of determining the type of the one-dimensional code:
    判断所述一维码是否为定长一维码;Determining whether the one-dimensional code is a fixed-length one-dimensional code;
    若所述一维码为定长一维码,获取所述一维码的长度,根据所述长度确定所述一维码的类型;If the one-dimensional code is a fixed-length one-dimensional code, obtaining the length of the one-dimensional code, and determining the type of the one-dimensional code according to the length;
    若所述一维码为可变长一维码,获取所述一维码的起始码和所述一维码的宽度,根据所述起始码和所述宽度确定所述一维码的类型。If the one-dimensional code is a variable-length one-dimensional code, obtaining a start code of the one-dimensional code and a width of the one-dimensional code, and determining the Types of.
  12. 根据权利要求10所述的终端,其特征在于,所述处理器在用于执行所述判断所述一维码是否为定长一维码的步骤时具体用于执行:The terminal according to claim 10, wherein the processor is specifically configured to execute when performing the step of determining whether the one-dimensional code is a fixed-length one-dimensional code:
    获取所述一维码的码制;Obtaining a coding system of the one-dimensional code;
    根据所述码制判断所述一维码是否为定长一维码。It is determined whether the one-dimensional code is a fixed-length one-dimensional code according to the coding system.
  13. 根据权利要求7所述的终端,其特征在于,所述识别终端进一步包括存储器,所述存储器与所述处理器耦合连接,所述存储器存储所述处理器处理的数据。The terminal according to claim 7, wherein the identification terminal further comprises a memory, the memory is coupled to the processor, and the memory stores data processed by the processor.
  14. 一种一维码识别装置,其特征在于,包括:A one-dimensional code identification device, comprising:
    定位单元,用于定位所述一维码;A positioning unit, configured to locate the one-dimensional code;
    获取单元,所述获取单元与所述定位单元信号连接,用于根据定位到的所述一维码获取所述一维码中条和空的总个数;An acquisition unit, where the acquisition unit is signally connected to the positioning unit, and is configured to acquire the total number of bars and spaces in the one-dimensional code according to the located one-dimensional code;
    判断单元,所述判断单元与所述获取单元信号连接,用于接收所述获取单元所获取的所述条和空的总个数,并判断所述条和空的总个数是否大于预设值;A judging unit, which is connected to the acquiring unit in a signal, and is configured to receive the total number of the bars and spaces acquired by the acquiring unit, and determine whether the total number of the bars and spaces is greater than a preset value;
    优化单元,所述优化单元与所述判断单元信号连接,用于若所述判断单元判定条和空的总个数大于所述预设值,所述优化单元按照预设的方法对所述一维码的条和空进行选择,以减少所述一维码的条和空的总个数,所选择的条和空用于解码所述一维码;An optimization unit, which is connected to the determination unit by a signal, and is configured to, if the total number of determination bars and spaces of the determination unit is greater than the preset value, the optimization unit performs a preset method on the Selecting the bars and spaces of the one-dimensional code to reduce the total number of bars and spaces of the one-dimensional code, and the selected bars and spaces are used to decode the one-dimensional code;
    解码单元,所述解码单元与优化单元信号连接,用于根据所述优化单元所选择的条和空解码所述一维码。A decoding unit, where the decoding unit is signally connected to the optimization unit, and is configured to decode the one-dimensional code according to the bar and space selected by the optimization unit.
  15. 根据权利要求14所述的装置,其特征在于,所述优化单元包括:The apparatus according to claim 14, wherein the optimization unit comprises:
    分类子单元,用于根据所述条和空的宽度对所述条和空进行分类;A classification subunit, configured to classify the bars and spaces according to the width of the bars and spaces;
    匹配子单元,所述匹配子单元与所述分类子单元信号连接,用于根据所述分类子单元的分类结果将每一类的所述条和空分别与相同类别的参考条和参考空进行相似度匹配;A matching subunit, the matching subunit being signal-connected to the classification subunit, and configured to perform, according to a classification result of the classification subunit, the bars and spaces of each class with reference bars and reference spaces of the same category, respectively Similarity matching
    第一选择子单元,所述选择子单元与所述匹配子单元信号连接,用于根据所述匹配子单元的匹配结果,选择相似度匹配后相似度大于或等于第一预设阈值的条,以及相似度大于或等于第二预设阈值的空。A first selection subunit, which is connected to the matching subunit in a signal, and is configured to select, based on the matching result of the matching subunit, a bar whose similarity after matching is greater than or equal to a first preset threshold, And a null with a similarity greater than or equal to a second preset threshold.
  16. 根据权利要求14所述的一种装置,其特征在于,所述优化单元包括:The device according to claim 14, wherein the optimization unit comprises:
    组合匹配子单元,用于将所述一维码中条和空的组合与参考字符对应的条和空的组合进行相似度匹配,所述一维码中条和空的组合为连续排列的条和空的组合;A combination matching subunit for matching the similarity between the combination of bars and spaces in the one-dimensional code and the combination of bars and spaces corresponding to the reference character, and the combination of bars and spaces in the one-dimensional code is consecutively arranged bars And empty combination;
    第二选择子单元,所述第二选择子单元与所述组合匹配子单元信号连接,用于根据所述组合匹配子单元的匹配结果,选择相似度大于或等于第三预设阈值的条和空的组合。A second selection subunit, which is signally connected to the combination matching subunit, and is configured to select, according to the matching result of the combination matching subunit, a bar whose similarity is greater than or equal to a third preset threshold Empty combination.
  17. 根据权利要求14-16任意一项所述的装置,其特征在于,所述装置进一步包括确定单元,所述确定单元与所述判断单元及优化单元信号连接,所述确定单元包括:The device according to any one of claims 14-16, wherein the device further comprises a determining unit, and the determining unit is signal-connected to the determining unit and the optimizing unit, and the determining unit includes:
    类型确定子单元,用于确定所述一维码的类型;A type determining subunit, configured to determine a type of the one-dimensional code;
    参考量确定子单元,用于根据所述一维码的类型确定参考条和参考空的宽度,或者根据所述一维码的类型确定参考字符。The reference quantity determining subunit is configured to determine a width of a reference bar and a reference space according to the type of the one-dimensional code, or determine a reference character according to the type of the one-dimensional code.
  18. 根据权利要求17任意一项所述的装置,其特征在于,所述类型确定子单元进一步包括:The device according to any one of claims 17, wherein the type determining subunit further comprises:
    定长判断模块,用于判断所述一维码是否为定长一维码;A fixed-length judgment module, configured to determine whether the one-dimensional code is a fixed-length one-dimensional code;
    第一确定模块,用于若所述一维码为定长一维码,获取所述一维码的长度,根据所述长度确定所述一维码的类型;A first determining module, configured to obtain a length of the one-dimensional code if the one-dimensional code is a fixed-length one-dimensional code, and determine a type of the one-dimensional code according to the length;
    第二确定模块,用于若所述一维码为可变长一维码,获取所述一维码的起始码和所述一维码的宽度,根据所述起始码和所述宽度确定所述一维码的类型。A second determining module, configured to obtain a start code of the one-dimensional code and a width of the one-dimensional code if the one-dimensional code is a variable-length one-dimensional code, and according to the start code and the width Determining the type of the one-dimensional code.
  19. 根据权利要求18所述的装置,其特征在于,所述定长判断模块进一步包括:The apparatus according to claim 18, wherein the fixed-length determination module further comprises:
    码制获取子模块,用于获取所述一维码的码制;A code system acquisition submodule, configured to acquire a code system of the one-dimensional code;
    判断子模块,所述判断子模块与所述码制获取子模块信号连接,所述判断子模块用于根据所述码制获取子模块获取的所述码制判断所述一维码是否为定长一维码。A judging submodule that is signally connected to the code system acquisition submodule, and the judging submodule is configured to judge whether the one-dimensional code is fixed according to the code system acquired by the code system acquisition submodule One-dimensional code.
  20. 一种具有存储功能的装置,其特征在于,存储有程序数据,所述程序数据能够被执行以实现如权利要求1-6任一项所述方法中的步骤。An apparatus having a storage function, characterized in that program data is stored, and the program data can be executed to implement the steps in the method according to any one of claims 1-6.
PCT/CN2018/100516 2018-08-14 2018-08-14 One-dimensional code recognition method, terminal and device, and device having storage function WO2020034103A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/100516 WO2020034103A1 (en) 2018-08-14 2018-08-14 One-dimensional code recognition method, terminal and device, and device having storage function
CN201880088571.1A CN111801675A (en) 2018-08-14 2018-08-14 One-dimensional code identification method, terminal, device and device with storage function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/100516 WO2020034103A1 (en) 2018-08-14 2018-08-14 One-dimensional code recognition method, terminal and device, and device having storage function

Publications (1)

Publication Number Publication Date
WO2020034103A1 true WO2020034103A1 (en) 2020-02-20

Family

ID=69524948

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/100516 WO2020034103A1 (en) 2018-08-14 2018-08-14 One-dimensional code recognition method, terminal and device, and device having storage function

Country Status (2)

Country Link
CN (1) CN111801675A (en)
WO (1) WO2020034103A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101710381A (en) * 2009-12-28 2010-05-19 天津优尼莱博泰克电子科技发展有限公司 High-performance one-dimensional bar code decoding method
CN101882202A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Sign character extracting module and method
CN107016388A (en) * 2017-03-02 2017-08-04 浙江华睿科技有限公司 A kind of localization method and device in one-dimension code region
CN108009455A (en) * 2017-11-07 2018-05-08 深圳市华汉伟业科技有限公司 A kind of coding/decoding method and device of the scanning signal of bar code

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6062481A (en) * 1986-04-18 2000-05-16 Cias, Inc. Optimal error-detecting, error-correcting and other coding and processing, particularly for bar codes, and applications therefor such as counterfeit detection
TWI300169B (en) * 2005-11-01 2008-08-21 Aetas System Inc A positioning system and method for a printer
CN201946007U (en) * 2010-06-01 2011-08-24 福建新大陆电脑股份有限公司 Symbol and character extraction module
CN103632183A (en) * 2013-10-31 2014-03-12 季争鸣 Four-unit bar and blank crossed bar code and application of four-unit bar and blank crossed bar code
CN105894074B (en) * 2016-04-15 2019-01-15 大连声鹭科技有限公司 A kind of Antiforge bar code label, Antiforge bar code label information collector, acquisition method and fake certification system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101710381A (en) * 2009-12-28 2010-05-19 天津优尼莱博泰克电子科技发展有限公司 High-performance one-dimensional bar code decoding method
CN101882202A (en) * 2010-06-01 2010-11-10 福建新大陆电脑股份有限公司 Sign character extracting module and method
CN107016388A (en) * 2017-03-02 2017-08-04 浙江华睿科技有限公司 A kind of localization method and device in one-dimension code region
CN108009455A (en) * 2017-11-07 2018-05-08 深圳市华汉伟业科技有限公司 A kind of coding/decoding method and device of the scanning signal of bar code

Also Published As

Publication number Publication date
CN111801675A (en) 2020-10-20

Similar Documents

Publication Publication Date Title
US8608074B2 (en) Method and apparatus for locating and decoding machine-readable symbols
EP3493101B1 (en) Image recognition method, terminal, and nonvolatile storage medium
US11475655B2 (en) Methods for optical character recognition (OCR)
TWI606406B (en) Methods, apparatus, and tangible computer readable storage media to extract text from imaged documents
WO2020177470A1 (en) Verification code recognition method and apparatus, terminal, and storage medium
US7980473B2 (en) Camera based code reading
CN113657274A (en) Table generation method and device, electronic equipment, storage medium and product
CN107895130B (en) Self-adaptive multi-branch tree anti-collision method based on collision tree
JP2000155803A (en) Character reading method and optical character reader
CN110399912B (en) Character recognition method, system, equipment and computer readable storage medium
CN103034830B (en) Bar code decoding method and device
CN104346596A (en) Identification method and identification device for QR (Quick Response) code
JP5796107B2 (en) Method and apparatus for text detection
WO2020034103A1 (en) One-dimensional code recognition method, terminal and device, and device having storage function
CN114996360B (en) Data analysis method, system, readable storage medium and computer equipment
CN116311276A (en) Document image correction method, device, electronic equipment and readable medium
KR101871379B1 (en) Apparatus for barcode recognition
CN114419636A (en) Text recognition method, device, equipment and storage medium
JP2013191078A (en) Image processing system, image processing method, program, and recording medium
CN113269101A (en) Bill identification method, device and equipment
KR101149716B1 (en) An identification code conversion method and the apparatus
US20220150374A1 (en) Image processing device, image reading device, image processing method, and non-transitory computer readable medium
CN111818141A (en) Method, system, device, terminal and storage medium for transmitting file
CN110957016A (en) Physical examination data intelligent recognition system and method based on health cloud management platform
CN109697382A (en) A kind of linear code edge distortion processing method and equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18930342

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18930342

Country of ref document: EP

Kind code of ref document: A1