Image processing method and device, electronic equipment and storage medium

By determining and reducing the pixel values ​​of the target pixel points in the dark area of ​​the image after white balance correction in the image in the image processing, the problem of purple dark area in the image is solved, and the visual effect of the image is improved.

CN119155429AActive Publication Date: 2024-12-17BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310714469.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-15
Publication Date
2024-12-17
Estimated Expiration
2043-06-15

AI Technical Summary

Technical Problem

The dark part of the image after white balance correction is purple, resulting in poor visual effects.

Method used

By obtaining the image after white balance correction, determine the target pixel points whose pixel value is smaller than the preset pixel threshold, and reduce the pixel values ​​of these pixel points in the color channel for white balance correction. Sliding window traversal and preset function processing are used for The dark area is adjusted in a targeted manner.

Benefits of technology

It improves the phenomenon of the dark part of the image being purple, while avoiding the impact on the bright part area, improving the overall visual effect of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119155429A_ABST
    Figure CN119155429A_ABST
Patent Text Reader

Abstract

The invention relates to an image processing method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring an image after white balance correction; determining a target pixel point of which the pixel value is smaller than a preset pixel threshold according to the pixel value of each pixel point in the image; reducing the pixel value of each target pixel point in the image in a first color channel; wherein the first color channel is a color channel for white balance correction. Through the method, the problem that the dark part of the image after white balance correction is purple can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image processing method and device, electronic equipment, and storage medium. Background Art

[0002] Usually, in order to make the color of the image more realistic, the captured image will be processed for white balance, such as by counting the pixel values ​​of the pixels in the image, calculating the red channel gain and the blue channel gain, and then using the red channel gain to weight the pixel values ​​of each pixel in the image in the red channel, and using the blue channel gain to weight the pixel values ​​of the blue channel, to obtain a white balance corrected image. However, the dark part of the image after white balance correction is purple, resulting in poor image visual effects. Summary of the invention

[0003] The present disclosure provides an image processing method and device, an electronic device, and a storage medium.

[0004] According to a first aspect of an embodiment of the present disclosure, there is provided an image processing method, including:

[0005] Get the image after white balance correction;

[0006] Determine, according to the pixel value of each pixel point in the image, a target pixel point whose pixel value is less than a preset pixel threshold;

[0007] The pixel value of each target pixel in the image in a first color channel is reduced; wherein the first color channel is a color channel for performing white balance correction.

[0008] In some embodiments, determining, according to the pixel value of each pixel in the image, a target pixel whose pixel value is less than a preset pixel threshold, includes:

[0009] A sliding window is used to slide and traverse with each pixel point in the image as the window center. When the pixel value of the pixel point in the second color channel of the current sliding window is less than the preset pixel threshold, the pixel point at the center of the window is determined to be the target pixel point; wherein the second color channel is a color channel that does not perform white balance correction.

[0010] In some embodiments, when the pixel value of the second color channel of the pixel point in the current sliding window is less than the preset pixel threshold, determining the pixel point at the center of the window as the target pixel point includes:

[0011] When the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, the pixel at the center of the window is determined to be the target pixel; wherein the pixel to be processed is any pixel adjacent to the pixel at the center of the window in the current sliding window.

[0012] In some embodiments, when the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, determining the pixel at the center of the window as the target pixel includes:

[0013] When the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel to be processed in the second color channel;

[0014] When the pixel point at the center of the window is not the contour point, the pixel point at the center of the window is determined as the target pixel point.

[0015] In some embodiments, the contour point includes a corner point; and determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel point to be processed in the second color channel includes:

[0016] When there is only one pixel to be processed and the pixel value of the second color channel is less than the preset pixel threshold, the pixel point at the center of the window is determined as the corner point;

[0017] or,

[0018] When there are only two pixels to be processed and the pixel values ​​of the second color channel are less than the preset pixel threshold, the pixel point at the center of the window is determined as the corner point; wherein the two pixels to be processed are in different rows and columns.

[0019] In some embodiments, the contour point includes a line point; and determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel point to be processed in the second color channel includes:

[0020] When the pixel values ​​of two to-be-processed pixel points in the first direction in the second color channel are both smaller than the preset pixel threshold, and the difference between the pixel values ​​of the two to-be-processed pixel points in the second direction in the second color channel is smaller than the preset pixel difference threshold, the pixel point at the center of the window is determined as the line point; wherein the first direction is the row direction or the column direction of the image, and the second direction is perpendicular to the first direction.

