Disclosure of Invention
The invention aims to provide an imaging exposure control method, an imaging exposure control device, a computer readable storage medium and a computer readable storage system.
In order to solve the above technical problem, the present invention provides an imaging exposure control method, which is suitable for a barcode scanner, and comprises:
step S1, initializing the CMOS;
step S2, acquiring an image;
step S3, calculating an exposure parameter a based on the currently acquired image;
step S4, configuring the CMOS according to the exposure parameter a, and acquiring an image;
step S5, decoding the currently acquired image;
step S6, if the decoding is successful, executing step S3;
step S7, judging whether overtime exists, if not, executing step S3;
step S8, configuring the CMOS with a fixed exposure parameter b, and acquiring an image;
step S9, decoding the currently acquired image;
step S10, if the decoding is successful, executing step S8;
in step S11, it is determined whether the time-out is exceeded, and if not, step S8 is executed, and if yes, the process returns to step S3.
According to one embodiment of the present invention, the exposure parameter a is calculated as follows:
wherein a' is a value set last time by the exposure parameter a, t is target brightness, r is image reduction scale, i and j are abscissa and ordinate, and m and n are width and height after image reduction.
According to an embodiment of the present invention, in step S7, it is determined whether the time length from the previous decoding success exceeds N1 seconds, and if not, step S3 is executed.
According to an embodiment of the present invention, in step S11, it is determined whether the time length from the previous successful decoding exceeds N2 seconds, if not, step S8 is executed, and if it exceeds N2 seconds, step S3 is returned to.
According to one embodiment of the present invention, N1 ═ N2.
According to one embodiment of the invention, the exposure parameter b is determined according to the model of the CMOS and the representation of the screen bar code under different exposure parameters.
According to an embodiment of the present invention, the value of the exposure parameter b is smaller than the value of the exposure parameter a.
According to an embodiment of the present invention, in step S1, the corresponding configuration table is initialized according to the model of the CMOS, and the auto exposure mode in the CMOS configuration table is turned off.
The invention also provides an imaging exposure control device, which is suitable for the imaging exposure control method and comprises,
a CMOS module;
an image acquisition module adapted to acquire an image;
the exposure parameter module is suitable for acquiring exposure parameters so as to configure the CMOS module;
the image decoding module is suitable for decoding the currently acquired image;
the comparison module is suitable for judging whether the decoding is successful or not;
and the timeout module is suitable for judging whether timeout exists or not.
The invention also provides a computer readable storage medium, on which computer instructions are stored, which when executed perform the steps of the imaging exposure control method according to any one of the preceding claims.
The invention also provides an imaging exposure control system, which comprises a memory and a processor, wherein the memory is stored with computer instructions capable of running on the processor, and the imaging exposure control system is characterized in that the processor executes the computer instructions to execute the steps of any one of the imaging exposure control methods.
The invention collects the image by controlling the exposure of the CMOS to be switched between two modes, one mode is automatic exposure which maintains the brightness of the image at a certain degree, the other mode is automatic exposure which locks the exposure time at a fixed value, the two modes are carried out alternately without mutual influence, thereby obtaining effective bar code information.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways than those specifically described herein, and thus the present invention is not limited to the specific embodiments disclosed below.
As used in this application and the appended claims, the terms "a," "an," "the," and/or "the" are not intended to be inclusive in the singular, but rather are intended to be inclusive in the plural unless the context clearly dictates otherwise. In general, the terms "comprises" and "comprising" merely indicate that steps and elements are included which are explicitly identified, that the steps and elements do not form an exclusive list, and that a method or apparatus may include other steps or elements.
In describing the embodiments of the present application in detail, the cross-sectional views illustrating the structure of the device are not enlarged partially in a general scale for convenience of illustration, and the schematic drawings are only examples, which should not limit the scope of the present application. In addition, the three-dimensional dimensions of length, width and depth should be included in the actual fabrication.
For convenience in description, spatial relational terms such as "below," "beneath," "below," "under," "over," "upper," and the like may be used herein to describe one element or feature's relationship to another element or feature as illustrated in the figures. It will be understood that these terms of spatial relationship are intended to encompass other orientations of the device in use or operation in addition to the orientation depicted in the figures. For example, if the device in the figures is turned over, elements described as "below" or "beneath" other elements or features would then be oriented "above" the other elements or features. Thus, the exemplary words "below" and "beneath" can encompass both an orientation of up and down. The device may have other orientations (rotated 90 degrees or at other orientations) and the spatial relationship descriptors used herein should be interpreted accordingly. Further, it will also be understood that when a layer is referred to as being "between" two layers, it can be the only layer between the two layers, or one or more intervening layers may also be present.
In the context of this application, a structure described as having a first feature "on" a second feature may include embodiments in which the first and second features are formed in direct contact, and may also include embodiments in which additional features are formed in between the first and second features, such that the first and second features may not be in direct contact.
Fig. 1 is a flowchart of an imaging exposure control method according to an embodiment of the present invention. The exposure control is a process of accurately exposing a target screen by reasonably configuring parameters such as an aperture, a shutter, and ISO based on a camera light measurement result. The imaging exposure control method suitable for the bar code scanner, provided by the invention, configures the CMOS through the exposure parameters, thereby controlling the exposure intensity of the CMOS and acquiring a target image containing a clear bar code, and further reading the bar code.
The invention provides an imaging exposure control method, which comprises the following steps:
in step S1, the CMOS is initialized. CMOS (Complementary Metal-Oxide-Semiconductor) is a Complementary Metal-Oxide-Semiconductor, mainly made of two elements, i.e. silicon and germanium, so that N (charged-charged) and P (charged + charged) semiconductors coexist on the CMOS, and the most basic data of bar code scanner system guidance is stored.
In step S2, an image is obtained, and the obtained image generally contains a barcode. Here the first frame image acquired after the CMOS initialization configuration table is validated.
In step S3, an exposure parameter a is calculated based on the currently acquired image. I.e. the exposure parameter a may be calculated from the brightness and size dimensions of the currently acquired image.
In step S4, the CMOS is configured according to the exposure parameter a, so as to control the exposure intensity of the CMOS and acquire an image.
Step S5, decoding the currently acquired image to acquire useful barcode information, and completing barcode reading.
In step S6, if the decoding is successful and useful barcode information can be acquired, step S3 is performed.
In step S7, it is determined whether the time-out is exceeded, and if not, step S3 is executed. If the decoding fails and the time is out, the next step is proceeded.
Step S8, configuring the CMOS with a fixed exposure parameter b, controlling the exposure intensity of the CMOS, and acquiring an image.
Step S9, decoding the currently acquired image to acquire useful barcode information, and completing barcode reading.
In step S10, if the decoding is successful and useful barcode information can be acquired, step S8 is performed.
In step S11, it is determined whether the time-out is exceeded, and if not, step S8 is executed. If the decoding fails and the time is out, the process returns to step S3 to switch the exposure parameters.
It should be noted that the scene scanned by the barcode scanner usually includes a paper barcode and a screen barcode. The steps S3 to S7 can be understood as controlling the exposure intensity of the CMOS according to the brightness of the real-time scene, which is relatively suitable for scanning the paper barcode. Generally, the target brightness is increased to enable the imaging of the paper bar code to be clearer and the brightness to be higher, the exposure parameter a is calculated through the currently acquired image, the exposure convergence speed is higher when the paper bar code is identified, and an ideal paper bar code image can be acquired more quickly. After the decoding is successful, because the scene is not changed too much in a short time, the exposure method is kept when the decoding is successful, and the efficiency of acquiring an ideal image is further improved. If the decoding is not successful and a timeout condition occurs, a screen barcode scene may be entered, and the exposure mode needs to be switched.
Steps S8 to S11 may be understood as being applicable to a scene of a scan screen barcode. When scanning the screen bar code, because screen itself can give out light, when the screen bar code is a little away from the camera, the condition that overexposure will appear when the screen bar code also can appear in the quick access visual angle from the camera visual angle, consequently chooses for use a fixed exposure parameter b, can acquire rational screen bar code image fast when making discernment screen bar code. After the decoding is successful, because the scene is not changed too much in a short time, the exposure method when the decoding is successful is maintained. If the decoding is not successful and the timeout condition occurs, and the paper barcode scene is possibly entered, the exposure mode needs to be switched, and the process returns to the steps S3 to S7.
The imaging exposure control method provided by the invention mainly comprises the steps of switching back and forth in the scenes of paper bar codes and screen bar codes, and controlling the exposure intensity of a CMOS (complementary metal oxide semiconductor) by obtaining the continuously updated exposure parameter a and the fixed exposure parameter b, so that a more ideal usable bar code image is obtained, and the efficiency of acquiring an ideal image is improved. When decoding fails and overtime happens, switching is carried out under two scenes, and by using the method, no matter whether the mobile phone screen bar code is fast moving or the paper bar code with low brightness, an ideal available bar code image can be acquired through fast switching of the scenes.
Preferably, the exposure parameter a in step S3 is calculated as follows:
when the exposure parameter a is calculated, all pixel points of the acquired image do not need to be calculated, and the image reduced image is calculated. Wherein a' is a value set last time by the exposure parameter a, t is target brightness, r is image reduction scale, i and j are abscissa and ordinate, and m and n are width and height after image reduction. The function f (x, y) represents a pixel point with coordinates (x, y) in the image, and because the value of the exposure parameter a is too large or too small, the value of the exposure parameter a can be limited in a reasonable interval by the calculation method.
Preferably, in step S7, it is determined whether the time length from the previous decoding success exceeds N1 seconds, and if not, step S3 is executed. N1 seconds here can be understood as the time duration from the last successful decoding. And once the time is out, switching the exposure method, and selecting a fixed exposure parameter b to configure the CMOS. By using the mode, when the paper bar code with darker brightness is converted into the mobile phone screen bar code which moves rapidly, the bar code scanner can rapidly acquire an ideal useful image.
Preferably, in step S11, it is determined whether the time length from the previous decoding success exceeds N2 seconds, and if not, step S8 is executed to continue configuring the CMOS with the exposure parameter b. N2 seconds here can be understood as the time duration from the last successful decoding. And once the time is out, switching the exposure method, and acquiring an exposure parameter a to configure the CMOS. By using the mode, when the mobile phone screen bar code which moves rapidly is converted into the paper bar code with darker brightness, the bar code scanner can rapidly acquire an ideal useful image.
By way of example and not limitation, the time length N1 seconds in step S7 and the time length N2 seconds in step S11 may be chosen according to actual needs. Preferably, N1 ═ N2. When N1, N2 take reasonable value, adopt the imaging exposure control method that the invention provides to wait for 1 frame of picture at most and can switch over the exposure parameter thus obtain the ideal useful bar code image.
Therefore, by adopting the imaging exposure control method, whether the mobile phone screen bar code is fast moving or the paper bar code with low brightness, the ideal useful image can be rapidly acquired by rapidly switching scenes and selecting different exposure parameters, so that the bar code reading efficiency is improved.
Preferably, in step S8, the exposure parameter b is determined according to the model of the CMOS in combination with the screen barcode under different exposure parameters. The exposure parameter b is a fixed value and is not changed after being determined. More preferably, the value of the exposure parameter b is smaller than the value of the exposure parameter a. It is easy to understand that because the brightness of the screen bar code is high and the brightness of the paper bar code is low, the exposure parameter b corresponding to the screen bar code and the paper bar code is less than the exposure parameter a.
Preferably, in step S1, the corresponding configuration table is initialized according to the model of the CMOS, and the auto exposure mode in the CMOS configuration table is turned off. In the subsequent steps, either the exposure parameter a or the exposure parameter b is selected.
It should be noted that some types of CMOS are not active immediately after configuring the parameters, but may be active every other frame, i.e. a new exposure parameter is started after capturing the next frame of image. If the next frame image is ignored, no substantial effect is exerted on the method.
The imaging exposure method in the above embodiment is to acquire the exposure parameter a as a first choice, and then switch between two scenes, namely, the screen barcode and the paper barcode, that is, switch between the exposure parameter b and the exposure parameter a. It is easy to understand that the exposure parameter b may be obtained as a first choice, and then the two scenes, namely the paper barcode and the screen barcode, may be switched, and the two methods are substantially the same. The specific imaging exposure method is as follows:
step V1, initializing CMOS;
step V2, configuring the CMOS with a fixed exposure parameter b, and acquiring an image;
step V3, decoding the currently acquired image; if the decoding is successful, executing step V2;
step V4, judging whether the time is overtime, if not, executing step V2;
step V5, calculating an exposure parameter a based on the currently acquired image;
step V6, configuring the CMOS according to the exposure parameter a, and acquiring an image;
step V7, decoding the current acquired image, if the decoding is successful, executing step V5;
and step V8, judging whether the time is out, if not, executing step V5, and if so, returning to step V2.
Fig. 2 is a schematic structural diagram of an imaging exposure control apparatus according to an embodiment of the present invention. As shown in the figure, an imaging exposure control device, which is suitable for the imaging exposure control method, comprises,
theCMOS module 210.
Anacquire image module 220 adapted to acquire an image. For performing the acquire image action in steps S2, S4, and S8.
Theexposure parameter module 230 is adapted to obtain an exposure parameter a or an exposure parameter b to configure the CMOS module.
And theimage decoding module 240 is adapted to decode the currently acquired image to acquire the barcode information.
A comparingmodule 250 adapted to determine whether the decoding was successful.
Atimeout module 260 adapted to determine if a timeout exists.
The present invention further provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transitory storage medium, and on which computer instructions are stored, and when the computer instructions are executed, the steps corresponding to any of the above-mentioned imaging exposure control methods are executed, which is not described herein again.
The invention also provides an imaging exposure control system, which comprises a memory and a processor, wherein the memory is stored with computer instructions capable of running on the processor, and the processor executes any one of the steps of the imaging exposure control method when running the computer instructions.
This application uses specific words to describe embodiments of the application. Reference throughout this specification to "one embodiment," "an embodiment," and/or "some embodiments" means that a particular feature, structure, or characteristic described in connection with at least one embodiment of the present application is included in at least one embodiment of the present application. Therefore, it is emphasized and should be appreciated that two or more references to "an embodiment" or "one embodiment" or "an alternative embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, some features, structures, or characteristics of one or more embodiments of the present application may be combined as appropriate.
Aspects of the imaging exposure control methods of the present invention may be performed entirely by hardware, entirely by software (including firmware, resident software, micro-code, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data block," module, "" engine, "" unit, "" component, "or" system. The processor may be one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), digital signal processing devices (DAPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or a combination thereof. Furthermore, aspects of the present application may be represented as a computer product, including computer readable program code, embodied in one or more computer readable media. For example, computer-readable media may include, but are not limited to, magnetic storage devices (e.g., hard disk, floppy disk, magnetic strips … …), optical disks (e.g., Compact Disk (CD), Digital Versatile Disk (DVD) … …), smart cards, and flash memory devices (e.g., card, stick, key drive … …).
The computer readable medium may comprise a propagated data signal with the computer program code embodied therein, for example, on a baseband or as part of a carrier wave. The propagated signal may take any of a variety of forms, including electromagnetic, optical, and the like, or any suitable combination. The computer readable medium can be any computer readable medium that can communicate, propagate, or transport the program for use by or in connection with an instruction execution system, apparatus, or device. Program code on a computer readable medium may be propagated over any suitable medium, including radio, electrical cable, fiber optic cable, radio frequency signals, or the like, or any combination of the preceding.
Additionally, the order in which elements and sequences of the processes described herein are processed, the use of alphanumeric characters, or the use of other designations, is not intended to limit the order of the processes and methods described herein, unless explicitly claimed. While various presently contemplated embodiments of the invention have been discussed in the foregoing disclosure by way of example, it is to be understood that such detail is solely for that purpose and that the appended claims are not limited to the disclosed embodiments, but, on the contrary, are intended to cover all modifications and equivalent arrangements that are within the spirit and scope of the embodiments herein. For example, although the system components described above may be implemented by hardware devices, they may also be implemented by software-only solutions, such as installing the described system on an existing server or mobile device.
Similarly, it should be noted that in the preceding description of embodiments of the application, various features are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure aiding in the understanding of one or more of the embodiments. This method of disclosure, however, is not intended to require more features than are expressly recited in the claims. Indeed, the embodiments may be characterized as having less than all of the features of a single embodiment disclosed above.
Numerals describing the number of components, attributes, etc. are used in some embodiments, it being understood that such numerals used in the description of the embodiments are modified in some instances by the use of the modifier "about", "approximately" or "substantially". Unless otherwise indicated, "about", "approximately" or "substantially" indicates that the number allows a variation of ± 20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximations that may vary depending upon the desired properties of the individual embodiments. In some embodiments, the numerical parameter should take into account the specified significant digits and employ a general digit preserving approach. Notwithstanding that the numerical ranges and parameters setting forth the broad scope of the range are approximations, in the specific examples, such numerical values are set forth as precisely as possible within the scope of the application.
Although the present invention has been described with reference to the present specific embodiments, it will be appreciated by those skilled in the art that the above embodiments are merely illustrative of the present invention, and various equivalent changes and substitutions may be made without departing from the spirit of the invention, and therefore, it is intended that all changes and modifications to the above embodiments within the spirit and scope of the present invention be covered by the appended claims.