条码识读方法及终端Bar code reading method and terminal
优先权priority
所述PCT专利申请要求申请日为2019年10月26日,申请号为201911026940.7,专利名称为“条码识读方法及终端”的中国专利优先权,本专利申请结合了上述专利的技术方案。The PCT patent application requires the application date to be October 26, 2019, the application number is 201911026940.7, and the patent name is "Barcode Recognition Method and Terminal". The patent application combines the technical solutions of the above patents.
技术领域Technical field
本公开涉及一种条码识读方法及终端,尤指一种条码识读方法及终端。The present disclosure relates to a barcode reading method and terminal, in particular to a barcode reading method and terminal.
背景技术Background technique
现有的一种扫描器,其扫描引擎受到触发而进入工作状态时,扫描器将启动照明源进行照明,并通过扫描引擎采集图像,这些图像进一步被处理而对图像中的条码进行解码。由于不论扫描引擎采集的图像中是否存在条码,照明源均会进行照明,故功耗很高;且当扫描引擎被错误触发时,如刚好此时扫描器对着人脸,扫描器仍将启动照明源进行照明,不免对人眼造成伤害。In an existing scanner, when the scan engine is triggered and enters the working state, the scanner will start the illumination source to illuminate, and collect images through the scan engine, and these images are further processed to decode the barcode in the image. Since the illumination source will illuminate regardless of whether there is a barcode in the image collected by the scan engine, the power consumption is high; and when the scan engine is triggered by mistake, if the scanner is facing the face at the same time, the scanner will still start The illumination source is used to illuminate, which will inevitably cause harm to human eyes.
本公开针对以上问题,提供一种新的条码识读方法及终端,采用新的方法和技术手段以解决这些问题。In view of the above problems, the present disclosure provides a new barcode reading method and terminal, and adopts new methods and technical means to solve these problems.
公开内容Public content
针对背景技术所面临的问题,本公开创作的目的在于提供一种通过预判图像中是否存在条码来控制补光灯是否进行补光的条码识读方法及终端。In view of the problems faced by the background art, the purpose of the creation of the present disclosure is to provide a barcode reading method and terminal that control whether the fill light performs fill light by predicting whether there is a barcode in the image.
为实现上述目的,本公开采用以下技术手段:In order to achieve the above objectives, the present disclosure adopts the following technical means:
本公开提供一种条码识读方法,其中,包括以下步骤:101:在补光灯处于关闭状态时采集第一图像;102:判断第一图像中是否存在条码,若存 在条码,则执行步骤103;若不存在条码,则结束;103:补光并重新采集第二图像;104:解码第二图像中的条码。The present disclosure provides a barcode reading method, which includes the following steps: 101: Collect a first image when the fill light is off; 102: Determine whether there is a barcode in the first image, and if there is a barcode, perform step 103 ; If there is no barcode, it ends; 103: fill light and re-acquire the second image; 104: decode the barcode in the second image.
在一种实现方式中,步骤101中,采集第一图像为经由一手势触发。In one implementation, in step 101, collecting the first image is triggered by a gesture.
在一种实现方式中,步骤101中包括:In an implementation manner, step 101 includes:
采集用户的手势,且在用户手持条码识读终端完成预设手势时,触发摄像头采集第一图像。The user's gesture is collected, and when the user holds the barcode reading terminal to complete the preset gesture, the camera is triggered to collect the first image.
在一种实现方式中,所述手势符合一预设的手势,一个或多个预设的手势经由机器学习算法被预先学习,经由学习的一个或多个预设的手势被预先存储。In an implementation manner, the gesture conforms to a preset gesture, one or more preset gestures are pre-learned through a machine learning algorithm, and one or more preset gestures through the learning are pre-stored.
在一种实现方式中,步骤102中,判断第一图像中是否存在条码为经由一手势触发。In one implementation, in step 102, determining whether there is a barcode in the first image is triggered by a gesture.
在一种实现方式中,所述手势符合一预设的手势,一个或多个预设的手势经由机器学习算法被预先学习,经由学习的一个或多个预设的手势被预先存储。In an implementation manner, the gesture conforms to a preset gesture, one or more preset gestures are pre-learned through a machine learning algorithm, and one or more preset gestures through the learning are pre-stored.
在一种实现方式中,步骤102中,判断第一图像中是否存在条码为经由一触发按键触发。In an implementation manner, in step 102, it is determined whether the barcode exists in the first image is triggered by a trigger button.
在一种实现方式中,第一图像仅用于判断是否存在条码而不用于解码。In an implementation manner, the first image is only used to determine whether there is a barcode and is not used for decoding.
本公开提供一种条码识读终端,其中,包括:一摄像头,用以采集图像;一补光灯,用以补光;一控制单元,用以控制摄像头在补光灯处于关闭的状态下采集第一图像,并用以进一步判断第一图像中是否存在条码,且在第一图像中存在条码时控制补光灯进行补光,并进一步控制摄像头采集第二图像。The present disclosure provides a barcode reading terminal, which includes: a camera to collect images; a light supplement light to supplement light; and a control unit to control the camera to collect when the light supplement light is off The first image is used to further determine whether there is a barcode in the first image, and when there is a barcode in the first image, the fill light is controlled to fill the light, and the camera is further controlled to collect the second image.
在一种实现方式中,所述摄像头和所述补光灯单独设置。In an implementation manner, the camera and the fill light are separately provided.
在一种实现方式中,控制单元还用以解码第二图像中的条码。In one implementation, the control unit is also used to decode the barcode in the second image.
在一种实现方式中,包括一传感器,用以采集用户的手势,且在用户的手势符合一预设手势时,触发控制单元对第一图像进行预判。In an implementation manner, a sensor is included to collect the user's gesture, and when the user's gesture matches a preset gesture, the control unit is triggered to predict the first image.
在一种实现方式中,包括一触发按键,用以触发控制单元对第一图像进行预判。In an implementation manner, a trigger button is included to trigger the control unit to prejudge the first image.
在一种实现方式中,触发按键还用以点亮显示屏,以使得控制单元和所述摄像头从睡眠状态被激活In one implementation, the trigger button is also used to light up the display screen, so that the control unit and the camera are activated from the sleep state
在一种实现方式中,包括一瞄准单元,控制单元还用以在判断第一图像中存在条码时,控制瞄准单元发射瞄准图案。In an implementation manner, an aiming unit is included, and the control unit is further used for controlling the aiming unit to transmit an aiming pattern when it is determined that there is a barcode in the first image.
与现有技术相比,本公开具有以下有益效果:Compared with the prior art, the present disclosure has the following beneficial effects:
所述补光灯在所述摄像头采集第一图像时处于关闭的状态,所述控制单元用以判断所述第一图像中是否存在条码,且在第一图像中存在条码时控制补光灯进行补光,并控制摄像头在补光环境下采集第二图像。由于在采集所述第一图像时,所述补光灯不发光,而在判断所述第一图像中存在条码,进而采集所述第二图像时,所述补光灯才进行补光,故更加节能,同时可避免扫描时因失误而对准人眼,所述补光灯刺伤人眼。The fill light is turned off when the camera captures the first image, and the control unit is used to determine whether there is a barcode in the first image, and when there is a barcode in the first image, the fill light is controlled to perform Fill light, and control the camera to collect the second image in the fill light environment. When the first image is collected, the fill light does not emit light, and when it is determined that there is a barcode in the first image, and then the second image is collected, the fill light only performs fill light, so It is more energy-saving, and at the same time, it can avoid aiming at people's eyes due to mistakes during scanning, and the fill-in light will sting people's eyes.
附图说明Description of the drawings
图1为本公开条码识读终端的框图;Figure 1 is a block diagram of a barcode reading terminal of the present disclosure;
图2为本公开条码识读终端识读条码的示意图,其中示出了补光灯在无条码时不补光,有条码时补光;Fig. 2 is a schematic diagram of barcode reading by the barcode reading terminal of the present disclosure, which shows that the fill light does not fill light when there is no barcode, and fills light when there is a barcode;
图3为本公开一种实施例中条码识读终端通过手势触发扫描的示意图;3 is a schematic diagram of a barcode reading terminal triggering scanning by gestures in an embodiment of the present disclosure;
图4为本公开一种实施例中条码识读终端连续扫描流水线上的物品的示意图;4 is a schematic diagram of a barcode reading terminal continuously scanning items on the assembly line in an embodiment of the present disclosure;
图5为本公开一种实施例中条码识读终端识读条码的流程图。FIG. 5 is a flowchart of barcode reading by a barcode reading terminal in an embodiment of the present disclosure.
具体实施方式的附图标号说明:Description of reference signs for specific implementations:
条码识读终端100 Barcode reading terminal 100
|
扫描头1Scan head 1
|
摄像头2 Camera 2
|
补光灯3 Fill light 3
|
瞄准单元4Aiming unit 4
|
控制单元5Control unit 5
|
存储单元6 Storage unit 6
|
触发按键7Trigger button 7
|
显示屏8 Display 8
|
传感器9Sensor 9
|
条码10 Barcode 10
|
To
|
To
|
To
|
To
|
具体实施方式Detailed ways
为便于更好的理解本公开的目的、结构、特征以及功效等,现结合附图和具体实施方式对本公开作进一步说明。In order to facilitate a better understanding of the purpose, structure, features, and effects of the present disclosure, the present disclosure will now be further described with reference to the accompanying drawings and specific embodiments.
如图1所示是本公开的条码识读终端100的框图,所述条码识读终端100的主要元件包括:扫描头1、控制单元5和存储单元6。1 is a block diagram of a barcode reading terminal 100 of the present disclosure. The main components of the barcode reading terminal 100 include: a scanning head 1, a control unit 5, and a storage unit 6.
所述扫描头1为一个集成器件,其主要包括摄像头2和补光灯3,所述摄像头2用以采集图像;所述补光灯3用以补光。在一种实现方式中,所述扫描头1还可包括瞄准单元4,如激光瞄准或LED瞄准,所述瞄准单元4用以发射瞄准图案,以指引用户精确瞄准待识读的条码10。一种实施例中(未图示,下同),所述摄像头2和所述补光灯3可单独设置,而不集成在所述扫描头1上,或者说无需设置一个集成的扫描头1。The scanning head 1 is an integrated device, which mainly includes a camera 2 and a fill light 3, the camera 2 is used to collect images; the fill light 3 is used to fill light. In an implementation manner, the scan head 1 may further include an aiming unit 4, such as laser aiming or LED aiming, and the aiming unit 4 is used to emit an aiming pattern to guide the user to accurately aim the barcode 10 to be read. In an embodiment (not shown, the same below), the camera 2 and the fill light 3 can be set separately, and not integrated on the scan head 1, in other words, there is no need to set an integrated scan head 1 .
所述控制单元5用以控制所述摄像头2采集图像和控制所述补光灯3进行补光。所述存储单元6用以存储各种数据或程序。The control unit 5 is used for controlling the camera 2 to collect images and controlling the light supplement lamp 3 to supplement light. The storage unit 6 is used to store various data or programs.
所述条码识读终端100还可包括一个或多个触发按键7,所述触发按键7可用于供用户操作,来触发所述控制单元5发出控制指令。所述触发按键7可用来点亮显示屏8,通常点亮所述显示屏8也同时表示所述控制单元5和所述摄像头2等元件从睡眠状态被激活。所述触发按键7可为实体按键,也可为所述显示屏8上的虚拟按键。The barcode reading terminal 100 may also include one or more trigger buttons 7, and the trigger buttons 7 may be used for user operations to trigger the control unit 5 to issue control instructions. The trigger button 7 can be used to light up the display screen 8. Generally, lighting up the display screen 8 also means that the control unit 5, the camera 2 and other elements are activated from the sleep state. The trigger button 7 may be a physical button or a virtual button on the display screen 8.
请补充参考图2所示,当所述摄像头2处于激活状态时,即开始采集图像,这些图像通常不需要经过所述控制单元5来解码,此时所述条码识读终端100的功耗也较低。当所述控制单元5受所述触发按键7的触发,则将所述摄像头2在受触发前采集的一帧图像进行预判,将这一帧图像定义为第一图像,所述控制单元5通过特征提取判断所述第一图像中是否存在条码10;或者当所述控制单元5受所述触发按键7的触发,将首先发送 指令至所述摄像头2,控制所述摄像头2在所述补光灯3处于关闭的状态下采集第一图像,所述控制单元5进一步通过特征提取判断所述第一图像中是否存在条码10。此时虽然所述第一图像亮度较暗,然而由于无需对所述第一图像中可能存在的条码10进行解码,即无需获取所述第一图像中可能存在的条码10的更多细节信息,也可成功对所述第一图像中可能存在的条码10进行预判,速度很快。当所述控制单元5判断所述第一图像中不存在条码10时,即结束本次图像预判;当所述控制单元5判断所述第一图像中存在条码10时,则控制所述补光灯3进行补光,并控制所述摄像头2采集第二图像,所述控制单元5随即解码所述第二图像中的条码10。由于在采集所述第一图像时,所述补光灯3不发光,且在所述第一图像中存在条码10时,所述补光灯3才进行补光,故更加节能,同时可避免扫描时因失误而对准人眼,所述补光灯3刺伤人眼。Please supplement with reference to FIG. 2. When the camera 2 is in the activated state, it starts to collect images. These images usually do not need to be decoded by the control unit 5. At this time, the power consumption of the barcode reading terminal 100 is also Lower. When the control unit 5 is triggered by the trigger button 7, it prejudges a frame of image collected by the camera 2 before being triggered, and defines this frame of image as the first image, and the control unit 5 Determine whether there is a barcode 10 in the first image by feature extraction; or when the control unit 5 is triggered by the trigger button 7, it will first send an instruction to the camera 2 to control the camera 2 in the supplement The first image is collected when the light 3 is turned off, and the control unit 5 further determines whether there is a barcode 10 in the first image through feature extraction. At this time, although the brightness of the first image is relatively dark, since there is no need to decode the barcode 10 that may exist in the first image, that is, there is no need to obtain more detailed information of the barcode 10 that may exist in the first image. It is also possible to successfully predict the possible barcode 10 in the first image, and the speed is very fast. When the control unit 5 determines that there is no barcode 10 in the first image, it ends this image pre-judgment; when the control unit 5 determines that there is a barcode 10 in the first image, it controls the complement The light lamp 3 fills in light and controls the camera 2 to collect a second image, and the control unit 5 then decodes the barcode 10 in the second image. When the first image is collected, the fill light 3 does not emit light, and when there is a barcode 10 in the first image, the fill light 3 only performs fill light, so it is more energy-saving and can be avoided at the same time. When scanning, it is aimed at the human eye due to a mistake, and the fill light 3 stabs the human eye.
如图3所示的实施例中,所述控制单元5可通过手势触发,即通过手势触发来替代前述实施例中的触发按键7触发。本实施例中,所述条码识读终端100还包括一个传感器9,所述传感器9用以采集用户的手势,且在用户的手势符合一预设的手势时,触发所述控制单元5对所述第一图像进行预判;或者,在用户手持所述条码识读终端100完成预设的手势时,即触发所述摄像头2采集所述第一图像,所述控制单元5进而对所述第一图像进行判断,且当所述第一图像中存在条码10时,则控制所述摄像头2采集所述第二图像,并进一步解码所述第二图像中的条码10。至少一个或多个预设的手势可经由机器学习算法被所述条码识读终端100预先学习,经由学习的一个或多个预设的手势进而被预先存储于所述存储单元6中;这样,用户的惯用手势也可通过机器学习而预先存储于所述存储单元6中。在使用时,用户的手势只需要符合多个预设的手势中的一个时,即可对所述控制单元5进行触发。In the embodiment shown in FIG. 3, the control unit 5 can be triggered by a gesture, that is, by a gesture trigger instead of the trigger button 7 in the foregoing embodiment. In this embodiment, the barcode reading terminal 100 further includes a sensor 9, which is used to collect the user's gesture, and when the user's gesture matches a preset gesture, trigger the control unit 5 to The first image is pre-judged; or, when the user holds the barcode reading terminal 100 to complete a preset gesture, the camera 2 is triggered to collect the first image, and the control unit 5 further controls the first image. A judgment is made on an image, and when there is a barcode 10 in the first image, the camera 2 is controlled to collect the second image, and the barcode 10 in the second image is further decoded. At least one or more preset gestures can be learned in advance by the barcode reading terminal 100 via a machine learning algorithm, and the learned one or more preset gestures are then stored in the storage unit 6 in advance; in this way, The user's usual gestures can also be stored in the storage unit 6 in advance through machine learning. In use, when the user's gesture only needs to match one of a plurality of preset gestures, the control unit 5 can be triggered.
请补充参考图4所示,另一种实施例中,所述控制单元5无需通过所 述触发按键7或手势来触发,而是连续不断对所述摄像头2采集的图像进行预判,当所述控制单元5判断某一帧图像中存在条码10时,即控制所述补光灯3在所述摄像头2采集下一帧图像时进行补光。这适用于自动化的流水线上,通过所述条码识读终端100对传送带上的物品进行扫码,所述摄像头2一直处于激活状态,当物品传送过来时,所述摄像头2连续采集图像,此时所述补光灯3处于关闭状态,所述控制单元5依次对这些图像进行预判,以判断图像中是否存在条码10,当某一帧图像中存在条码10时,所述控制单元5即控制所述补光灯3在所述摄像头2采集物品的下一帧图像时进行补光。由于所述补光灯3对预判的图像不进行补光,仅对预判有条码10时所述摄像头2采集的下一帧(或下几帧)图像进行补光,可降低功耗。Please supplement with reference to FIG. 4. As shown in FIG. 4, in another embodiment, the control unit 5 does not need to be triggered by the trigger button 7 or gestures, but continuously predicts the images collected by the camera 2. When the control unit 5 determines that there is a barcode 10 in a certain frame of image, it controls the fill light 3 to fill in the light when the camera 2 collects the next frame of image. This is applicable to an automated assembly line. The barcode reading terminal 100 scans the items on the conveyor belt. The camera 2 is always active. When the items are transferred, the camera 2 continuously collects images. The fill light 3 is in the off state, and the control unit 5 performs pre-judgment on these images in turn to determine whether there is a barcode 10 in the image. When a barcode 10 exists in a certain frame of image, the control unit 5 controls The fill light 3 performs fill light when the camera 2 collects the next frame of image of the article. Since the fill light 3 does not fill the predicted image, it only fills the next frame (or the next few frames) of the image collected by the camera 2 when the barcode 10 is predicted, which can reduce power consumption.
如图5所示,为本公开一种实施例中所述条码识读终端100识读条码10的流程图,包括以下步骤:As shown in FIG. 5, it is a flowchart of the barcode reading terminal 100 reading the barcode 10 in an embodiment of the present disclosure, including the following steps:
S101:摄像头2在补光灯3处于关闭状态时采集第一图像。S101: The camera 2 collects a first image when the fill light 3 is in the off state.
具体来说,所述摄像头2处于激活状态时,即开始连续采集图像,此时所述补光灯3处于关闭状态。当用户手持所述条码识读终端100做出预设的手势时,即可触发所述控制单元5对所述摄像头2采集的前一帧或下一帧图像进行预判,将这一帧图像定义为所述第一图像。Specifically, when the camera 2 is in the activated state, it starts to continuously collect images, and the fill light 3 is in the off state at this time. When the user holds the barcode reading terminal 100 and makes a preset gesture, the control unit 5 can be triggered to pre-judge the previous or next frame of the image collected by the camera 2, and then this frame of image Defined as the first image.
S102:控制单元5判断第一图像中是否存在条码10,若存在条码10,则执行步骤S103;若不存在条码10,则结束图像预判。S102: The control unit 5 judges whether there is a barcode 10 in the first image, and if there is a barcode 10, step S103 is executed; if there is no barcode 10, the image pre-judgment is ended.
S103:补光并重新采集第二图像。S103: Fill light and re-acquire a second image.
所述控制单元5在判断所述第一图像中存在条码10后,即发送指令控制所述补光灯3进行补光,并控制所述摄像头2在补光环境下采集第二图像。After determining that the barcode 10 exists in the first image, the control unit 5 sends an instruction to control the fill light 3 to fill light, and control the camera 2 to collect the second image in the fill light environment.
S104:解码第二图像中的条码10。S104: Decode the barcode 10 in the second image.
由于所述第二图像在补光环境下采集,亮度合适,图像清晰度相对于 无补光更高,更加有利于解码,所述控制单元5也能更加快速解码出所述第二图像中的条码10。Since the second image is collected in a supplemental light environment, the brightness is appropriate, and the image definition is higher than that without supplementary light, which is more conducive to decoding. The control unit 5 can also decode the barcode in the second image more quickly 10.
本公开的条码识读方法及终端具有以下有益效果:The barcode reading method and terminal of the present disclosure have the following beneficial effects:
所述补光灯3在所述摄像头2采集第一图像时处于关闭的状态,所述控制单元5用以判断所述第一图像中是否存在条码10,且在第一图像中存在条码10时控制补光灯3进行补光,并控制摄像头2在补光环境下采集第二图像。由于在采集所述第一图像时,所述补光灯3不发光,而在判断所述第一图像中存在条码10,进而采集所述第二图像时,所述补光灯3才进行补光,故更加节能,同时可避免扫描时因失误而对准人眼,所述补光灯3刺伤人眼。The fill light 3 is in a closed state when the camera 2 captures the first image, and the control unit 5 is used to determine whether there is a barcode 10 in the first image, and when there is a barcode 10 in the first image Control the fill light 3 to fill light, and control the camera 2 to collect the second image in the fill light environment. Because when the first image is collected, the fill light 3 does not emit light, and when it is determined that there is a barcode 10 in the first image, and then the second image is collected, the fill light 3 performs the compensation. Therefore, it is more energy-saving, and at the same time, it can prevent the human eye from being aimed at the human eye due to errors during scanning, and the supplementary light 3 pierces the human eye.
以上详细说明仅为本公开之较佳实施例的说明,非因此局限本公开之专利范围,所以,凡运用本创作说明书及图示内容所为之等效技术变化,均包含于本创作之专利范围内。The above detailed description is only the description of the preferred embodiments of the present disclosure, and does not limit the scope of the patent of the present disclosure. Therefore, all equivalent technical changes made by using the content of this creation specification and illustrations are included in the creation of the patent. Within range.