[0021] In some embodiments, reducing the pixel value of each target pixel in the image in the first color channel includes:

[0022] For each target pixel point, a preset function is used to process the pixel value of the target pixel point in the first color channel to obtain a reduced pixel value of the target pixel point in the first color channel.

[0023] According to a second aspect of an embodiment of the present disclosure, there is provided an image processing apparatus, including:

[0024] An acquisition module, used for acquiring an image after white balance correction;

[0025] A determination module, configured to determine, based on the pixel values ​​of each pixel in the image, a target pixel whose pixel value is less than a preset pixel threshold;

[0026] A reduction module is used to reduce the pixel value of each target pixel in the image in a first color channel; wherein the first color channel is a color channel for performing white balance correction.

[0027] In some embodiments, the determination module is used to use a sliding window to perform sliding traversal with each pixel point in the image as the center of the window, and when the pixel value of the pixel point in the second color channel of the current sliding window is less than the preset pixel threshold, the pixel point in the center of the window is determined to be the target pixel point; wherein, the second color channel is a color channel that does not perform white balance correction.

[0028] In some embodiments, the determination module is used to determine that the pixel point at the center of the window is the target pixel point when the pixel value of the pixel point to be processed in the second color channel is less than the preset pixel threshold; wherein the pixel point to be processed is any pixel point adjacent to the pixel point at the center of the window in the current sliding window.

[0029] In some embodiments, the determination module is used to determine whether the pixel point at the center of the window is a contour point based on the pixel value of the pixel point to be processed in the second color channel when the pixel value of the pixel point to be processed in the second color channel is less than the preset pixel threshold; if the pixel point at the center of the window is not the contour point, determine the pixel point at the center of the window as the target pixel point.

[0030] In some embodiments, the contour points include corner points; the determination module is used to determine the pixel point at the center of the window as the corner point when there is only one pixel point to be processed and the pixel value of the second color channel is less than the preset pixel threshold; or, when there are only two pixel points to be processed and the pixel value of the second color channel is less than the preset pixel threshold, determine the pixel point at the center of the window as the corner point; wherein the two pixel points to be processed are in different rows and columns.

[0031] In some embodiments, the contour points include line points; the determination module is used to determine the pixel point at the center of the window as the line point when the pixel values ​​of two to-be-processed pixel points in the first direction in the second color channel are both less than the preset pixel threshold and the difference between the pixel values ​​of the two to-be-processed pixel points in the second direction in the second color channel is less than the preset pixel difference threshold; wherein the first direction is the row direction or column direction of the image, and the second direction is perpendicular to the first direction.

[0032] In some embodiments, the reduction module is used to process the pixel value of each target pixel in the first color channel using a preset function to obtain the reduced pixel value of the target pixel in the first color channel.

[0033] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0034] A processor; a memory for storing processor-executable instructions; wherein the processor is configured to execute the method as described in the first aspect above.

[0035] According to a fourth aspect of an embodiment of the present disclosure, there is provided a storage medium, including:

[0036] When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as described in the first aspect above.

[0037] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:

[0038] On the one hand, since white balance will increase the pixel value of the pixel point in the first color channel of the image, the image processing device of the embodiment of the present disclosure determines the target pixel point in the image whose pixel value is less than the preset pixel threshold value according to the pixel value of each pixel point in the image after white balance processing, and reduces the pixel value of each target pixel point in the first color channel, such as reducing the pixel value of the target pixel point in the red channel and the blue channel, to improve the purple cast in the dark part of the image. On the other hand, since the dark part of the image after white balance processing is more obviously purple, compared with processing all the pixels of the image, the embodiment of the present disclosure only reduces the pixel value of the target pixel point in the dark area of ​​the image in the first color channel, which can improve the necessity and purpose of reducing the pixel value of the target pixel point in the first color channel, improve the purple cast in the dark part of the image while taking into account that the bright part of the image is not affected.

[0039] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0041] Figure 1 It is an example flowchart of an image processing method shown in an embodiment of the present disclosure.

[0042] Figure 2 This is an example diagram of comparison of an image before and after processing provided by an embodiment of the present disclosure.

[0043] Figure 3 This is an example diagram of a sliding window in which the first color channel is a red channel, provided in an embodiment of the present disclosure.

[0044] Figure 4 This is an example diagram of a sliding window in which the first color channel is a blue channel, provided in an embodiment of the present disclosure.

