Disclosure of Invention
The embodiment of the invention aims to provide a method, a device and a storage medium for adjusting the brightness of an LED light supplement lamp panel, which can realize automatic adjustment of the light supplement intensity of the LED light supplement lamp panel.
In order to solve the technical problem, an embodiment of the present invention provides a method for adjusting luminance of an LED fill light panel, including:
carrying out graying processing on the collected image to obtain the gray value of each pixel point in the image;
according to a preset threshold value, carrying out binarization processing on a target area of the image so as to classify each pixel point in the target area into a first type pixel point or a second type pixel point;
calculating first average values corresponding to all the first type pixel points and second average values corresponding to all the second type pixel points;
and adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to the first average value and the second average value.
Optionally, the adjusting the number of the LED lamps on the LED light supplement lamp panel according to the first average value and the second average value includes:
judging whether the first average value is smaller than a first threshold value;
if yes, adjusting the number of the lighted LED lamps on the LED light supplementing lamp plate according to a first rule, and acquiring images again according to the adjusted LED light supplementing lamp plate;
if not, judging whether the second average value is larger than a second threshold value;
when the second average value is larger than the second threshold value, adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a second rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
and ending the operation when the second average value is less than or equal to the second threshold value.
Optionally, the adjusting the number of the LED lamps on the LED light supplement lamp panel according to the first average value and the second average value includes:
calculating a target ratio of the first average value to the second average value according to a preset rule;
judging whether the target ratio is smaller than a third threshold value;
if yes, adjusting the number of the lighted LED lamps on the LED light supplementing lamp plate according to a first rule, and acquiring images again according to the adjusted LED light supplementing lamp plate;
if not, judging whether the target ratio is larger than a fourth threshold value;
when the target ratio is larger than the fourth threshold, adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a second rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
and ending the operation when the target ratio is smaller than or equal to the fourth threshold.
Optionally, the adjusting the number of the LED lamps on the LED light supplement lamp panel according to the first average value and the second average value includes:
calculating a target difference value of the first average value and the second average value according to a preset rule;
judging whether the target difference value is smaller than a fifth threshold value;
if yes, adjusting the number of the lighted LED lamps on the LED light supplementing lamp plate according to a first rule, and acquiring images again according to the adjusted LED light supplementing lamp plate;
if not, judging whether the target difference value is larger than a sixth threshold value;
when the target difference value is larger than the sixth threshold value, adjusting the number of the lighted LED lamps on the LED light supplementing lamp panel according to a second rule, and acquiring images again according to the adjusted LED light supplementing lamp panel;
and when the target difference value is smaller than or equal to the sixth threshold value, ending the operation.
The embodiment of the invention also provides a device for adjusting the brightness of the LED fill-in light lamp panel, which comprises an acquisition unit, a processing unit, a calculation unit and an adjustment unit;
the acquisition unit is used for carrying out graying processing on the acquired image to acquire the gray value of each pixel point in the image;
the processing unit is used for carrying out binarization processing on a target area of the image according to a preset threshold value so as to classify each pixel point in the target area into a first type pixel point or a second type pixel point;
the calculating unit is used for calculating first average values corresponding to all the first pixel points and second average values corresponding to all the second pixel points;
and the adjusting unit is used for adjusting the number of the LED lamps on the LED light supplementing lamp panel according to the first average value and the second average value.
Optionally, the adjusting unit includes a first determining subunit, a first adjusting subunit, a second determining subunit, and a second adjusting subunit;
the first judging subunit is configured to judge whether the first average value is smaller than a first threshold;
if yes, triggering the first adjusting subunit, wherein the first adjusting subunit is used for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a first rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
if not, triggering the second judging subunit, where the second judging subunit is configured to judge whether the second average value is greater than a second threshold;
when the second average value is larger than the second threshold value, triggering the second adjusting subunit, where the second adjusting subunit is used to adjust the number of lit LED lamps on the LED light supplement lamp panel according to a second rule, and collecting images again according to the adjusted LED light supplement lamp panel;
and ending the operation when the second average value is less than or equal to the second threshold value.
Optionally, the adjusting unit includes a calculating subunit, a first judging subunit, a first adjusting subunit, a second judging subunit, and a second adjusting subunit;
the calculating subunit is configured to calculate a target ratio of the first average value to the second average value according to a preset rule;
the first judging subunit is configured to judge whether the target ratio is smaller than a third threshold;
if yes, triggering the first adjusting subunit, wherein the first adjusting subunit is used for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a first rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
if not, triggering the second judgment subunit, where the second judgment subunit is used to judge whether the target ratio is greater than a fourth threshold;
when the target ratio is greater than the fourth threshold, triggering the second adjusting subunit, where the second adjusting subunit is used to adjust the number of lit LED lamps on the LED light supplement lamp panel according to a second rule, and collecting images again according to the adjusted LED light supplement lamp panel;
and ending the operation when the target ratio is smaller than or equal to the fourth threshold.
Optionally, the adjusting unit includes a calculating subunit, a first judging subunit, a first adjusting subunit, a second judging subunit, and a second adjusting subunit;
the calculating subunit is configured to calculate a target difference value between the first average value and the second average value according to a preset rule;
the first judging subunit is configured to judge whether the target difference is smaller than a fifth threshold;
if yes, triggering the first adjusting subunit, wherein the first adjusting subunit is used for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a first rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
if not, triggering the second judgment subunit, where the second judgment subunit is used to judge whether the target difference is greater than a sixth threshold;
when the difference is greater than the sixth threshold, triggering the second adjusting subunit, where the second adjusting subunit is used to adjust the number of lit LED lamps on the LED light supplement lamp panel according to a second rule, and collecting images again according to the adjusted LED light supplement lamp panel;
and when the target difference value is smaller than or equal to the sixth threshold value, ending the operation.
The embodiment of the invention also provides a device for adjusting the brightness of the LED fill-in lamp panel, which comprises the following components:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the steps of the method for adjusting the brightness of the LED supplementary lighting lamp panel.
The embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the method for adjusting the brightness of the LED supplementary lighting lamp panel are realized.
According to the technical scheme, the image acquisition equipment performs graying processing on the acquired image to acquire the gray value of each pixel point in the image; according to a preset threshold value, carrying out binarization processing on a target area of the image so as to classify each pixel point in the target area into a first type pixel point or a second type pixel point; calculating first target values corresponding to all the first type pixel points and second target values corresponding to all the second type pixel points; the value of the first target value and the value of the second target value reflect the brightness condition of the image, and the number of the lighted LED lamps on the LED light supplement lamp panel is adjusted according to the first target value and the second target value so as to realize automatic adjustment of the light supplement intensity of the LED light supplement lamp panel and ensure that the image with qualified brightness is shot.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Next, a method for adjusting the brightness of the LED fill-in light panel according to an embodiment of the present invention is described in detail. Fig. 1 is a flowchart of a method for adjusting luminance of an LED fill-in light panel according to an embodiment of the present invention, where the method includes:
s101: carrying out graying processing on the collected image to obtain the gray value of each pixel point in the image.
The image is grayed, so that the color information with little influence can be removed, the storage space can be reduced, and the decoding speed can be increased.
In the grayed image, the gray value of the pure white point is 255, and the gray value of the pure black point is 0.
S102: and carrying out binarization processing on the target area of the image according to a preset threshold value so as to classify each pixel point in the target area into a first type pixel point or a second type pixel point.
The target area refers to an effective area for performing brightness analysis on the image. Taking the collected two-dimensional code image as an example, the target area refers to an area where the two-dimensional code image is located. In specific implementation, the region where the two-dimensional code is located can be intercepted from the image, and binarization processing is performed on pixel points in the region.
Through binarization processing, all pixel points in the target area can be divided into two types, namely first type pixel points and second type pixel points.
The first type of pixel points may be pixel points with a gray value greater than a threshold, and correspondingly, the second type of pixel points may be pixel points with a gray value less than or equal to the threshold. For convenience of subsequent introduction, the pixels with the gray value greater than the threshold value are taken as the first type of pixels, and the pixels with the gray value less than or equal to the threshold value are taken as the second type of pixels for example.
The threshold value may be set according to actual requirements, for example, the threshold value may be set to 128.
S103: and calculating a first average value corresponding to all the first type pixel points and a second average value corresponding to all the second type pixel points.
In S102, the pixel points in the target region may be divided into two types, in the embodiment of the present invention, an averaging method may be adopted to calculate respective target values corresponding to the two types of pixel points, that is, the gray values of the pixel points belonging to the first type of pixel points are added and averaged, and the obtained average value is the first target value; and adding and averaging the gray values of all the pixels belonging to the second type of pixels to obtain an average value, namely a second target value.
S104: and adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to the first average value and the second average value.
The value sizes of the first target value and the second target value reflect the brightness condition of the image. The method can accurately judge the brightness degree of the image, namely accurately judge whether the brightness of the image is slightly bright or slightly dark, and is a key for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel.
There are various ways to determine the brightness level of an image, and in the embodiment of the present invention, three ways are taken as an example for description.
In the first determination method, two corresponding thresholds may be set for the first target value and the second target value, where the first target value corresponds to the first threshold, and the second target value corresponds to the second threshold.
Specifically, it may be determined whether the first average value is smaller than a first threshold. When the first target value is smaller than the first threshold value, it is indicated that the acquired image is dark, at this time, the number of the lighted LED lamps on the LED light supplement lamp panel can be adjusted according to a first rule, and the image acquisition is performed again according to the adjusted LED light supplement lamp panel.
And when the first target value is greater than or equal to the first threshold value, further judging whether the second average value is greater than a second threshold value. When the second target value is greater than the second threshold value, it is indicated that the acquired image is slightly bright, at this time, the number of the lighted LED lamps on the LED light supplement lamp panel can be adjusted according to a second rule, and the image acquisition is performed again according to the adjusted LED light supplement lamp panel. When the second target value is less than or equal to the second threshold, it indicates that the brightness level of the image is satisfactory, and the operation may be ended.
In the second determination mode, the ratio of the first target value to the second target value is calculated, and the target ratio is compared with a set corresponding threshold value to determine the brightness of the image.
Specifically, the target ratio of the first average value and the second average value may be calculated according to a preset rule.
The preset rule includes a specific rule for calculating the target ratio. In the embodiment of the present invention, there may be a plurality of ways to calculate the target ratio, and taking two calculation ways as an example, the first calculation way may directly use a value obtained by dividing the first target value by the second target value as the target ratio. The second calculation method may be to calculate a square value of the first target value and a square value of the second target value, and to use a value obtained by dividing the square value of the first target value by the square value of the second target value as the target ratio. It should be noted that, the calculation manner of the target ratio is different, and the values of the corresponding thresholds are also different.
Judging whether the target ratio is smaller than a third threshold value; when the target ratio is smaller than the third threshold value, it is indicated that the acquired image is dark, the number of the lighted LED lamps on the LED light supplement lamp panel can be adjusted according to the first rule, and the image is acquired again according to the adjusted LED light supplement lamp panel.
And when the target ratio is greater than or equal to the third threshold, further judging whether the target ratio is greater than a fourth threshold.
When the target ratio is greater than the fourth threshold, it is indicated that the acquired image is slightly bright, at this time, the number of the lighted LED lamps on the LED light supplement lamp panel can be adjusted according to a second rule, and the image is acquired again according to the adjusted LED light supplement lamp panel. When the target ratio is smaller than or equal to the fourth threshold, it indicates that the brightness of the image is satisfactory, and the operation may be ended.
In a third determination mode, the brightness of the image can be determined by calculating a difference between the first target value and the second target value, and comparing the difference with a set corresponding threshold.
Specifically, the target difference between the first average value and the second average value may be calculated according to a preset rule.
The preset rule includes a specific rule for calculating the target difference. In the embodiment of the present invention, there may be a plurality of ways to calculate the target difference, and taking two calculation ways as an example, the first calculation way may directly use a value obtained by subtracting the second target value from the first target value as the target difference. The second calculation method may be to calculate a square value of the first target value and a square value of the second target value, and to use a value obtained by subtracting the square value of the second target value from the square value of the first target value as the target difference. It should be noted that, the calculation manner of the target difference is different, and the values of the corresponding thresholds are also different.
Judging whether the target difference value is smaller than a fifth threshold value; when the target difference value is smaller than the fifth threshold value, it is indicated that the acquired image is dark, the number of the lighted LED lamps on the LED light supplement lamp panel can be adjusted according to the first rule, and the image is acquired again according to the adjusted LED light supplement lamp panel.
When the target difference value is greater than or equal to a fifth threshold value, further judging whether the target difference value is greater than a sixth threshold value; when the target difference is greater than the sixth threshold, it is indicated that the acquired image is slightly bright, at this time, the number of lighted LED lamps on the LED light supplement lamp panel can be adjusted according to a second rule, and the image acquisition is performed again according to the adjusted LED light supplement lamp panel; when the target difference is smaller than or equal to the sixth threshold, it indicates that the brightness of the image meets the requirement, and the operation may be ended.
The LED light supplement lamp panel is provided with a plurality of groups of LED lamps, and all the LED lamps on the LED light supplement lamp panel can be grouped according to actual conditions. The number of the LED lamps in each group can be one or more.
The first rule includes a specific adjusting method for the light supplement intensity of the LED light supplement lamp panel when the image is dark. When the image is dark, the number that LED lamp was lighted on the LED light filling lamp plate can be increased, also light a set of or multiunit LED lamp on original basis promptly to promote image acquisition's luminance.
The second rule includes a specific adjusting method for the light supplement intensity of the LED light supplement lamp panel when the image is slightly bright. When the image is on a partial scale, the number of the LED lamps on the LED light supplementing lamp plate can be reduced, and one or more groups of LED lamps are turned off on the original basis to reduce the brightness of image acquisition.
After the number of the LED lamps is lightened on the LED light supplement lamp plate is adjusted once, whether the acquisition brightness of the image meets the requirement or not is judged according to the adjusted LED light supplement lamp plate, so that the acquisition of the image needs to be carried out again according to the adjusted LED light supplement lamp plate after the light intensity of the LED light supplement lamp plate is adjusted.
Considering that the aging and brightness attenuation of the LED lamps are gradual processes, in general, when the brightness of the acquired image is dark, only one group of LED lamps needs to be increased, one group of LED lamps can be increased firstly, namely, one group of LED lamps is lightened on the original basis, then the image is acquired again, and whether the brightness of the image meets the requirement or not is judged.
Correspondingly, when the brightness of the collected image is slightly bright, the collected brightness of the image can be reduced according to a group of reduction modes, a group of LED lamps can be reduced firstly, namely, the group of LED lamps is turned off on the original basis, then the image is collected again, and whether the brightness of the image meets the requirement or not is judged. By repeatedly executing the steps, the light supplement intensity of the LED light supplement lamp plate can be continuously adjusted, and therefore images with qualified brightness can be shot.
According to the technical scheme, the image acquisition equipment performs graying processing on the acquired image to acquire the gray value of each pixel point in the image; according to a preset threshold value, carrying out binarization processing on a target area of the image so as to classify each pixel point in the target area into a first type pixel point or a second type pixel point; calculating first target values corresponding to all the first type pixel points and second target values corresponding to all the second type pixel points; the value of the first target value and the value of the second target value reflect the brightness condition of the image, and the number of the lighted LED lamps on the LED light supplement lamp panel is adjusted according to the first target value and the second target value so as to realize automatic adjustment of the light supplement intensity of the LED light supplement lamp panel and ensure that the image with qualified brightness is shot.
Fig. 2 is a schematic structural diagram of a device for adjusting luminance of an LED fill-in light panel according to an embodiment of the present invention, including an obtaining unit 21, a processing unit 22, a calculating unit 23, and an adjusting unit 24;
the acquiring unit 21 is configured to perform graying processing on the acquired image to acquire a grayscale value of each pixel point in the image;
the processing unit 22 is configured to perform binarization processing on a target region of the image according to a preset threshold value, so as to classify each pixel point in the target region into a first type pixel point or a second type pixel point;
the calculating unit 23 is configured to calculate first average values corresponding to all the first type pixel points and second average values corresponding to all the second type pixel points;
and the adjusting unit 24 is configured to adjust the number of the lit LED lamps on the LED supplementary lighting lamp panel according to the first average value and the second average value.
Optionally, the adjusting unit includes a first determining subunit, a first adjusting subunit, a second determining subunit, and a second adjusting subunit;
the first judging subunit is configured to judge whether the first average value is smaller than a first threshold;
if yes, triggering the first adjusting subunit, wherein the first adjusting subunit is used for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a first rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
if not, triggering the second judging subunit, where the second judging subunit is configured to judge whether the second average value is greater than a second threshold;
when the second average value is larger than the second threshold value, triggering the second adjusting subunit, where the second adjusting subunit is used to adjust the number of lit LED lamps on the LED light supplement lamp panel according to a second rule, and collecting images again according to the adjusted LED light supplement lamp panel;
and ending the operation when the second average value is less than or equal to the second threshold value.
Optionally, the adjusting unit includes a calculating subunit, a first judging subunit, a first adjusting subunit, a second judging subunit, and a second adjusting subunit;
the calculating subunit is configured to calculate a target ratio of the first average value to the second average value according to a preset rule;
the first judging subunit is configured to judge whether the target ratio is smaller than a third threshold;
if yes, triggering the first adjusting subunit, wherein the first adjusting subunit is used for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a first rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
if not, triggering the second judgment subunit, where the second judgment subunit is used to judge whether the target ratio is greater than a fourth threshold;
when the target ratio is greater than the fourth threshold, triggering the second adjusting subunit, where the second adjusting subunit is used to adjust the number of lit LED lamps on the LED light supplement lamp panel according to a second rule, and collecting images again according to the adjusted LED light supplement lamp panel;
and ending the operation when the target ratio is smaller than or equal to the fourth threshold.
Optionally, the adjusting unit includes a calculating subunit, a first judging subunit, a first adjusting subunit, a second judging subunit, and a second adjusting subunit;
the calculating subunit is configured to calculate a target difference value between the first average value and the second average value according to a preset rule;
the first judging subunit is configured to judge whether the target difference is smaller than a fifth threshold;
if yes, triggering the first adjusting subunit, wherein the first adjusting subunit is used for adjusting the number of the lighted LED lamps on the LED light supplement lamp panel according to a first rule, and acquiring images again according to the adjusted LED light supplement lamp panel;
if not, triggering the second judgment subunit, where the second judgment subunit is used to judge whether the target difference is greater than a sixth threshold;
when the target difference is greater than the sixth threshold, triggering the second adjusting subunit, where the second adjusting subunit is used to adjust the number of lit LED lamps on the LED light supplement lamp panel according to a second rule, and collecting images again according to the adjusted LED light supplement lamp panel;
and when the target difference value is smaller than or equal to the sixth threshold value, ending the operation.
The description of the features in the embodiment corresponding to fig. 2 may refer to the related description of the embodiment corresponding to fig. 1, and is not repeated here.
According to the technical scheme, the image acquisition equipment performs graying processing on the acquired image to acquire the gray value of each pixel point in the image; according to a preset threshold value, carrying out binarization processing on a target area of the image so as to classify each pixel point in the target area into a first type pixel point or a second type pixel point; calculating first target values corresponding to all the first type pixel points and second target values corresponding to all the second type pixel points; the value of the first target value and the value of the second target value reflect the brightness condition of the image, and the number of the lighted LED lamps on the LED light supplement lamp panel is adjusted according to the first target value and the second target value so as to realize automatic adjustment of the light supplement intensity of the LED light supplement lamp panel and ensure that the image with qualified brightness is shot.
Fig. 3 is a schematic diagram of a hardware structure of a device 30 for adjusting luminance of an LED fill-in light panel according to an embodiment of the present invention, which includes a memory 31 for storing a computer program;
and the processor 32 is configured to execute the computer program to implement the steps of the method for adjusting the brightness of the LED fill-in light panel.
The embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when the computer program is executed by a processor, the steps of the method for adjusting the brightness of the LED supplementary lighting lamp panel are realized.
The method, the device and the storage medium for adjusting the brightness of the LED fill-in light lamp panel provided by the embodiment of the invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.