Invention content
The purpose of the embodiment of the present invention is to provide a kind of method, apparatus and storage medium adjusting LED light supplement lamp plate brightness,
The automatic adjustment of LED light supplement lamp plate light filling intensity may be implemented.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of method adjusting LED light supplement lamp plate brightness, packet
It includes:
Gray processing processing is carried out to the image of acquisition, obtains the gray value of each pixel in described image;
According to preset threshold value, binary conversion treatment is carried out to the target area of described image, by the target area
Each pixel in domain is classified as first kind pixel or the second class pixel;
It calculates corresponding first average value of all first kind pixels and all second class pixels corresponds to
The second average value;
According to first average value and second average value, the number that LED light supplement lamp onboard led lamp is lighted is adjusted.
Optionally, described according to first average value and second average value, adjust LED light supplement lamp onboard led lamp
The number lighted includes:
Judge whether first average value is less than first threshold;
If so, according to the number that the first rule adjustment LED light supplement lamp onboard led lamp is lighted, mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
If it is not, then judging whether second average value is more than second threshold;
When second average value is more than the second threshold, then LED light supplement lamp onboard led is adjusted according to Second Rule
The number that lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
When second average value is less than or equal to the second threshold, end operation.
Optionally, described according to first average value and second average value, adjust LED light supplement lamp onboard led lamp
The number lighted includes:
According to preset rules, the target ratio of first average value and second average value is calculated;
Judge whether the target ratio is less than third threshold value;
If so, according to the number that the first rule adjustment LED light supplement lamp onboard led lamp is lighted, mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
If it is not, then judging whether the target ratio is more than the 4th threshold value;
When second average value is more than four threshold value, then LED light supplement lamp onboard led is adjusted according to Second Rule
The number that lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
When the target ratio is less than or equal to four threshold value, end operation.
Optionally, described according to first average value and second average value, adjust LED light supplement lamp onboard led lamp
The number lighted includes:
According to preset rules, the target difference of first average value and second average value is calculated;
Judge whether the target ratio is less than the 5th threshold value;
If so, according to the number that the first rule adjustment LED light supplement lamp onboard led lamp is lighted, mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
If it is not, then judging whether the target ratio is more than the 6th threshold value;
When second average value is more than six threshold value, then LED light supplement lamp onboard led is adjusted according to Second Rule
The number that lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
When the target ratio is less than or equal to six threshold value, end operation.
The embodiment of the present invention additionally provides a kind of device adjusting LED light supplement lamp plate brightness, including acquiring unit, processing list
Member, computing unit and adjustment unit;
The acquiring unit carries out gray processing processing for the image to acquisition, obtains each pixel in described image
Gray value;
The processing unit, for according to preset threshold value, being carried out at binaryzation to the target area of described image
Reason, is classified as first kind pixel or the second class pixel by each pixel in the target area;
The computing unit, for calculating corresponding first average value of all first kind pixels and all described
Corresponding second average value of second class pixel;
The adjustment unit, for according to first average value and second average value, adjusting on LED light supplement lamp plate
The number that LED light is lighted.
Optionally, the adjustment unit include the first judgment sub-unit, the first adjustment subelement, the second judgment sub-unit and
Second adjustment subelement;
First judgment sub-unit, for judging whether first average value is less than first threshold;
If so, the first adjustment subelement is triggered, the first adjustment subelement, for according to the first rule adjustment
The number that LED light supplement lamp onboard led lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
If it is not, second judgment sub-unit is then triggered, second judgment sub-unit, for judging that described second is average
Whether value is more than second threshold;
When second average value is more than the second threshold, then the second adjustment subelement is triggered, described second
Subelement is adjusted, the number for being lighted according to Second Rule adjustment LED light supplement lamp onboard led lamp is mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
When second average value is less than or equal to the second threshold, end operation.
Optionally, the adjustment unit includes computation subunit, the first judgment sub-unit, the first adjustment subelement, second
Judgment sub-unit and second adjustment subelement;
The computation subunit, for according to preset rules, calculating first average value and second average value
Target ratio;
First judgment sub-unit, for judging whether the target ratio is less than third threshold value;
If so, the first adjustment subelement is triggered, the first adjustment subelement, for according to the first rule adjustment
The number that LED light supplement lamp onboard led lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
If it is not, second judgment sub-unit is then triggered, second judgment sub-unit, for judging the target ratio
Whether the 4th threshold value is more than;
When second average value is more than four threshold value, then the second adjustment subelement is triggered, described second
Subelement is adjusted, the number for being lighted according to Second Rule adjustment LED light supplement lamp onboard led lamp is mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
When the target ratio is less than or equal to four threshold value, end operation.
Optionally, the adjustment unit includes computation subunit, the first judgment sub-unit, the first adjustment subelement, second
Judgment sub-unit and second adjustment subelement;
The computation subunit, for according to preset rules, calculating first average value and second average value
Target difference;
First judgment sub-unit, for judging whether the target ratio is less than the 5th threshold value;
If so, the first adjustment subelement is triggered, the first adjustment subelement, for according to the first rule adjustment
The number that LED light supplement lamp onboard led lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
If it is not, second judgment sub-unit is then triggered, second judgment sub-unit, for judging the target ratio
Whether the 6th threshold value is more than;
When second average value is more than six threshold value, then the second adjustment subelement is triggered, described second
Subelement is adjusted, the number for being lighted according to Second Rule adjustment LED light supplement lamp onboard led lamp is mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
When the target ratio is less than or equal to six threshold value, end operation.
The embodiment of the present invention additionally provides a kind of device adjusting LED light supplement lamp plate brightness, including:
Memory, for storing computer program;
Processor, for executing the computer program to realize such as the method for above-mentioned adjusting LED light supplement lamp plate brightness
Step.
The embodiment of the present invention additionally provides a kind of computer readable storage medium, is deposited on the computer readable storage medium
Computer program is contained, the side such as above-mentioned adjusting LED light supplement lamp plate brightness is realized when the computer program is executed by processor
The step of method.
Image capture device carries out gray processing processing to the image of acquisition it can be seen from above-mentioned technical proposal, obtains institute
State the gray value of each pixel in image;According to preset threshold value, binaryzation is carried out to the target area of described image
Processing, is classified as first kind pixel or the second class pixel by each pixel in the target area;It calculates all
The corresponding first object value of first kind pixel and corresponding second desired value of all second class pixels;First
The value size of desired value and the second desired value reflects the brightness case of image, according to the first object value and described second
Desired value, the number that adjustment LED light supplement lamp onboard led lamp is lighted, to realize the automatic tune to LED light supplement lamp plate light filling intensity
Section, so that it is guaranteed that taking the image of brightness qualification.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole embodiments.Based on this
Embodiment in invention, without making creative work, what is obtained is every other by those of ordinary skill in the art
Embodiment belongs to the scope of the present invention.
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description
The present invention is described in further detail.
Next, the method that a kind of adjusting LED light supplement lamp plate brightness that the embodiment of the present invention is provided is discussed in detail.Fig. 1
For a kind of flow chart for the method adjusting LED light supplement lamp plate brightness provided in an embodiment of the present invention, this method includes:
S101:Gray processing processing is carried out to the image of acquisition, obtains the gray value of each pixel in described image.
The processing that gray processing is carried out to image, can will influence little color information and remove, can not only reduce storage
Space can also increase decoded speed.
The gray value of image after gray processing, pure white point is 255, and the gray value of black point is 0.
S102:According to preset threshold value, binary conversion treatment is carried out to the target area of described image, by the mesh
Each pixel in mark region is classified as first kind pixel or the second class pixel.
Target area refers to the effective coverage that Luminance Analysis is carried out to image.By taking the image in 2 D code of acquisition as an example, target
Region refers to the region where two-dimension code pattern.In the concrete realization, the area where Quick Response Code can be intercepted out from image
Domain carries out binary conversion treatment to the pixel in the region.
By binary conversion treatment, all pixels point in target area can be divided into two classes, i.e. first kind pixel
With the second class pixel.
First kind pixel can be the pixel that gray value is more than threshold value, correspondingly, the second class pixel can be ash
Angle value is less than or equal to the pixel of threshold value.For the ease of subsequently introducing, the pixel of threshold value is more than for first with gray value
Class pixel, the pixel that gray value is less than or equal to threshold value are expansion explanation for the second class pixel.
Wherein, the size of threshold value can be set according to actual demand, for example, 128 can be set the threshold to.
S103:Calculate corresponding first average value of all first kind pixels and all second class pixels
Corresponding second average value.
In S102, the pixel in target area can be divided into two types, it in embodiments of the present invention, can be with
By the way of being averaged, this corresponding desired value of two classes pixel is calculated, first kind pixel will be also belonged to
Each pixel gray value adduction be averaging, obtained average value is first object value;The second class pixel will be belonged to
Each pixel gray value adduction be averaging, obtained average value is the second desired value.
S104:According to first average value and second average value, adjustment LED light supplement lamp onboard led lamp is lighted
Number.
The value size of first object value and the second desired value reflects the brightness case of image.Accurately judge image
Bright dark degree, namely it is partially bright or partially dark to be accurately judged to brightness of image, is that adjustment LED light supplement lamp onboard led lamp is lighted
Number key.
For the bright dark degree of image judgment mode there are many, in embodiments of the present invention, by taking three kinds of judgment modes as an example
Expansion is introduced.
The first judgment mode can be directed to first object value and the second desired value and set corresponding two threshold values, and first
Desired value and first threshold are corresponding, and the second desired value and second threshold are corresponding.
Specifically, may determine that whether first average value is less than first threshold.When first object value is less than the first threshold
When value, then illustrate that the image of acquisition is partially dark, that can be lighted at this time according to the first rule adjustment LED light supplement lamp onboard led lamp
Number re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment.
When first object value is greater than or equal to first threshold, then further judge whether second average value is more than the
Two threshold values.When second desired value is more than the second threshold, then illustrate that the image of acquisition is partially bright, it at this time can be according to the
The number that two rule adjustment LED light supplement lamp onboard led lamps are lighted re-starts image according to the LED light supplement lamp plate after adjustment
Acquisition.When second desired value is less than or equal to the second threshold, then illustrate that the bright dark degree of image has conformed to
It asks, it at this time can be with end operation.
Second of judgment mode, can be by the ratio of calculating first object value and the second desired value, by the target ratio
It is compared with the respective threshold of setting, judges the bright dark degree of image.
Specifically, the target ratio of first average value and second average value can be calculated according to preset rules.
The preset rules contain the specific rules for calculating target ratio.In embodiments of the present invention, target ratio is calculated
Mode can there are many, by taking two kinds of calculations as an example, the first calculation can be directly by first object value divided by
The numerical value that two targets are worth to is as target ratio.Second of calculation can first calculate the square value and of first object value
The square value of two desired values, using the square value of first object value divided by square numerical value being worth to of the second desired value as target
Ratio.It should be noted that the calculation of target ratio is different, the value of its corresponding threshold value would also vary from.
Judge whether the target ratio is less than third threshold value;When target ratio is less than third threshold value, then illustrate to acquire
Image it is partially dark, the number that can be lighted at this time according to the first rule adjustment LED light supplement lamp onboard led lamp, according to adjustment after
LED light supplement lamp plate re-starts the acquisition of image.
When target ratio is greater than or equal to third threshold value, then further judge whether the target ratio is more than the 4th threshold
Value.
When second average value is more than four threshold value, then illustrate that the image of acquisition is partially bright, it at this time can be according to
The number that Second Rule adjustment LED light supplement lamp onboard led lamp is lighted, image is re-started according to the LED light supplement lamp plate after adjustment
Acquisition.When the target ratio is less than or equal to four threshold value, then illustrate that the bright dark degree of image has conformed to
It asks, it at this time can be with end operation.
The third judgment mode by the difference and can be set by the difference of calculating first object value and the second desired value
Fixed respective threshold is compared, and judges the bright dark degree of image.
Specifically, the target difference of first average value and second average value can be calculated according to preset rules.
The preset rules contain the specific rules for calculating target difference.In embodiments of the present invention, target difference is calculated
Mode can there are many, by taking two kinds of calculations as an example, first object value directly can be subtracted by the first calculation
The numerical value that two targets are worth to is as target ratio.Second of calculation can first calculate the square value and of first object value
The square value of first object value is subtracted square numerical value being worth to of the second desired value as target by the square value of two desired values
Ratio.It should be noted that the calculation of target difference is different, the value of its corresponding threshold value would also vary from.
Judge whether the target ratio is less than the 5th threshold value;When target ratio is less than five threshold values, then illustrate to acquire
Image it is partially dark, the number that can be lighted at this time according to the first rule adjustment LED light supplement lamp onboard led lamp, according to adjustment after
LED light supplement lamp plate re-starts the acquisition of image.
When target ratio is greater than or equal to five threshold values, then further judge whether the target ratio is more than the 6th threshold
Value;When second average value is more than six threshold value, then illustrate that the image of acquisition is partially bright, it at this time can be according to the second rule
The number that LED light supplement lamp onboard led lamp is lighted then is adjusted, the acquisition of image is re-started according to the LED light supplement lamp plate after adjustment;
When the target ratio is less than or equal to six threshold value, then illustrate that the bright dark degree of image has met the requirements, at this time
It can be with end operation.
Include multigroup LED light on LED light supplement lamp plate, it can be according to actual conditions, to the institute for including on LED light supplement lamp plate
There is LED light to be grouped.The number of every group of LED light can there are one or it is multiple.
First rule contain be directed to image it is partially dark when LED light supplement lamp plate light filling intensity specific method of adjustment.Work as figure
When picture is partially dark, the number that LED light supplement lamp onboard led lamp is lighted can be increased, namely light on the original basis one or more groups of
LED light, to promote the brightness of Image Acquisition.
Second Rule contain be directed to image it is partially bright when LED light supplement lamp plate light filling intensity specific method of adjustment.Work as figure
When picture is partially bright, it is possible to reduce the number that LED light supplement lamp onboard led lamp is lighted, namely extinguish on the original basis one or more groups of
LED light, to reduce the brightness of Image Acquisition.
After completing the adjustment for the number that a LED light supplement lamp onboard led lamp is lighted, need to mend according to the LED after adjusting
Light lamp plate, judges whether the acquisition brightness of image reaches requirement, so, after adjusting LED light supplement lamp plate light filling intensity, need according to
The acquisition of image is re-started according to the LED light supplement lamp plate after adjustment.
In view of aging, the brightness decay of LED light are progressive processes, under normal circumstances when the brightness of image of acquisition is partially dark
When, it need to only increase a group by a group, can first increase by one group of LED light, namely light one group of LED light again on the original basis, then
Image is resurveyed, judges whether brightness of image meets the requirements.
Correspondingly, when the brightness of image of acquisition is partially bright, adopting for image can also be reduced in the way of reduction a group by a group
Collect brightness, can first reduce by one group of LED light, namely extinguish one group of LED light on the original basis, then resurvey image, sentence
Whether disconnected brightness of image meets the requirements.By repeating above-mentioned steps, to realize to the continuous of LED light supplement lamp plate light filling intensity
Adjustment, so that it is guaranteed that the image of brightness qualification can be taken.
Image capture device carries out gray processing processing to the image of acquisition it can be seen from above-mentioned technical proposal, obtains institute
State the gray value of each pixel in image;According to preset threshold value, binaryzation is carried out to the target area of described image
Processing, is classified as first kind pixel or the second class pixel by each pixel in the target area;It calculates all
The corresponding first object value of first kind pixel and corresponding second desired value of all second class pixels;First
The value size of desired value and the second desired value reflects the brightness case of image, according to the first object value and described second
Desired value, the number that adjustment LED light supplement lamp onboard led lamp is lighted, to realize the automatic tune to LED light supplement lamp plate light filling intensity
Section, so that it is guaranteed that taking the image of brightness qualification.
Fig. 2 is a kind of structural schematic diagram of device adjusting LED light supplement lamp plate brightness provided in an embodiment of the present invention, including
Acquiring unit 21, processing unit 22, computing unit 23 and adjustment unit 24;
The acquiring unit 21 carries out gray processing processing for the image to acquisition, obtains each pixel in described image
The gray value of point;
The processing unit 22, for according to preset threshold value, binaryzation to be carried out to the target area of described image
Processing, is classified as first kind pixel or the second class pixel by each pixel in the target area;
The computing unit 23, for calculating corresponding first average value of all first kind pixels and all institutes
State corresponding second average value of the second class pixel;
The adjustment unit 24, for according to first average value and second average value, adjusting LED light supplement lamp plate
The number that upper LED light is lighted.
Optionally, the adjustment unit include the first judgment sub-unit, the first adjustment subelement, the second judgment sub-unit and
Second adjustment subelement;
First judgment sub-unit, for judging whether first average value is less than first threshold;
If so, the first adjustment subelement is triggered, the first adjustment subelement, for according to the first rule adjustment
The number that LED light supplement lamp onboard led lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
If it is not, second judgment sub-unit is then triggered, second judgment sub-unit, for judging that described second is average
Whether value is more than second threshold;
When second average value is more than the second threshold, then the second adjustment subelement is triggered, described second
Subelement is adjusted, the number for being lighted according to Second Rule adjustment LED light supplement lamp onboard led lamp is mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
When second average value is less than or equal to the second threshold, end operation.
Optionally, the adjustment unit includes computation subunit, the first judgment sub-unit, the first adjustment subelement, second
Judgment sub-unit and second adjustment subelement;
The computation subunit, for according to preset rules, calculating first average value and second average value
Target ratio;
First judgment sub-unit, for judging whether the target ratio is less than third threshold value;
If so, the first adjustment subelement is triggered, the first adjustment subelement, for according to the first rule adjustment
The number that LED light supplement lamp onboard led lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
If it is not, second judgment sub-unit is then triggered, second judgment sub-unit, for judging the target ratio
Whether the 4th threshold value is more than;
When second average value is more than four threshold value, then the second adjustment subelement is triggered, described second
Subelement is adjusted, the number for being lighted according to Second Rule adjustment LED light supplement lamp onboard led lamp is mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
When the target ratio is less than or equal to four threshold value, end operation.
Optionally, the adjustment unit includes computation subunit, the first judgment sub-unit, the first adjustment subelement, second
Judgment sub-unit and second adjustment subelement;
The computation subunit, for according to preset rules, calculating first average value and second average value
Target difference;
First judgment sub-unit, for judging whether the target ratio is less than the 5th threshold value;
If so, the first adjustment subelement is triggered, the first adjustment subelement, for according to the first rule adjustment
The number that LED light supplement lamp onboard led lamp is lighted re-starts the acquisition of image according to the LED light supplement lamp plate after adjustment;
If it is not, second judgment sub-unit is then triggered, second judgment sub-unit, for judging the target ratio
Whether the 6th threshold value is more than;
When second average value is more than six threshold value, then the second adjustment subelement is triggered, described second
Subelement is adjusted, the number for being lighted according to Second Rule adjustment LED light supplement lamp onboard led lamp is mended according to the LED after adjustment
Light lamp plate re-starts the acquisition of image;
When the target ratio is less than or equal to six threshold value, end operation.
The explanation of feature may refer to the related description of embodiment corresponding to Fig. 1 in embodiment corresponding to Fig. 2, here no longer
It repeats one by one.
Image capture device carries out gray processing processing to the image of acquisition it can be seen from above-mentioned technical proposal, obtains institute
State the gray value of each pixel in image;According to preset threshold value, binaryzation is carried out to the target area of described image
Processing, is classified as first kind pixel or the second class pixel by each pixel in the target area;It calculates all
The corresponding first object value of first kind pixel and corresponding second desired value of all second class pixels;First
The value size of desired value and the second desired value reflects the brightness case of image, according to the first object value and described second
Desired value, the number that adjustment LED light supplement lamp onboard led lamp is lighted, to realize the automatic tune to LED light supplement lamp plate light filling intensity
Section, so that it is guaranteed that taking the image of brightness qualification.
Fig. 3 is a kind of hardware configuration signal of device 30 adjusting LED light supplement lamp plate brightness provided in an embodiment of the present invention
Figure, including memory 31, for storing computer program;
Processor 32, for executing the computer program to realize the method such as above-mentioned adjusting LED light supplement lamp plate brightness
The step of.
The embodiment of the present invention additionally provides a kind of computer readable storage medium, is deposited on the computer readable storage medium
Computer program is contained, the side such as above-mentioned adjusting LED light supplement lamp plate brightness is realized when the computer program is executed by processor
The step of method.
Be provided for the embodiments of the invention above it is a kind of adjust LED light supplement lamp plate brightness method, apparatus and storage be situated between
Matter is described in detail.Each embodiment is described by the way of progressive in specification, and each embodiment stresses
It is difference from other examples, just to refer each other for identical similar portion between each embodiment.For embodiment public affairs
For the device opened, since it is corresponded to the methods disclosed in the examples, so description is fairly simple, related place is referring to side
Method part illustrates.It should be pointed out that for those skilled in the art, not departing from the principle of the invention
Under the premise of, it can be with several improvements and modifications are made to the present invention, these improvement and modification also fall into the claims in the present invention
In protection domain.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure
And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and
The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These
Function is implemented in hardware or software actually, depends on the specific application and design constraint of technical solution.Profession
Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered
Think beyond the scope of this invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor
The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit
Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology
In any other form of storage medium well known in field.