[0045] Figure 5 This is an example of a corner point shown in the embodiment of the present disclosure. Figure 1 .

[0046] Figure 6 This is an example of a corner point shown in the embodiment of the present disclosure. Figure 2 .

[0047] Figure 7 An example diagram of line points shown in an embodiment of the present disclosure.

[0048] Figure 8 is a diagram of an image processing device shown in an embodiment of the present disclosure.

[0049] Fig. 9It is a block diagram of an electronic device shown in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0050] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0051] As mentioned above, the dark part of the image after white balance correction is purple. The reasons for the purple dark part of the image after white balance correction are as follows:

[0052] (1) After white balance correction, the pixel value of each pixel in the red channel and the pixel value of the blue channel in the image will increase; and because the human eye is more sensitive to the purple color of the dark part of the image than the bright part of the image, the dark part of the image will visually appear purple.

[0053] (2) In the process of counting the pixel values ​​of the pixels in the image, the pixels in the black part of the image are usually discarded, such as a pure black point with a pixel value of (0, 0, 0). This will cause the calculated red channel gain and blue channel gain to be too large, further increasing the problem of the dark part of the image being purple.

[0054] In this regard, an embodiment of the present disclosure provides an image processing method, the execution subject of which may be an image processing device, for example, the image processing method may be executed by a terminal device or a server or other electronic device, wherein the terminal device may be a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. If the execution subject is a server, the terminal sends the image after white balance correction to the server, so that the server executes the image processing method provided by the embodiment of the present disclosure to improve the purple color of the dark part of the image. In some possible implementations, the image processing method may be implemented by a processor calling computer-readable instructions stored in a memory.

[0055] Figure 1 is an example flow chart of an image processing method shown in an embodiment of the present disclosure, comprising Figure 1 It can be seen that the following steps are included:

[0056] S11, obtaining an image after white balance correction;

[0057] S12, determining a target pixel point whose pixel value is less than a preset pixel threshold according to the pixel value of each pixel point in the image;

[0058] S13. Reduce the pixel value of each target pixel in the image in a first color channel; wherein the first color channel is a color channel for performing white balance correction.

[0059] In step S11, the image processing device obtains an image after white balance correction, wherein the original image before white balance correction may be an image captured by an image acquisition device (such as a camera), an image frame in a video stream, etc. The image may be corrected for white balance by the image processing device itself, or by other terminal devices performing white balance correction on the original image and then sending the corrected image to the image processing device, so that the image processing device obtains the image after white balance correction, which is not limited in the present disclosure.

[0060] It should be noted that the white balance correction of the disclosed embodiment only corrects the pixel value of the first color channel; wherein, the first color channel can be one or more. Taking the color channel including the red (R) channel, the green (G) channel, and the blue (B) channel as an example, if the first color channel is the R channel and the B channel, the corresponding R channel gain and the B channel gain are calculated, and the pixel value of the pixel point in the R channel is weighted by the R channel gain, and the pixel value of the pixel point in the B channel is weighted by the B channel gain, and the pixel value of each pixel point in the G channel remains unchanged. For another example, the gains of the three channels of R, G, and B are calculated respectively according to the pixel value of the pixel point, and the G channel gain is used as the basis for normalization, and the R channel gain and the B channel gain are normalized, and the normalized color channel gain is used to weight the pixel value of the corresponding color channel, and the pixel value of the pixel point in the R channel and the pixel value of the B channel are increased; since the normalized G channel gain is 1, the pixel value of each pixel point in the G channel remains unchanged. In the above example, the image appears purple because the pixel values ​​in the R and B channels increase after weighting, while the pixel value in the G channel remains unchanged.

[0061] In step S12, the image processing device determines a target pixel whose pixel value is less than a preset pixel threshold value based on the pixel value of each pixel in the acquired white balance corrected image. In some embodiments, the image processing device determines each pixel in the image as a target pixel if the pixel value of the pixel is less than the preset pixel threshold value, such as the pixel values ​​of the three color channels of the pixel, R, G, and B, are all less than the preset pixel threshold value.

