A brightness adaptive adjustment method, device, storage medium and equipment
By obtaining the grayscale histogram, brightness value and information entropy of the target image in the scanning device, determining the brightness level and adjusting the brightness and aperture size of the lamp beads, the shortcomings of the scanning device in ambient brightness adjustment are solved, and the accuracy of the scanning results and imaging quality are improved.
Patent Information
- Application Number
- CN202111620019.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-27
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2041-12-27
AI Technical Summary
The prior art is difficult to effectively adjust the ambient brightness when scanning a scanning device, resulting in poor imaging quality, especially in environments such as reflection, light absorption and light overexposure.
By obtaining the grayscale histogram, brightness value and image information entropy of the target image, the brightness level of the image is determined, and the bead brightness and/or aperture size of the scanning device are adjusted according to the brightness level and information entropy to achieve adaptive adjustment of the ambient brightness.
It improves the accuracy of scanning results, improves imaging quality, and provides users with a better user experience.
Smart Images

Figure CN114283410B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image processing, and in particular, to a method, device, storage medium, and equipment for brightness adaptive adjustment. Background Technique
[0002] In recent years, with the rapid development of informatization, technology, and intelligence; especially the requirements for intelligence of children's intelligent products are getting higher and higher. For example, a portable intelligent dictionary pen has various functions such as word scanning, word lookup, and translation in one. The dictionary pen first uses a camera to capture the scanned text, then stitches the scanned video into a static image, and finally uses Optical Character Recognition (OCR) technology to recognize the text in the image.
[0003] However, the premise for OCR technology to recognize is that the image is clear, which requires that the scanned medium does not reflect light, absorb light, or be overexposed to light. However, in actual use scenarios, the above problems will inevitably occur. For example, when the scanning device scans a leathery and shiny surface, there will be a reflection problem, and there will also be a reflection problem when there is strong light directly above. Therefore, it is necessary to adjust the ambient light brightness during imaging to ensure the imaging quality. Currently, when performing brightness adjustment, the usual method is to first use a light sensor to calculate the illumination intensity in the use environment, and then use a light feedback mechanism to adjust the brightness of the lamp. However, since the light sensor is applicable when it is greatly affected by the external ambient light, and the dictionary pen scanning device is more affected by the scanning medium during scanning, and the light sensor directly acts in the external illumination environment and cannot truly feedback the imaging quality, resulting in a poor brightness adjustment effect.
[0004] Therefore, how to reasonably and adaptively adjust the ambient brightness during the scanning of the scanning device to improve the accuracy of the scanning result is a technical problem that needs to be solved urgently at present. Summary of the Invention
[0005] The main purpose of the embodiments of the present application is to provide a method, device, storage medium, and equipment for brightness adaptive adjustment, which can reasonably and adaptively adjust the ambient brightness during the scanning of the scanning device, improve the accuracy of the scanning result, and also provide a better user experience for users.
[0006] The embodiments of the present application provide a method for brightness adaptive adjustment, including:
[0007] Obtain a target image to be adjusted;
[0008] Calculate the grayscale histogram, brightness value, and image information entropy of the target image;
[0009] Determine the brightness level of the target image according to the grayscale histogram and brightness value of the target image;
[0010] Adjust the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, and obtain the adjustment result of the ambient brightness when the scanning device performs scanning.
[0011] In a possible implementation, the brightness level includes dim brightness, normal brightness, and bright brightness.
[0012] In a possible implementation, when the exposure time of the scanning device is fixed, the adjusting the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, and obtaining the adjustment result of the ambient brightness when the scanning device performs scanning includes:
[0013] When the brightness level and the image information entropy of the target image do not meet the preset conditions, determine whether the brightness of the target image is dim;
[0014] If so, when it is determined that the brightness of the lamp beads of the scanning device can be increased, increase the brightness level of the lamp beads of the scanning device, and obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions;
[0015] If not, when it is determined that the brightness of the lamp beads of the scanning device can be decreased, decrease the brightness level of the lamp beads of the scanning device, and obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0016] In a possible implementation, when the brightness level of the lamp beads of the scanning device is fixed, the adjusting the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, and obtaining the adjustment result of the ambient brightness when the scanning device performs scanning includes:
[0017] When the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the lamp beads of the scanning device is dim, increase the aperture of the scanning device, or when it is determined that the brightness of the lamp beads of the scanning device is bright, decrease the aperture of the scanning device, and obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions;
[0018] Determine whether the image information entropy of the re-acquired updated target image reaches the maximum value. If not, finely adjust the aperture of the scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0019] In a possible implementation, the adjusting the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level and the image information entropy of the target image to obtain the adjustment result of the ambient brightness when the scanning device performs scanning includes:
[0020] When the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the target image is too dark, raise one brightness level of the scanning device on the basis of the previous brightness level, and gradually raise it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness and the image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the target image is too bright, lower one brightness level of the scanning device on the basis of the previous brightness level, and gradually lower it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions;
[0021] When the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the image information entropy of the target image is small, increase the aperture size of the scanning device on the basis of the previous aperture size, and gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the image information entropy of the target image is large, decrease the aperture size of the scanning device on the basis of the previous aperture size, and gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0022] In a possible implementation, the preset conditions include that the brightness level is normal brightness, the image information entropy is not less than the minimum threshold and not greater than the maximum threshold.
[0023] In a possible implementation, the minimum threshold is 0; the maximum threshold is 8.
[0024] The embodiment of the present application also provides a brightness adaptive adjustment device, including:
[0025] An acquisition unit, configured to acquire a target image to be adjusted;
[0026] A calculation unit for calculating the grayscale histogram, brightness value, and image information entropy of the target image;
[0027] A determination unit for determining the brightness level of the target image according to the grayscale histogram and brightness value of the target image;
[0028] An adjustment unit for adjusting the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, so as to obtain an adjustment result of the ambient brightness when the scanning device performs scanning.
[0029] In a possible implementation manner, the brightness level includes a dim brightness, a normal brightness, and a bright brightness.
[0030] In a possible implementation manner, when the exposure time of the scanning device is fixed, the adjustment unit includes:
[0031] A judgment subunit for judging whether the brightness of the target image is dim when the brightness level and image information entropy of the target image do not meet the preset conditions;
[0032] An increase subunit for, if it is judged that the brightness of the target image is dim, and when it is judged that the brightness of the lamp beads of the scanning device can be increased, increasing the brightness level of the lamp beads of the scanning device to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions;
[0033] A decrease subunit for, if it is judged that the brightness of the target image is not dim, and when it is judged that the brightness of the lamp beads of the scanning device can be decreased, decreasing the brightness level of the lamp beads of the scanning device to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0034] In a possible implementation manner, when the brightness level of the lamp beads of the scanning device is fixed, the adjustment unit includes:
[0035] A first adjustment subunit for, when the brightness level and image information entropy of the target image do not meet the preset conditions, and when it is judged that the brightness of the lamp beads of the scanning device is dim, increasing the aperture of the scanning device, or, when it is judged that the brightness of the lamp beads of the scanning device is bright, decreasing the aperture of the scanning device, to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions;
[0036] A fine-tuning subunit is configured to determine whether the image information entropy of the re-obtained updated target image reaches the maximum value. If not, the aperture of the scanning device is fine-tuned to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-obtained by the scanning device meets a preset condition.
[0037] In a possible implementation manner, the adjustment unit includes:
[0038] A second adjustment subunit is configured to, when the brightness level and the image information entropy of the target image do not meet the preset condition and it is determined that the brightness of the target image is too dark, increase the brightness level of the scanning device by one level on the basis of the previous brightness level, and gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness and the image information entropy of the target image do not meet the preset condition and it is determined that the brightness of the target image is too bright, decrease the brightness level of the scanning device by one level on the basis of the previous brightness level, and gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-obtained by the scanning device meets the preset condition;
[0039] A third adjustment subunit is configured to, when the brightness level and the image information entropy of the target image do not meet the preset condition and it is determined that the image information entropy of the target image is small, increase the size of the aperture of the scanning device on the basis of the previous aperture size, and gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness level and the image information entropy of the target image do not meet the preset condition and it is determined that the image information entropy of the target image is large, decrease the size of the aperture of the scanning device on the basis of the previous aperture size, and gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-obtained by the scanning device meets the preset condition.
[0040] In a possible implementation manner, the preset condition includes that the brightness level is normal brightness, the image information entropy is not less than the minimum threshold and not greater than the maximum threshold.
[0041] In a possible implementation manner, the minimum threshold is 0; the maximum threshold is 8.
[0042] The embodiment of the present application further provides a brightness adaptive adjustment device, including: a processor, a memory, and a system bus;
[0043] The processor and the memory are connected through the system bus;
[0044] The memory is used to store one or more programs, and the one or more programs include instructions which, when executed by the processor, cause the processor to execute any of the implementation manners of the above brightness adaptive adjustment method.
[0045] An embodiment of the present application further provides a computer-readable storage medium, in which instructions are stored. When the instructions run on a terminal device, the terminal device is caused to execute any of the implementation manners of the above brightness adaptive adjustment method.
[0046] An embodiment of the present application further provides a computer program product which, when running on a terminal device, causes the terminal device to execute any of the implementation manners of the above brightness adaptive adjustment method.
[0047] A brightness adaptive adjustment method, device, storage medium and device provided by an embodiment of the present application first obtain a target image to be adjusted; then calculate the gray histogram, brightness value and image information entropy of the target image; then, according to the gray histogram and brightness value of the target image, determine the brightness level of the target image; furthermore, according to the brightness level of the target image and the image information entropy of the target image, the brightness of the lamp beads and / or the aperture size of a scanning device can be adjusted to obtain an adjustment result of the ambient brightness when the scanning device performs scanning. It can be seen that the embodiment of the present application adaptively adjusts the brightness of the lamp beads and / or the aperture size of the scanning device based on the image brightness level and richness reflected by the gray histogram, brightness value and image information entropy of the image, so that the ambient brightness can be reasonably and adaptively adjusted when the scanning device performs scanning, thereby improving the accuracy of the scanning result and providing a better user experience for users. Description of the Drawings
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0049] Figure 1 It is a schematic flow chart of a brightness adaptive adjustment method provided by an embodiment of the present application;
[0050] Figure 2 It is an example diagram of a target image provided by an embodiment of the present application;
[0051] Figure 3 It is a distribution example diagram of the gray histogram of the target image provided by an embodiment of the present application;
[0052] Figure 4 Schematic diagram of the relationship between exposure time and image information entropy provided by an embodiment of the present application;
[0053] Figure 5 One of the flowcharts for adjusting the brightness of the lamp beads and / or the aperture size of a scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning provided by an embodiment of the present application;
[0054] Figure 6 Another flowchart for adjusting the brightness of the lamp beads and / or the aperture size of a scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning provided by an embodiment of the present application;
[0055] Figure 7 Another flowchart for adjusting the brightness of the lamp beads and / or the aperture size of a scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning provided by an embodiment of the present application;
[0056] Figure 8 Composition schematic diagram of a brightness adaptive adjustment device provided by an embodiment of the present application. Detailed implementation manners
[0057] With the rapid development of informatization, technology, and intelligence; especially the requirements for intelligence in children's intelligent products are getting higher and higher. For example, portable intelligent dictionary pens integrate various functions such as scanning words, looking up words, and translation. However, currently, when using scanning devices such as dictionary pens for scanning, it is easily affected by environmental brightness such as reflection, light absorption, and overexposure of the scanning medium, resulting in inaccurate final recognition results. For example, brightness changes caused by the appearance color of the dictionary pen, differences in brightness in different external usage environments, and brightness differences when scanning different media (such as books, computer monitor screens, and mobile phone tablet screens). Therefore, it is necessary to adjust the brightness when the scanning device performs scanning to ensure the imaging quality. Currently, when performing brightness adjustment, the commonly used method is to first use a light sensor to calculate the illumination intensity in the usage environment, and then use an illumination feedback mechanism to adjust the brightness of the lamp. However, since the light sensor is suitable for situations where it is greatly affected by external ambient light, while the dictionary pen scanning device is more affected by the scanning medium during scanning, and the spatial structure of the dictionary pen and other scanning devices has a certain influence on the placement position of the sensor. In addition, the light sensor directly acts in the external illumination environment and cannot truly feedback the imaging quality, resulting in poor brightness adjustment effects.
[0058] To address the above deficiencies, the present application provides a method for adaptively adjusting brightness. First, a target image to be adjusted is obtained; then, the grayscale histogram, brightness value, and image information entropy of the target image are calculated; next, based on the grayscale histogram and brightness value of the target image, the brightness level of the target image is determined; furthermore, based on the brightness level of the target image and the image information entropy of the target image, the brightness of the lamp beads and / or the aperture size of the scanning device can be adjusted to obtain the adjustment result of the ambient brightness when the scanning device performs scanning. It can be seen that the embodiments of the present application adaptively adjust the brightness of the lamp beads and / or the aperture size of the scanning device based on the image brightness level and richness reflected by the grayscale histogram, brightness value, and image information entropy of the image, so as to reasonably and adaptively adjust the ambient brightness when the scanning device performs scanning, thereby improving the accuracy of the scanning result and providing a better user experience for users.
[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the scope of protection of the present application.
[0060] First Embodiment
[0061] See Figure 1 , which is a schematic flowchart of a method for adaptively adjusting brightness provided in this embodiment. The method includes the following steps:
[0062] S101: Obtain a target image to be adjusted.
[0063] In this embodiment, an image obtained by any scanning for which brightness adaptive adjustment is performed in this embodiment (such as an image obtained by scanning with a scanning device such as a dictionary pen, etc.) is defined as a target image. It should be noted that the type of the target image is not limited in this embodiment. For example, the target image can be a color image composed of the three primary colors of red (R), green (G), and blue (B), or a grayscale image, etc. For example, the target image as shown in Figure 2 can be acquired by driving a camera, and the image resolution of the target image can be defined as W*H, where the width can be defined as W and the height can be defined as H.
[0064] S102: Calculate the grayscale histogram, brightness value, and image information entropy of the target image.
[0065] In this embodiment, after obtaining the target image through step S101, the grayscale histogram, brightness value, and image information entropy of the target image can be further calculated to execute subsequent steps S103 and S104 to achieve adaptive adjustment of brightness.
[0066] Specifically, the grayscale histogram of the target image can reflect the brightness distribution of the target image. When calculating the grayscale histogram of the target image, first let f(x, y) represent the grayscale value at the pixel point coordinates (x, y) of the target image. Among them, the image grayscale value covers 0 - 255, 0 represents "black point", 255 represents "white point", and then the frequency distribution histogram of the pixel values equal to the range of 0 - 255 in the target image (such as Figure 2 the target image shown) is statistically calculated, as shown in Figure 3 ;
[0067] When calculating the brightness value of the target image, that is, when calculating the overall brightness mean value of the target image (here defined as GM), the specific calculation formula is as follows:
[0068]
[0069] Among them, GM represents the brightness value of the target image; W represents the width of the target image; H represents the height of the target image. Thus, using the above formula (1), the brightness value GM = 92 of the target image as shown in Figure 2 can be calculated.
[0070] When calculating the image information entropy of the target image, it should be noted that since entropy refers to the degree of chaos of the system. For the image information entropy, it represents the richness of the image feature information. The larger the information entropy of the image, the richer the image content features. On the contrary, the smaller the information entropy of the image, the poorer the image content features; and when the ambient brightness changes, the information entropy of the image will also change accordingly. When the brightness reaches a certain value, the information entropy of the image also reaches the maximum.
[0071] According to the calculated grayscale histogram of the target image, the probability vector P = (p 0 , p 1 , …, p n ) of each grayscale level can be calculated, where p i represents the proportion probability of the pixel points with grayscale value i in the target image, satisfying 0 ≤ p i ≤ 1, where i = 0, 1, 2, …, n (n ≤ 255, a total of 256 levels), and the specific calculation formula is as follows:
[0072]
[0073] Among them, p iRepresents the proportion probability of pixels with grayscale value i in the target image; F i Represents the frequency of grayscale value i; W represents the width of the target image; H represents the height of the target image.
[0074] On this basis, the calculation formula for the image information entropy of the target image can be obtained as follows:
[0075]
[0076] Among them, E(p) represents the image information entropy of the target image; p i Represents the proportion probability of pixels with grayscale value i in the target image, and the specific value can be determined according to the above formula (2).
[0077] In addition, it should be noted that for an image, if all grayscales are evenly distributed, the calculated value is the maximum value of the image information entropy. At this time, the probabilities of all grayscale levels appearing are the same, that is:
[0078] At this time, the maximum entropy of the image is However, in different usage scenarios, the brightness information has a great impact on it. Weak brightness will cause the image feature information not to be fully highlighted, and high brightness will cause some image features to be covered; therefore, choosing a suitable brightness has a great impact on the image imaging effect; under the condition of certain ambient light, the length of the exposure time can reflect different brightness values, and its relationship with the image information entropy is as Figure 4 shown. Therefore, after calculating the grayscale histogram, brightness value, and image information entropy of the target image, further adaptive adjustment of the brightness can be performed by executing the subsequent steps S103 - S104 to improve the image imaging effect.
[0079] S103: Determine the brightness level of the target image according to the grayscale histogram and brightness value of the target image.
[0080] In this embodiment, after calculating the grayscale histogram and brightness value of the target image through step S102, further according to the grayscale histogram and brightness value of the target image, and the corresponding relationship between the preset brightness level and the brightness value and histogram distribution trend, the brightness level of the target image can be determined for performing the subsequent step S104.
[0081] Among them, for the usage conditions of brightness of scanning devices such as dictionary pens, this application has preset three brightness levels, namely, dim brightness, normal brightness, and bright brightness, as shown in Table 1 below:
[0082]
[0083] Table 1
[0084] Among them, GM_T1 and GM_T2 are the threshold conditions for the luminance values in judging the luminance level, and GT1 and GT2 are the threshold conditions for the distribution trend of the histogram gray level in judging the luminance level. Judging the luminance level requires meeting the conditions of both the luminance value and the histogram simultaneously.
[0085] S104: Adjust the brightness of the lamp beads and / or the aperture size of the scanning device according to the luminance level of the target image and the image information entropy of the target image, so as to obtain the adjustment result of the ambient luminance when the scanning device performs scanning.
[0086] It should be noted that for scanning devices such as dictionary pens, the ambient light luminance mainly comes from the internal lamp beads of the device. By changing the drive, the brightness level of the lamp beads can be adjusted, thereby achieving the purpose of adjusting the image luminance. And when the exposure time is fixed, the imaging effect can be adjusted by adjusting the brightness level of the lamp beads.
[0087] Thus, in this embodiment, after calculating the image information entropy of the target image through step S102 and determining the luminance level of the target image through step S103, further, according to the luminance level of the target image and the image information entropy of the target image, the brightness of the lamp beads and / or the aperture size of the scanning device can be adjusted to obtain the adjustment result of the ambient luminance when the scanning device performs scanning, so that the luminance level of the updated target image re-acquired by the scanning device meets the preset conditions and the imaging effect is better.
[0088] Among them, the preset conditions include that the luminance level is normal luminance (see Table 1), the image information entropy (herein defined as E) is not less than the minimum threshold (herein defined as ET min ) and not greater than the maximum threshold (herein defined as ET max ), that is, ET min ≤E≤ET MAX . As shown in Table 1, normal luminance means that the luminance value of the image is between the thresholds GM_T1 and GM_T2, and most of the histogram gray level values of the image are distributed between GT1 and GT2. Among them, for GM_T1 and GM_T2, GT1 and GT2, E min and E max , the specific values can be set according to the actual situation, and the embodiments of the present application do not limit this. For example, GM_T1 and GM_T2 can be set to 200 and 240 respectively, and ET min and ET max can be set to 0 and 8 respectively.
[0089] Specifically, an optional implementation method is that when the exposure time of the scanning device is fixed, the specific implementation process of this step S104 can include: For example Figure 5As shown, when it is determined that the brightness level and image information entropy of the target image do not meet the preset conditions, first determine whether the brightness of the target image is too dark. If so, then determine whether the brightness of the lamp beads of the scanning device can be increased. If so, the brightness level of the lamp beads of the scanning device can be gradually increased until the adjustment result of the ambient brightness during scanning by the scanning device is obtained, and the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions (i.e., the brightness is normal). Conversely, if it is determined that the brightness of the lamp beads of the scanning device cannot be increased, it means that the brightness cannot be adjusted to the optimal level, and it is necessary to consider adjusting the aperture size to adjust the exposure time.
[0090] Or, if it is determined that the brightness of the target image is not too dark but too bright, it can be further determined whether the brightness of the lamp beads of the scanning device can be decreased. If so, the brightness level of the lamp beads of the scanning device can be gradually decreased until the adjustment result of the ambient brightness during scanning by the scanning device is obtained, and the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions. Conversely, if it is determined that the brightness of the lamp beads of the scanning device cannot be decreased, it means that the brightness cannot be adjusted to the optimal level, and it is necessary to consider adjusting the aperture size to adjust the exposure time.
[0091] In addition, it can also be determined whether the image information entropy of the target image and the image information entropy of the updated target image re-acquired are the largest. If so, the parameters of the scanning device set currently are retained; if not, it is possible to consider adjusting the brightness within a moderate brightness range.
[0092] In another alternative implementation, since the brightness range of the lamp beads of scanning devices such as dictionary pens is limited, when the requirements cannot be met by adjusting the brightness of the lamp beads, it is necessary to adjust by means of adjusting the exposure time. Therefore, when the brightness level of the lamp beads of the scanning device is fixed, the specific implementation process of step S104 above can include: As Figure 6 shown, when it is determined that the brightness level and image information entropy of the target image do not meet the preset conditions, first determine whether the brightness of the lamp beads of the scanning device is too dark. If so, the aperture of the scanning device can be gradually increased. Conversely, if it is determined that the brightness of the lamp beads of the scanning device is not too dark but too bright, the aperture of the scanning device can be gradually decreased until the adjustment result of the ambient brightness during scanning by the scanning device is obtained, and the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0093] In addition, it is also possible to determine whether the image information entropy of the target image and the image information entropy of the updated target image re-acquired are the largest. If so, the parameters of the current scanning device settings are retained; if not, it is possible to consider fine-tuning the aperture of the scanning device within a moderate brightness range until the adjustment result of the ambient brightness during scanning by the scanning device is obtained, and the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0094] It should be noted that whether it is adjusting the brightness of the lamp beads or the aperture size, it is all to make the adjustment result of the brightness better and the imaging effect better. However, the adjustment efficiency is also a very important factor. In order to speed up the adjustment efficiency, in practical applications, usually not all the brightness of the lamp beads or the aperture size will be adjusted one by one, which will consume a long time. Therefore, in an optional implementation method, it is possible to consider comprehensively adjusting the brightness of the lamp beads and the aperture size. The specific implementation process may include: as Figure 7 shown, when it is determined that the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the target image is too dark, one brightness level of the scanning device can be increased on the basis of the previous brightness level. After gradually increasing the brightness level, until the adjustment result of the ambient brightness during scanning by the scanning device is obtained; or, when the brightness and the image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the target image is too bright, then one brightness level of the scanning device can be decreased on the basis of the previous brightness level. After gradually decreasing the brightness level, until the adjustment result of the ambient brightness during scanning by the scanning device is obtained, and the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0095] At the same time, when it is determined that the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the image information entropy of the target image is small, the size of the aperture of the scanning device can be increased on the basis of the previous aperture size. After gradually increasing the aperture, until the adjustment result of the ambient brightness during scanning by the scanning device is obtained; or, when it is determined that the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the image information entropy of the target image is large, the size of the aperture of the scanning device can be decreased on the basis of the previous aperture size, gradually decreasing, until the adjustment result of the ambient brightness during scanning by the scanning device is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions.
[0096] In summary, for the brightness adaptive adjustment method provided in this embodiment, first, a target image to be adjusted is obtained; then, the grayscale histogram, brightness value, and image information entropy of the target image are calculated; next, according to the grayscale histogram and brightness value of the target image, the brightness level of the target image is determined; furthermore, according to the brightness level of the target image and the image information entropy of the target image, the brightness of the lamp beads and / or the aperture size of the scanning device can be adjusted to obtain the adjustment result of the ambient brightness when the scanning device performs scanning. It can be seen that the embodiment of the present application adaptively adjusts the brightness of the lamp beads and / or the aperture size of the scanning device based on the image brightness level and richness reflected by the grayscale histogram, brightness value, and image information entropy of the image, so as to reasonably and adaptively adjust the ambient brightness when the scanning device performs scanning, thereby improving the accuracy of the scanning result and providing a better user experience for users.
[0097] Second Embodiment
[0098] This embodiment will introduce a brightness adaptive adjustment device. For related content, please refer to the above method embodiment.
[0099] See Figure 8 , which is a schematic diagram of the composition of a brightness adaptive adjustment device provided in this embodiment. The device 800 includes:
[0100] An acquisition unit 801, configured to acquire a target image to be adjusted;
[0101] A calculation unit 802, configured to calculate the grayscale histogram, brightness value, and image information entropy of the target image;
[0102] A determination unit 803, configured to determine the brightness level of the target image according to the grayscale histogram and brightness value of the target image;
[0103] An adjustment unit 804, configured to adjust the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image to obtain the adjustment result of the ambient brightness when the scanning device performs scanning.
[0104] In one implementation manner of this embodiment, the brightness level includes being darker in brightness, normal brightness, and brighter in brightness.
[0105] In one implementation manner of this embodiment, when the exposure time of the scanning device is fixed, the adjustment unit 804 includes:
[0106] A judgment subunit, configured to judge whether the brightness of the target image is darker when the brightness level and image information entropy of the target image do not meet the preset conditions;
[0107] An elevation subunit, configured to, if it is determined that the brightness of the target image is too dark and it is determined that the brightness of the lamp beads of the scanning device can be increased, increase the brightness level of the lamp beads of the scanning device to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets a preset condition;
[0108] A reduction subunit, configured to, if it is determined that the brightness of the target image is not too dark and it is determined that the brightness of the lamp beads of the scanning device can be decreased, decrease the brightness level of the lamp beads of the scanning device to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets a preset condition.
[0109] In an implementation manner of this embodiment, when the brightness level of the lamp beads of the scanning device is fixed, the adjustment unit 804 includes:
[0110] A first adjustment subunit, configured to, when the brightness level and the image information entropy of the target image do not meet the preset condition and it is determined that the brightness of the lamp beads of the scanning device is too dark, increase the aperture of the scanning device, or, when it is determined that the brightness of the lamp beads of the scanning device is too bright, decrease the aperture of the scanning device, to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets a preset condition;
[0111] A fine-tuning subunit, configured to determine whether the image information entropy of the re-acquired updated target image reaches the maximum value. If not, perform fine-tuning on the aperture of the scanning device to obtain an adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired by the scanning device meets a preset condition.
[0112] In an implementation manner of this embodiment, the adjustment unit 804 includes:
[0113] A second adjustment subunit, configured to, when the brightness level and the image information entropy of the target image do not meet the preset condition and it is determined that the brightness of the target image is too dark, increase one brightness level of the scanning device on the basis of the previous brightness level, and gradually increase it until an adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness and the image information entropy of the target image do not meet the preset condition and it is determined that the brightness of the target image is too bright, decrease one brightness level of the scanning device on the basis of the previous brightness level, and gradually decrease it until an adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets a preset condition;
[0114] A third adjustment subunit, configured to, when the brightness level and the image information entropy of the target image do not meet a preset condition and it is determined that the image information entropy of the target image is small, increase the aperture size of the scanning device on the basis of the previous aperture size, gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness level and the image information entropy of the target image do not meet the preset condition and it is determined that the image information entropy of the target image is large, decrease the aperture size of the scanning device on the basis of the previous aperture size, gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset condition.
[0115] In an implementation manner of this embodiment, the preset condition includes that the brightness level is normal brightness, the image information entropy is not less than a minimum threshold and not greater than a maximum threshold.
[0116] In an implementation manner of this embodiment, the minimum threshold is 0; the maximum threshold is 8.
[0117] Furthermore, an embodiment of the present application further provides a brightness adaptive adjustment device, including: a processor, a memory, and a system bus;
[0118] The processor and the memory are connected through the system bus;
[0119] The memory is used to store one or more programs, and the one or more programs include instructions, and when the instructions are executed by the processor, the processor executes any implementation method of the above-mentioned brightness adaptive adjustment method.
[0120] Furthermore, an embodiment of the present application further provides a computer-readable storage medium, in which instructions are stored, and when the instructions run on a terminal device, the terminal device executes any implementation method of the above-mentioned brightness adaptive adjustment method.
[0121] Furthermore, an embodiment of the present application further provides a computer program product, and when the computer program product runs on a terminal device, the terminal device executes any implementation method of the above-mentioned brightness adaptive adjustment method.
[0122] As can be seen from the description of the above embodiments, those skilled in the art can clearly understand that all or part of the steps in the above-described embodiment methods can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in each embodiment or some parts of the embodiments of the present application.
[0123] It should be noted that the various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, reference can be made to the description in the method part.
[0124] It should also be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0125] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for brightness adaptive adjustment, characterized in that, it includes: Obtain a target image to be adjusted; Calculate the grayscale histogram, brightness value and image information entropy of the target image; Determine the brightness level of the target image according to the grayscale histogram and brightness value of the target image; the brightness level includes darker brightness, normal brightness and brighter brightness; Adjust the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, and obtain the adjustment result of the ambient brightness when the scanning device performs scanning; the scanning device is a dictionary pen; The adjusting the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, and obtaining the adjustment result of the ambient brightness when the scanning device performs scanning includes: When the brightness level and image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the target image is darker, raise one brightness level of the scanning device on the basis of the previous brightness level, and gradually raise it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness and image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the target image is brighter, lower one brightness level of the scanning device on the basis of the previous brightness level, and gradually lower it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-obtained by the scanning device meets the preset conditions; When the brightness level and image information entropy of the target image do not meet the preset conditions, and it is determined that the image information entropy of the target image is less than the minimum threshold, increase the aperture size of the scanning device on the basis of the previous aperture size, and gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness level and image information entropy of the target image do not meet the preset conditions, and it is determined that the image information entropy of the target image is greater than the maximum threshold, decrease the aperture size of the scanning device on the basis of the previous aperture size, and gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-obtained by the scanning device meets the preset conditions; The preset conditions include that the brightness level is normal brightness, the image information entropy is not less than the minimum threshold and not greater than the maximum threshold.
2. The method according to claim 1, characterized in that, When the exposure time of the scanning device is fixed, the adjusting the brightness of the lamp beads and / or the aperture size of the scanning device according to the brightness level of the target image and the image information entropy of the target image, and obtaining the adjustment result of the ambient brightness when the scanning device performs scanning includes: When the brightness level and image information entropy of the target image do not meet the preset conditions, judge whether the brightness of the target image is darker; If so, when it is determined that the brightness of the lamp beads of the scanning device can be increased, increase the brightness level of the lamp beads of the scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired through the scanning device meets the preset conditions; If not, when it is determined that the brightness of the lamp beads of the scanning device can be decreased, decrease the brightness level of the lamp beads of the scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired through the scanning device meets the preset conditions.
3. The method according to claim 1, wherein, when the brightness level of the lamp beads of the scanning device is fixed, the adjusting the brightness and / or aperture size of the lamp beads of the scanning device according to the brightness level and the image information entropy of the target image to obtain the adjustment result of the ambient brightness when the scanning device performs scanning includes: when the brightness level and the image information entropy of the target image do not meet the preset conditions, and it is determined that the brightness of the lamp beads of the scanning device is too dim, increase the aperture of the scanning device, or when it is determined that the brightness of the lamp beads of the scanning device is too bright, decrease the aperture of the scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired through the scanning device meets the preset conditions; judge whether the image information entropy of the re-acquired updated target image reaches the maximum value. If not, fine-tune the aperture of the scanning device to obtain the adjustment result of the ambient brightness when the scanning device performs scanning, so that the brightness level of the updated target image re-acquired through the scanning device meets the preset conditions.
4. The method according to claim 1, wherein, the minimum threshold is 0; the maximum threshold is 8.
5. A brightness adaptive adjustment device, wherein, comprising: an acquisition unit for acquiring a target image to be adjusted; a calculation unit for calculating the gray histogram, brightness value and image information entropy of the target image; a determination unit for determining the brightness level of the target image according to the gray histogram and brightness value of the target image; the brightness level includes too dim, normal brightness and too bright; an adjustment unit for adjusting the brightness and / or aperture size of the lamp beads of the scanning device according to the brightness level and the image information entropy of the target image to obtain the adjustment result of the ambient brightness when the scanning device performs scanning; the scanning device is a dictionary pen; the adjustment unit includes: A second adjustment subunit, configured to, when the brightness level and the image information entropy of the target image do not meet the preset conditions and it is determined that the brightness of the target image is too dark, increase the brightness level of the scanning device by one level on the basis of the previous brightness level, and gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness and the image information entropy of the target image do not meet the preset conditions and it is determined that the brightness of the target image is too bright, decrease the brightness level of the scanning device by one level on the basis of the previous brightness level, and gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions; A third adjustment subunit, configured to, when the brightness level and the image information entropy of the target image do not meet the preset conditions and it is determined that the image information entropy of the target image is less than the minimum threshold, increase the size of the aperture of the scanning device on the basis of the previous aperture size, and gradually increase it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained; or, when the brightness level and the image information entropy of the target image do not meet the preset conditions and it is determined that the image information entropy of the target image is greater than the maximum threshold, decrease the size of the aperture of the scanning device on the basis of the previous aperture size, and gradually decrease it until the adjustment result of the ambient brightness when the scanning device performs scanning is obtained, so that the brightness level of the updated target image re-acquired by the scanning device meets the preset conditions; The preset conditions include that the brightness level is normal brightness, the image information entropy is not less than the minimum threshold and not greater than the maximum threshold.
6. A brightness adaptive adjustment device, characterized in that, it includes: a processor, a memory, and a system bus; the processor and the memory are connected through the system bus; the memory is used to store one or more programs, and the one or more programs include instructions, and when the instructions are executed by the processor, the processor executes the method according to any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, the computer-readable storage medium stores instructions, and when the instructions run on a terminal device, the terminal device executes the method according to any one of claims 1-4.
Citation Information
Patent Citations
Graphic code scanning method and mobile terminal
CN107844730A
Camera automatic exposure method based on ambient brightness and image information entropy
CN110602414A