Inductive control method, apparatus, device and medium for bar code reading equipment
By adjusting the camera shooting parameters to adapt to different lighting conditions, the problem of inaccurate sensing by barcode reading devices in low or high light environments has been solved, and the scanning performance of the device under various lighting conditions has been improved.
Patent Information
- Application Number
- CN202411736549.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-11-29
AI Technical Summary
Barcode reading devices have difficulty effectively detecting objects moving in under dim or overly bright light, resulting in a poor scanning experience.
By detecting the brightness value of the image captured by the camera, the camera's shooting parameters are adjusted to ensure that the image brightness is within a preset range, thereby improving image clarity and enabling the device to accurately sense the movement of objects under different lighting conditions.
It improves the adaptability of barcode reading devices in different lighting environments and enhances the scanning experience, ensuring that objects can still be effectively identified even in dimly lit or overly bright lighting conditions.
Smart Images

Figure CN119808808B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of bar code reading, and in particular to an induction control method and device for a bar code reading device, a bar code reading device, and a medium. BACKGROUND
[0002] Bar code reading technology is an automatic identification technology based on computer application and practical development. The bar code reading device is a device or equipment for scanning one-dimensional codes and / or two-dimensional codes, and is usually a box-shaped structure with an optical code scanning head. The bar code reading device has been widely used in supermarkets, hospitals, transportation, logistics and other occasions.
[0003] The reading mode of the bar code reading device generally includes a continuous reading mode and an induction reading mode. The continuous reading mode is that the light supplement lamp of the bar code reading device is always on, continuously acquires two-dimensional code images, decodes the two-dimensional code images, and outputs the decoding result after successful decoding. The induction reading mode generally includes two states: an induction state and a decoding state. The induction state is a state in which the bar code reading device is closed and does not scan the code, and waits until an object is moved in, and the bar code reading device enters the decoding state, turns on the light supplement lamp, and controls the camera to acquire the bar code image and decode. In the induction state of the induction reading mode, the light supplement lamp is turned off, which can save power consumption and is more in line with the actual use scene.
[0004] In the induction reading mode, the following two schemes are usually used to sense whether an object is moved in. The first scheme is to use infrared induction technology to determine whether an object is moved in, which requires adding an infrared induction device in the bar code reading device, and the cost is relatively high. The second scheme is to use the camera to acquire images, compare the difference between two images to determine whether an object is moved in.
[0005] However, when the bar code reading device is in the induction state and the light supplement lamp is turned off, the brightness of the image acquired by the camera depends on the brightness of the external environment. In scenes with relatively dark or bright light, it is easy to fail to sense that an object is moved in, so as to fail to trigger the decoding to start, and thus the code scanning experience is greatly reduced. SUMMARY
[0006] To solve the above technical problems, the present application provides an induction control method and device for a bar code reading device, a bar code reading device, and a medium, which can easily sense that an object is moved in in scenes with relatively dark or bright light, improve the adaptability of the bar code reading device to the environment, and thus improve the code scanning experience.
[0007] In a first aspect, the present application provides a sensing control method for a bar code reading device, the method comprising: detecting that the bar code reading device enters a sensing state, and acquiring a first image captured by a camera; determining whether a 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 a shooting parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera shoots according to the adjusted shooting parameter to obtain a new first image, and returning to the step of acquiring the first image captured by the camera; and until the brightness value of the first image is within the first preset range, acquiring a second image captured by the camera, and determining whether the bar code reading device exits the sensing state based on the second image.
[0008] In a second aspect, the present application provides a sensing control device for a bar code reading device, the device comprising: a first image acquisition module configured to detect that the bar code reading device enters a sensing state, and acquire a first image captured by a camera; a first determination module configured to determine whether a brightness value of the first image is within a first preset range; a shooting parameter adjustment module configured to, if the brightness value of the first image is not within the first preset range, adjust a shooting parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera shoots according to the adjusted shooting parameter to obtain a new first image, and return to the step of acquiring the first image captured by the camera; and a sensing state control module configured to, until the brightness value of the first image is within the first preset range, acquire a second image captured by the camera, and determine whether the bar code reading device exits the sensing state based on the second image.
[0009] In a third aspect, the present application provides an electronic device, the electronic device comprising a bar code reading device, the device comprising: a camera configured to capture images; one or more processors; a storage device configured to store one or more programs; and when the one or more programs are executed by the one or more processors, the one or more processors implement the sensing control method for the bar code reading device as described in the first aspect.
[0010] In a fourth aspect, the present application provides a storage medium, which can be a computer readable storage medium, and the storage medium has stored thereon a computer program, which is executed by a processor to implement the sensing control method for the bar code reading device as described in the first aspect.
[0011] In a fifth aspect, the present application provides a computer program product, the computer program product comprising a computer program or instructions, and the computer program or instructions are executed by a processor to implement the sensing control method for the bar code reading device as described in any one of the first aspect.
[0012] The technical solution provided by the embodiments of the present application has the following advantages compared with the prior art:
[0013] The embodiment of the present application provides a sensing control method, device and equipment for a bar code reading device and a storage medium, and the method comprises the following steps: detecting that the bar code reading device enters a sensing state, and acquiring a first image photographed by a camera; judging 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 photographing parameter of the camera according to the brightness value of the first image to obtain an adjusted photographing parameter, so that the camera photographs according to the adjusted photographing parameter to obtain a new first image, and returning to the step of acquiring the first image photographed by the camera; until the brightness value of the first image is within the first preset range, acquiring a second image photographed by the camera, and determining whether the bar code reading device exits the sensing state based on the second image. Since the brightness value of the image photographed by the camera can reflect the light and shade degree of the external environment light to a certain extent, the photographing parameter of the camera is adjusted based on the brightness value of the image photographed by the camera, so that the camera can still photograph a relatively clear image in a scene with relatively dark or too bright light, so that the bar code reading device is still easy to sense the object moving in under the scene with relatively dark or too bright light, the adaptability of the bar code reading device to the environment is improved, and the scanning code experience is improved. BRIEF DESCRIPTION OF DRAWINGS
[0014] The accompanying drawings, which are incorporated into and form a part of the specification, illustrate preferred embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained without creative labor based on these drawings.
[0016] Figure 1 A flowchart of the sensing control method for the bar code reading device provided by the embodiment of the present application is shown in the figure.
[0017] Figure 2 A structural diagram of the bar code reading device provided by the embodiment of the present application is shown in the figure.
[0018] Figure 3 A flowchart of the optimized sensing control method for the bar code reading device provided by the embodiment of the present application is shown in the figure.
[0019] Figure 4 A structural diagram of the sensing control device for the bar code reading device provided by the embodiment of the present application is shown in the figure.
[0020] Figure 5This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.
[0022] Many specific details are set forth in the following description in order to provide a full understanding of this application, but this application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of this application, and not all embodiments.
[0023] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based 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". Definitions of other terms will be given in the description below.
[0024] It should be noted that the concepts of "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 of functions performed by these devices, modules or units or their interdependencies.
[0025] It should be noted that the terms "a" and "a plurality of" used in this application are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0026] The sensing control method for barcode reading devices provided in this application will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] Figure 1 This is a flowchart illustrating a sensing control method for a barcode reading device according to an embodiment of this application. This embodiment is applicable to controlling barcode reading devices. The method can be executed by a sensing control device for the barcode reading device, which can be implemented in software and / or hardware and can be configured within the barcode reading device. Furthermore, the sensing control method for a barcode reading device provided in this embodiment is executed by a processor within the barcode reading device.
[0028] like Figure 1 As shown, the sensing control method for barcode reading devices provided in this application mainly includes steps S101-S105.
[0029] S101, detecting that the bar code reading device enters a sensing state, and acquiring a first image captured by a camera.
[0030] A bar code reading device is an electronic device used to read and decode bar code or QR code information. Bar code reading devices are widely used in retail, logistics, inventory management, healthcare and other fields to improve the speed and accuracy of data input.
[0031] As shown in Figure 2 , the bar code reading device includes a processor, a camera, a fill light and other components. 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 bar code reading device, responsible for processing all computing tasks. The camera interface can be a Digital Video Port (DVP) or Mobile Industry Processor Interface (MIPI) Camera Serial Interface (CSI)-2 standard interface, 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. The GPIO can be used to control external devices such as fill lights or other sensors. The clock signal interface is used for the processor to provide a clock signal to the camera.
[0033] The camera is a key part of the bar code reading device, mainly used for image capture. In the bar code reading device, the camera needs to have sufficient resolution and fast imaging capability to accurately capture bar code information. The camera transmits image data to the processor through the DVP or MIPI interface described above.
[0034] The fill light is to ensure that the bar code 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 state of the fill light is controlled by the processor through the GPIO port.
[0035] The process of reading the barcode information by the barcode reading device can be referred to as a barcode reading mode, and the barcode reading device has two working states in the barcode reading mode, which are respectively: a sensing state and a decoding state. In the sensing state, the flash is turned off, the image is captured by the camera, and the difference between the two images is compared to determine whether an object has moved into the target area. In the decoding state, the flash is turned on, the barcode image is captured by the camera, 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 power-off state or a standby state to the sensing state, or detecting that the barcode reading device switches from the decoding state to the sensing state.
[0037] In one possible implementation, when it is detected that the barcode reading device enters the sensing state, the adjustable range of the shooting parameter of the camera 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 shooting parameter of the camera when the barcode reading device is in the decoding state.
[0038] The first range [E d1 ,E d2 ] is the adjustable range of the shooting parameter of the camera when the barcode reading device is in the decoding state. The second range is [E s1 ,E s2 ] is the adjustable range of the shooting parameter of the camera when the barcode reading device is in the sensing state. Wherein the maximum value E s2 of the second range is greater than the maximum value E d2 of the first range, and the minimum value E s1 of the second range is less than the minimum value E d1 .
[0039] Wherein, the shooting parameter of the camera mainly refers to the parameter for controlling the brightness of the image captured by the camera. Optionally, the shooting parameter of the camera mainly includes the exposure time and the gain value.
[0040] In the decoding state, the light supplement lamp of the barcode reading device is turned on. In the case of light supplement, the exposure time and the gain value for the camera to capture the image do not need to be too large. However, in the sensing state, under the original preset fixed camera parameter scheme, in the condition of only external environment light, if the environment light is weak, it is easy to capture a too dark picture, and it is difficult to distinguish the object and the barcode, so a larger exposure time and gain value are needed to capture a clearer image; if the environment light is strong, the captured image is easy to be overexposed, and the overexposed image is difficult to detect the change of the image, so a smaller exposure and gain value are needed to adjust the image to be more normal.
[0041] In the embodiment, the adjustable range of the camera parameter in the sensing state is greater than the adjustable range of the camera parameter in the decoding state, so that clearer images can be obtained in darker or brighter environments, and the environmental adaptability of the barcode reading device is further improved.
[0042] The first image refers to an image captured by the camera to determine whether an object has moved in. The first image can include an image captured by the camera according to the set camera parameter, or an image captured by the camera according to the adjusted camera parameter.
[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 parameter, and the first image captured by the camera is obtained. The set camera parameter can be a fixed camera parameter set by the barcode reading device when it leaves the factory, which is used to capture the first image according to the fixed camera parameter when the barcode reading device enters the sensing state for the first time. Alternatively, the set camera parameter can be the adjusted camera parameter in the previous sensing state. Alternatively, the set camera parameter can be the average 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 the image can be understood as the brightness level of each pixel point in the image, and the brightness value of the image is usually used to reflect the brightness of each pixel point in the image. The brightness value of the first image refers to the brightness level of the image collected by the camera of the barcode reading device, which reflects the brightness of each pixel point 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 is located when the first image is captured. The greater the brightness value of the first image, the higher the brightness of the environment in which the barcode reading device is located when the first image is captured, and the smaller the brightness value of the first image, the lower the brightness of the environment in which the barcode reading device is located when the first image is captured. The first preset range is the intermediate brightness of the image brightness which is neither too dark nor too bright.
[0046] The first preset range is a preset range representing whether the image brightness is appropriate. The first preset range includes two end values, i.e., a maximum value of the first preset range and a minimum value of the first preset range. Whether the brightness value of the first image is within the first preset range can be determined by comparing the brightness value of the first image with the maximum value of the first preset range and the minimum value of the first preset range, respectively. Specifically, whether the brightness value of the first image is less than the maximum value of the first preset range is compared, whether the brightness value of the first image is greater than the minimum value of the first preset range is compared, 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] In S103, if the brightness value of the first image is not within the first preset range, the shooting parameter of the camera is adjusted according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera shoots according to the adjusted shooting parameter to obtain a new first image, and the step of obtaining the first image shot by the camera is executed again.
[0048] The shooting parameter of the camera can be understood as a parameter for adjusting the brightness of the shot image. Specifically, the shooting parameter of the camera can include an exposure time and a gain value. Adjusting the shooting parameter of the camera to obtain an adjusted shooting parameter includes adjusting the current shooting parameter of the camera to obtain an adjusted shooting parameter.
[0049] Adjusting the shooting parameter 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, adjusting the shooting parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter includes: if the brightness value of the first image is less than the minimum value of the first preset range, increasing the shooting parameter of the camera to obtain an adjusted shooting parameter; if the brightness value of the first image is greater than the maximum value of the first preset range, decreasing the shooting parameter of the camera to obtain an adjusted shooting parameter.
[0051] The brightness value of the first image is not within the first preset range, including: the brightness value of the first image is less than the minimum value of the first preset range, or the brightness value of the first image is greater than the maximum value of the first preset range.
[0052] When the luminance value of the first image is less than the minimum value of the first preset range, it indicates that the environment in which the bar code reading device is located is relatively dark when the first image is captured. The captured image is too dark, which can result in low difference between the two images, thereby causing the bar code reading device to fail to identify that an object has moved in, and further fail to enter the decoding state. Therefore, the camera parameter needs to be increased so that the luminance value of the first image recaptured by the camera can be within the first preset range. In other words, when the luminance value of the first image is less than the minimum value of the first preset range, the camera parameter is increased so that the luminance value of the first image recaptured by the camera can be increased, avoiding the case that the captured image is too dark.
[0053] When the luminance value of the first image is greater than the maximum value of the first preset range, it indicates that the environment in which the bar code reading device is located is relatively bright when the first image is captured. The captured image is too bright, which can result in low difference between the two images, thereby causing the bar code reading device to fail to identify that an object has moved in, and further fail to enter the decoding state. Therefore, the camera parameter needs to be reduced so that the luminance value of the first image recaptured by the camera can be within the first preset range. In other words, when the luminance value of the first image is greater than the maximum value of the first preset range, the camera parameter is reduced so that the luminance value of the first image recaptured by the camera can be reduced, avoiding the case that the captured image is too bright.
[0054] In the embodiments of the present application, when the luminance value of the first image is less than the minimum value of the first preset range, the camera parameter is increased, and when the luminance value of the first image is greater than the maximum value of the first preset range, the camera parameter is reduced. In this way, the luminance of the image recaptured by the camera is in the middle luminance that is neither too dark nor too bright, avoiding the case that the captured image is too dark or too bright, the object cannot be identified to move in, and further the decoding state cannot be entered, thereby further improving the environmental adaptability of the bar code reading device, and further improving the scanning code experience.
[0055] S104, until the luminance value of the first image is within the first preset range, a second image captured by the camera is acquired, and whether the bar code reading device exits the sensing state is determined based on the second image.
[0056] The second image can be understood as an image captured by the camera for judging the difference between two images. The second image refers to an image captured after it is determined that the luminance value of the first image is within the first preset range, i.e., the image captured by the camera is neither too dark nor too bright. Further, the second image and the first image can be the same image or can not be the same image, which is not specifically limited in the embodiments of the present application.
[0057] The method for determining whether the bar code reading device exits the sensing state based on the second image comprises: obtaining a preset difference threshold value, and determining that the bar code reading device exits the sensing state and enters a decoding state if the difference value of the second image and the third image is greater than the difference threshold value. The difference threshold value can be set according to actual conditions. The shooting parameter of the third image is the same as the shooting parameter of the second image.
[0058] The embodiment of the application provides a sensing control method for a bar code reading device. When it is detected that the bar code reading device enters a sensing state, a first image captured by a camera is obtained, and then it is judged 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 parameter of the camera is adjusted according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera shoots according to the adjusted shooting parameter to obtain a new first image, and the step of obtaining the first image captured by the camera is executed again. Until the brightness value of the first image is within the first preset range, a second image captured by the camera is obtained, and it is determined whether the bar code 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 external ambient light to a certain extent, the shooting parameter of the camera is adjusted based on the brightness value of the image captured by the camera. In a scene with relatively dark or bright light, the camera can still capture a relatively clear image, so that the bar code reading device is still easy to sense the object moving in under the scene with relatively dark or bright light, the adaptability of the bar code reading device to the environment is improved, and the scanning code experience is improved.
[0059] On the basis of the above-mentioned embodiment, the embodiment of the application further optimizes the sensing control method for the bar code reading device, as shown in Figure 3 The optimized sensing control method for the bar code reading device provided by the embodiment of the application mainly comprises the following steps:
[0060] S201, detecting that the bar code reading device enters a sensing state.
[0061] When it is detected that the bar code reading device enters the sensing state, the fill light is turned off.
[0062] In one possible implementation, detecting that the bar code reading device enters the sensing state comprises one of the following: detecting that the bar code reading device is in a decoding state for a time length exceeding a second set time length, controlling the bar code reading device to enter the sensing state; receiving a decoding success signal, controlling the bar code reading device to enter the sensing state; and receiving the decoding success signal and then controlling the bar code reading device to enter the sensing state after a third set time length.
[0063] If the time length of the barcode reading device in the decoding state is detected to exceed the second set time length, the barcode reading device is controlled to enter the sensing state. The second set time length can be set according to actual conditions. For example, the second set time length can be 5 seconds.
[0064] From the detection that the barcode reading device exits the sensing state and enters the decoding state, the flash is turned on, and the time length of the barcode reading device in the decoding state is counted. If the time length of the barcode reading device in the decoding state exceeds the second set time length, it is indicated that the barcode reading device is in the decoding state timeout, and the information in the barcode is not successfully decoded. At this time, the decoding state is exited, and the sensing state is entered. This avoids the barcode reading device being in the decoding state for a long time, resulting in power waste, and also avoids the user's poor scanning experience caused by long scanning time.
[0065] The decoding success signal is used to indicate that the barcode reading device has read the information in the captured barcode and read the information included in the barcode.
[0066] After the barcode reading device enters the decoding state, the barcode is decoded to obtain the information included in the barcode. At this time, the decoding is successful, a decoding success signal is generated, and the barcode reading device is controlled to switch from the decoding state to the sensing state in response to receiving the decoding success signal. This realizes the switching of the working state of the barcode reading device and improves the working efficiency.
[0067] In response to receiving the decoding success signal, the barcode reading device is immediately controlled to switch from the decoding state to the sensing state. This is mainly applied to libraries, museums, and other objects with a small number of entries and exits. In many cases, only one object needs to be scanned, and a long time interval is required before the next barcode reading.
[0068] The third set time length is a time interval for measuring the switching of the barcode reading device from the decoding state to the sensing state. The specific value can be set according to actual conditions. For example, the third set time length can be 300 milliseconds (ms).
[0069] After the barcode reading device enters the decoding state, the barcode is decoded to obtain the information included in the barcode. At this time, the decoding is successful, a decoding success signal is generated, and the barcode reading device is controlled to switch from the decoding state to the sensing state in response to receiving the decoding success signal and after a third set time length. This realizes the switching of the working state of the barcode reading device and improves the working efficiency.
[0070] In response to receiving the decoding success signal and after a third set time interval, the bar code reading device is switched from the decoding state to the sensing state, which is mainly applied to the objects such as supermarkets and logistics, and the number of objects in and out is large, or a large number of bar codes need to be read in a short time. For example, a customer purchases 10 goods at a time, and needs to read the bar codes of the 10 goods in a short time. At this time, since a large number of bar codes need to be read by the bar code reading device, after the decoding of the previous bar code is successful, if a new bar code image is captured by the camera within the third set time interval, since the bar code reading device is still in the decoding state, the new bar code image captured can be decoded. After the third set time interval, if no new bar code image is captured, it indicates that the bar code reading is completed, and the bar code reading device is switched to the sensing state.
[0071] In this way, the bar code reading device can be prevented from frequently switching between the sensing state and the decoding state in a short time, and the bar code reading device is improved.
[0072] S202, it is judged whether the time interval of entering the sensing state exceeds the first set time interval, if not, S203 is executed, and if yes, S207 is executed.
[0073] In one possible implementation, it is detected that the sensing state is entered, the light supplement lamp is turned off, and the time when the sensing state is entered is recorded as t s The current time is t, and the time interval of entering the sensing state is t-t s .
[0074] The first set time interval T is set according to the actual situation, and optionally, the first set time interval T is set to 200ms to 500ms. If the first set time interval T is less than 200ms, the number of times of adjusting the camera parameters is small, assuming that the camera is 30 frames, and the camera parameters are effective every frame, and can be adjusted less than 2-3 times, which leads to that the number of times of adjusting the shooting parameters is too small, and the shooting parameters cannot be adjusted to appropriate shooting parameters in a short time. If T is greater than 500ms, it will lead to a long time of adjusting the camera parameters after entering the sensing stage, and the difference between two images cannot be judged in time, which leads to a decline in the actual scanning experience.
[0075] S203, a first image captured by the camera is acquired.
[0076] When the bar code reading device enters the sensing state for the first time, the camera is controlled to shoot a first image according to a set camera parameter, and the first image shot by the camera is obtained. The set camera parameter can be a fixed camera parameter set when the bar code reading device is manufactured, which is used to make the camera shoot the first image according to the fixed camera parameter when the bar code reading device enters the sensing state for the first time. Alternatively, the set camera parameter can be an adjusted camera parameter in the previous sensing state process. Alternatively, the set camera parameter can be an average of the adjusted camera parameters corresponding to multiple sensing states.
[0077] The first time that the bar code reading device enters the sensing state can be understood as that the bar code reading device enters the sensing state in this bar code reading process and has not adjusted the camera parameter.
[0078] After the bar code reading device is in the sensing state and the camera parameter has been adjusted, the first image shot by the camera according to the adjusted shooting parameter is obtained.
[0079] S204, it is judged whether the brightness value of the first image is less than the minimum value of the first preset range, if yes, S205 is executed, and if no, S206 is executed.
[0080] The brightness value of the first image is compared with the minimum value of the first preset range, and it is judged 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 shooting parameter of the camera needs to be increased.
[0081] S205, the shooting parameter of the camera is increased to obtain an adjusted shooting parameter, so that the camera shoots according to the adjusted shooting parameter to obtain a new first image, and step S202 is returned.
[0082] Increasing the shooting parameter of the camera includes any one of the following: increasing the exposure time of the camera, increasing the gain value of the camera, increasing the exposure time and the gain value of the camera.
[0083] In one possible implementation, increasing the shooting parameter of the camera includes: increasing the exposure time by a set step, for example, by 1 / 2 step (for example, from 1 / 60 s to 1 / 30 s), and increasing the gain value by a set step. For example, by 1 dB or 2 dB. Specifically, each time the adjustment can first keep the gain value unchanged, first adjust the exposure time, 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, start to gradually increase the gain value.
[0084] In a possible implementation, the shooting parameter of the camera is increased, including: increasing the shooting parameter of the camera according to the brightness value of the first image and a 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 about 128 (medium brightness). The ratio between the preset brightness value and the brightness value of the first image is calculated, and the shooting parameter of the camera is increased according to the ratio. In other words, the ratio between the increased shooting parameter of the camera and the current shooting parameter is the same as the ratio between the preset brightness value and the brightness value of the first image. That is, the current shooting parameter is 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 second, and the increased exposure time is 1 / 10 second. Only the gain value is increased, the current gain value is 1 dB, and the increased gain value is 6 dB. If the exposure time and the gain value are increased at the same time, the product of the increased 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 second, and the current gain value is 1 dB. Therefore, the increased exposure time is 1 / 20 second, and the increased gain value is 2 dB.
[0085] In S206, it is determined whether the brightness value of the first image is greater than the maximum value of the first preset range. If yes, S207 is performed; if no, S208 is performed.
[0086] The brightness value of the first image is compared with the maximum value of the first preset range, and it is determined 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 parameter of the camera needs to be reduced.
[0087] In S207, the shooting parameter of the camera is reduced to obtain an adjusted shooting parameter, the camera performs shooting according to the adjusted shooting parameter to obtain a new first image, and the step S202 is returned.
[0088] The shooting parameter of the camera is reduced, including any one of the following: reducing the exposure time of the camera, reducing the gain value of the camera, and reducing the exposure time and the gain value of the camera.
[0089] In a possible implementation, the shooting parameter of the camera is reduced, including: reducing the exposure time by a set step, for example, reducing from 1 / 30s to 1 / 60s; reducing the gain value by a set step, for example, increasing by 2dB or 1dB each time. Specifically, each adjustment can first keep the gain value unchanged, first adjust the exposure time, 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, start to gradually reduce the gain value.
[0090] In a possible implementation, the shooting parameter of the camera is reduced, including: reducing the shooting parameter of the camera according to the brightness value of the first image and a preset brightness value. The preset brightness value is a pre-set expected brightness value. For example, for most application scenarios, the preset brightness value can be about 128 (medium brightness). A ratio between the preset brightness value and the brightness value of the first image is calculated, and the shooting parameter of the camera is reduced according to the ratio. In other words, the ratio of the shooting parameter of the camera after reduction to the current shooting parameter is the same as the ratio between the preset brightness value and the brightness value of the first image. That is, the current shooting parameter is 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 the exposure time is increased, and the current exposure time is 1 / 10s, and the exposure time after reduction is 1 / 15s. Only the gain value is increased, and the current gain value is 3dB, and the gain value after reduction is 2dB. If the exposure time and the gain value are both increased, the product of the increased exposure time and the increased 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 / 10s, and the current gain value is 3dB, so the exposure time after reduction is 1 / 10s, and the gain value after reduction is 2dB.
[0091] S208, acquiring a second image shot by the camera.
[0092] The second image can be understood as an image shot by the camera for judging the difference between two images.
[0093] S209, judging whether the second image is the first image shot by the camera according to the adjusted shooting parameter, if yes, performing S210, and if no, performing S211.
[0094] In a possible implementation, the shooting parameter of the second image is compared with the shooting parameter of the previous image, if the shooting parameter changes, the second image is the first image shot by the camera according to the adjusted shooting parameter; if the shooting parameter does not change, the second image is the first image shot by the camera according to the adjusted shooting parameter.
[0095] In another possible implementation, a setting mark is added on the first image captured by the camera according to the adjusted shooting parameter, and if the setting mark is included in the second image, the second image is the first image captured by the camera according to the adjusted shooting parameter; if the setting mark is not included in the second image, the second image is the first image captured by the camera according to the adjusted shooting parameter.
[0096] In S210, the difference threshold is determined 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 parameter, 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, a first value is taken as the difference threshold; if the brightness value of the fourth image is not within the second preset range, a second value is taken as the difference threshold, the first value being greater than the second value.
[0099] The brightness value of the second image is calculated as L c In actual application, the brightness range of an image is generally 0-255. The brightness of an image is divided into three ranges, the brightness value of an image being less than a minimum value L1 of a second preset range, the brightness value of an image being greater than a maximum value L2 of the second preset range, and the brightness value of an image being greater than the minimum value L1 and less than the maximum value L2 of the second preset range, i.e. [0~L1, L1~L2, L2~255]. If the brightness value of the second image is greater than the minimum value L1 and less than the maximum value L2 of the second preset range, i.e. the brightness value of the second image is between L1 and L2, it indicates that the brightness of the captured image is appropriate after the shooting parameter of the camera is adjusted, and a moderate first value Th1 is selected as the difference threshold. If the brightness value of the second image is greater than the maximum value L2 of the second range or the brightness value of the second image is less than the minimum value L1 of the second preset range, i.e. the brightness value of the second image is between L2 and 255 or 0 and L1, it indicates that the brightness of the captured image is still dark or bright after the shooting parameter of the camera is adjusted, and a second value Th2 smaller than the first value is selected as the difference threshold. This makes it easier to monitor the changes of external objects or barcodes.
[0100] In S211, the difference value of the second image and a third image is calculated, the shooting parameter corresponding to the third image being the same as the shooting parameter corresponding to the second image.
[0101] When the second image is not the first image captured by the camera according to the adjusted shooting parameter, a previous frame image of the second image is taken as the third image.
[0102] The difference value of the second image and the third image is represented by a method such as a mean squared error (MSE), a peak signal-to-noise ratio (PSNR), a structural similarity index (SSIM), and the like.
[0103] In S212, if the difference value of 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.
[0104] If the difference value of the second image and the third image is greater than the difference threshold, it is indicated that the difference between the two images is large, it is determined that an object is moved in, and the decoding state is entered, the light compensation lamp is turned on, and the range of the shooting parameter of the camera is reset to the first range. d1 d2 ].
[0105] If the difference value of the second image and the third image is less than or equal to the difference threshold, it is indicated that the difference between the two images is small, it is determined that no object is moved in, otherwise, S208 and the subsequent steps are repeated until the difference value of 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. Alternatively, if the time length of the barcode reading device in the decoding state exceeds the second set time length, the step S201 is executed.
[0106] Figure 4 A structure diagram of a sensing control device for a barcode reading device in an embodiment of the present application is shown in FIG. 1. Figure 4 As shown in FIG. 1, the sensing control device 40 for the barcode reading device provided in the embodiment of the present application mainly comprises 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] The first image acquisition module 41 is configured to acquire a first image captured by a camera when detecting that the barcode reading device enters a sensing state; the first judgment module 42 is configured to determine whether a brightness value of the first image is within a first preset range; the shooting parameter adjustment module 43 is configured to, if the brightness value of the first image is not within the first preset range, adjust a shooting parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera captures a new first image according to the adjusted shooting parameter, and returns to the step of acquiring the first image captured by the camera; and the sensing state control module 44 is configured to, until the brightness value of the first image is within the first preset range, acquire a second image captured by the camera, 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 configured to perform the following processes: detecting that the barcode reading device enters a sensing state, and acquiring a first image captured by a camera; determining whether a 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 a shooting parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera captures a new first image according to the adjusted shooting parameter, and returns to the step of acquiring the first image captured by the camera; and until the brightness value of the first image is within the first preset range, acquiring 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 external ambient light to a certain extent, the shooting parameter of the camera is adjusted based on the brightness value of the image captured by the camera, so that the camera can still capture a relatively clear image in a scene with relatively dark or bright light, and the barcode reading device is still easy to sense the movement of an object into the scene with relatively dark or bright light, thereby improving the adaptability of the barcode reading device to the environment and improving the scanning code experience.
[0109] In one possible implementation, the shooting parameter adjustment module 43 is specifically configured to, if the brightness value of the first image is less than a minimum value of the first preset range, increase the shooting parameter of the camera to obtain the adjusted shooting parameter; and if the brightness value of the first image is greater than a maximum value of the first preset range, decrease the shooting parameter of the camera to obtain the adjusted shooting parameter.
[0110] In a possible implementation, the sensing state control module 44 is specifically configured to acquire a second image captured by the camera; determine whether the second image is a first image captured by the camera according to the adjusted capturing parameter; if yes, determine a difference threshold based on a brightness value of the second image; if no, calculate a difference value of the second image and a third image, the third image corresponding to the same capturing parameter as the second image; and if the difference value of 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: if the brightness value of the second image is within a second preset range, take a first value as the difference threshold; and if the brightness value of the second image is not within the second preset range, take a second value as the difference threshold, the first value being greater than the second value.
[0112] In a possible implementation, the capturing parameter adjustable range setting module is configured to: when detecting that the barcode reading device enters the sensing state, adjust a capturing parameter adjustable range of the camera from a first range to a second range 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 a capturing parameter adjustable range of the camera when the barcode reading device is in the decoding state.
[0113] In a possible implementation, the sensing state duration judgment module is further configured to: determine whether a duration of entering the sensing state exceeds a first set duration; if the first set duration is not exceeded, acquire a first image captured by the camera; and if the first set duration is exceeded, acquire a second image captured by the camera, and determine whether the barcode reading device exits the sensing state based on the second image.
[0114] In a possible implementation, detecting that the barcode reading device enters the sensing state includes one of the following: detecting that a duration of the barcode reading device being in the decoding state exceeds a second set duration, and controlling the barcode reading device to enter the sensing state; receiving a decoding success signal, and controlling the barcode reading device to enter the sensing state; and receiving the decoding success signal and then controlling the barcode reading device to enter the sensing state after a third set duration.
[0115] The sensing control apparatus for the barcode reading device provided in the embodiments of the present application can perform the sensing control method for the barcode reading device provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of performing the method.
[0116] Figure 5 is a structural schematic diagram of an electronic device provided by the embodiment. The electronic device can include a sensing control device for a bar code 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 processors 510 in the electronic device can be one or more, Figure 5 In the embodiment, the 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 through a bus or other means, Figure 5 In the embodiment, the connection through the bus is taken as an example.
[0117] The memory 520, as a computer readable storage medium, can be used to store software programs, computer executable programs, and modules, such as program instructions / modules of the sensing control method for a bar code reading device provided by the embodiment. The processor 510 executes the software programs, instructions, and modules stored in the memory 520, thereby performing various function applications and data processing of the electronic device, that is, implementing the sensing control method for a bar code reading device provided by the embodiment.
[0118] The memory 520 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application program required by a function; the data storage area can store data created according to the use of the terminal, etc. In addition, the memory 520 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state memory device. In some examples, the memory 520 can further include a memory remotely arranged relative to the processor 510, and these remote memories can be connected to the electronic device through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0119] The input device 530 can 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 can include a keyboard, a mouse, etc. The output device 540 can include a display device such as a display screen.
[0120] The embodiment further provides a storage medium containing computer executable instructions, which, when executed by a computer processor, are used to implement the sensing control method for a bar code reading device provided by the embodiment.
[0121] Of course, the storage medium provided by the embodiment of the present application includes computer executable instructions, which are not limited to the method operations described above, but can also perform the related operations in the sensing control method for the bar code reading device provided by any embodiment of the present application.
[0122] Through the above description of the embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary universal hardware, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a floppy disk, a read-only memory (ROM), a random access memory (RAM), a FLASH, a hard disk or an optical disk, etc., including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in various embodiments of the present application.
[0123] It is worth noting that in the above embodiment of the sensing control device for the bar code reading device, each unit and module included is only divided according to the functional logic, but is not limited to the above division, as long as the corresponding function can be realized; in addition, the specific name of each functional unit is only for the convenience of mutual distinction, and does not limit the protection scope of the present application.
[0124] It should be noted that in this paper, such as "first" and "second" and other relational terms 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 the entities or operations. Moreover, the term "includes", "contains" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "includes a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0125] The foregoing detailed description of the application has been presented for purposes of illustration and description. Various modifications to the description will be readily apparent to those skilled in the art, and the generic principles defined herein can be applied to other implementations without departing from the spirit or scope of the application. Accordingly, the application is not intended to be limited to the embodiments described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for inductively controlling a bar code reading device, comprising the steps of: The method comprises: detecting that the barcode reading device enters a sensing state, and obtaining a first image captured by a camera; judging 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 parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter, so that the camera shoots according to the adjusted shooting parameter to obtain 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; Before the step of detecting that the barcode reading device enters the sensing state and obtaining the first image captured by the camera, the method further comprises: when detecting that the barcode reading device enters the sensing state, adjusting the adjustable range of the shooting parameter of the camera 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 shooting parameter of the camera when the barcode reading device is in a decoding state.
2. The method of claim 1, wherein, If the brightness value of the first image is not within the first preset range, adjusting the shooting parameter of the camera according to the brightness value of the first image to obtain an adjusted shooting parameter, comprises: if the brightness value of the first image is less than the minimum value of the first preset range, increasing the shooting parameter of the camera to obtain an adjusted shooting parameter; if the brightness value of the first image is greater than the maximum value of the first preset range, decreasing the shooting parameter of the camera to obtain an adjusted shooting parameter.
3. The method of claim 1, wherein, Determining whether the barcode reading device exits the sensing state based on the second image comprises: obtaining a second image captured by the camera; judging whether the second image is the first image captured by the camera according to the adjusted shooting parameter; if yes, determining a difference threshold based on the brightness value of the second image; if no, calculating the difference value of the second image and a third image, the shooting parameter corresponding to the third image being the same as the shooting parameter corresponding to the second image; if the difference value of 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 a decoding state.
4. The method of claim 3, wherein, Determining the difference threshold based on the brightness value of the second image comprises: if the brightness value of the second image is within a second preset range, taking a first value as the difference threshold; if the brightness value of the second image is not within the second preset range, taking a second value as the difference threshold, the first value being greater than the second value.
5. The method of claim 1, wherein, Further comprising: judging whether the duration that the barcode reading device enters the sensing state exceeds a first set duration; if the first set duration is not exceeded, obtaining a first image captured by a camera; if the first set duration is exceeded, obtaining a second image captured by a camera, and determining whether the barcode reading device exits the sensing state based on the second image.
6. The method of claim 1, wherein, detecting that the barcode reading device enters a sensing state, including one of: detecting that the barcode reading device is in a decoding state for more than a second set time length, controlling the barcode reading device to enter the sensing state; receiving a decoding success signal, controlling the barcode reading device to enter the sensing state; receiving the decoding success signal and then waiting for a third set time length, controlling the barcode reading device to enter the sensing state.
7. A sensing control device for a bar code reading apparatus, characterized by comprising: The device includes: a first image acquisition module for detecting that the barcode reading device enters a sensing state, acquiring a first image captured by a camera; a first judgment module for judging whether a brightness value of the first image is within a first preset range; a shooting parameter adjustment module for adjusting 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, obtaining adjusted shooting parameters, so that the camera captures a new first image according to the adjusted shooting parameters, and returning to the step of acquiring the first image captured by the camera; a sensing state control module for acquiring a second image captured by the camera until the brightness value of the first image is within the first preset range, and determining whether the barcode reading device exits the sensing state based on the second image; Before the detecting that the barcode reading device enters a sensing state, acquiring a first image captured by a camera, the method further includes: adjusting a range of adjustable shooting parameters of the camera from a first range to a second range when detecting that the barcode reading device enters the sensing state; wherein the first range is a subset of the second range, and the first range is a range of adjustable shooting parameters of the camera when the barcode reading device is in a decoding state.
8. An electronic device, comprising: 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 the one or more processors, the one or more processors implement the sensing control method for the barcode reading device as claimed in any one of claims 1-6.
9. A storage medium having stored thereon a computer program, characterized in that The program is executed by the processor to implement the sensing control method for the barcode reading device as claimed in any one of claims 1-6.
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