[0062] In some embodiments, the image processing device traverses each pixel point in the image, performs statistical analysis on the pixel values ​​of the pixel points in the local area of ​​the image where the currently traversed pixel point is located, and determines whether the currently traversed pixel point is a target pixel point based on the statistical analysis results. The statistical analysis results include the mean pixel value of the pixel points in the local area, the maximum pixel value, the percentage of the pixel points in the local area whose pixel values ​​are less than the preset pixel threshold, etc. Exemplarily, if the statistical analysis result is at least one of the following: the mean pixel value of the pixel points in the local area is less than the preset pixel threshold, the maximum pixel value is less than the preset pixel threshold, and the percentage of the pixel points in the local area whose pixel values ​​are less than the preset pixel threshold is greater than the preset percentage threshold, it is characterized that the local area is more likely to be a darker area, so that the currently traversed pixel point is determined as the target pixel point. It can be understood that the pixel value of the pixel point is positively correlated with the brightness, and the target pixel point in the embodiment of the present disclosure is the pixel point in the dark area of ​​the image.

[0063] After determining the target pixel in the image, step S13 is executed, and the image processing device reduces the pixel value of each target pixel in the image in the first color channel. For example, the pixel value of the target pixel in the first color channel can be weighted with a preset weight less than 1, or the difference between the pixel value of the target pixel in the first color channel and the preset pixel value can be used as the processed pixel value, etc., and then the image processing device can preview or further process the image after improving the purple cast in the dark area.

[0064] Figure 2 This is an example diagram of a comparison of images before and after processing provided by an embodiment of the present disclosure. Figure 2 The middle left image is an image after white balance processing, and the right image is an image after the left image is processed using the image processing method of the embodiment of the present disclosure, wherein, compared with the dark block marked by I1, the purple cast of the dark block marked by I2 is significantly improved.

[0065] It can be understood that, on the one hand, since white balance will increase the pixel value of the pixel point in the first color channel (such as R channel and B channel) in the image, the image processing device of the embodiment of the present disclosure determines the target pixel point in the image whose pixel value is less than the preset pixel threshold value according to the pixel value of each pixel point in the image after white balance processing, and reduces the pixel value of each target pixel point in the first color channel, such as reducing the pixel value of the target pixel point in the R channel and the B channel, to improve the purple cast in the dark part of the image. On the other hand, since the dark part of the image after white balance processing is more obviously purple, compared with processing all the pixels of the image, the embodiment of the present disclosure only reduces the pixel value of the target pixel point in the dark area of ​​the image in the first color channel, which can improve the necessity and purpose of reducing the pixel value of the target pixel point in the first color channel, improve the purple cast in the dark part of the image while taking into account that the bright part of the image is not affected.

[0066] In some embodiments, determining, according to the pixel value of each pixel in the image, a target pixel whose pixel value is less than a preset pixel threshold, includes:

[0067] A sliding window is used to slide and traverse with each pixel point in the image as the window center. When the pixel value of the pixel point in the second color channel of the current sliding window is less than the preset pixel threshold, the pixel point at the center of the window is determined to be the target pixel point; wherein the second color channel is a color channel that does not perform white balance correction.

[0068] In the embodiment of the present disclosure, the second color channel is a color channel that does not perform white balance correction. For example, in the aforementioned example, the first color channel is the R channel and the B channel, and correspondingly, the second color channel is the G channel.

[0069] The image processing device of the disclosed embodiment adopts a sliding window to slide and traverse with each pixel point in the image as the center of the window, and when the pixel value of the second color channel of the pixel point in the current sliding window is less than the preset pixel threshold; wherein the sliding window includes the pixel points adjacent to the pixel point at the center of the window (the distance is 1), and may also include the pixel points whose distance from the pixel point at the center of the window is within the preset distance range. In a manner similar to the aforementioned statistical analysis of the pixel values ​​of the pixel points in the local area of ​​the image, the pixel values ​​of the pixel points in the sliding window are statistically analyzed, and according to the statistical analysis results, if the maximum pixel value of each pixel point in the sliding window in the second color channel is less than the preset pixel threshold, the average pixel value of each pixel point in the sliding window in the second color channel is less than the preset pixel threshold, or the proportion of the pixel points whose pixel value in the second color channel of the sliding window is less than the preset pixel threshold is greater than the preset proportion threshold, the pixel point at the center of the window is determined as the target pixel point, thereby reducing the pixel value of the target pixel point in the first color channel, and improving the purple bias in the dark part of the image.

