Adaptive image shading correction method and system
Through the adaptive image shadow correction method, the image is divided into blocks, the color channel difference is counted, and the correction rate is updated in real time, which solves the module differences and metaspectral problems in lens shadow compensation, and realizes accurate compensation under different light sources.
Patent Information
- Application Number
- CN202410090691.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-22
- Publication Date
- 2025-07-22
AI Technical Summary
The prior art has misjudgment and metaspectral phenomena caused by module differences in lens shadow compensation, and requires additional computing or hardware support, so lens shadow cannot be accurately compensated under different light sources and environments.
Through the adaptive image shadow correction method, the image processing unit is used to segment the image into multiple blocks, count the block differences, filter similar blocks, and judge the shadow correction rate based on the color channel difference, and update the correction rate in real time to adapt to scene changes, avoiding additional calculations and hardware requirements.
Accurate compensation of lens shadows under different light sources and environments, reduce calculation amount and hardware requirements, avoid metaspectral errors, adapt to differences in different lens modules, and improve image quality.
Smart Images

Figure CN120358420A_ABST
Abstract
Description
Technical Field
[0001] The specification discloses a technique for compensating for image shadows caused by a lens, particularly an adaptive image shadow correction method and system that can automatically compensate for lens shadows adaptable to different light sources. Background Art
[0002] A common distortion phenomenon in an imaging system is lens vignetting caused by a lens, that is, when light passes through the lens of the lens and shoots towards the image sensor for imaging, a phenomenon where the brightness gradually decreases from the center to the periphery is formed, that is, lens shading caused by the factors of the photographic lens.
[0003] The causes of lens shading can be generally divided into two. One of them is luminance shading. Since the lens can be regarded as a convex lens, most of the light is concentrated in the central area of the lens, resulting in insufficient light in the edge corners. It will also cause luminance shading due to the attenuation of natural light caused by the incident angle (approximate with cos 4 θ); the other is color shading, and the cause of color shading is related to the infrared light filter (IR-cut filter) in the lens module.
[0004] The general design of a camera is to place the infrared light filter between the lens and the image sensor. The purpose of the infrared light filter is to prevent invisible infrared light from interfering with the sensor. Common infrared light filters are mainly divided into absorption type and reflection type. The advantage of the reflection type infrared light filter is that the cut-off region is steeper and more infrared light can be cut off, but the requirement for the incident light angle is its biggest problem and one of the main causes of color shading. On the contrary, the absorption type infrared light filter can reduce color shading because it is stable and does not cause a shift in the cut-off wavelength due to the change of the incident light angle, but the problem is that the cost of the absorption type filter is higher.
[0005] There are several dynamic adjustment methods in the prior art to compensate for lens shadows. For example, in the prior art, since processing images requires a large amount of memory, when processing a stream of images with consecutive frames, when performing shadow compensation for the current frame, the following frame cannot timely reflect the corrected shadow compensation. Some prior art methods require the support of additional software arithmetic units and only perform shadow compensation for the red channel in the color, but in actual operation, the lens shadow problems of other channels (such as the green and blue channels) still need to be improved. Some other prior methods require pixel-level operations to perform hue swapping and clustering calculations, but pixel-level operations consume a considerable amount of computing power. There is also prior art that needs to obtain the gradient operation results of each pixel horizontally and vertically, but shadow compensation cannot be effectively achieved under hardware limitations.
[0006] Due to differences between different lenses and different sensors in different image modules, the same shadow compensation settings cannot achieve the same performance for each module. Secondly, the phenomenon of metamerism occurs in shadow compensation, and the shadow compensation required under similar color temperatures is not the same. Therefore, a shadow compensation method that can better adapt to various scenarios is needed. Summary of the Invention
[0007] Aiming at the problem of misjudgment caused by differences between image modules in the prior art of lens shadow compensation, the present disclosure proposes an adaptive image shadow correction method and system. One of its purposes is to achieve a better balance between different image modules and avoid shadow compensation errors caused by metamerism. The method can achieve the goal of lens shadow compensation through the statistics of automatic white balance and automatic exposure without consuming additional computing power and additional hardware requirements.
[0008] According to an embodiment of the system for implementing the adaptive image shadow correction method, the adaptive image shadow correction method is executed by an image processing unit. After receiving the image generated by shooting through the lens, the image processing unit obtains the pixel values in each color channel of the image and divides the image into multiple blocks, and statistically analyzes the pixel values of each block to obtain the image differences between multiple blocks, aiming to screen out similar blocks. Then, according to the screening results of similar blocks, multiple groups of paired blocks are obtained, and the color channel difference degrees in each group of paired blocks are obtained, and the shadow correction rate for the image can be judged based on this, so as to use the shadow correction rate to perform shadow correction on the image.
[0009] Further, in the method, similar blocks in the image can be screened out according to one or any combination of the hue difference, brightness and saturation difference, green channel average value difference, and sharpness difference between multiple blocks.
[0010] Among them, for the hue difference, the hue difference between multiple blocks can be determined according to the results of comparing the red channel value and the green channel value between multiple blocks and comparing the blue channel value and the green channel value between multiple blocks.
[0011] For the brightness difference, first obtain the pixel brightness information in each area of the image to calculate the average brightness of each area, and then calculate the brightness difference between the blocks. In this way, by introducing the weight value, the brightness difference between the blocks is amplified. When the brightness difference between two blocks is less than the brightness difference threshold, they are similar blocks in the image. Further, the saturation difference between two blocks can be used to filter out non-brightness similar blocks at the same time.
[0012] For the difference in the average value of the green channel, the multiple blocks divided by the image can be classified into inner blocks and outer blocks, and then the average value of the green channel of the pixels in the inner blocks and the average value of the green channel of the pixels in the outer blocks are calculated respectively to obtain the difference in the average value of the green channel between the inner blocks and the outer blocks.
[0013] Taking the sharpness difference as an example, a Sobel filter can be used to calculate the gray-scale change gradient of each block as the sharpness difference.
[0014] Further, the degree of difference in the color channels in the paired blocks includes the degree of difference between the red channel value and the blue channel value. In this way, after summing up the degrees of difference between the red channel value and the blue channel value of multiple groups of paired blocks and then calculating the average value, the shadow correction rate of the image can be determined according to this average value.
[0015] Further, for the multiple groups of paired blocks screened out, the red gain value and the blue gain value of each block are statistically calculated, and the extreme outliers can be filtered out by using the moving average filtering method.
[0016] Further, when performing shadow correction on each image by using the shadow correction rate, if it is determined that there is a scene change according to the change in the block difference of multiple groups of paired blocks, the shadow correction rate will be updated in real time.
[0017] To enable a further understanding of the features and technical content of the present invention, please refer to the following detailed description and drawings of the present invention. However, the provided drawings are only for reference and illustration and are not used to limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 FIG. showing an embodiment diagram of an image system using an adaptive image shadow correction method;
[0019] Figure 2 FIG. showing an embodiment diagram of a system running an adaptive image shadow correction method;
[0020] Figure 3 Shows the main flowchart of an embodiment of the adaptive image shadow correction method;
[0021] Figure 4 Shows an example diagram of an image block;
[0022] Figure 5 Shows the flowchart of an embodiment of the adaptive image shadow correction method;
[0023] Figure 6 Shows the flowchart of an embodiment of adaptively updating the shadow correction rate;
[0024] Figure 7 Shows the flowchart of an embodiment of determining scene change in the adaptive image shadow correction method. Detailed implementation manners
[0025] The following are specific embodiments to illustrate the implementation manners of the present invention. Those skilled in the art can understand the advantages and effects of the present invention from the content disclosed in this specification. The present invention can be implemented or applied through other different specific embodiments, and various details in this specification can also be modified and changed based on different viewpoints and applications without departing from the concept of the present invention. Additionally, the drawings of the present invention are only for simple schematic illustration and are not drawn according to actual sizes, which is stated in advance. The following implementation manners will further detail the related technical content of the present invention, but the disclosed content is not used to limit the protection scope of the present invention.
[0026] It should be understood that although terms such as "first", "second", "third", etc. may be used in this article to describe various elements or signals, these elements or signals should not be limited by these terms. These terms are mainly used to distinguish one element from another element, or one signal from another signal. Additionally, the term "or" used in this article should, depending on the actual situation, possibly include any one or a combination of more of the associated listed items.
[0027] In an imaging system, due to the physical characteristics of the lens (such as different light reception at the center and edges), a problem of lens shading will occur in the image. The prior art proposes lens shading correction (LSC) technology for lens shading. However, general lens shadow compensation technologies will cause misjudgment problems due to differences between imaging modules. Therefore, the present disclosure proposes an adaptive image shadow correction method and system. One of its purposes is to achieve a better balance between different imaging modules and also avoid shadow compensation errors caused by metamerism. Among them, the method can achieve the goal of lens shadow compensation through the statistics of automatic white balance and automatic exposure without consuming additional computational amount and additional hardware requirements.
[0028] Figure 1 A diagram showing an embodiment of an imaging system using an adaptive image shading correction method.
[0029] The imaging system may be any photographic device or image processing device that captures images through a lens. According to an implementation manner, the adaptive image shading correction method is applicable to photographic devices with poor hardware computing power, such as a webcam, or a photographic module coupled to a display. Furthermore, the adaptive image shading correction method may be run on firmware without using additional software resources or hardware, in order to accurately restore image errors caused by lens shading under different color temperatures and environments.
[0030] The main components of the imaging system are Figure 1 As shown, there is an image processing unit 101 for performing image processing. According to an embodiment, a software program for performing an adaptive image shading correction method can be loaded into the firmware of the image processing unit 101. The image processing unit 101 receives an image captured by a lens 105 from an image capture unit 103, which can be a static image or a video generated by continuous shooting. After obtaining the pixel value in each color channel of the image, the pixel value is stored in the memory 107.
[0031] The image processing unit 101 executes an adaptive image shading correction method through software or firmware to correct the shading and dark corners in the image caused by the lens. After the image is encoded into a specific format, the image is output to the display unit 111 through the output interface 109 for display. For a network camera or a camera module on a computer system, the output interface 109 can be a universal serial bus (USB) or any other signal connection method to connect to the display unit 111 of the computer system.
[0032] A system for performing an adaptive image shading correction method includes: Figure 2 As shown in the firmware (such as Figure 1 The image processing unit 101 shown in the figure is a functional module implemented by software and hardware computing power, wherein the main concept is the image processing unit in the image system (such as Figure 1 A software program is embedded in the image processing unit 101) to implement firmware for executing the adaptive image shading correction method in the system, which may include an image acquisition unit 201 for receiving an image or converting a signal into an image, an image block processing unit 203, an image statistics unit 205, a similarity processing unit 207 and a shading correction unit 209 according to their functions.
[0033] After the system obtains an image through the image acquisition unit 201, the image is averaged or divided into M*N blocks according to specific requirements by the image block processing unit 203. The pixel values of each block are counted by the image statistics unit 205. One of the purposes is to obtain the image differences between multiple blocks and find similar blocks from them. The image block processing unit 203 can then screen out multiple pairs of paired blocks from them.
[0034] According to an embodiment, one of the methods for screening paired blocks is that the similarity processing unit 207 obtains similar blocks based on the pixel statistics of multiple blocks in the image. For example, similar blocks in the image can be screened out according to one or any combination of the hue difference, brightness and saturation difference, green channel average value (Gmean) difference, and sharpness difference between multiple blocks. Then, multiple pairs of paired blocks are obtained according to the screening results of the similar blocks.
[0035] After the similarity processing unit 207 obtains a sufficient number of paired blocks according to the similarity between blocks, shadow correction is performed by the shadow correction unit 209. The method is as Figure 3 shown in the embodiment, and the shading correction rate for the image can be determined according to the difference ratio of each pair of paired blocks (such as the difference in each color channel), and the shading correction rate is used to perform shadow correction on the image.
[0036] It should be mentioned here that when setting some screening thresholds, it should be considered that the system needs to obtain a sufficient number of paired blocks to effectively perform shadow correction. However, in some cases, the number of paired blocks screened may be too small. Since the system can dynamically adjust the screening threshold during shadow correction and can use weight settings to facilitate obtaining a sufficient number of paired blocks.
[0037] Furthermore, when the system performs automatic shadow correction, to avoid excessive real-time processing of the image, a buffer for performing shadow correction can be set in the system firmware (such as Figure 1 the image processing unit 101 shown). For example, the system provides an arithmetic and memory block (such as Figure 1 a part of the system memory 107 shown) to perform shadow correction. When a sufficient number of paired blocks are not obtained during the shadow correction process, the shadow correction program can be skipped.
[0038] Figure 3 The flowchart of the embodiment of the adaptive image shadow correction method running on the above system is shown.
[0039] The system receives an image and can obtain the pixel values in each color channel of the image (step S301), and then divides the image into multiple blocks according to requirements (step S303). The size and number of the blocks are determined according to specific requirements. For example, the way of dividing the blocks can be determined according to the real-time computing power of the system, and reference can be made to Figure 4 FIG. Figure 4 shows an embodiment diagram of image blocks, in which the image is divided into multiple blocks such as 10*10 and numbered from 0 to 99 respectively.
[0040] Next, similar block screening is performed to form paired blocks (step S305). The method is to count the pixel values of each block, and the average value of various pixel statistics in each block can be taken to obtain the image difference between multiple blocks, and the similarity between each block can be obtained, so as to perform similar block screening according to the similarity between blocks. According to the embodiment, similar blocks in the image can be screened out according to one or any combination of the hue difference, brightness (brightness or lightness) and saturation difference, green channel average value (Gmean) difference, and sharpness difference between multiple blocks.
[0041] According to the embodiment of judging block similarity in the adaptive image shadow correction method, it is necessary to determine the similarity threshold, and the similarity threshold can be determined by synthesizing the above various pixel statistical values. For example, this similarity threshold is calculated based on the hue difference, brightness and saturation difference between multiple blocks, and then this similarity threshold is dynamically adjusted according to the sharpness difference between multiple blocks, as the basis for selecting similar blocks in the image.
[0042] For example, the system first obtains the statistical values describing the image such as hue, saturation, and lightness in the HSL color space in the image described in color channels such as red, green, and blue (RGB).
[0043] After that, taking the hue difference between blocks as an example to judge similar blocks, according to the results of comparing the red channel values and green channel values between multiple blocks, and comparing the blue channel values and green channel values between multiple blocks, the hue difference between multiple blocks is judged. When the hue difference is less than the hue difference threshold set by the system, similar blocks in the image can be judged accordingly.
[0044] Taking the luminance difference between blocks as the basis for judging block similarity as an example, first obtain the pixel luminance information in each region of the image to calculate the average luminance of each region, and then calculate the luminance difference between blocks. Among them, in the implementation, a weight value is introduced to amplify the luminance difference between blocks. When the luminance difference between two blocks is less than the luminance difference threshold, they are similar blocks in the image. Further, since there will be errors in judging similarity only based on luminance difference, the saturation difference between two blocks can also be used to filter non-luminance-similar blocks to avoid misjudgment of similarity.
[0045] Taking the difference in the average value of the green channel (Gmean) as the basis for judging block similarity as an example, it is necessary to classify multiple blocks distinguished in the image into inner blocks and outer blocks, and then calculate the average value of the green channel of the pixels in the inner blocks and the average value of the green channel of the pixels in the outer blocks respectively to obtain the difference in the average value of the green channel between the inner blocks and the outer blocks.
[0046] Taking the judgment of block similarity according to the sharpness difference as an example, the Sobel filter can be used to calculate the gray-scale change gradient of each block as a reference for judging the sharpness difference between blocks. Further, the Sobel filter is used to find the object edges in the image. In the process, the image is first grayscale, and then the image is scanned to find the local change amount of the gray scale between pixels, and this part can be judged as an edge. For example, an object in the image will form an edge with the background image, and then calculate its change gradient. In this example, the sharpness difference is obtained by referring to the gray-scale change gradient.
[0047] The paired blocks are selected according to the block similarity. After referring to Figure 4 the illustrated example of the image block implementation, the paired blocks can be obtained according to the similarity between blocks. For example, block 0 with number 0 can form paired block 0 with block 4 with number 4; block 9 with number 9 can form paired block 1 with block 5 with number 5; block 90 with number 90 can form paired block 2 with block 94 with number 94; block 99 with number 99 can form paired block 3 with block 95 with number 95; block 21 with number 21 can form paired block 4 with block 23 with number 23; and block 28 with number 28 can form paired block 5 with block 26 with number 26, etc. The way of paired blocks is determined according to the pixel statistical values in the actual image and is not limited to this example.
[0048] After obtaining multiple groups of paired blocks based on the similar block screening results, the difference ratio of each group of paired blocks can be obtained next, such as the difference ratio of color channels (step S307). Therefore, the system can determine the shading rate based on the difference ratio of multiple groups of paired blocks (step S309), which is the basis for performing shading correction, enabling the system to perform shading correction using the shading rate (step S311).
[0049] According to the embodiment, the difference ratio in the paired blocks mainly refers to the difference ratio between color channels. For example, the difference ratio between the red channel value (R channel) and the blue channel value (B channel) among each group of paired blocks. After that, when the difference ratio between different color channels among the paired blocks is obtained, the difference ratios of the color channels (such as the red channel value and the blue channel value) of multiple groups of paired blocks can be summed up and then the average value is calculated, and the shading rate for this image is determined based on this average value.
[0050] It should be noted that the basis for determining the shading rate is the degree of shadow caused by the lens in the image, and exposure gain compensation is performed for each block. Therefore, the shading rate is a combination of the gain compensation values for multiple groups of different color channels at the parts of the image affected by the lens to produce shadows. In this way, the shading rate can be adjusted according to the difference ratio between the red channel value and the blue channel value of each group of paired blocks obtained above and the numerical relationship between the red channel value and the blue channel value. The main purpose is to make the color difference less than a certain threshold. After obtaining the shading rate, it is recorded in the memory. After that, when it is determined that there is a scene change, which may cause the relevant gain or color temperature to change by more than a certain degree, at this time, the shading rate needs to be updated to apply the shading correction program for the current scene.
[0051] It should be mentioned that in step S305 of screening similar blocks to form paired blocks, when the system requires correction accuracy in the shading correction program, the image stability still needs to be maintained. Therefore, a moving average filtering method is also adopted in the adaptive image shading correction method to filter out the bias extremum. According to the above embodiment, the system will count the red gain value (RGain) and blue gain value (BGain) of each block for the multiple groups of paired blocks obtained by screening, and filter out the bias extremum using this moving average filtering method to avoid excessive offset caused by a single paired block, thereby ensuring the stability of the shading correction program.
[0052] Figure 5Further shown is a more detailed flowchart of an embodiment of the adaptive image shadow correction method.
[0053] After receiving the image (step S501), the image is divided into multiple blocks and paired (step S503). The calculation process of block similarity will exclude blocks that do not meet the similarity through multiple-layer judgment. The method includes first obtaining the pixel values of each channel of the image (step S505). As described in the above embodiments, information such as the hue, saturation, and brightness of the pixels in the HSL color space can be obtained, and the differences in brightness and saturation are calculated therefrom (step S507), and it is determined whether the differences in brightness and saturation meet the similarity conditions (step S509). This includes the judgment of brightness or saturation differences. According to the embodiment, when the brightness difference between two blocks is obtained and compared with the brightness difference threshold, if it is less than this threshold, it is determined as a similar block in the image. At the same time, the saturation difference between the two blocks can also be used to filter out blocks that are not similar in brightness.
[0054] If it is determined that the blocks are non-similar blocks (no) through brightness and saturation judgment, the paired blocks are discarded (step S511); on the contrary, if it is determined that the blocks are similar blocks (yes), the hue statistical values of each block can be further obtained (step S513). The way to obtain the hue difference is to compare the red channel value and the green channel value between multiple blocks, and compare the blue channel value and the green channel value between multiple blocks. The comparison result is used as the hue difference between multiple blocks, and then compared with the system-set hue difference threshold to determine whether the hue difference between each two blocks meets the similarity conditions (step S515).
[0055] If the hue difference does not meet the similarity conditions (no), the paired blocks are discarded (step S511); on the contrary, if the hue difference meets the similarity conditions (yes), the sharpness comparison is continued (step S517).
[0056] The sharpness difference between blocks can refer to the method proposed in the above embodiments to calculate the gray-scale change gradient of each block using the Sobel filter, and determine whether the sharpness difference meets the similarity conditions (step S519). If it is determined that the sharpness difference does not meet the block similarity conditions (no), the paired blocks are discarded (step S511); on the contrary, if it is determined that the sharpness difference meets the similarity conditions (yes), it means that the judgment of the sequence paired blocks is completed, and multiple groups of paired blocks that meet the similarity conditions are obtained.
[0057] After that, in order to obtain the shadow correction rate for shadow correction, it is necessary to obtain the difference ratio between each pair of paired blocks, which can be the ratio of specific color channel values between each pair of paired blocks. For example, the difference ratio between the red channel (R channel) value and the blue channel (B channel) value. Further, after summing up the difference ratios of the red channel values and the blue channel values of multiple pairs of paired blocks, the average value is calculated, and then the shadow correction rate of the image can be judged according to this average value (step S521), and then the shadow correction is performed with this shadow correction rate (step S523).
[0058] In the shadow correction program, for multiple blocks divided from the image, according to the difference degree of the color channels between the obtained paired blocks, the automatic exposure and automatic white balance adjustment values of each pair of paired blocks are obtained, and a shadow correction curve is established, so that the system can perform lens shadow correction accordingly.
[0059] In particular, when the adaptive image shadow correction method is applied to continuous images, it may face scene changes, and the scene changes also require updating the originally judged shadow correction rate. For related process embodiments, reference can be made to Figure 6 the flowchart of the embodiment for adaptively updating the shadow correction rate shown
[0060] When judging scene changes, because different scenes have differences in color temperature and brightness, it is necessary to adjust the white balance and exposure values when the system processes images, and scene changes are also one of the conditions for triggering automatic lens shadow correction. According to the embodiment, in the system executing the adaptive image shadow correction method, automatic shadow correction is performed using the currently judged shadow correction rate (step S601), and during the process, it is continuously judged whether there is a scene change (step S603).
[0061] In the judgment of scene changes, reference can be made to Figure 7 the process shown, in which it is mainly judged whether there is a scene change according to the change of the block difference of multiple pairs of paired blocks. For example, the method for judging the shadow correction rate described above can be used to continuously calculate the difference ratio between the red channel (R channel) value and the blue channel (B channel) value between each pair of paired blocks, thereby judging whether the scene has changed.
[0062] Among them, the system can determine whether the scene has changed according to the changes in the number and degree of difference of the paired blocks. When the difference between multiple groups of paired blocks greater than the number threshold is greater than the difference threshold, it indicates that the scene has changed (yes), that is, the shadow correction rate is updated according to the degree of difference between the red channel values and blue channel values of multiple groups of paired blocks (step S607), and then the shadow correction program is executed; on the contrary, if the degree of difference of the paired blocks is not greater than the difference threshold, or the number of paired blocks with a difference greater than the difference threshold is not greater than the number threshold, it indicates that there is no scene change, or the degree of scene change does not require adjustment of the shadow correction rate (no), that is, the original shadow correction rate is maintained (step S605).
[0063] Similarly, after completing the scene judgment and updating the shadow correction rate, it is also necessary to use the buffer for the shadow correction program to prevent the occurrence of excessive shadow compensation.
[0064] Regarding the method for judging scene changes, reference can be made to Figure 7 the flowchart of the embodiment shown
[0065] When the system runs the adaptive image shadow correction method, it checks the difference of the paired blocks at any time (step S701), and judges whether the difference of the paired blocks reaches the threshold (step S703). The threshold is such as Figure 6 the difference between the paired blocks described, and the number of paired blocks reaching the difference threshold. If the difference does not reach the threshold (no), the original shadow correction rate is maintained (step S705), and the automatic shadow correction is continued (step S713); if the difference reaches the threshold (yes), calculate the difference ratio of the red channel and blue channel in multiple groups of paired blocks (step S707), and use this difference ratio to judge whether it is necessary to correct the existing shadow correction rate. If the difference ratio exceeds the threshold set by the system (yes), it is necessary to correct the shadow correction rate (step S711), and then execute the automatic shadow correction (step S713).
[0066] The method for adjusting the shadow correction rate can adopt the approximation method. For example, when the calculated degree of difference between the red channel value and blue channel value of each group of paired blocks is greater than the proportion threshold set by the system, it means that the red channel value and blue channel value within the paired block are relatively small. In this case, it is necessary to increase the shadow correction rate to increase the red channel value and blue channel value; on the contrary, if the degree of difference between the red channel value and blue channel value of each group of paired blocks is less than this proportion threshold, it means that the red channel value and blue channel value within the paired block are relatively large, and it is necessary to decrease the shadow correction rate to reduce the red channel value and blue channel value.
[0067] In summary, according to the above-described embodiments of the adaptive image shadow correction method and system, the method is to solve the problem of luminance shadows and color shadows in an image caused by uneven refracted light due to the optical characteristics of a photographic lens, and can automatically adjust the shadow correction rate obtained by the system under different light sources to improve the color shadow problem caused by metamerism. Specifically, similar blocks in the image are first judged, and then paired blocks are selected from them. Therefore, the shadow correction method performs shadow correction based on the difference characteristics of these paired blocks. Further, real-time adjustment can also be performed according to the scene change in consecutive images, and the adjustment process also needs to wait until the scene change is stable before starting shadow correction. For example, shadow correction is performed after automatic exposure (AE) and automatic white balance (AWB) are stable.
[0068] The content disclosed above is only the preferred feasible embodiment of the present invention, and does not limit the scope of the patent application of the present invention. Therefore, all equivalent technical changes made by using the content of the specification and drawings of the present invention are included in the scope of the patent application of the present invention.
[0069]
Symbol Explanation
[0070] 101: Image processing unit
[0071] 103: Image capture unit
[0072] 105: Lens
[0073] 107: Memory
[0074] 109: Output interface
[0075] 111: Display unit
[0076] 201: Image acquisition unit
[0077] 203: Image block processing unit
[0078] 205: Image statistics unit
[0079] 207: Similarity processing unit
[0080] 209: Shadow correction unit
[0081] Steps S301 - S311 Adaptive image shadow correction
[0082] Steps S501 - S523 Adaptive image shadow correction
[0083] Steps S601 - S607 Adaptive update shadow correction rate process
[0084] Steps S701 - S713 Process for judging scene change.
Claims
1. An adaptive image shadow correction method, comprising: Receiving an image and obtaining pixel values in each color channel of the image; Dividing the image into a plurality of blocks, counting the pixel values of each block, obtaining the image differences between the plurality of blocks, and performing similar block screening; Deriving multiple groups of paired blocks according to the similar block screening results; Obtaining the degree of difference in each group of paired blocks; Judging the shadow correction rate for the image according to the degree of difference in the multiple groups of paired blocks; and Performing shadow correction on the image by using the shadow correction rate.
2. The adaptive image shadow correction method according to claim 1, wherein similar blocks in the image are screened out according to one or any combination of the hue difference, brightness and saturation difference, green channel average difference, and sharpness difference between the plurality of blocks.
3. The adaptive image shadow correction method according to claim 2, wherein, Calculating a similarity threshold according to the hue difference, brightness and saturation difference between the plurality of blocks, and then dynamically adjusting the similarity threshold according to the sharpness difference between the plurality of blocks, as a basis for selecting similar blocks in the image.
4. The adaptive image shadow correction method according to claim 2, wherein, Judging the hue difference between the plurality of blocks according to the results of comparing the red channel value and the green channel value between the plurality of blocks and comparing the blue channel value and the green channel value between the plurality of blocks.
5. The adaptive image shadow correction method according to claim 2, wherein, First obtaining the pixel brightness information in each area of the image to calculate the average brightness of each area, and then calculating the brightness difference between the blocks; then introducing a weight value to amplify the brightness difference between the blocks, and using the saturation difference between two blocks to filter non-brightness similar blocks. When the brightness difference between two blocks is less than the brightness difference threshold, they are similar blocks in the image.
6. The adaptive image shadow correction method according to claim 2, wherein, Classifying the plurality of blocks divided from the image into inner blocks and outer blocks, and then respectively calculating the average green channel value of the pixels in the inner blocks and the average green channel value of the pixels in the outer blocks to obtain the green channel average difference between the inner blocks and the outer blocks.
7. The adaptive image shadow correction method according to claim 2, wherein the sharpness difference is calculated by using a Sobel filter to calculate the gray-level change gradient of each block.
8. The adaptive image shadow correction method according to claim 1, wherein the degree of difference in each group of paired blocks includes the degree of difference between the red channel value and the blue channel value. After summing the degree of difference between the red channel value and the blue channel value of the multiple groups of paired blocks, an average value is calculated, and the shadow correction rate of the image is judged according to the average value.
9. The adaptive image shadow correction method according to any one of claims 1 to 8, wherein the adaptive image shadow correction method is applied to continuous images, and while performing shadow correction on each image using the shadow correction rate, it is determined whether there is a scene change based on the change in the block difference of the multiple sets of paired blocks. If it is determined that there is a scene change, the shadow correction rate is updated; wherein, When the difference between more than a quantity threshold of the multiple groups of paired blocks is greater than the difference threshold, the shadow correction rate is updated according to the degree of difference between the red channel value and the blue channel value of the multiple groups of paired blocks.
10. A system for performing an adaptive image shadow correction method, comprising: An image processing unit, which performs an adaptive image shadow correction method, comprising: Receiving an image generated by shooting through a lens and obtaining pixel values in each color channel of the image; Dividing the image into a plurality of blocks, counting the pixel values of each block, obtaining the image differences between the plurality of blocks, and performing similar block screening; Deriving multiple groups of paired blocks according to the similar block screening results; Obtain the degree of difference in each group of paired blocks; Determine the shadow correction rate for the image according to the degree of difference in the multiple groups of paired blocks; and Perform shadow correction on the image using the shadow correction rate.