Inductive control method and device for bar code reading equipment, equipment and medium
By adjusting the camera shooting parameters to adapt to the image brightness value, the problem of barcode reading equipment's difficulty in sensing in poor lighting scenarios is solved, and the scanning experience and equipment adaptability are improved.
Patent Information
- Application Number
- CN202411736549.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-11-29
AI Technical Summary
In the dark or too bright scene, barcode reading devices find it difficult to sense objects moving in, resulting in a reduced scan experience.
By detecting the image brightness value captured by the camera, adjusting the camera shooting parameters, so that the image brightness value is within the preset range, thereby improving the sensing accuracy.
In scenarios where the light is dark or too bright, the barcode reading device can more accurately sense the object movement, improving the scanning experience and the equipment's adaptability to the environment.
Smart Images

Figure CN119808808A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of barcode reading technology, and in particular to an induction control method, device, equipment and medium for a barcode reading device. Background Art
[0002] Barcode reading technology is an automatic recognition technology developed based on computer application practice. Among them, barcode reading equipment is a device or equipment used to scan one-dimensional and / or two-dimensional codes, usually a boxed structure equipped with an optical scanner. Barcode reading equipment has been widely used in supermarkets, hospitals, transportation, logistics and other occasions.
[0003] The reading modes of barcode reading devices generally include continuous reading mode and inductive reading mode. In continuous reading mode, the fill light of the barcode reading device is always on, and the QR code image is continuously collected and decoded. After the decoding is successful, the decoding result is output. Inductive reading mode generally includes two states: sensing state and decoding state. In the sensing state, the barcode reading device turns off the fill light by default and does not scan the code. When an object is sensed to move in, the barcode reading device enters the decoding state, turns on the fill light, and controls the camera to collect the barcode image and decode it. In the sensing reading mode, turning off the fill light in the sensing state can save power consumption and is more in line with the actual usage scenario.
[0004] In the induction reading mode, the following two solutions are usually used to sense whether an object has moved in. The first method is to use infrared sensing technology to determine whether an object has moved in. This method requires adding an infrared sensing device to the barcode reading device, which is relatively expensive. The second method is to use a camera to capture images and compare the difference between two frames of images to determine whether an object has moved in.
[0005] However, when the barcode reading device is in the sensing state and the fill light is turned off, the brightness of the image captured by the camera depends on the brightness of the external environment. In dimly lit or overly bright scenes, it is easy for the camera to fail to sense the movement of objects, thus failing to trigger the start of decoding, which greatly reduces the scanning experience. Summary of the invention
[0006] In order to solve the above technical problems, the present application provides a sensing control method, device, equipment and medium for a barcode reading device, which can easily sense the movement of objects in dim or overly bright scenes, thereby improving the adaptability of the barcode reading device to the environment and further improving the scanning experience.
[0007] In the first aspect, the present application provides a sensing control method for a barcode reading device, the method comprising: detecting that the barcode reading device enters a sensing state, obtaining a first image taken by a camera; determining whether the brightness value of the first image is within a first preset range; if the brightness value of the first image is not within the first preset range, adjusting the shooting parameters of the camera according to the brightness value of the first image, obtaining adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters, obtains a new first image, and returns to execute the step of obtaining the first image taken by the camera; until the brightness value of the first image is within the first preset range, obtaining a second image taken by the camera, and determining whether the barcode reading device exits the sensing state based on the second image.
[0008] In the second aspect, the present application provides a sensing control device for a barcode reading device, the device comprising: a first image acquisition module, used to detect that the barcode reading device enters a sensing state and obtain a first image taken by a camera; a first judgment module, used to judge whether the brightness value of the first image is within a first preset range; a shooting parameter adjustment module, used to adjust the shooting parameters of the camera according to the brightness value of the first image if the brightness value of the first image is not within the first preset range, to obtain the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and returns to execute the step of obtaining the first image taken by the camera; a sensing state control module, used to obtain a second image taken by the camera until the brightness value of the first image is within the first preset range, and determine whether the barcode reading device exits the sensing state based on the second image.
[0009] In a third aspect, the present application provides an electronic device, which includes a barcode reading device, and the device includes: a camera for capturing images; one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the induction control method for the barcode reading device as described in the first aspect above.
[0010] In a fourth aspect, the present application provides a storage medium, which may be a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the induction control method for a barcode reading device as in the first aspect above.
[0011] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, an induction control method for a barcode reading device as described in any one of the first aspects above is implemented.
[0012] Compared with the prior art, the technical solution provided by the embodiments of the present application has the following advantages:
[0013] The embodiment of the present application provides a sensing control method, device, equipment and storage medium for a barcode reading device, the method comprising: detecting that the barcode reading device enters a sensing state, obtaining a first image captured by a camera; determining whether the brightness value of the first image is within a first preset range; if the brightness value of the first image is not within the first preset range, adjusting the camera's shooting parameters according to the brightness value of the first image, obtaining the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters, obtains a new first image, and returns to the step of obtaining the first image captured by the camera; until the brightness value of the first image is within the first preset range, obtaining a second image captured by the camera, and determining whether the barcode reading device exits the sensing state based on the second image. Since the brightness value of the image captured by the camera can reflect the brightness of the external environment to a certain extent, the camera's shooting parameters are adjusted based on the brightness value of the image captured by the camera, so that the camera can still capture a clearer image in a dark or overly bright scene, so that in a dark or overly bright scene, the barcode reading device can still easily sense the movement of objects, thereby improving the adaptability of the barcode reading device to the environment, thereby improving the scanning experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0015] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0016] Figure 1 A schematic diagram of a flow chart of an induction control method for a barcode reading device provided in an embodiment of the present application;
[0017] Figure 2 A schematic diagram of the structure of a barcode reading device provided in an embodiment of the present application;
[0018] Figure 3 A schematic diagram of the process flow of the optimized induction control method for a barcode reading device provided in an embodiment of the present application;
[0019] Figure 4 A schematic diagram of the structure of the induction control device for a barcode reading device provided in an embodiment of the present application;
[0020] Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to more clearly understand the above-mentioned purposes, features and advantages of the present application, the scheme of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0022] In the following description, many specific details are set forth to facilitate a full understanding of the present application, but the present application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only part of the embodiments of the present application, rather than all of the embodiments.
[0023] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0024] It should be noted that the concepts such as "first" and "second" mentioned in this application are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0025] It should be noted that the modifications of "one" and "plurality" mentioned in the present application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0026] The following is a detailed description of the induction control method for a barcode reading device provided by the present application in conjunction with the accompanying drawings and specific implementation methods.
[0027] Figure 1 This is a flow chart of an inductive control method for a barcode reading device in an embodiment of the present application. This embodiment can be applied to control a barcode reading device. The method can be executed by an inductive control device for a barcode reading device. The inductive control device for a barcode reading device can be implemented in software and / or hardware. The inductive control device for a barcode reading device can be configured in the barcode reading device. Furthermore, the inductive control method for a barcode reading device provided in an embodiment of the present application is executed by a processor in the barcode reading device.
[0028] like Figure 1 As shown, the induction control method for a barcode reading device provided in the embodiment of the present application mainly includes steps S101-S105.
[0029] S101: Detect that a barcode reading device enters a sensing state, and obtain a first image captured by a camera.
[0030] Barcode reading equipment is an electronic device used to read and decode barcode or QR code information. Barcode reading equipment is widely used in retail, logistics, inventory management, healthcare and other fields to improve the speed and accuracy of data input.
[0031] like Figure 2 As shown, the barcode reading device includes a processor, a camera, a fill light, etc. The processor includes a camera interface, an Inter-Integrated Circuit (I2C or IIC) interface, a general-purpose input / output (GPIO) interface, and a clock signal interface.
[0032] The processor can be understood as the brain of the barcode reading device, responsible for handling all computing tasks. The camera interface can be a standard interface such as Digital Video Port (DVP) or Mobile Industry Processor Interface (MIPI) Camera Serial Interface (CSI)-2, which is used to receive image data from the camera. The I2C interface is a serial communication protocol used to control and configure the camera. Through I2C, the processor can send commands to the camera to set parameters such as exposure time, gain, etc. GPIO can be used to control external devices such as fill lights or other sensors. The clock signal interface is used by the processor to provide a clock signal to the camera.
[0033] The camera is a key part of the barcode reading device, mainly used to capture images. In the barcode reading device, the camera needs to have sufficient resolution and fast imaging capabilities to accurately capture the barcode information. The camera transmits image data to the processor through the above-mentioned DVP or MIPI interface.
[0034] The fill light is to ensure that the barcode can be clearly captured even in low light conditions. The fill light can be an LED light that automatically turns on to illuminate the target area during scanning. The working status of the fill light is controlled by the processor through the GPIO port.
[0035] The process of a barcode reader reading barcode information can be called a barcode reading mode. In the barcode reading mode, the barcode reader has two working states: sensing state and decoding state. In the sensing state, the flash is turned off, the camera is used to capture images, and the difference between the two frames of images is compared to determine whether an object has moved into the target area. In the decoding state, the flash is turned on, the camera is used to capture the barcode image, and the barcode in the barcode image is decoded to obtain the information contained in the barcode.
[0036] Detecting that the barcode reading device enters the sensing state includes: detecting that the barcode reading device switches from a shutdown state or a standby state to a sensing state, or detecting that the barcode reading device switches from a decoding state to a sensing state.
[0037] In one possible implementation, when it is detected that the barcode reading device enters a sensing state, the adjustable range of the camera's shooting parameters is adjusted from a first range to a second range; wherein the first range is a subset of the second range, and the first range is the adjustable range of the camera's shooting parameters when the barcode reading device is in a decoding state.
[0038] First Range [E d1 ,E d2 ] is the adjustable range of the camera's shooting parameters when the barcode reading device is in the decoding state. The second range is [E s1 ,E s2 ] is the adjustable range of the camera's shooting parameters when the barcode reading device is in the sensing state. Among them, the maximum value E of the second range s2 Greater than the maximum value E of the first range d2 , the minimum value E of the second range s1 Less than the minimum value E of the first range d1 .
[0039] The shooting parameters of the camera mainly refer to the parameters for controlling the brightness of the image shot by the camera. Optionally, the shooting parameters of the camera mainly include exposure time and gain value.
[0040] In the decoding state, the fill light of the barcode reading device is turned on. In the case of fill light, the exposure time and gain value of the camera to take a clear image do not need to be too large. However, in the sensing state, under the originally preset fixed camera parameter scheme, under the condition of only external ambient light, if the ambient light is weak, it is easy to take a dark picture and cannot distinguish objects and barcodes, so a larger exposure time and gain value are required to take a clearer image; if the ambient light is strong, the captured image is easy to be overexposed, and it is difficult to detect image changes in the overexposed image, so a smaller exposure and gain value are required to adjust the image to be more normal.
[0041] In this embodiment, the adjustable range of the camera parameters in the sensing state is greater than the adjustable range of the camera parameters in the decoding state, so that clearer images can still be obtained in darker or brighter environments, further improving the environmental adaptability of the barcode reading device.
[0042] The first image refers to an image taken by a camera and used to determine whether an object has moved in. The first image may include an image taken by the camera according to set camera parameters, or may be an image taken by the camera according to adjusted camera parameters.
[0043] When the barcode reading device enters the sensing state for the first time, the camera is controlled to capture the first image according to the set camera parameters, and the first image captured by the camera is obtained. The set camera parameters may be a fixed camera parameter set by the barcode reading device when it leaves the factory, and the fixed camera parameters are used to enable the camera to capture the first image according to the fixed camera parameters when the barcode reading device enters the sensing state for the first time. Alternatively, the set camera parameters may be the adjusted camera parameters during the previous sensing state. Alternatively, the set camera parameters may be the average value of the adjusted camera parameters corresponding to multiple sensing states.
[0044] S102: Determine whether the brightness value of the first image is within a first preset range.
[0045] The brightness value of an image can be understood as the brightness level of each pixel in the image, and the brightness value of an image is usually used to reflect the brightness of each pixel in the image. The brightness value of the first image refers to the brightness level of the image captured by the camera of the barcode reading device, and the brightness value reflects the brightness of each pixel in the first image. In other words, the brightness value of the first image reflects the brightness of the environment in which the barcode reading device was located when the first image was taken. The larger the brightness value of the first image, the higher the brightness of the environment in which the barcode reading device was located when the first image was taken, and the smaller the brightness value of the first image, the lower the brightness of the environment in which the barcode reading device was located when the first image was taken. The first preset range is an intermediate brightness where the image brightness is neither too dark nor overexposed.
[0046] The first preset range is a pre-set range that characterizes whether the brightness of the image is appropriate. The first preset range includes two endpoint values, namely, the maximum value of the first preset range and the minimum value of the first preset range. To determine whether the brightness value of the first image is within the first preset range, the brightness value of the first image can be compared with the maximum value of the first preset range and the minimum value of the first preset range respectively. Specifically, compare whether the brightness value of the first image is less than the maximum value of the first preset range, and compare whether the brightness value of the first image is greater than the minimum value of the first preset range. If the brightness value of the first image is less than the maximum value of the first preset range and the brightness value of the first image is greater than the minimum value of the first preset range, it is determined that the brightness value of the first image is within the first preset range. If the brightness value of the first image is greater than the maximum value of the first preset range, or the brightness value of the first image is less than the minimum value of the first preset range, it is determined that the brightness value of the first image is not within the first preset range.
[0047] S103. If the brightness value of the first image is not within the first preset range, adjust the shooting parameters of the camera according to the brightness value of the first image to obtain the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and return to execute the step of obtaining the first image taken by the camera.
[0048] The shooting parameters of the camera can be understood as parameters for adjusting the brightness of the captured image. Specifically, the shooting parameters of the camera may include exposure time and gain value. Adjusting the shooting parameters of the camera to obtain the adjusted shooting parameters includes adjusting the current shooting parameters of the camera to obtain the adjusted shooting parameters.
[0049] Adjusting the shooting parameters of the camera includes: adjusting only the exposure time of the camera, or adjusting only the gain value of the camera, or adjusting both the exposure time and the gain value of the camera.
[0050] In one possible implementation, if the brightness value of the first image is not within the first preset range, the shooting parameters of the camera are adjusted according to the brightness value of the first image to obtain adjusted shooting parameters, including: if the brightness value of the first image is less than the minimum value of the first preset range, the shooting parameters of the camera are increased to obtain adjusted shooting parameters; if the brightness value of the first image is greater than the maximum value of the first preset range, the shooting parameters of the camera are reduced to obtain adjusted shooting parameters.
[0051] The brightness value of the first image is not within the first preset range, which includes: the brightness value of the first image is less than a minimum value of the first preset range, or the brightness value of the first image is greater than a maximum value of the first preset range.
[0052] If the brightness value of the first image is less than the minimum value of the first preset range, it means that when the first image was taken, the environment in which the barcode reading device was located was dark, and the image taken was too dark. Since the image was too dark, the difference between the two images may be low, which may cause the barcode reading device to be unable to recognize that an object has moved in, and thus unable to enter the decoding state. Therefore, it is necessary to increase the camera parameters so that the brightness value of the first image retaken by the camera can be within the first preset range. In other words, when the brightness value of the first image is less than the minimum value of the first preset range, increase the camera's shooting parameters so that the brightness value of the first image retaken by the camera can be increased to avoid the situation where the image taken is too dark.
[0053] If the brightness value of the first image is greater than the maximum value of the first preset range, it means that when the first image was taken, the environment in which the barcode reading device was located was relatively bright. The image taken was too bright, and the difference between the two images was low due to the image being too bright, which caused the barcode reading device to be unable to recognize that an object had moved in, and thus unable to enter the decoding state. Therefore, it is necessary to reduce the camera parameters so that the brightness value of the first image retaken by the camera can be within the first preset range. In other words, when the brightness value of the first image is greater than the maximum value of the first preset range, reduce the camera's shooting parameters so that the brightness value of the first image retaken by the camera can be reduced, thereby avoiding the situation where the image taken is too bright.
[0054] In the embodiment of the present application, when the brightness value of the first image is less than the minimum value of the first preset range, the shooting parameters of the camera are increased, and when the brightness value of the first image is greater than the maximum value of the first preset range, the shooting parameters of the camera are reduced. This allows the brightness of the image re-taken by the camera to be in the middle brightness that is neither too dark nor overexposed, avoiding the situation where the captured image is too dark or too bright, and the object cannot be recognized to move in, and then the decoding state cannot be entered, further improving the environmental adaptability of the barcode reading device, and thus improving the code scanning experience.
[0055] S104: until the brightness value of the first image is within a first preset range, a second image captured by the camera is acquired, and based on the second image, it is determined whether the barcode reading device exits the sensing state.
[0056] The second image can be understood as an image taken by a camera for determining the difference between two frames of images. The second image refers to an image taken after determining that the brightness value of the first image is within a first preset range, that is, the image taken by the camera is neither too dark nor too bright. Furthermore, the second image and the first image may be the same image or may not be the same image, which is not specifically limited in the embodiments of the present application.
[0057] Determining whether the barcode reading device exits the sensing state based on the second image includes: obtaining a preset difference threshold, and if the difference value between the second image and the third image is greater than the difference threshold, determining that the barcode reading device exits the sensing state and enters the decoding state. The difference threshold can be set according to actual conditions. The shooting parameters of the third image are the same as the shooting parameters of the second image.
[0058] The embodiment of the present application provides a sensing control method for a barcode reading device. When it is detected that the barcode reading device enters the sensing state, a first image captured by a camera is obtained, and then it is determined whether the brightness value of the first image is within a first preset range. If the brightness value of the first image is not within the first preset range, the shooting parameters of the camera are adjusted according to the brightness value of the first image to obtain the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and returns to the step of obtaining the first image captured by the camera; until the brightness value of the first image is within the first preset range, the second image captured by the camera is obtained, and based on the second image, it is determined whether the barcode reading device exits the sensing state. Since the brightness value of the image captured by the camera can reflect the degree of light in the external environment to a certain extent, the shooting parameters of the camera are adjusted based on the brightness value of the image captured by the camera. The camera can still capture clearer images in scenes with dark or overly bright light, so that in scenes with dark or overly bright light, the barcode reading device can still easily sense the movement of objects, thereby improving the adaptability of the barcode reading device to the environment and thus improving the scanning experience.
[0059] On the basis of the above-mentioned embodiments, the embodiments of the present application further optimize the induction control method for the barcode reading device, such as Figure 3 As shown, the optimized induction control method for a barcode reading device provided in the embodiment of the present application mainly includes the following steps:
[0060] S201, detecting that the barcode reading device enters the sensing state.
[0061] When the sensing phase is detected, the fill light is turned off.
[0062] In one possible implementation, detecting that the barcode reading device enters a sensing state includes one of the following: detecting that the length of time the barcode reading device is in a decoding state exceeds a second set length of time, and controlling the barcode reading device to enter a sensing state; receiving a decoding success signal, and controlling the barcode reading device to enter a sensing state; and controlling the barcode reading device to enter a sensing state after a third set length of time has elapsed after receiving a decoding success signal.
[0063] When it is detected that the duration of the barcode reading device being in the decoding state exceeds the second set duration, the barcode reading device is controlled to enter the sensing state. The second set duration can be set according to actual conditions. For example, the second set duration can be 5 seconds.
[0064] From the time the barcode reader exits the sensing state and enters the decoding state, the flash light is turned on to start timing. The timing value is the length of time the barcode reader is in the decoding state. If the length of time the barcode reader is in the decoding state exceeds the second set length of time, it indicates that the barcode reader has timed out in the decoding state and has failed to successfully decode the information in the barcode. At this time, the barcode reader exits the decoding state and enters the sensing state. This prevents the barcode reader from being in the decoding state for a long time, resulting in a waste of power consumption, and also prevents the barcode scanning time from being too long, resulting in a poor user scanning experience.
[0065] The decoding success signal is used to indicate that the barcode reading device has read the information in the photographed barcode and has read out the information included in the barcode.
[0066] After the barcode reading device enters the decoding state, it decodes the barcode to obtain the information included in the barcode. At this time, the decoding is successful and a decoding success signal is generated. In response to receiving the decoding success signal, the barcode reading device is controlled to switch from the decoding state to the sensing state, thereby realizing the switching of the working state of the barcode reading device and improving work efficiency.
[0067] In response to receiving a successful decoding signal, the barcode reading device is immediately controlled to switch from the decoding state to the sensing state. This is mainly used in libraries, museums, etc. where the number of objects entering and leaving is not large. In many cases, only one object needs to be barcoded, and the next barcode reading is required only after a long interval.
[0068] The third set time length is a time interval between when the barcode reading device switches from the decoding state to the sensing state. The specific value can be set according to the actual situation. For example, the third set time length can be 300 milliseconds (ms).
[0069] After the barcode reading device enters the decoding state, it decodes the barcode to obtain the information included in the barcode. At this time, the decoding is successful and a decoding success signal is generated. In response to receiving the decoding success signal, the barcode reading device is controlled to switch from the decoding state to the sensing state after a third set time interval. The switching of the working state of the barcode reading device is realized to improve the working efficiency.
[0070] In response to receiving a decoding success signal, the barcode reading device is controlled to switch from a decoding state to a sensing state after a third set time interval. This is mainly used in supermarkets, logistics, and other places where the number of objects entering and leaving is very large, or a large number of barcodes need to be read in a short period of time. For example: a customer purchased 10 items at a time, and the barcodes of the 10 items need to be read in a short period of time. At this time, since it is necessary to control the barcode reading device to read a large number of barcodes, after the previous barcode is read successfully, within the third set time interval, if the camera captures a new barcode image, since the barcode reading device is still in the decoding state, the captured new barcode image can be decoded. After the third set time interval, if no new barcode image is captured, it indicates that the barcode reading is over, and the barcode reading device is controlled to switch to the sensing state.
[0071] In this way, it is possible to avoid the barcode reading device from frequently switching between the sensing state and the decoding state in a short period of time, thereby improving the barcode reading device.
[0072] S202, determining whether the duration of entering the sensing state exceeds a first set duration, if not, executing S203, and if so, executing S207.
[0073] In a possible implementation, it is detected that the sensing state has been entered, the fill light is turned off, and the time of entering the sensing stage is recorded as t s . Get the current time as t, and the duration of entering the sensing state as tt s .
[0074] Among them, the first set time length T is set according to the actual situation. Optionally, the first set time length T is set between 200ms and 500ms. If the first set time length T is less than 200ms, the camera parameters can be adjusted less frequently. Assuming it is a 30-frame camera, and the camera parameters are effective every other frame, they can only be adjusted less than 2-3 times, resulting in too few shooting parameter adjustments, and the appropriate shooting parameters cannot be adjusted in a short time. If T is greater than 500ms, it will take a long time to adjust the camera parameters after entering the sensing stage, and the difference between the two frames of images cannot be judged in time, resulting in a decrease in the actual scanning experience.
[0075] S203: Acquire a first image captured by a camera.
[0076] When the barcode reading device enters the sensing state for the first time, the camera is controlled to capture the first image according to the set camera parameters, and the first image captured by the camera is obtained. The set camera parameters may be a fixed camera parameter set by the barcode reading device when it leaves the factory, and the fixed camera parameters are used to enable the camera to capture the first image according to the fixed camera parameters when the barcode reading device enters the sensing state for the first time. Alternatively, the set camera parameters may be the adjusted camera parameters during the previous sensing state. Alternatively, the set camera parameters may be the average value of the adjusted camera parameters corresponding to multiple sensing states.
[0077] The barcode reading device enters the sensing state for the first time. It can be understood that the barcode reading device has just entered the sensing state during the barcode reading process and has not yet adjusted the camera parameters.
[0078] When the barcode reading device is in a sensing state and the camera parameters have been adjusted, a first image captured by the camera according to the adjusted shooting parameters is obtained.
[0079] S204, determining whether the brightness value of the first image is less than the minimum value of the first preset range, if so, executing S205, if not, executing S206.
[0080] Compare the brightness value of the first image with the minimum value of the first preset range to determine whether the brightness value of the first image is less than the minimum value of the first preset range. If the brightness value of the first image is less than the minimum value of the first preset range, it indicates that the first image is too dark and the camera shooting parameters need to be increased.
[0081] S205 , increasing the shooting parameters of the camera to obtain adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and returning to step S202 .
[0082] Increasing the shooting parameters of the camera includes any of the following: increasing the exposure time of the camera, increasing the gain value of the camera, or increasing the exposure time and gain value of the camera.
[0083] In one possible implementation, increasing the shooting parameters of the camera includes: increasing the exposure time according to a set step length, increasing by 1 / 2 step each time. For example, increasing from 1 / 60 second to 1 / 30 second), and increasing the gain value according to a set step length. Each time the gain value is increased by 1dB or 2dB. Specifically, each time the gain value is adjusted, the exposure time is adjusted first, and when the exposure time reaches the upper limit, but the brightness value of the first image is still less than the minimum value of the first preset range, the gain value is gradually increased.
[0084] In one possible implementation, increasing the shooting parameters of the camera includes: increasing the shooting parameters of the camera according to the brightness value of the first image and the preset brightness value. The preset brightness value is a preset expected brightness value. For example, for most application scenarios, the preset brightness value can be around 128 (medium brightness). Calculate the ratio between the preset brightness value and the brightness value of the first image, and increase the shooting parameters of the camera according to the ratio. In other words, the ratio of the increased shooting parameters of the camera to the current shooting parameters is the same as the ratio between the preset brightness value and the brightness value of the first image. That is, the current shooting parameters are increased according to the ratio. For example: the preset brightness value is 126, the brightness value of the first image is 21, and the ratio between the preset brightness value and the brightness value of the first image is 6. Only the exposure time is increased, the current exposure time is 1 / 60 seconds, and the increased exposure time is 1 / 10 seconds. Only the gain value is increased, the current gain value is 1dB, and the increased gain value is 6dB. If the exposure time and the gain value are increased at the same time, the ratio of the product of the increased exposure time and the gain value to the product of the current exposure time and the gain value is the same as the ratio between the preset brightness value and the brightness value of the first image. The current exposure time is 1 / 60 seconds and the current gain value is 1dB, then the increased exposure time is 1 / 20 seconds and the increased gain value is 2dB.
[0085] S206, determining whether the brightness value of the first image is greater than the maximum value of the first preset range, if so, executing S207, if not, executing S208.
[0086] Compare the brightness value of the first image with the maximum value of the first preset range to determine whether the brightness value of the first image is greater than the maximum value of the first preset range. If the brightness value of the first image is greater than the maximum value of the first preset range, it indicates that the first image is too bright and the shooting parameters of the camera need to be reduced.
[0087] S207, reducing the shooting parameters of the camera to obtain adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and returning to execute step S202.
[0088] Reducing the shooting parameters of the camera includes any one of the following: reducing the exposure time of the camera, reducing the gain value of the camera, or reducing the exposure time and gain value of the camera.
[0089] In a possible implementation, reducing the shooting parameters of the camera includes: reducing the exposure time according to a set step length, reducing it by 1 / 2 step each time. For example: reducing from 1 / 30 second to 1 / 60 second, reducing the gain value according to a set step length. Increase by 2dB or 1dB each time. Specifically, each adjustment can keep the gain value unchanged, adjust the exposure time first, and when the exposure time reaches the lower limit, but the brightness value of the first image is still greater than the maximum value of the first preset range, then start to gradually reduce the gain value.
[0090] In a possible implementation, reducing the shooting parameters of the camera includes: reducing the shooting parameters of the camera according to the brightness value of the first image and the preset brightness value. The preset brightness value is a preset expected brightness value. For example, for most application scenarios, the preset brightness value can be around 128 (medium brightness). Calculate the ratio between the preset brightness value and the brightness value of the first image, and reduce the shooting parameters of the camera according to the ratio. In other words, the ratio of the reduced shooting parameters of the camera to the current shooting parameters is the same as the ratio between the preset brightness value and the brightness value of the first image. That is, the current shooting parameters are reduced according to the ratio. For example: the preset brightness value is 128, the brightness value of the first image is 192, and the ratio between the preset brightness value and the brightness value of the first image is 2 / 3. Only increase the exposure time, the current exposure time is 1 / 10 second, and the reduced exposure time is 1 / 15 second. Only increase the gain value, the current gain value is 3dB, and the reduced gain value is 2dB. If the exposure time and the gain value are increased at the same time, the ratio of the product of the increased exposure time and the gain value to the product of the current exposure time and the gain value is the same as the ratio between the preset brightness value and the brightness value of the first image. The current exposure time is 1 / 10 second and the current gain value is 3dB, then the reduced exposure time is 1 / 10 second and the reduced gain value is 2dB.
[0091] S208: Acquire a second image captured by the camera.
[0092] The second image can be understood as an image taken by a camera and used to determine the difference between two frames of images.
[0093] S209, determining whether the second image is the first image captured by the camera according to the adjusted shooting parameters, if so, executing S210, if not, executing S211.
[0094] In one possible implementation, the shooting parameters of the second image are compared with the shooting parameters of the previous frame image. If the shooting parameters have changed, the second image is the first image taken by the camera according to the adjusted shooting parameters; if the shooting parameters have not changed, the second image is the first image taken by the camera according to the adjusted shooting parameters.
[0095] In another possible implementation, a setting mark is added to the first image taken by the camera according to the adjusted shooting parameters. If the setting mark is included in the second image, the second image is the first image taken by the camera according to the adjusted shooting parameters; if the setting mark is not included in the second image, the second image is the first image taken by the camera according to the adjusted shooting parameters.
[0096] S210: Determine a difference threshold based on the brightness value of the second image.
[0097] If the second image is the first image captured by the camera according to the adjusted shooting parameters, the difference threshold is determined based on the brightness value of the second image.
[0098] In one possible implementation, the difference threshold is determined based on the brightness value of the second image, including: if the brightness value of the second image is within a second preset range, using the first value as the difference threshold; if the brightness value of the fourth image is not within the second preset range, using the second value as the difference threshold, and the first value is greater than the second value.
[0099] Calculate the brightness value of the second image and determine it as L c In practical applications, the brightness range of an image is generally 0-255. The image brightness is divided into three ranges: the image brightness value is less than the minimum value L1 of the second preset range, the image brightness value is greater than the maximum value L2 of the second preset range, and the image brightness value is greater than the minimum value L1 of the second range and less than the maximum value L2 of the second preset range, that is, [0~L1, L1~L2, L2~255]. If the second image brightness value is greater than the minimum value L1 of the second range and less than the maximum value L2 of the second preset range, that is, the brightness value of the second image is between L1 and L2, it indicates that after adjusting the shooting parameters of the camera, the brightness of the captured image is appropriate, and a moderate first value Th1 is selected as the difference threshold. If the second image brightness value is greater than the maximum value L2 of the second range, or the second image brightness value is less than the minimum value L1 of the second preset range, that is, the second image brightness value is between L2 and 255 or 0~L1, it indicates that after adjusting the shooting parameters of the camera, the brightness of the captured image is still darker or brighter, and a second value Th2 smaller than the first value is selected as the difference threshold. It makes it easier to monitor changes in external objects or barcodes.
[0100] S211. Calculate a difference value between the second image and the third image, where the shooting parameters corresponding to the third image are the same as the shooting parameters corresponding to the second image.
[0101] When the second image is not the first image captured by the camera according to the adjusted shooting parameters, a frame of image preceding the second image is acquired as the third image.
[0102] The difference value between the second image and the third image is represented by methods such as Mean Squared Error (MSE), Peak Signal-to-Noise Ratio (PSNR), and Structural Similarity Index (SSIM).
[0103] S212: If the difference value between the second image and the third image is greater than the difference threshold, determine that the barcode reading device exits the sensing state and enters the decoding state.
[0104] If the difference between the second image and the third image is greater than the difference threshold, it indicates that the two images are very different and an object is determined to have moved in. Then the decoding state is entered, the fill light is turned on, and the range of the camera's shooting parameters is reset to the first range. d1 ,E d2 ].
[0105] If the difference value between the second image and the third image is less than or equal to the difference threshold, it indicates that the difference between the two images is small, and it is determined that no object has moved in. Otherwise, S208 and subsequent steps are repeated until the difference value between the second image and the third image is greater than the difference threshold, and it is determined that the barcode reading device exits the sensing state and enters the decoding state. Alternatively, when recording the duration of the barcode reading device in the decoding state, if the duration of the barcode reading device in the decoding state exceeds the second set duration, the execution returns to step S201.
[0106] Figure 4 FIG. 1 is a schematic diagram of the structure of a sensing control device for a barcode reading device in an embodiment of the present application. Figure 4 As shown, the sensing control device 40 for a barcode reading device provided in the embodiment of the present application mainly includes: a first image acquisition module 41, a first judgment module 42, a shooting parameter adjustment module 43 and a sensing state control module 44.
[0107] Among them, the first image acquisition module 41 is used to detect that the barcode reading device enters the sensing state and obtains the first image taken by the camera; the first judgment module 42 is used to judge whether the brightness value of the first image is within the first preset range; the shooting parameter adjustment module 43 is used to adjust the shooting parameters of the camera according to the brightness value of the first image if the brightness value of the first image is not within the first preset range, and obtain the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and returns to execute the step of obtaining the first image taken by the camera; the sensing state control module 44 is used to obtain the second image taken by the camera until the brightness value of the first image is within the first preset range, and determine whether the barcode reading device exits the sensing state based on the second image.
[0108] The embodiment of the present application provides a sensing control device for a barcode reading device, which is used to execute the following process: detecting that the barcode reading device enters a sensing state, obtaining a first image captured by a camera; determining whether the brightness value of the first image is within a first preset range; if the brightness value of the first image is not within the first preset range, adjusting the camera's shooting parameters according to the brightness value of the first image, obtaining the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters, obtaining a new first image, and returning to the step of obtaining the first image captured by the camera; until the brightness value of the first image is within the first preset range, obtaining a second image captured by the camera, and determining whether the barcode reading device exits the sensing state based on the second image. Since the brightness value of the image captured by the camera can reflect the degree of ambient light to a certain extent, the camera's shooting parameters are adjusted based on the brightness value of the image captured by the camera, so that the camera can still capture a clearer image in a dark or overly bright scene, so that in a dark or overly bright scene, the barcode reading device can still easily sense the movement of objects, thereby improving the adaptability of the barcode reading device to the environment, thereby improving the scanning experience.
[0109] In one possible implementation, the shooting parameter adjustment module 43 is specifically used to increase the shooting parameters of the camera to obtain adjusted shooting parameters if the brightness value of the first image is less than the minimum value of the first preset range; if the brightness value of the first image is greater than the maximum value of the first preset range, reduce the shooting parameters of the camera to obtain adjusted shooting parameters.
[0110] In one possible implementation, the sensing state control module 44 is specifically used to obtain a second image taken by the camera; determine whether the second image is the first image taken by the camera according to the adjusted shooting parameters; if so, determine a difference threshold based on the brightness value of the second image; if not, calculate the difference value between the second image and the third image, and the shooting parameters corresponding to the third image are the same as the shooting parameters corresponding to the second image; if the difference value between the second image and the third image is greater than the difference threshold, determine that the barcode reading device exits the sensing state and enters the decoding state.
[0111] In a possible implementation, the sensing state control module 44 is specifically configured to use a first value as a difference threshold if the brightness value of the second image is within a second preset range; and use a second value as a difference threshold if the brightness value of the second image is not within the second preset range, and the first value is greater than the second value.
[0112] In one possible implementation, a shooting parameter adjustable range setting module is used to adjust the shooting parameter adjustable range of the camera from a first range to a second range when it is detected that the barcode reading device enters a sensing state, before acquiring a first image captured by the camera; wherein the first range is a subset of the second range, and the first range is the shooting parameter adjustable range of the camera when the barcode reading device is in a decoding state.
[0113] In a possible implementation, it also includes: a sensing state duration judgment module, which is used to judge whether the duration of entering the sensing state exceeds a first set duration; if it does not exceed the first set duration, a first image taken by the camera is obtained; if it exceeds the first set duration, a second image taken by the camera is obtained, and based on the second image, it is determined whether the barcode reading device exits the sensing state.
[0114] In one possible implementation, detecting that the barcode reading device enters a sensing state includes one of the following: detecting that the time duration that the barcode reading device is in a decoding state exceeds a second set time duration, and controlling the barcode reading device to enter a sensing state; receiving a decoding success signal, and controlling the barcode reading device to enter a sensing state; and controlling the barcode reading device to enter a sensing state after a third set time duration has elapsed after receiving a decoding success signal.
[0115] The induction control device for a barcode reading device provided in the embodiment of the present application can execute the induction control method for a barcode reading device provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0116] Figure 5 is a schematic diagram of the structure of an electronic device provided in this embodiment. The electronic device may include a sensing control device for a barcode reading device, such as Figure 5 As shown, the electronic device 500 includes a processor 510, a memory 520, an input device 530, and an output device 540; the number of the processor 510 in the electronic device can be one or more. Figure 5 A processor 510 is taken as an example; the processor 510, the memory 520, the input device 530 and the output device 540 in the electronic device can be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0117] The memory 520 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the inductive control method for a barcode reading device in the embodiment of the present invention. The processor 510 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the memory 520, that is, implements the inductive control method for a barcode reading device provided in the embodiment of the present invention.
[0118] The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 520 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 520 may further include a memory remotely arranged relative to the processor 510, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0119] The input device 530 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the electronic device, and may include a keyboard, a mouse, etc. The output device 540 may include a display device such as a display screen.
[0120] This embodiment also provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to implement the induction control method for a barcode reading device provided in the embodiment of the present invention.
[0121] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided in an embodiment of the present invention are not limited to the method operations described above, and can also execute related operations in the induction control method for a barcode reading device provided in any embodiment of the present invention.
[0122] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.
[0123] It is worth noting that in the above-mentioned embodiment of the induction control device for barcode reading equipment, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0124] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0125] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An induction control method for a barcode reading device, characterized in that: The method comprises: Detecting that the barcode reading device enters a sensing state, acquiring a first image captured by a camera; Determining whether the brightness value of the first image is within a first preset range; If the brightness value of the first image is not within the first preset range, adjusting the shooting parameters of the camera according to the brightness value of the first image to obtain adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and returning to the step of obtaining the first image captured by the camera; When the brightness value of the first image is within a first preset range, a second image captured by the camera is acquired, and it is determined whether the barcode reading device exits the sensing state based on the second image.
2. The method according to claim 1, characterized in that If the brightness value of the first image is not within a first preset range, adjusting the shooting parameters of the camera according to the brightness value of the first image to obtain the adjusted shooting parameters includes: If the brightness value of the first image is less than the minimum value of the first preset range, increasing the shooting parameters of the camera to obtain adjusted shooting parameters; If the brightness value of the first image is greater than the maximum value of the first preset range, the shooting parameters of the camera are reduced to obtain adjusted shooting parameters.
3. The method according to claim 1, characterized in that Determining whether the barcode reading device exits the sensing state based on the second image includes: Acquire a second image captured by the camera; Determining whether the second image is the first image captured by the camera according to the adjusted shooting parameters; If yes, determining a difference threshold based on the brightness value of the second image; If not, calculating the difference value between the second image and the third image, the shooting parameters corresponding to the third image are the same as the shooting parameters corresponding to the second image; If the difference value between the second image and the third image is greater than the difference threshold, it is determined that the barcode reading device exits the sensing state and enters the decoding state.
4. The method according to claim 3, characterized in that Determining a difference threshold based on the brightness value of the second image includes: If the brightness value of the second image is within a second preset range, taking the first value as the difference threshold; If the brightness value of the second image is not within the second preset range, the second value is used as the difference threshold, and the first value is greater than the second value.
5. The method according to any one of claims 1, characterized in that Before detecting that the barcode reading device enters the sensing state and obtaining the first image captured by the camera, the method further includes: When it is detected that the barcode reading device enters the sensing state, the adjustable range of the shooting parameters of the camera is adjusted from the first range to the second range; The first range is a subset of the second range, and the first range is an adjustable range of shooting parameters of the camera when the barcode reading device is in a decoding state.
6. The method according to claim 1, characterized in that Also includes: Determining whether the duration of the barcode reading device entering the sensing state exceeds a first set duration; If the first set time period is not exceeded, obtaining a first image captured by the camera; If the first set time period is exceeded, a second image captured by the camera is acquired, and based on the second image, it is determined whether the barcode reading device exits the sensing state.
7. The method according to claim 1, characterized in that Detecting that the barcode reading device enters the sensing state includes one of the following: Detecting that the duration of the barcode reading device being in the decoding state exceeds a second set duration, controlling the barcode reading device to enter the sensing state; Upon receiving a decoding success signal, the barcode reading device is controlled to enter a sensing state; After receiving the decoding success signal, the barcode reading device is controlled to enter the sensing state at a third set time interval.
8. An induction control device for a barcode reading device, characterized in that: The device comprises: A first image acquisition module, used to detect that the barcode reading device enters a sensing state and acquire a first image taken by a camera; A first judging module, used to judge whether the brightness value of the first image is within a first preset range; a shooting parameter adjustment module, configured to adjust the shooting parameters of the camera according to the brightness value of the first image if the brightness value of the first image is not within a first preset range, obtain the adjusted shooting parameters, so that the camera shoots according to the adjusted shooting parameters to obtain a new first image, and return to execute the step of obtaining the first image shot by the camera; The sensing state control module is used to obtain a second image taken by a camera until the brightness value of the first image is within a first preset range, and determine whether the barcode reading device exits the sensing state based on the second image.
9. An electronic device, characterized in that: The device comprises: A camera for capturing images; one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the induction control method for a barcode reading device as described in any one of claims 1-7.
10. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the induction control method for a barcode reading device as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Automatic bar code induction reading method and reader
CN104008360A
Method and device for acquiring code scanning image, code scanning equipment and storage medium
CN113542617A
Cord reader, electronic equipment, and method and program for adjusting parameter
JP2005295313A
Optical information reader, optical information reading method, optical information reading program, and computer readable recording medium, and recorded instrument
JP2021149656A