[0070] It can be understood that, since the pixel value of the second color channel of the embodiment of the present disclosure has not been weighted by the white balance gain, the pixel value of the pixel point in the second color channel is more accurate. In this regard, the embodiment of the present disclosure uses a sliding window to traverse the pixel points, and determines the target pixel point according to the pixel value of the pixel point in the second color channel in the current sliding window, which can improve the accuracy of determining the target pixel point. In addition, compared to only based on the pixel value of the current pixel point in the second color channel, the embodiment of the present disclosure determines the target pixel point based on the pixel values ​​of multiple pixels in the current sliding window in the second color channel, which can further improve the accuracy of determining the target pixel point.

[0071] In some embodiments, when the pixel value of the second color channel of the pixel point in the current sliding window is less than the preset pixel threshold, determining the pixel point at the center of the window as the target pixel point includes:

[0072] When the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, the pixel at the center of the window is determined to be the target pixel; wherein the pixel to be processed is any pixel adjacent to the pixel at the center of the window in the current sliding window.

[0073] In the embodiment of the present disclosure, the image processing device uses a sliding window to determine the pixel point at the center of the window as the target pixel point when the pixel value of any pixel point to be processed in the second color channel is less than a preset pixel threshold. The pixel point to be processed is a pixel point adjacent to the pixel point at the center of the window in the current sliding window, and the adjacent pixel point may be a four-neighborhood or an eight-neighborhood.

[0074] Usually white balance is processed in the raw domain of the image. The arrangement of each pixel in the raw domain is Bayer format. For this arrangement, a 3*3 sliding window can be designed, and the grid in the sliding window corresponds to one pixel. Figure 3 An example diagram of a sliding window in which the first color channel is a red channel is provided for an embodiment of the present disclosure, wherein the grid marked by L1 in the sliding window indicates the pixel value of the pixel point at the center of the sampling acquisition window in the R channel; and then, when the pixel point is subsequently determined to be a target pixel point, step S13 is executed to reduce the pixel value of the pixel point in the R channel. The grid marked by L2 in the sliding window indicates the pixel values ​​of the four neighboring pixel points of the pixel point at the center of the sampling acquisition window in the G channel; and then, when it is subsequently determined that the pixel value of any pixel point marked by L2 in the current sliding window in the G channel is less than a preset pixel threshold, the pixel point marked by L1 is determined to be the target pixel point. Figure 3 The unmarked grids in the sliding window shown may correspond to any color channel, such as the B channel.

[0075] Figure 4 An example diagram of a sliding window in which the first color channel is a blue channel is provided for an embodiment of the present disclosure, wherein the grid marked by L3 in the sliding window indicates the pixel value of the pixel point at the center of the sampling acquisition window in the B channel; and then, when the pixel point is subsequently determined to be a target pixel point, step S13 is executed to reduce the pixel value of the pixel point in the B channel. The grid marked by L4 in the sliding window indicates the pixel values ​​of the four neighboring pixel points of the pixel point at the center of the sampling acquisition window in the G channel; and then, when it is subsequently determined that the pixel value of any pixel point marked by L4 in the current sliding window in the G channel is less than a preset pixel threshold, the pixel point marked by L3 is determined to be the target pixel point. Figure 4 The unmarked grids in the sliding window shown may correspond to any color channel, such as the R channel.

[0076] It can be understood that since the pixel value of a pixel point has a large correlation with the pixel values ​​of its adjacent pixel points, compared to determining the target pixel point based on the pixel value of a pixel point that is far away from the pixel point at the center of the window, the embodiment of the present disclosure is based on the adjacent pixel points of the pixel point. When the pixel value of any adjacent pixel point in the second color channel is less than a preset pixel threshold, the pixel point at the center of the window is determined as the target pixel point, which can improve the accuracy of determining the target pixel point.

[0077] In some embodiments, when the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, determining the pixel at the center of the window as the target pixel includes:

[0078] When the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel to be processed in the second color channel;

[0079] When the pixel point at the center of the window is not the contour point, the pixel point at the center of the window is determined as the target pixel point.

[0080] In the embodiment of the present disclosure, the image processing device is based on a sliding window, and when the pixel value of any pixel to be processed adjacent to the pixel at the center of the window in the current sliding window in the second color channel is less than a preset pixel threshold, that is, the pixel at the center of the window is a dark point, the image processing device further determines whether the pixel at the center of the window is a contour point according to the pixel value of the pixel to be processed in the second color channel. The contour point includes at least one of the following: a corner point and a line point.

[0081] In some embodiments, the contour point includes a corner point; and determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel point to be processed in the second color channel includes:

[0082] When there is only one pixel to be processed and the pixel value of the second color channel is less than the preset pixel threshold, the pixel point at the center of the window is determined as the corner point;

