Image processing method and device, computer readable storage medium and terminal equipment
By calculating the pixel point change before and after image enhancement and correcting, the problem of local details loss after image enhancement is solved, and the image quality and enhancement effect are improved.
Patent Information
- Application Number
- CN202311085065.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2025-03-04
AI Technical Summary
After image enhancement, there is a problem of local details loss in the picture/video.
By acquiring the first picture before enhancement and the second picture after enhancement, the amount of change between the pixel points and the adjacent pixel points in each area in both is calculated, the correction amplitude is calculated based on the difference, and the pixel values in the second picture are corrected to add local details in the first picture.
It alleviates the problem of loss of local details in enhanced pictures, improves the quality and enhancement effect of pictures, and makes the corrected pixel value change more natural.
Smart Images

Figure CN119559058A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image processing method and apparatus, a computer-readable storage medium, and a terminal device. Background Art
[0002] Deep learning technology has been used in more and more scenarios, and most deep learning is supervised. For example, in the task of image dynamic range enhancement, pictures need to be used as supervisory labels. These supervisory labels are often obtained by manual image retouching. After manual image retouching, the modified pictures will introduce problems such as color cast, local detail loss, and video flicker due to changes in the brightness and contrast of different areas of the input picture. Such problematic pictures are used as supervisory labels for training models, and the resulting models often have problems such as color cast, local detail loss, and video flicker, resulting in problems such as color cast, local detail loss, and video flicker in the enhanced pictures.
[0003] However, the loss of details in enhanced images is still a technical problem that needs to be solved. Summary of the invention
[0004] The technical problem to be solved by this application is the problem of local detail loss in images / videos after image enhancement.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] In a first aspect, an image processing method is provided, the image processing method comprising: acquiring a first picture and a second picture, the second picture being a picture after enhancing the first picture; calculating a first change in pixel values between each first pixel point in each first area of the first picture and its adjacent pixel points, and a second change in pixel values between each second pixel point in each second area of the second picture and its adjacent pixel points; for each second area, calculating a correction amplitude according to a first difference between a first change in the first area corresponding to the second area and a second change in the second area, and correcting the pixel value of each second pixel point in the second area according to the correction amplitude.
[0007] Optionally, the calculation of the first change amount between each first pixel point and its neighboring pixel points in each first area in the first image includes: for each first area, calculating the first mean value of the pixel values of each pixel point in the first area, and the difference between each pixel point and the first mean value, as the first change amount; the calculation of the second change amount between each second pixel point and its neighboring pixel points in each second area in the second image includes: for each second area, calculating the second mean value of the pixel values of each pixel point in the second area, and the difference between each pixel point and the second mean value, as the second change amount.
[0008] Optionally, calculating the correction amplitude based on a first difference between a first change amount of a first area corresponding to the second area and a second change amount of the second area includes: calculating the correction amplitude using a smoothing function and the first difference, the larger the first difference is, the larger the correction amplitude is.
[0009] Optionally, the first difference is calculated in the following manner: calculating a third mean of the first variation corresponding to each pixel point in each color channel, and a fourth mean of the second variation corresponding to each pixel point in each color channel; calculating the difference between the third mean and the fourth mean as the first difference
[0010] Optionally, correcting the pixel value of each second pixel point in the second area according to the correction amplitude includes: weighting the weight corresponding to each second pixel point, the correction amplitude and the first change amount; summing the weighted value with the pixel value of the second pixel point to obtain the corrected pixel value of the second pixel point, the weight corresponding to the second pixel point located at the center of the second area is greater than or equal to the weights corresponding to other pixel points.
[0011] Optionally, after acquiring the first picture and the second picture, the method further includes: dividing the first picture into multiple regions to obtain multiple first regions, and dividing the second picture into multiple regions to obtain multiple second regions; or, moving a first sliding window in the first picture to obtain the first region, and moving a second sliding window in the second picture to obtain the second region.
[0012] Optionally, the image processing method further includes: respectively calculating the ratios of the values of each color channel of each first pixel point to the values of each color channel to obtain multiple sets of ratios; respectively weighting the ratios of the values of each second pixel point in each color channel to the values corresponding to the color channel to obtain multiple sets of correction values; and correcting the values of each second pixel point in each color channel using at least the multiple sets of correction values.
[0013] Optionally, correcting the value of each second pixel in each color channel using at least the multiple sets of correction values includes: calculating the mean difference between the first pixel and the second pixel as a first correction value; and correcting the value of each second pixel in each color channel using the multiple sets of correction values and the first correction value.
[0014] Optionally, the ratio of the value of each color channel of each second pixel to the sum of the values of all color channels is calculated as the weighted weight of the color channel; and the value of the corrected second pixel in each color channel is weightedly calculated using the weighted weights of each color channel and the corresponding correction value.
[0015] Optionally, the smoothing function is a S-type function.
[0016] In a second aspect, the present application also discloses an image processing device, which includes: an acquisition module, used to acquire a first image and a second image, wherein the second image is an image after enhancing the first image; a change calculation module, used to calculate a first change in pixel values between each first pixel point in each first area of the first image and its adjacent pixel points, and a second change in pixel values between each second pixel point in each second area of the second image and its adjacent pixel points; a correction module, used to calculate a correction amplitude for each second area according to a first difference between the first change amplitude of the first area corresponding to the second area and the second change amplitude of the second area, and correct the pixel value of each second pixel point in the second area according to the correction amplitude.
[0017] According to a third aspect, a computer-readable storage medium is provided, on which a computer program is stored. The computer program is executed by a processor to execute any one of the methods provided in the first aspect.
[0018] According to a fourth aspect, a computer program product is provided, on which a computer program is stored, and the computer program is executed by a processor to perform any one of the methods provided in the first aspect.
[0019] In a fifth aspect, an embodiment of the present application further provides a chip (or a data transmission device) on which a computer program is stored, and when the computer program is executed by the chip, the steps of the above method are implemented.
[0020] In the sixth aspect, an embodiment of the present application also provides a system chip, which is applied to a terminal, and the chip system includes at least one processor and an interface circuit, the interface circuit and the at least one processor are interconnected through lines, and the at least one processor is used to execute instructions to execute any one of the methods provided in the first aspect.
[0021] Compared with the prior art, the technical solution of this application has the following beneficial effects:
[0022] In the technical solution of the present application, a first image and a second image are obtained, and the second image is an image after the first image is enhanced; the first change amount between each first pixel point and its neighboring pixel points in each first area of the first image, and the second change amount between each second pixel point and its neighboring pixel points in each second area of the second image are calculated; for each second area, a correction amplitude is calculated according to the first difference between each first change amount and each second change amount, and the pixel value of each second pixel point in the second area is corrected according to the correction amplitude. The technical solution of the present application refers to the relationship between the first pixel point and its neighboring pixel points in the first image before enhancement, and corrects the relationship between the second pixel point and its neighboring pixel points in the enhanced second image, so as to add local details in the first image to the second image, alleviate the problem of local detail loss in the second image, and improve the quality of the second image and the image enhancement effect.
[0023] Furthermore, a correction amplitude is calculated using a smoothing function and the first difference, and the larger the first difference, the larger the correction amplitude. The present application calculates the correction amplitude by a smoothing function, so that the correction amplitude can change smoothly with the first difference, thereby making the pixel value in the corrected second image change naturally, and further improving the quality of the corrected second image.
[0024] Furthermore, the ratios of the values of each color channel of each first pixel to the values of each color channel are calculated respectively to obtain multiple groups of ratios; the ratios of the values of each second pixel in each color channel to the corresponding values of the color channel are weighted respectively to obtain multiple groups of correction values; and the values of each second pixel in each color channel are corrected using at least multiple groups of correction values. The present application considers more comprehensive color channel ratio relationships, such as r / g, b / g, g / r, g / b, b / r, b / g, r / b and other ratio relationships, and calculates the values of the second pixel in each color channel by weight, so as to better handle the color cast correction problem in areas with obvious color tendencies, without introducing obvious artifacts, and improve the effect of image color cast correction. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flow chart of an image processing method provided by an embodiment of the present application;
[0026] Figure 2 is a framework diagram of an image processing system provided in an embodiment of the present application;
[0027] Figure 3 is a flowchart of another image processing method provided by an embodiment of the present application;
[0028] Figure 4 is a curve diagram of the first difference and the correction amplitude provided in an embodiment of the present application;
[0029] Figure 5 is a framework diagram of another image processing system provided in an embodiment of the present application;
[0030] Figure 6 is a flowchart of another image processing method provided in an embodiment of the present application;
[0031] Figure 7 is a structural schematic diagram of an image processing device provided in an embodiment of the present application;
[0032] Figure 8 It is a schematic diagram of the hardware structure of an image processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] As described in the background technology, the loss of details in the enhanced image is still a technical problem that needs to be solved urgently.
[0034] In addition, existing color cast correction often separates brightness and color information, such as converting from RGB domain to HSV for correction, and this method may introduce color stratification problems.
[0035] The technical solution of the present application refers to the relationship between the first pixel and its neighboring pixels in the first image before enhancement, and corrects the relationship between the second pixel and its neighboring pixels in the second image after enhancement, thereby adding local details in the first image to the second image, alleviating the problem of local detail loss in the second image, and improving the quality of the second image and the image enhancement effect.
[0036] Furthermore, the present application considers more comprehensive color channel ratio relationships, such as r / g, b / g, g / r, g / b, b / r, b / g, r / b and other ratio relationships, and calculates the value of the second pixel point in each color channel by weighted calculation. In this way, the color cast correction problem in areas with obvious color tendencies can be better handled without introducing obvious artifacts, thereby improving the effect of image color cast correction.
[0037] The first picture or the second picture referred to in the embodiment of the present invention may be a single picture or a video frame in a video.
[0038] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0039] See also Figure 1 The method provided in this application specifically includes the following steps:
[0040] Step 101: Obtain a first picture and a second picture, where the second picture is a picture obtained by enhancing the first picture;
[0041] Step 102: Calculate a first variation between each first pixel point in each first region in the first image and its adjacent pixel points, and a second variation between each second pixel point in each second region in the second image and its adjacent pixel points;
[0042] Step 103: For each second area, a correction amplitude is calculated according to a first difference between a first change amount of the first area corresponding to the second area and a second change amount of the second area, and pixel values of each second pixel point in the second area are corrected according to the correction amplitude.
[0043] It should be pointed out that the serial numbers of the steps in this embodiment do not limit the execution order of the steps.
[0044] It is understandable that, in a specific implementation, the image processing method can be implemented in the form of a software program, and the software program runs in a processor integrated inside a chip or a chip module. The method can also be implemented in the form of software combined with hardware, which is not limited in this application.
[0045] In this embodiment, refer to Figure 2 , the image enhancement device 20 can enhance the first picture and output the second picture. Alternatively, the image enhancement device 20 can enhance the first video and output the second video, the first picture is a video frame in the first video, and the second picture is a video frame in the second video corresponding to the first picture.
[0046] The image correction device 30 can perform Figure 1 The first picture and the second picture are input to the image correction device 30, and the image correction device 30 outputs the corrected second picture. Specifically, the image correction device 30 can correct the local details in the second picture, and compared with the second picture before correction, the corrected second picture has more local details and the quality of the corrected second picture is higher.
[0047] Continue to refer to Figure 1 In the specific implementation of step 101, after obtaining the first image before enhancement and the second image after enhancement, each first region in the first image and each second region in the second image are obtained. The first region and the second region have the same size, for example, 3 pixels×3 pixels.
[0048] In a specific implementation, the first image is divided into multiple regions to obtain multiple first regions, and the second image is divided into multiple regions to obtain multiple second regions. The first image and the second image are divided in the same division manner, the number of the obtained first regions and the size of the obtained second regions are the same, and the multiple first regions correspond to the multiple second regions in position.
[0049] In another specific implementation, a first sliding window is moved in a first image to obtain a first region, and a second sliding window is moved in a second image to obtain a second region. The first sliding window and the second sliding window have the same size, for example, 3 pixels×3 pixels. The first sliding window and the second sliding window are moved in the same manner, so that the obtained multiple first regions correspond to the obtained multiple second regions in position.
[0050] In the specific implementation of step 102, for each first region, the first variation between each first pixel and its neighboring pixel is calculated. Correspondingly, for each second region, the second variation between each second pixel and its neighboring pixel is calculated.
[0051] Further, the first pixel point can be the central pixel point of the first area, then the first change is the change in pixel value between the central pixel point and other pixel points in the first area; the second pixel point is the central pixel point of the second area, then the second change is the change in pixel value between the central pixel point and other pixel points in the second area.
[0052] Please refer to Figure 3 , Figure 3 Step 301 shows a specific method of calculating the first variation and the second variation.
[0053] Specifically, for each first region, a first mean value of the pixel values of each pixel point in the first region and a difference between each pixel point and the first mean value are calculated as a first variation. For each second region, a second mean value of the pixel values of each pixel point in the second region and a difference between each pixel point and the second mean value are calculated as a second variation.
[0054] For example, the first picture is represented as org_img, and the second picture is represented as org_label_img. The sizes of the first region and the second region are 3 pixels×3 pixels.
[0055] Calculate the first mean org_mean of each first pixel and the surrounding areas above, below, left, and right of the first image org_img, and the second mean org_label_mean of each second pixel and the surrounding areas above, below, left, and right of the second image org_label_img, respectively. Calculate the difference between the first pixel and its surrounding areas, i.e., the first variation delta_org. Calculate the difference between the second pixel and its surrounding areas, i.e., the second variation delta_org_label. The specific formula is as follows:
[0056] delta_org = org_img – org_mean (1)
[0057] delta_org_label = org_label_img – org_label_mean (2)
[0058] In a specific implementation, the first difference diff_delta may be a difference between a first variation of a first pixel and a second variation of a second pixel corresponding to the first pixel, as shown in formula (3):
[0059] diff_delta=abs(delta_org- delta_org_label) (3)
[0060] Among them, abs() represents the absolute value function.
[0061] In another specific implementation, the first change amount and the second change amount on each color channel are first calculated, and then the average of the difference between the pixel values of the first pixel point and its neighboring area in the three RGB color channels, and the average of the difference between the pixel values of the second pixel point and its neighboring area in the three RGB color channels are calculated. The specific formula is as follows:
[0062] mean_delta_org = mean(abs(delta_org)) (4)
[0063] mean_delta_org_label = mean(abs(delta_org_label)) (5)
[0064] In this case, the first difference diff_delta is the difference between the above difference means, and the specific formula is as follows:
[0065] diff_delta = abs(mean_delta_org- mean_delta_org_label) (6)
[0066] The first difference diff_delta has a value range of [0,255].
[0067] Continue to refer to Figure 1 In the specific implementation of step 103, the correction amplitude cgp can be calculated based on the first difference diff_delta, and the correction amplitude cgp represents the adjustment amplitude of the pixel value when performing detail correction on the second pixel point.
[0068] Refer to Figure 3Step 302 shows a specific implementation step for calculating the correction amplitude. The correction amplitude is calculated using a smoothing function and a first difference. The first difference is positively correlated with the correction amplitude. That is, the larger the first difference, the larger the correction amplitude; conversely, the smaller the first difference, the smaller the correction amplitude.
[0069] In a specific embodiment, the smoothing function is a sigmoid function, the first difference diff_delta is an input of the sigmoid function, and the correction amplitude is an output of the sigmoid function.
[0070] For example, the formula for calculating the correction amplitude cgp using the S-type function is as follows:
[0071]
[0072] Wherein, k and b are empirical constants, for example, k=0.5 and b=-5.
[0073] The embodiment of the present invention calculates the correction amplitude through a smoothing function, so that the correction amplitude can change smoothly with the first difference, so that the pixel values in the corrected second image change naturally, and the quality of the corrected second image is further improved.
[0074] Please refer to Figure 4 , Figure 4 The curve of the change of the first difference and the correction amplitude is shown. Taking the first difference diff_delta taking a value of 0 to 50 as an example, the curve is drawn, the horizontal axis is the first difference diff_delta, and the vertical axis is the correction amplitude cgp.
[0075] Continue to refer to Figure 3 In step 303, the weight corresponding to each second pixel point is weighted with the correction amplitude and the first change amount, and the weighted value is summed with the pixel value of the second pixel point to obtain the corrected pixel value of the second pixel point.
[0076] The weight corresponding to the second pixel point located at the center of the second area is greater than or equal to the weights corresponding to other pixel points.
[0077] Taking the size of the second area as 3 pixels×3 pixels as an example, the weight corresponding to the second pixel is 0.5, and the weights corresponding to other pixels in the second area are 0.125.
[0078] For example, the calculation formula of the pixel value after correction of the second pixel point is as follows:
[0079] rectify_rgb = org_label_img+0.5×delta_org×cgp (8)
[0080] The calculation formula for the corrected pixel values of the other 8 pixels in the second area is as follows:
[0081] rectify_rgb = org_label_img+0.125×delta_org×cgp (9)
[0082] It should be noted that the sizes of the first area and the second area may also be any other feasible values, such as 4 pixels×4 pixels, and the weights corresponding to other pixels may be 0.067.
[0083] In addition, as mentioned above, the first region may be obtained through a first sliding window, for example, the size of the first sliding window is N×N, in which case the moving stride of the first sliding window may be N, and there is no overlap between adjacent windows. Correspondingly, the second region may be obtained through a second sliding window, the moving stride of the second sliding window may also be N, and there is no overlap between adjacent windows.
[0084] At this point, the above-mentioned detail correction process is performed on each pixel point in the second image, the detail correction of the second image is completed, and the second image after detail correction is obtained.
[0085] The embodiment of the present application refers to the relationship between the first pixel and its neighboring pixels in the first image before enhancement, and corrects the relationship between the second pixel and its neighboring pixels in the second image after enhancement, thereby adding local details in the first image to the second image, alleviating the problem of local detail loss in the second image, and improving the quality of the second image and the image enhancement effect.
[0086] Refer to Figure 5 In addition to performing detail correction 501 on the second image, the image correction device 30 can also perform color cast correction 502 on the second image to correct the color cast problem in the second image.
[0087] Please refer to Figure 6 , Figure 6 The process of performing color cast correction on the second image is shown.
[0088] In step 601, the ratios of the values of each color channel of each first pixel to the values of each color channel are calculated respectively to obtain multiple sets of ratios.
[0089] Taking the color channel as RGB as an example, the ratio of the color channel R, G, B values of each first pixel to the color channel R is calculated to obtain a set of ratios ratio_rr, ratio_gr, ratio_br. The specific formula is as follows:
[0090] ratio_rr = 1 (10)
[0091] ratio_gr = org_g / org_r (11)
[0092] ratio_br = org_b / org_r (12)
[0093] If the denominator is zero, the ratio is not calculated.
[0094] Accordingly, the ratios of the values of the color channels R, G, and B of each first pixel to the color channel G are calculated respectively to obtain a set of ratios ratio_rg, ratio_gg, and ratio_bg.
[0095] The ratios of the values of the color channels R, G, and B of each first pixel to the color channel B are calculated respectively to obtain a set of ratios ratio_rb, ratio_gb, and ratio_bb.
[0096] In step 602, the value of each second pixel in each color channel and the ratio corresponding to the color channel are weighted to obtain multiple groups of correction values.
[0097] For a set of ratios ratio_rr, ratio_gr, ratio_br, weight them with the value of each second pixel in the color channel R to obtain a set of correction values rectify_rr, rectify_gr, rectify_br. The specific formula is as follows:
[0098] rectify_rr = org_label_r×ratio_rr (13)
[0099] rectify_gr = org_label_r×ratio_gr (14)
[0100] rectify_br = org_label_r×ration_br (15)
[0101] Among them, org_label_r represents the value of the second pixel in the R channel.
[0102] For a set of ratios ratio_rg, ratio_gg, ratio_bg, weight them with the value of each second pixel in the color channel G to obtain a set of correction values rectify_rg, rectify_gg, rectify_bg.
[0103] For a set of ratios ratio_rb, ratio_gb, ratio_bb, weight them with the value of each second pixel in color channel B to obtain a set of correction values rectify_rb, rectify_gb, rectify_bb.
[0104] Furthermore, the correction values that exceed the preset range are modified. For example, the first picture and the second picture are both 8-bit pictures, and their data representation range is 0 to 255. If there are correction values exceeding 255 in a set of correction values, they need to be modified so that the correction values fall within the range of 0 to 255. Taking a set of correction values rectify_rr, rectify_gr, rectify_br as an example, the specific formula is as follows:
[0105] maxv = max(rectify_rr,rectify_gr,rectify_br) (16)
[0106] rectify_rr = rectify_rr / maxv×255 (17)
[0107] rectify_gr = rectify_gr / maxv×255 (18)
[0108] rectify_br = rectify_br / maxv×255 (19)
[0109] In step 603, the value of each second pixel in each color channel is corrected using at least a plurality of sets of correction values.
[0110] Specifically, a weighted sum of multiple groups of correction values and corresponding weights is calculated to obtain the corrected value of the second pixel on each color channel.
[0111] Specifically, the ratio of the value of each color channel of each second pixel to the sum of the values of all color channels is calculated as the weighted weight of the color channel. The weighted weights of each color channel and the corresponding correction value are used to weight the values of the second pixel in each color channel after correction.
[0112] For example, the weighted weight of each color channel is calculated according to the proportion of each color channel org_label_r, org_label_g, and org_label_b of the second pixel. The specific formula is as follows:
[0113] pr = org_label_r / (org_label_r+org_label_g+org_label_b) (20)
[0114] pg = org_label_g / (org_label_r+org_label_g+org_label_b) (21)
[0115] pb = org_label_b / (org_label_r+org_label_g+org_label_b) (22)
[0116] If a set of correction values rectify_rr, rectify_gr, rectify_br corresponding to the color channel R are not calculated, the weighted weight pr corresponding to the color channel R is zero.
[0117] Correspondingly, if a set of correction values rectify_rg, rectify_gg, rectify_bg corresponding to the color channel G are not calculated, the weighted weight pg corresponding to the color channel G is zero.
[0118] If a set of correction values rectify_rg, rectify_gg, rectify_bg corresponding to color channel B are not calculated, the weighted weight pb corresponding to color channel B is zero.
[0119] In a non-limiting embodiment, the difference mean between the first pixel and the second pixel is calculated as the first correction value; and the values of each second pixel in each color channel are corrected using multiple sets of correction values and the first correction value.
[0120] Specifically, by calculating the mean difference between the RGB value of the second image org_label_img and the RGB value of the first image org_img at each pixel, the first correction value mean_diffs is obtained to represent the average difference of each pixel in all color channels. The first correction value mean_diffs is added to the second image org_label_img to obtain a correction image rectify_mean_diffs. This correction will not cause the ratio to be unable to be calculated due to the zero division problem.
[0121] Accordingly, in step 603, the values of each second pixel in each color channel are corrected using the multiple groups of correction values and the first correction value.
[0122] The weighted weight corresponding to the first correction value is the absolute value of the difference between the sum of the weighted weights corresponding to each color channel and 1, that is, pmean_diff=(1-pr-pg-pb).
[0123] Assume that the first correction values of each color channel on the correction map rectify_mean_diffs are rectify_mean_diffs_r, rectify_mean_diffs_g, rectify_mean_diffs_b. The weights of rectify_mean_diffs_r, rectify_mean_diffs_g, rectify_mean_diffs_b are pmean_diff.
[0124] The correction value of the second pixel in each color channel is shown in the following formula:
[0125] rectify_r=pr×rectify_rr+pg×rectify_rg+pb×rectify_rb+(1-pr-pg-pb)×rectify_mean_diffs_r(23)
[0126] rectify_g=pr×rectify_gr+pg×rectify_gg+pb×rectify_gb+(1-pr-pg-pb)×rectify_mean_diffs_g(24)
[0127] rectify_b=pr×rectify_br+pg×rectify_bg+pb×rectify_bb+(1-pr-pg-pb)×rectify_mean_diffs_b(25)
[0128] The embodiment of the present invention considers more comprehensive color channel ratio relationships, such as r / g, b / g, g / r, g / b, b / r, b / g and other ratio relationships, and calculates the value of the second pixel point in each color channel by weighted calculation. It can better handle the color cast correction in areas with obvious color tendencies without introducing obvious artifacts, thereby improving the effect of image color cast correction.
[0129] In addition, when the second picture is a video frame in a video, the image correction device 30 can also perform flicker correction on the second picture to improve the problem of video flicker. Specifically, the image correction device 30 can use any implementable algorithm to perform flicker correction on the second picture, and this application does not limit this.
[0130] It should be noted that the image correction device 30 can selectively perform detail correction 501, color cast correction 502 and / or flicker correction 503, and the above three correction processes can be independently executed in parallel or in series, and the present application does not impose any limitation on this.
[0131] For more specific implementation methods of the embodiments of the present application, please refer to the aforementioned embodiments, which will not be repeated here.
[0132] Please refer to Figure 7 , Figure 7 An image processing device 70 is shown, and the image processing device 70 may include:
[0133] An acquisition module 701 is used to acquire a first picture and a second picture, where the second picture is a picture obtained by enhancing the first picture;
[0134] The variation calculation module 702 is used to calculate a first variation of the pixel values of each first pixel point in each first area of the first picture and its neighboring pixel points, and a second variation of the pixel values of each second pixel point in each second area of the second picture and its neighboring pixel points;
[0135] The correction module 703 is used to calculate the correction amplitude for each second area according to the first difference between the first change amount of the first area corresponding to the second area and the second change amount of the second area, and correct the pixel value of each second pixel point in the second area according to the correction amplitude.
[0136] In a specific implementation, the above-mentioned image processing device 70 can correspond to a chip with image processing function in a terminal device, such as a system-on-a-chip (SOC), a baseband chip, etc.; or correspond to a chip module with a power control parameter determination function in the terminal device; or correspond to a chip module with a data processing function chip, or correspond to a terminal device.
[0137] For other related descriptions about the image processing device 70 , reference may be made to the related descriptions in the aforementioned embodiments, which will not be repeated here.
[0138] Regarding the various modules / units included in the various devices and products described in the above embodiments, they can be software modules / units, or hardware modules / units, or they can be partially software modules / units and partially hardware modules / units. For example, for various devices and products applied to or integrated in a chip, the various modules / units included therein can all be implemented in the form of hardware such as circuits, or at least some of the modules / units can be implemented in the form of software programs, which run on a processor integrated inside the chip, and the remaining (if any) modules / units can be implemented in the form of hardware such as circuits; for various devices and products applied to or integrated in a chip module, the various modules / units included therein can all be implemented in the form of hardware such as circuits, and different modules / units can be located in the same component of the chip module (such as a chip, circuit module, etc.) or in different components, or at least some of the modules / units can be implemented in the form of software programs. It is implemented in the form of a software program, which runs on a processor integrated inside the chip module, and the remaining (if any) modules / units can be implemented in hardware such as circuits; for various devices and products applied to or integrated in the terminal equipment, the various modules / units contained therein can be implemented in hardware such as circuits, and different modules / units can be located in the same component (for example, chip, circuit module, etc.) or different components in the terminal equipment, or, at least some modules / units can be implemented in the form of a software program, which runs on a processor integrated inside the terminal equipment, and the remaining (if any) modules / units can be implemented in hardware such as circuits.
[0139] The present application also discloses a storage medium, which is a computer-readable storage medium and stores a computer program, which can be executed when the computer program is run. Figures 1 to 3 The steps of the method shown in . The storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc. The storage medium may also include a non-volatile memory (non-volatile) or a non-transitory memory, etc.
[0140] Please refer to Figure 8 The embodiment of the present application also provides a hardware structure diagram of a communication device. The device includes a processor 801, a memory 802 and a transceiver 803.
[0141] Processor 801 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application. Processor 801 may also include multiple CPUs, and processor 801 may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor here may refer to one or more devices, circuits, or processing cores for processing data (such as computer program instructions).
[0142] The memory 802 may be a ROM or other types of static storage devices that can store static information and instructions, a RAM or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, and the embodiments of the present application do not impose any restrictions on this. The memory 802 may exist independently (in this case, the memory 802 may be located outside the device or inside the device), or it may be integrated with the processor 801. Among them, the memory 802 may contain a computer program code. The processor 801 is used to execute the computer program code stored in the memory 802, thereby realizing the method provided in the embodiments of the present application.
[0143] The processor 801, the memory 802 and the transceiver 803 are connected via a bus. The transceiver 803 is used to communicate with other devices or communication networks. Optionally, the transceiver 803 may include a transmitter and a receiver. The device used to implement the receiving function in the transceiver 803 can be regarded as a receiver, and the receiver is used to perform the receiving step in the embodiment of the present application. The device used to implement the sending function in the transceiver 803 can be regarded as a transmitter, and the transmitter is used to perform the sending step in the embodiment of the present application.
[0144] when Figure 5 The schematic diagram of the structure shown in FIG. 1 is used to illustrate the structure of the terminal device involved in the above embodiment. The processor 801 is used to control and manage the actions of the terminal device. For example, the processor 801 is used to support the terminal device to execute Figure 1 , Figure 3 or Figure 6 The processor 801 may communicate with other network entities, for example, the network devices described above, through the transceiver 803. The memory 802 is used to store program codes and data of the terminal device.
[0145] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article indicates that the associated objects before and after are in an "or" relationship.
[0146] The "plurality" appearing in the embodiments of the present application refers to two or more.
[0147] The first, second, etc. descriptions appearing in the embodiments of the present application are only used for illustration and distinction of the description objects. There is no order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.
[0148] The "connection" that appears in the embodiments of the present application refers to various connection methods such as direct connection or indirect connection to achieve communication between devices, and the embodiments of the present application do not impose any limitations on this.
[0149] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means.
[0150] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0151] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. For example, the device embodiments described above are merely schematic; for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation; for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0152] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0153] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0154] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present application.
[0155] Although the present application is disclosed as above, the present application is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the protection scope of the present application shall be subject to the scope defined by the claims.
Claims
1. An image processing method, characterized in that: include: Acquire a first picture and a second picture, where the second picture is a picture obtained by enhancing the first picture; Calculating a first change in pixel values between each first pixel point in each first area in the first picture and its neighboring pixel points, and a second change in pixel values between each second pixel point in each second area in the second picture and its neighboring pixel points; For each second area, a correction amplitude is calculated according to a first difference between a first change amount of the first area corresponding to the second area and a second change amount of the second area, and pixel values of each second pixel point in the second area are corrected according to the correction amplitude.
2. The image processing method according to claim 1, characterized in that: The calculating of the first variation between each first pixel point and its neighboring pixel points in each first region in the first picture comprises: for each first region, calculating a first mean value of the pixel values of each pixel point in the first region, and a difference between each pixel point and the first mean value, as the first variation; The calculating the second variation between each second pixel point and its adjacent pixel points in each second area of the second picture comprises: For each second region, a second mean value of pixel values of each pixel point in the second region and a difference between each pixel point and the second mean value are calculated as the second variation.
3. The image processing method according to claim 1, characterized in that: The calculating of the correction amplitude according to a first difference between a first change amount of the first area corresponding to the second area and a second change amount of the second area comprises: The correction amplitude is calculated using a smoothing function and the first difference. The larger the first difference is, the larger the correction amplitude is.
4. The image processing method according to claim 1, characterized in that: The first difference is calculated in the following way: Calculate the third mean of the first variation corresponding to each pixel point in each color channel, and the fourth mean of the second variation corresponding to each pixel point in each color channel; A difference between the third mean and the fourth mean is calculated as the first difference.
5. The image processing method according to claim 1, characterized in that: The correcting the pixel value of each second pixel point in the second area according to the correction amplitude comprises: The weight corresponding to each second pixel point is weighted with the correction amplitude and the first change; the weighted value is summed with the pixel value of the second pixel point to obtain the corrected pixel value of the second pixel point, and the weight corresponding to the second pixel point located at the center of the second area is greater than or equal to the weights corresponding to other pixel points.
6. The image processing method according to claim 1, characterized in that: Also includes: Calculating the ratios of the values of each color channel of each first pixel to the values of each color channel to obtain multiple sets of ratios; Weighting the ratio of the value of each second pixel in each color channel to the value corresponding to the color channel to obtain multiple groups of correction values; The value of each second pixel in each color channel is corrected by at least using the multiple groups of correction values.
7. The image processing method according to claim 6, characterized in that: The correcting the value of each second pixel in each color channel by at least using the multiple sets of correction values comprises: The difference mean between the first pixel point and the second pixel point is calculated as a first correction value; and the value of each second pixel point in each color channel is corrected using the multiple sets of correction values and the first correction value.
8. An image processing device, characterized in that: include: An acquisition module, used to acquire a first picture and a second picture, where the second picture is a picture obtained by enhancing the first picture; a variation calculation module, configured to calculate a first variation of pixel values between each first pixel point in each first area of the first picture and its adjacent pixel points, and a second variation of pixel values between each second pixel point in each second area of the second picture and its adjacent pixel points; The correction module is used to calculate the correction amplitude for each second area according to the first difference between the first change amount of the first area corresponding to the second area and the second change amount of the second area, and correct the pixel value of each second pixel point in the second area according to the correction amplitude.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the image processing method according to any one of claims 1 to 7 are executed.
10. A terminal device, comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor runs the computer program, the steps of the image processing method according to any one of claims 1 to 7 are performed.