[0083] or,

[0084] When there are only two pixels to be processed and the pixel values ​​of the second color channel are less than the preset pixel threshold, the pixel point at the center of the window is determined as the corner point; wherein the two pixels to be processed are in different rows and columns.

[0085] In the embodiment of the present disclosure, the image processing device is based on a sliding window, and when there is only one pixel point to be processed adjacent to the pixel point at the center of the window in the current sliding window and the pixel value of the second color channel is less than a preset pixel threshold, the pixel point at the center of the window is determined as a corner point. Figure 5 As shown, Figure 5 An example of a corner point shown in the embodiment of the present disclosure Figure 1 , Figure 5 Sliding window reference in Figure 3 To understand, Figure 5 If there is only one pixel to be processed whose pixel value in the G channel (such as 0) is less than the preset pixel threshold, then the pixel at the center of the current window is a corner point.

[0086] In the embodiment of the present disclosure, if there are only two pixels to be processed in the current sliding window whose pixel values ​​in the second color channel are less than the preset pixel threshold, then the pixel at the center of the window is a corner point; wherein the two pixels to be processed are in different rows and columns. Figure 6 As shown, Figure 6 An example of a corner point shown in the embodiment of the present disclosure Figure 2 , Figure 6 Sliding window reference in Figure 3 To understand, Figure 6 In the image row direction, there is only one pixel point to be processed whose pixel value in the G channel (such as 0) is less than the preset pixel threshold, and in the image column direction, there is only one pixel point to be processed whose pixel value in the G channel is less than the preset pixel threshold, then the pixel point at the center of the current window is the corner point. Determining the corner point by this scheme has the advantage of low computational complexity.

[0087] In addition, in some embodiments, algorithms such as Harris corner detection, Shi-Tomasi corner detection, and FAST (Feature from Accelerated Segment Test) corner detection can be used to determine whether the pixel point at the center of the window is a corner point based on the pixel values ​​of the pixel points to be processed adjacent to the pixel point at the center of the window in the second color channel.

[0088] In some embodiments, the contour point includes a line point; and determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel point to be processed in the second color channel includes:

[0089] When the pixel values ​​of two to-be-processed pixel points in the first direction in the second color channel are both smaller than the preset pixel threshold, and the difference between the pixel values ​​of the two to-be-processed pixel points in the second direction in the second color channel is smaller than the preset pixel difference threshold, the pixel point at the center of the window is determined as the line point; wherein the first direction is the row direction or the column direction of the image, and the second direction is perpendicular to the first direction.

[0090] In the embodiment of the present disclosure, the image processing device is based on a sliding window. If the pixel values ​​of two pixels to be processed in the first direction in the second color channel are both less than a preset pixel threshold, and the difference between the pixel values ​​of the two pixels to be processed in the second direction in the second color channel is less than a preset pixel difference threshold, the pixel point at the center of the window is determined as a line point; wherein the first direction is the row direction or column direction of the image, and the second direction is perpendicular to the first direction. Figure 7 As shown, Figure 7 is an example diagram of a line point shown in an embodiment of the present disclosure, Figure 7 Sliding window reference in Figure 3 To understand, Figure 7 The pixel values ​​of the two pixels to be processed in the row direction of the image are both 0 (less than the preset pixel threshold), and the pixel values ​​of the two pixels to be processed in the column direction of the image are both 100 (the pixel value difference is less than the preset pixel difference threshold), indicating that the pixel point at the center of the window is more likely to be a line point in the column direction, so the pixel point at the center of the current window is determined as a line point. Determining line points by this scheme has the advantage of low computational complexity.

[0091] In addition, in some embodiments, edge detection algorithms, contour detection algorithms, etc. can be used to determine whether the pixel point at the center of the window is a line point according to the pixel value of the pixel point to be processed in the second color channel. Among them, edge detection algorithms such as using Canny operators, Sobel operators, etc. to perform edge detection, and determine the pixel points in the detected edge as line points; contour detection algorithms such as contour tracking algorithms, run-length-based contour detection algorithms, etc., and determine the pixel points in the detected contour as line points.

[0092] Based on the above method, if the pixel point at the center of the window is a contour point, the point is excluded and the pixel value of the pixel point in the first color channel is not reduced; if the pixel point at the center of the window is not a contour point, the pixel point at the center of the window is determined as the target pixel point, and the pixel value of the target pixel point in the first color channel is reduced.

[0093] It can be understood that in the embodiment of the present disclosure, when the pixel point at the center of the window is a dark point, it is determined whether the pixel point at the center of the window is a contour point based on the pixel values ​​of the to-be-processed pixels adjacent to the pixel point at the center of the window in the second color channel, and the contour points are excluded, and the dark points that are not contour points are determined as target pixels, and the pixel values ​​of the target pixels in the first color channel are further reduced, without reducing the pixel values ​​of the contour points, thereby improving both the purple cast in the dark parts of the image and the clarity of the image contours.

[0094] In some embodiments, reducing the pixel value of each target pixel in the image in the first color channel includes:

[0095] For each target pixel point, a preset function is used to process the pixel value of the target pixel point in the first color channel to obtain a reduced pixel value of the target pixel point in the first color channel.

[0096] In the embodiment of the present disclosure, after determining the target pixel in the image, the image processing device processes the pixel value of the target pixel in the first color channel using a preset function for each target pixel to obtain a reduced pixel value of the target pixel in the first color channel. The preset function may be customized by the user as needed, or may be a function fitted based on multiple tests, which is not limited in the present disclosure.

[0097] For example, if the first color channel includes an R channel, the pixel value R of the target pixel in the first color channel after the reduction is out It can be expressed by the following formula (1):

[0098] R out =a*R input +b; (1)

[0099] Among them, R input To reduce the pixel value of the front target pixel in the R channel, a and b are coefficients in a preset function, a is greater than 0 and less than 1. For example, a is 0.0156 and b is 0.

[0100] If the first color channel includes a B channel, the pixel value B of the target pixel in the first color channel is reduced. out It can be expressed by the following formula (2):

[0101] B out =a*B input +b; (2)

[0102] Among them, B input To reduce the pixel value of the front target pixel in the B channel.

[0103] It can be understood that the image processing device of the embodiment of the present disclosure uses a preset function to reduce the pixel value of the target pixel point in the first color channel, and adjusts the degree of reduction of the pixel value as needed by updating the preset function (such as adjustment coefficients a and b). It has high flexibility and low computational complexity, is very suitable for actual application development, and greatly reduces the power consumption of the image processing device.

[0104] Figure 8 is a diagram of an image processing device shown in an embodiment of the present disclosure, comprising Figure 8 It is known that, including:

[0105] An acquisition module 801 is used to acquire an image after white balance correction;

[0106] A determination module 802, configured to determine, based on the pixel values ​​of each pixel in the image, a target pixel whose pixel value is less than a preset pixel threshold;

[0107] The reducing module 803 is used to reduce the pixel value of each target pixel in the image in the first color channel; wherein the first color channel is a color channel for performing white balance correction.

[0108] In some embodiments, the determination module 802 is used to use a sliding window to perform sliding traversal with each pixel point in the image as the center of the window, and when the pixel value of the pixel point in the second color channel of the current sliding window is less than the preset pixel threshold, determine the pixel point at the center of the window as the target pixel point; wherein, the second color channel is a color channel that does not perform white balance correction.

[0109] In some embodiments, the determination module 802 is used to determine that the pixel point at the center of the window is the target pixel point when the pixel value of the pixel point to be processed in the second color channel is less than the preset pixel threshold; wherein the pixel point to be processed is any pixel point adjacent to the pixel point at the center of the window in the current sliding window.

[0110] In some embodiments, the determination module 802 is used to determine whether the pixel point at the center of the window is a contour point based on the pixel value of the pixel point to be processed in the second color channel when the pixel value of the pixel point to be processed in the second color channel is less than the preset pixel threshold; if the pixel point at the center of the window is not the contour point, determine the pixel point at the center of the window as the target pixel point.

[0111] In some embodiments, the contour points include corner points; the determination module 802 is used to determine the pixel point at the center of the window as the corner point when there is only one pixel point to be processed and the pixel value of the second color channel is less than the preset pixel threshold; or, when there are only two pixel points to be processed and the pixel value of the second color channel is less than the preset pixel threshold, determine the pixel point at the center of the window as the corner point; wherein the two pixel points to be processed are in different rows and columns.

[0112] In some embodiments, the contour points include line points; the determination module 802 is used to determine the pixel point at the center of the window as the line point when the pixel values ​​of two to-be-processed pixel points in the first direction in the second color channel are both less than the preset pixel threshold, and the difference between the pixel values ​​of the two to-be-processed pixel points in the second direction in the second color channel is less than the preset pixel difference threshold; wherein the first direction is the row direction or column direction of the image, and the second direction is perpendicular to the first direction.

[0113] In some embodiments, the reduction module 803 is used to process the pixel value of each target pixel in the first color channel using a preset function to obtain the reduced pixel value of the target pixel in the first color channel.

[0114] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0115] Fig. 9 8 is a block diagram of an electronic device 800 shown in an embodiment of the present disclosure. For example, the electronic device 800 may be a mobile phone, a mobile computer, etc.

[0116] Reference Fig. 9 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0117] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0118] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0119] The power component 806 provides power to the various components of the electronic device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.

[0120] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0121] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0122] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0123] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or a component of the electronic device 800, the presence or absence of contact between the user and the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0124] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as Wi-Fi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0125] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0126] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by a processor 820 of an electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0127] A non-transitory computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to perform the aforementioned image processing method.

[0128] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims above.

[0129] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image processing method, characterized in that: The method comprises: Get the image after white balance correction; Determine, according to the pixel value of each pixel point in the image, a target pixel point whose pixel value is less than a preset pixel threshold; The pixel value of each target pixel in the image in a first color channel is reduced; wherein the first color channel is a color channel for performing white balance correction.

2. The method according to claim 1, characterized in that The step of determining, according to the pixel value of each pixel in the image, a target pixel whose pixel value is less than a preset pixel threshold, comprises: A sliding window is used to slide and traverse with each pixel point in the image as the window center. When the pixel value of the pixel point in the second color channel of the current sliding window is less than the preset pixel threshold, the pixel point at the center of the window is determined to be the target pixel point; wherein the second color channel is a color channel that does not perform white balance correction.

3. The method according to claim 2, characterized in that When the pixel value of the second color channel of the pixel point in the current sliding window is less than the preset pixel threshold, determining the pixel point at the center of the window as the target pixel point includes: When the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, the pixel at the center of the window is determined to be the target pixel; wherein the pixel to be processed is any pixel adjacent to the pixel at the center of the window in the current sliding window.

4. The method according to claim 3, characterized in that The step of determining the pixel point at the center of the window as the target pixel point when the pixel value of the pixel point to be processed in the second color channel is less than the preset pixel threshold comprises: When the pixel value of the pixel to be processed in the second color channel is less than the preset pixel threshold, determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel to be processed in the second color channel; When the pixel point at the center of the window is not the contour point, the pixel point at the center of the window is determined as the target pixel point.

5. The method according to claim 4, characterized in that The contour points include corner points; and determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel point to be processed in the second color channel includes: When there is only one pixel to be processed and the pixel value of the second color channel is less than the preset pixel threshold, the pixel point at the center of the window is determined as the corner point; or, When there are only two pixels to be processed and the pixel values ​​of the second color channel are less than the preset pixel threshold, the pixel point at the center of the window is determined as the corner point; wherein the two pixels to be processed are in different rows and columns.

6. The method according to claim 4, characterized in that The contour point includes a line point; and determining whether the pixel point at the center of the window is a contour point according to the pixel value of the pixel point to be processed in the second color channel includes: When the pixel values ​​of two to-be-processed pixel points in the first direction in the second color channel are both smaller than the preset pixel threshold, and the difference between the pixel values ​​of the two to-be-processed pixel points in the second direction in the second color channel is smaller than the preset pixel difference threshold, the pixel point at the center of the window is determined as the line point; wherein the first direction is the row direction or the column direction of the image, and the second direction is perpendicular to the first direction.

7. The method according to claim 1, characterized in that The step of reducing the pixel value of each target pixel in the image in the first color channel includes: For each target pixel point, a preset function is used to process the pixel value of the target pixel point in the first color channel to obtain a reduced pixel value of the target pixel point in the first color channel.

8. An image processing device, characterized in that: The device comprises: An acquisition module, used for acquiring an image after white balance correction; A determination module, used to determine a target pixel point whose pixel value is less than a preset pixel threshold according to the pixel value of each pixel point in the image; A reduction module is used to reduce the pixel value of each target pixel in the image in a first color channel; wherein the first color channel is a color channel for performing white balance correction.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the method as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Image processing method and apparatus

    CN105335979A

  • Image purple edge elimination device and method

    CN111080559A

  • Method for correcting purple distortion in digital images and a computing device employing same

    US20140112581A1