Image shooting method, electronic equipment and computer readable storage medium

By detecting and processing color overflow pixels in the image in HDR mode, and generating and applying a second color correction matrix for secondary color correction, the color overflow problem caused by dynamic range compression of high saturation imaging objects in HDR mode is solved, and the clarity of image content and the resolution of details are achieved.

CN120075631AActive Publication Date: 2025-05-30HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202311562328.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-21
Publication Date
2025-05-30
Estimated Expiration
2043-11-21

AI Technical Summary

Technical Problem

In HDR mode, high-saturation imaging objects have color overflow due to image dynamic range compression, making the image content difficult to distinguish and the details are lost and blurred.

Method used

By detecting the pixels with color overflow in the image, the color overflow value is calculated, and a second color correction matrix for each pixel is generated, and a secondary color correction is performed to avoid color overflow.

Benefits of technology

It effectively avoids the color overflow problem of high-saturation imaging objects in the image, ensuring that the image content is clear and the details are distinguishable.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120075631A_ABST
    Figure CN120075631A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image shooting, and provides an image shooting method, electronic equipment and a computer readable storage medium, and the method comprises the steps: obtaining a first image in an HDR mode in response to the click operation of a user on a shooting shutter after the electronic equipment displays a first interface comprising the shooting shutter; wherein the first image is an image obtained after color correction is carried out on an image collected by the camera, and the first image comprises first pixels with color overflow. Then, the electronic device performs color correction on the first pixel of the first image based on the color overflow value of the first pixel to obtain a second image including a second pixel. Wherein the color overflow value is a total pixel value exceeding a pixel value range, and the pixel value range corresponds to the color depth of the HDR mode. According to the method, the electronic equipment carries out secondary color correction on the pixels with the color overflow phenomenon again in the HDR mode shooting scene, and unclear content display caused by the color overflow problem of high saturation object imaging can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the technical field of image capture, and in particular, to an image capture method, an electronic device, and a computer-readable storage medium. Background Art

[0002] With the development of image capture technology and the increasing demands of users for capture functions and image effects, more and more capture modes can be provided by the camera function in electronic devices. For example, portrait mode, panoramic mode, and High Dynamic Range Imaging (HDR or HDRI) mode, etc. Currently, in the HDR mode, in order to adapt to the display capabilities of the display, the dynamic range of the image is usually compressed.

[0003] However, objects with high-saturation imaging are prone to serious color bleeding problems due to compression, resulting in the image content corresponding to the high-saturation imaging objects being difficult to distinguish, and the details being lost and blurred. Summary of the Invention

[0004] Embodiments of the present application provide an image capture method, an electronic device, and a computer-readable storage medium, which are used to solve the problem that the content of high-saturation imaging objects is difficult to distinguish due to color bleeding caused by compression in the HDR mode, and the details are lost and blurred.

[0005] To achieve the above object, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, an image capture method is provided. The method is applied to an electronic device, the electronic device includes a camera, and the electronic device supports the High Dynamic Range Imaging (HDR) mode. The method includes:

[0007] The electronic device displays a first interface, the first interface includes a preview image captured by the electronic device and a capture shutter; in response to a click operation of the user on the capture shutter, a first image is obtained in the HDR mode; wherein, the first image is an image obtained by color-correcting the image collected by the camera, and the first image includes first pixels with color bleeding. Then, the electronic device obtains a second image including second pixels based on the first image. Wherein, the second pixels correspond to the first pixels in the first image and are pixels obtained by color-correcting the first pixels based on the color bleeding value of the first pixels. Wherein, the color bleeding value is the total pixel value exceeding the pixel value range, and the pixel value range corresponds to the color depth of the HDR mode.

[0008] In the images captured in HDR mode, if there is color bleeding in the objects with high saturation imaging, the corresponding pixels will also show color bleeding. Therefore, in the color correction stage of the electronic device in the HDR mode shooting scenario, the pixels with color bleeding are re-corrected twice, so as to avoid color bleeding in the pixels corresponding to the objects with high saturation imaging, ensure that there is no color bleeding problem in the objects with high saturation after imaging, and the corresponding image content can be clearly displayed and the details can be distinguished.

[0009] In a possible implementation manner of the first aspect, since color correction is currently usually implemented based on a color correction matrix, the first image is an image obtained by color-correcting the image captured by the camera through a first color correction matrix (the standard color correction matrix for color correction). Therefore, obtaining the second image based on the first image may include: calculating the color bleeding value of the first pixel; generating a second color correction matrix corresponding to the first pixel according to the color bleeding value of the first pixel; and using each second color correction matrix to re-correct the corresponding first pixel in the first image respectively to obtain the second image including the second pixel.

[0010] Thus, a precise second color correction matrix applicable to this first pixel is generated for the color bleeding value of each first pixel to implement the secondary color correction of the first pixel, which is equivalent to performing secondary color correction according to the color correction intensity required by the first pixel, so as to improve the color correction effect of the first pixel and ensure the avoidance of color bleeding.

[0011] In another possible implementation manner of the first aspect, considering the requirements of the actual service for the color correction intensity, generating a second color correction matrix corresponding to the first pixel according to the color bleeding value of the first pixel may include: determining the ratio of the color bleeding value to the maximum pixel value in the pixel value range; determining the first color adjustment weight according to the product of the ratio and the intensity adjustment threshold; and using the product of the first color adjustment weight and the standard unit matrix as the second color correction matrix.

[0012] It can be seen that after the electronic device determines the adjustment intensity required by the first pixel through the ratio, it is further multiplied by the set intensity adjustment threshold rio3. Since the intensity adjustment threshold rio3 is set based on experience and is a preset value for adjusting the intensity of color correction, it can ensure that the obtained second CCM meets both the adjustment intensity required by the first pixel and the adjustment intensity required by the actual service.

[0013] In another possible implementation of the first aspect, since the conventional value range of the weight is usually [0, 1]. Therefore, determining the first color adjustment weight of the first pixel according to the product of the ratio and the intensity adjustment threshold may include: if the product of the ratio and the intensity adjustment threshold is less than or equal to 0, the first color adjustment weight is equal to 0; if the product of the ratio and the intensity adjustment threshold is greater than or equal to 1, the first color adjustment weight is equal to 1; if the product of the ratio and the intensity adjustment threshold is greater than 0 and less than 1, the first color adjustment weight is equal to the product of the ratio and the intensity adjustment threshold.

[0014] In another possible implementation of the first aspect, in order to accurately adjust the color of the first pixel and avoid the problem that the image content is unclear and indistinguishable due to color overflow caused by color truncation of the first pixel, the electronic device needs to accurately determine the color overflow value of each first pixel. And, since a pixel usually corresponds to three color components of R, G, and B, the electronic device can first calculate the absolute differences between the pixel values of the three component pixels corresponding to the first pixel and the pixel value range respectively. Then, the electronic device sums up these three absolute differences to obtain the color overflow value of this first pixel.

[0015] Based on this, calculating the color overflow value of the first pixel may include: calculating the absolute differences between the pixel values of the three component pixels of the first pixel and the pixel value range respectively; where the three component pixel values are the pixel values corresponding to the three color components of RGB; summing up the absolute differences corresponding to the three component pixel values to obtain the color overflow value of the first pixel.

[0016] In another possible implementation of the first aspect, since the higher the pixel values corresponding to the R color component (red) and the B color component (blue) of a pixel, the higher the color vividness of this pixel. And the probability of color overflow of an imaging object with more vivid colors (an imaging object with higher saturation) is higher. Therefore, the electronic device can further generate a second CCM in combination with the RGB color ratio of the first pixel, so as to improve the correction effect for correcting the color overflow area.

[0017] Therefore, the image capturing method may further include: calculating the RGB color ratio of the first pixel, and determining the second color adjustment weight corresponding to the first pixel according to the RGB color ratio; wherein, the RGB color ratio is the ratio between the pixel values corresponding to the three RGB color components. Furthermore, taking the product of the first color adjustment weight and the standard unit matrix as the second color correction matrix may include: taking the product of the second color adjustment weight and the first color adjustment weight as the new first color adjustment weight; taking the sum of the first product and the second product as the second color correction matrix; wherein, the first product is the product of the new first color adjustment weight and the standard unit matrix; the second product is the product of the first color correction matrix and the first difference, and the first difference is the difference between the value 1 and the second color adjustment weight.

[0018] In another possible implementation manner of the first aspect, since the influence of the R color component and the B color component on the color vividness is mainly considered, and as long as one reference value is selected from the three values to calculate its ratios with the remaining two values respectively, the relationship between the remaining two values can also be deduced based on the known ratios. Therefore, the RGB color ratio may mainly include the RG ratio and the BG ratio; the RG ratio is the ratio of the pixel values corresponding to the R color component and the G color component, and the BG ratio is the ratio of the pixel values corresponding to the B color component and the G color component.

[0019] Furthermore, determining the second color adjustment weight corresponding to the first pixel according to the RGB color ratio may include: determining the RG adjustment weight according to the RG ratio corresponding to the first pixel, and determining the BG adjustment weight according to the BG ratio corresponding to the first pixel; taking the product of the RG adjustment weight and the BG adjustment weight as the second color adjustment weight corresponding to the first pixel.

[0020] In another possible implementation manner of the first aspect, determining the RG adjustment weight according to the RG ratio corresponding to the first pixel includes: when the RG ratio is greater than or equal to 10 or less than or equal to 0.1, the RG adjustment weight is equal to 1; when the RG ratio is greater than or equal to 1 and less than 10, the RG adjustment weight is equal to the ratio of the second difference to the value 9; the second difference is the difference between the RG ratio and the value 1; when the RG ratio is less than or equal to 1 and greater than 0.1, the RG adjustment weight is equal to the product of the value 10 / 9 and the third difference; the third difference is the difference between the value 1 and the RG ratio.

[0021] In another possible implementation of the first aspect, determining the BG adjustment weight according to the BG ratio corresponding to the first pixel includes: when the BG ratio is greater than or equal to 10 or less than or equal to 0.1, the BG adjustment weight is equal to 1; when the BG ratio is greater than or equal to 1 and less than 10, the BG adjustment weight is equal to the ratio of the fourth difference to the value 9; the fourth difference is the difference between the BG ratio and the value 1; when the BG ratio is less than or equal to 1 and greater than 0.1, the BG adjustment weight is equal to the product of the value 10 / 9 and the fifth difference; the fifth difference is the difference between the value 1 and the BG ratio.

[0022] In another possible implementation of the first aspect, since the phenomenon of color overflow in a pixel means that the pixel value of the pixel exceeds the pixel value range, and an image pixel usually includes three color components of R, G, and B, and each color component corresponds to a component pixel value respectively, therefore, the electronic device can determine whether this pixel is the first pixel with color overflow by judging whether the three component pixel values corresponding to each pixel in the first image exceed the pixel value range.

[0023] Based on this, detecting the first pixel with color overflow in the first image can include: comparing the component pixel values of each pixel in the first image with the pixel value range respectively; wherein, the component pixel values include the pixel values corresponding to the three color components of RGB; regarding the pixel in the first image where the component pixel value is not within the pixel value range as the first pixel with color overflow.

[0024] In another possible implementation of the first aspect, the following formula can be used to calculate the second pixel:

[0025] R out =a 11 ×R in +a 12 ×G in +a 13 ×B in

[0026] G out =a 21 ×R in +a 22 ×G in +a 23 ×B in

[0027] B out =a 31 ×R in +a 32 ×G in +a 33 ×B in

[0028] Wherein, Rin , G in , B in are the RGB values of the first pixel; R out , G out , B out are the RGB values of the second pixel; a 11 , a 12 , a 13 , a 21 , a 22 , a 23 , a 31 , a 32 , a 32 are the elements in the second color correction matrix.

[0029] In another possible implementation of the first aspect, there may be discrete noise pixels in the image. To avoid the influence of discrete noise pixels, the image capturing method may further include: when determining that the first pixel is a discrete noise pixel according to the neighboring pixels of the first pixel, discarding the first pixel.

[0030] In another possible implementation of the first aspect, determining that the first pixel is a discrete noise pixel according to the neighboring pixels of the first pixel may include: converting the first image into a binary image, and the pixel value of the first pixel in the binary image is 1; in the binary image, dividing the first pixel and its neighboring pixels into pixel blocks according to a preset block size; if there are n pixels with a pixel value of 1 in the pixel block, the first pixel is not a discrete noise pixel; if there are no n pixels with a pixel value of 1 in the pixel block, the first pixel is a discrete noise pixel.

[0031] In a second aspect, the present application provides an image capturing method, which is applied to an electronic device. The electronic device includes a camera, and the electronic device supports the high dynamic range imaging HDR mode. The method includes:

[0032] The electronic device receives a user's operation to turn on the camera application; in response to the turn-on operation, the electronic device obtains a first image in the HDR mode; wherein, the first image is an image obtained by color correction of the image collected by the camera, and the first image includes a first pixel with color overflow. Then, the electronic device obtains a second image including a second pixel based on the first image. Wherein, the second pixel corresponds to the first pixel in the first image and is a pixel obtained by color correcting the first pixel based on the color overflow value of the first pixel. Wherein, the color overflow value is the total pixel value that exceeds the pixel value range, and the pixel value range corresponds to the color depth of the HDR mode.

[0033] It should be noted that the difference between the image capturing method provided in the second aspect and the image capturing method provided in the first aspect lies in the different scenarios that trigger the electronic device to capture images. The second aspect is for the scenario of opening the camera to capture a preview image, while the first aspect is for the scenario of clicking the capture shutter to actually capture an image.

[0034] However, it can be understood that regardless of the image capturing method triggered in which scenario, its implementation principle and the functions that can be achieved are the same. Therefore, for the beneficial effects in the second aspect and any possible implementation manner thereof, reference can be made to the beneficial effects in the first aspect and any possible implementation manner thereof, which will not be elaborated here.

[0035] In another possible implementation manner of the second aspect, the first image is an image obtained by performing color correction on the image captured by the camera through a first color correction matrix (the standard color correction matrix for color correction). Therefore, obtaining the second image based on the first image may include: calculating the color overflow value of the first pixel, and calculating the RGB color ratio of the first pixel; where the RGB color ratio is the ratio between the pixel values corresponding to the three RGB color components; generating a second color correction matrix corresponding to the first pixel according to the color overflow value and the RGB color ratio of the first pixel; and respectively performing color correction on the corresponding first pixel in the first image by using each second color correction matrix to obtain the second image including the second pixel.

[0036] In another possible implementation manner of the second aspect, calculating the color overflow value of the first pixel may include: respectively calculating the absolute differences between the three component pixel values of the first pixel and the pixel value range; where the three component pixel values are the pixel values corresponding to the three RGB color components; and summing the absolute differences corresponding to the three component pixel values to obtain the color overflow value of the first pixel.

[0037] In another possible implementation manner of the second aspect, generating a second color correction matrix corresponding to the first pixel according to the color overflow value and the RGB color ratio of the first pixel may include: calculating the ratio of the color overflow value corresponding to the first pixel to the maximum pixel value in the pixel value range, and determining the first color adjustment weight of the first pixel according to the product of the ratio and the intensity adjustment threshold; calculating the second color adjustment weight of the first pixel according to the RGB color ratio corresponding to the first pixel; taking the product of the second color adjustment weight and the first color adjustment weight as the new first color adjustment weight; taking the sum of the first product and the second product as the second color correction matrix; where the first product is the product of the new first color adjustment weight and the standard unit matrix; the second product is the product of the first color correction matrix and the first difference, and the first difference is the difference between the value 1 and the second color adjustment weight.

[0038] In another possible implementation of the second aspect, determining the first color adjustment weight of the first pixel according to the product of the ratio and the intensity adjustment threshold may include: if the product of the ratio and the intensity adjustment threshold is less than or equal to 0, the first color adjustment weight is equal to 0; if the product of the ratio and the intensity adjustment threshold is greater than or equal to 1, the first color adjustment weight is equal to 1; if the product of the ratio and the intensity adjustment threshold is greater than 0 and less than 1, the first color adjustment weight is equal to the product of the ratio and the intensity adjustment threshold.

[0039] In another possible implementation of the second aspect, the RGB color ratio includes the RG ratio and the BG ratio; the RG ratio is the ratio of the pixel values corresponding to the R color component and the G color component, and the BG ratio is the ratio of the pixel values corresponding to the B color component and the G color component; determining the second color adjustment weight corresponding to the first pixel according to the RGB color ratio may include: determining the RG adjustment weight according to the RG ratio corresponding to the first pixel, and determining the BG adjustment weight according to the BG ratio corresponding to the first pixel; taking the product of the RG adjustment weight and the BG adjustment weight as the second color adjustment weight corresponding to the first pixel.

[0040] In another possible implementation of the second aspect, determining the RG adjustment weight according to the RG ratio corresponding to the first pixel includes: when the RG ratio is greater than or equal to 10 or less than or equal to 0.1, the RG adjustment weight is equal to 1; when the RG ratio is greater than or equal to 1 and less than 10, the RG adjustment weight is equal to the ratio of the second difference to the value 9; the second difference is the difference between the RG ratio and the value 1; when the RG ratio is less than or equal to 1 and greater than 0.1, the RG adjustment weight is equal to the product of the value 10 / 9 and the third difference; the third difference is the difference between the value 1 and the RG ratio.

[0041] In another possible implementation of the second aspect, determining the BG adjustment weight according to the BG ratio corresponding to the first pixel includes: when the BG ratio is greater than or equal to 10 or less than or equal to 0.1, the BG adjustment weight is equal to 1; when the BG ratio is greater than or equal to 1 and less than 10, the BG adjustment weight is equal to the ratio of the fourth difference to the value 9; the fourth difference is the difference between the BG ratio and the value 1; when the BG ratio is less than or equal to 1 and greater than 0.1, the BG adjustment weight is equal to the product of the value 10 / 9 and the fifth difference; the fifth difference is the difference between the value 1 and the BG ratio.

[0042] In another possible implementation of the second aspect, the image capturing method further includes detecting the first pixels with color overflow in the first image, including: comparing the component pixel values of each pixel in the first image with the pixel value range respectively; wherein, the component pixel values include the pixel values corresponding to the RGB three color components; taking the pixels in the first image with component pixel values not within the pixel value range as the first pixels with color overflow.

[0043] In another possible implementation of the second aspect, the following formula can be used to calculate the second pixel:

[0044] R out = a 11 × R in + a 12 × G in + a 13 × B in

[0045] G out = a 21 × R in + a 22 × G in + a 23 × B in

[0046] B out = a 31 × R in + a 32 × G in + a 33 × B in

[0047] Wherein, R in , G in , B in are the RGB values of the first pixel; R out , G out , B out are the RGB values of the second pixel; a 11 , a 12 , a 13 , a 21 , a 22 , a 23 , a 31 , a 32 , a 32 are the elements in the second color correction matrix.

[0048] In another possible implementation of the second aspect, the image capturing method may further include: when determining that the first pixel is a discrete noise pixel based on the neighboring pixels of the first pixel, discarding the first pixel.

[0049] In another possible implementation of the second aspect, determining that the first pixel is a discrete noise pixel based on the neighboring pixels of the first pixel includes: converting the first image into a binary image, where the pixel value of the first pixel in the binary image is 1; in the binary image, dividing the first pixel and its neighboring pixels into pixel blocks according to a preset block size; if there are n pixels with a pixel value of 1 in the pixel block, the first pixel is not a discrete noise pixel; if there are no n pixels with a pixel value of 1 in the pixel block, the first pixel is a discrete noise pixel.

[0050] In a third aspect, the present application provides an electronic device, including: one or more processors and a memory, the memory being coupled to the processor; the memory stores one or more computer program codes, and the computer program codes include computer instructions; when the processor executes the computer instructions, the electronic device is caused to perform the following steps:

[0051] Display a first interface, the first interface including a preview image captured by the electronic device and a shooting shutter; in response to a click operation of the user on the shooting shutter, obtain a first image in HDR mode; or, receive an opening operation of the user on the camera application; the electronic device obtains a first image in HDR mode in response to the opening operation; where the first image is an image obtained by color correction of the image captured by the camera, and the first image includes a first pixel with color overflow.

[0052] Obtain a second image including a second pixel based on the first image; where the second pixel corresponds to the first pixel in the first image and is a pixel obtained by color correction of the first pixel based on the color overflow value of the first pixel. Where the color overflow value is the total pixel value exceeding the pixel value range, and the pixel value range corresponds to the color depth of the HDR mode.

[0053] In a possible implementation of the third aspect, when the above computer instructions are executed by the processor, the electronic device is further caused to perform the following steps: calculate the color overflow value of the first pixel; generate a first color correction matrix corresponding to the first pixel according to the color overflow value of the first pixel; use each first color correction matrix to re-perform color correction on the corresponding first pixel in the first image to obtain the second image including the second pixel.

[0054] In a possible implementation of the third aspect, when the above computer instructions are executed by the processor, the electronic device is further caused to perform the following steps: determine the ratio of the color overflow value to the maximum pixel value in the pixel value range; determine a first color adjustment weight according to the product of the ratio and the intensity adjustment threshold; use the product of the first color adjustment weight and the standard unit matrix as the first color correction matrix.

[0055] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: If the product of the ratio and the intensity adjustment threshold is less than or equal to 0, the first color adjustment weight is equal to 0; if the product of the ratio and the intensity adjustment threshold is greater than or equal to 1, the first color adjustment weight is equal to 1; if the product of the ratio and the intensity adjustment threshold is greater than 0 and less than 1, the first color adjustment weight is equal to the product of the ratio and the intensity adjustment threshold.

[0056] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: Calculate the absolute differences between the three component pixel values of the first pixel and the pixel value range respectively; wherein, the three component pixel values are the pixel values corresponding to the three RGB color components; Sum the absolute differences corresponding to the three component pixel values to obtain the color overflow value of the first pixel.

[0057] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: Calculate the RGB color ratio of the first pixel, and determine the second color adjustment weight corresponding to the first pixel according to the RGB color ratio; Take the product of the second color adjustment weight and the first color adjustment weight as the new first color adjustment weight; Take the sum of the first product and the second product as the second color correction matrix; wherein, the first product is the product of the new first color adjustment weight and the standard unit matrix; the second product is the product of the first color correction matrix and the first difference, and the first difference is the difference between the value 1 and the second color adjustment weight.

[0058] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: Determine the RG adjustment weight according to the RG ratio corresponding to the first pixel, and determine the BG adjustment weight according to the BG ratio corresponding to the first pixel; Take the product of the RG adjustment weight and the BG adjustment weight as the second color adjustment weight corresponding to the first pixel.

[0059] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: When the RG ratio is greater than or equal to 10 or less than or equal to 0.1, the RG adjustment weight is equal to 1; when the RG ratio is greater than or equal to 1 and less than 10, the RG adjustment weight is equal to the ratio of the second difference to the value 9; the second difference is the difference between the RG ratio and the value 1; when the RG ratio is less than or equal to 1 and greater than 0.1, the RG adjustment weight is equal to the product of the value 10 / 9 and the third difference; the third difference is the difference between the value 1 and the RG ratio.

[0060] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: when the BG ratio is greater than or equal to 10 or less than or equal to 0.1, the BG adjustment weight is equal to 1; when the BG ratio is greater than or equal to 1 and less than 10, the BG adjustment weight is equal to the ratio of the fourth difference to the value 9; the fourth difference is the difference between the BG ratio and the value 1; when the BG ratio is less than or equal to 1 and greater than 0.1, the BG adjustment weight is equal to the product of the value 10 / 9 and the fifth difference; the fifth difference is the difference between the value 1 and the BG ratio.

[0061] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: detecting first pixels with color overflow in the first image, including: comparing the component pixel values of each pixel in the first image with the pixel value range respectively; wherein, the component pixel values include the pixel values corresponding to the three color components RGB; taking the pixels in the first image with component pixel values not within the pixel value range as the first pixels with color overflow.

[0062] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: calculating a second pixel using the following formula:

[0063] R out =a 11 ×R in +a 12 ×G in +a 13 ×B in

[0064] G out =a 21 ×R in +a 22 ×G in +a 23 ×B in

[0065] B out =a 31 ×R in +a 32 ×G in +a 33 ×B in

[0066] Wherein, R in 、G in 、B in are the RGB values of the first pixel; R out 、G out 、B out are the RGB values of the second pixel; a11 、a 12 、a 13 、a 21 、a 22 、a 23 、a 31 、a 32 、a 32 is an element in the second color correction matrix.

[0067] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: when it is determined, according to the neighboring pixels of the first pixel, that the first pixel is a discrete noise pixel, discard the first pixel.

[0068] In a possible implementation of the third aspect, when the above computer instructions are executed by a processor, the electronic device is further caused to perform the following steps: convert the first image into a binary image, where the pixel value of the first pixel in the binary image is 1; in the binary image, divide the first pixel and its neighboring pixels into pixel blocks according to a preset block size; if there are n pixels with a pixel value of 1 in the pixel block, the first pixel is not a discrete noise pixel; if there are no n pixels with a pixel value of 1 in the pixel block, the first pixel is a discrete noise pixel.

[0069] In a fourth aspect, the present application provides an electronic device, including: one or more processors and a memory, the memory being coupled to the processors; the memory stores one or more computer program codes, and the computer program codes include computer instructions; when the processors execute the computer instructions, the electronic device is caused to perform the image capturing method as in the second aspect and any of its possible implementations.

[0070] In a fifth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor in an electronic device, the electronic device is caused to perform the image capturing method as in the first aspect and any of its possible implementations, and the second aspect and any of its possible implementations.

[0071] In a sixth aspect, the present application provides a computer program product, and when the computer program product runs on a computer, the computer is caused to perform the image capturing method as in the first aspect and any of its possible implementations, and the second aspect and any of its possible implementations. The computer may be the above-mentioned electronic device.

[0072] Understandably, for the electronic devices in any possible implementation manner of the above third aspect, the electronic devices in any possible implementation manner of the fourth aspect, the computer-readable storage medium in the fifth aspect, and the computer program product in the sixth aspect, the beneficial effects that can be achieved can refer to the beneficial effects in the first aspect and any possible implementation manner thereof, and the second aspect and any possible implementation manner thereof, which will not be elaborated herein. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] Figure 1 Schematic diagram of an image with color bleeding phenomenon provided by an embodiment of the present application Figure 1 ;

[0074] Figure 2 Schematic diagram of an image with color bleeding phenomenon provided by an embodiment of the present application Figure 2 ;

[0075] Figure 3 Schematic diagram of a scenario for triggering the opening of the HDR mode provided by an embodiment of the present application Figure 1 ;

[0076] Figure 4 Schematic diagram of a scenario for triggering the opening of the HDR mode provided by an embodiment of the present application Figure 2 ;

[0077] Figure 5 Schematic diagram of a scenario for triggering the opening of the HDR mode provided by an embodiment of the present application Figure 3 ;

[0078] Figure 6 Schematic diagram of the process of an image shooting method provided by an embodiment of the present application Figure 1 ;

[0079] Figure 7 Schematic diagram of a first interface provided by an embodiment of the present application;

[0080] Figure 8 Schematic diagram of an image without color bleeding phenomenon provided by an embodiment of the present application Figure 1 ;

[0081] Figure 9 Schematic diagram of an image without color bleeding phenomenon provided by an embodiment of the present application Figure 2 ;

[0082] Figure 10 Schematic diagram of a second interface provided by an embodiment of the present application;

[0083] Figure 11 Schematic diagram of the structure of an electronic device 100 supporting the HDR mode provided by an embodiment of the present application;

[0084] Figure 12 Flow schematic of an image capturing method provided by an embodiment of the present application Figure 2 ;

[0085] Figure 13 Flow schematic of generating a second CCM provided by an embodiment of the present application Figure 1 ;

[0086] Figure 14 Principle block diagram of an image capturing method provided by an embodiment of the present application;

[0087] Figure 15 Flow schematic of an image capturing method provided by an embodiment of the present application Figure 3 ;

[0088] Figure 16 Flow schematic of generating a second CCM provided by an embodiment of the present application Figure 2 ;

[0089] Figure 17 Image schematic of a binary image provided by an embodiment of the present application;

[0090] Figure 18 Schematic diagram of a pixel block provided by an embodiment of the present application;

[0091] Figure 19 Structure schematic diagram of a chip system provided by an embodiment of the present application. Detailed implementation manners

[0092] Next, the technical solutions of the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to limit the present application.

[0093] In addition, in order to facilitate a clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the terms "first" and "second" do not limit the quantity and execution order, and the terms "first" and "second" do not necessarily limit to be different. Also, in the description of the embodiments of the present application, unless otherwise specified, the meaning of "a plurality" means two or more.

[0094] With the development of image capture technology and the increasing demands of users for capture functions and image effects, the number of capture modes provided by the camera function in electronic devices is increasing. For example, the capture modes that existing electronic devices can provide to users include, but are not limited to, portrait mode, panoramic mode, time-lapse photography, night mode, and high dynamic range imaging (HDR or HDRI) mode, etc.

[0095] Among them, HDR is an imaging technology used to achieve a larger exposure dynamic range (i.e., a greater difference between light and dark) than ordinary digital image technology. The main purpose is to correctly represent the brightness range from direct sunlight to the darkest shadows in the real world. Simply put, compared with the existing low dynamic range (LDR) or standard dynamic range (SDR), HDR can display a larger brightness range, making the image more truly present the brightness and color details of the actual scene, and making the whole image look clearer in terms of light and dark adjustment.

[0096] That is to say, the images and videos captured in HDR mode have higher brightness, color depth (bit), and a wider color gamut. Color depth can also be called bit depth. For example, the color depth of HDR images can generally reach 10bit, 12bit, or 14bit, etc. A color depth of 10bit means that the number of counting units bit used by the computer is 10, and the computer can represent 2 10 (1024, 0 - 1023) colors through these 10bit. In an SDR image, the bit depth representing colors is 8bit, and the computer can represent 2 8 (256, 0 - 255) colors through these 8bit.

[0097] However, currently, most of the displays configured on electronic devices can only discretize the color channels to 8bit, and the chromaticity space has only 255 levels, and the color range that can be displayed is small (i.e., 0 to 255 of gray scale). Therefore, in order to adapt to the display capabilities of electronic devices and make HDR images and videos compatible for display on electronic devices, HDR tone mapping is required.

[0098] The purpose of HDR tone mapping can be simply understood as: enabling high dynamic range HDR images to adapt to LDR or SDR display devices. Currently, to achieve this purpose, it is necessary to map HDR images to the standard range of LDR images or SDR images, thereby achieving compression of the dynamic range. That is to say, when an electronic device captures an image in HDR mode, the generation of the image requires compression of the scene dynamic range.

[0099] However, during the compression process, the colors of high-saturation (brightly colored) imaging objects in the image that exceed the color gamut (0 to 255) will inevitably be cropped off, resulting in very small differences in the RGB channels of the pixels, leading to problems such as unclear texture and inability to distinguish clearly. That is, when the electronic device takes an image in HDR mode, high-saturation imaging objects are prone to serious color bleeding problems due to the compression of the scene dynamic range, resulting in the image content corresponding to the high-saturation imaging objects being difficult to distinguish and the details being lost and blurred.

[0100] Exemplarily, as Figure 1 and Figure 2 shown, a schematic diagram of an image with a color bleeding phenomenon is provided.

[0101] Figure 1 The high-saturation object in the shown image is the dashboard. Since the illumination light of this dashboard is highly saturated red (the red is not shown in the attached figure), the dashboard in the captured image has a color bleeding problem, resulting in the content in the dashboard, such as text content like driving speed, time, and driving gear, being unable to be clearly displayed in the captured image.

[0102] Figure 2 The shown image has a color bleeding phenomenon in the entire scene due to the blue LED light source (the glowing cylinder in the figure), resulting in Figure 2 the entire scene shown having a problem of lost and blurred details in the captured image.

[0103] Based on this, in order to avoid the problem that the image content is difficult to distinguish and the details are lost and blurred due to color bleeding of high-saturation objects in HDR mode, the embodiments of the present application provide an image capturing method. The image capturing method provided by the embodiments of the present application is applied to an electronic device that supports HDR mode shooting. For example, a mobile phone, a tablet computer, a camera, a video camera, etc. that support HDR mode shooting. The embodiments of the present application do not impose special restrictions on the specific type of the electronic device.

[0104] When the HDR mode is turned on, the electronic device can respond to the user's shooting operation and trigger the electronic device to execute the image capturing method provided by the embodiments of the present application. Among them, the shooting operation can be an opening operation in response to the user opening the camera application, or a click operation in response to the user on the shooting shutter.

[0105] The principle of the image capture method provided by the embodiments of this application is mainly as follows: After the electronic device performs conventional color correction processing on the images captured by the camera, for the pixels with color overflow in the images after color correction processing, secondary color correction is performed based on the color overflow value corresponding to this pixel. Because, if there is a color overflow phenomenon in the high-saturation imaging object in the image, the corresponding pixels will also show color overflow. That is, the color overflow value of the pixels corresponding to the high-saturation imaging object will exceed the pixel value range corresponding to the color depth in the HDR mode. Therefore, the embodiments of this application perform secondary color correction on this pixel again according to the color overflow value of this pixel, which can avoid color overflow of this pixel, thereby ensuring that the content of the high-saturation imaging object corresponding to the pixel is clearly displayed.

[0106] Among them, according to actual product requirements, the HDR mode in the electronic device can be configured to be in the default on state, so that there is no need for the user to trigger the opening. Furthermore, as long as the electronic device detects the user's shooting operation or the operation of opening the camera application, it can trigger the execution of the image capture method provided by the embodiments of this application.

[0107] Optionally, the HDR mode in the electronic device can also be triggered to be turned on by the user through the corresponding control. For example, the user can trigger the opening of the HDR mode in the shooting interface of the camera application in the electronic device, or can trigger the opening of the HDR mode in the settings interface of the camera application in the electronic device, or trigger the opening of the HDR mode in the settings interface of the electronic device.

[0108] Exemplarily, taking a mobile phone as an example of the electronic device, Figures 3 - 5 different scenarios for triggering the opening of the HDR mode are respectively shown.

[0109] Figure 3 The scenario where the user triggers the opening of the HDR mode in the shooting interface of the camera application in the mobile phone is shown. Refer to Figure 3 , when the mobile phone 1 is in the boot state, it can display the main interface 300 as shown in Figure 3 . The main interface 300 may include: application icons of applications such as "Clock", "Calendar", "Camera", "Gallery", "Memo"..., and "Settings".

[0110] The mobile phone 1 responds to the user's trigger operation on the "Camera" application icon 301 in the main interface 300, enters the camera application, and displays the shooting interface 302.

[0111] The shooting interface 302 includes multiple shooting options, for example, shooting options such as "AI", "HDR", "Settings", "Aperture", "Night Scene", "Portrait", "Take Photo", "Record Video", "Professional", etc. Figure 3The "HDR" shooting option in the shown shooting interface 302 is in the off state. Further, the mobile phone 1 enables the HDR shooting mode in response to the user's triggering operation on the "HDR" shooting option 303 in the shooting interface 302.

[0112] Figure 4 It shows the scenario where the user triggers the enabling of the HDR mode in the settings interface of the camera application in the mobile phone. Refer to Figure 4 , when the mobile phone 1 is in the powered-on state, it can display the main interface 400 as shown in Figure 4 . The main interface 400 may include: application icons of "Clock", "Calendar", "Camera", "Gallery", "Memo"... and applications such as "Settings" and "XX Camera".

[0113] Among them, the "Camera" in the main interface 400 can be understood as the camera application built into the mobile phone 1 system, and "XX Camera" can be understood as a third-party camera application installed in the mobile phone 1. The scenario where the user triggers the enabling of the HDR mode in the shooting interface within the "Camera" application can be referred to Figure 3 as shown.

[0114] For the scenario where the user uses the third-party camera application to take pictures, the mobile phone 1 enters the third-party camera application and displays the XX camera interface 402 in response to the user's triggering operation on the "XX Camera" application icon 401 in the main interface 400.

[0115] The XX camera interface 402 includes multiple function options. For example, it may include function options such as "Beauty", "Jigsaw Puzzle", "Cutout"... "Home Page", "Camera", "Me", etc. The mobile phone 1 enters the camera user interface 404 in response to the user's triggering operation on the "Me" option 403 in the XX camera interface 402.

[0116] The camera user interface 404 includes multiple function options. For example, it may include function options such as "Login", "Message", "Settings", and "Feedback". The mobile phone 1 enters the camera settings interface 406 in response to the user's triggering operation on the "Settings" option 405 in the camera user interface 404.

[0117] The camera settings interface 406 includes multiple setting options. For example, it may include setting options such as "Photo Shooting Settings", "Language Settings", "Clear Cache", etc. The mobile phone 1 enters the photo shooting settings interface 408 in response to the user's triggering operation on the "Photo Shooting Settings" option 407 in the camera user interface 406.

[0118] The camera settings interface 408 includes multiple setting options, such as options like "Save Original Image", "Watermark", "Auto Mirror", and "HDR". The mobile phone 1 activates the HDR shooting mode in response to a user's triggering operation on the "HDR" option 409 in the camera settings interface 408.

[0119] Figure 5 The figure shows a scenario where a user triggers the activation of the HDR mode in the settings interface of an electronic device. Refer to Figure 5 , when the mobile phone 1 is in the powered-on state, it can display the main interface 500 as shown in Figure 5 . The main interface 500 may include: application icons for applications such as "Clock", "Calendar", "Camera", "Gallery", "Memo"... and "Settings".

[0120] The mobile phone 1 enters the settings application and displays the settings application interface 502 in response to a user's triggering operation on the "Settings" application icon 501 in the main interface 500.

[0121] The settings application interface 502 may include multiple setting options, such as settings options for WLAN, Bluetooth, SIM card management, mobile network... music, camera, etc. The mobile phone 1 enters the camera settings interface 504 in response to a user's selection of the "Camera" option 503 in the settings application interface 502.

[0122] The camera settings interface 504 may include multiple camera settings options, such as camera settings options like HDR, grid, horizontal, etc. The mobile phone 1 activates the HDR shooting mode in response to a user's triggering operation on the "HDR" option 505 in the camera settings interface 504.

[0123] It should be noted that the above Figures 3 - 5 shown HDR mode activation scenario is used in the examples of this application. The ways for a user to trigger the activation of the HDR mode include but are not limited to the above Figures 3 - 5 shown scenario, and the embodiments of this application do not limit this.

[0124] Since an electronic device usually captures a preview image in response to a user's operation of opening the camera application, and the preview image mainly serves the purpose of pre-viewing the image. Therefore, compared with actual image capture in response to pressing the shooting shutter, the image information collected during preview image capture is less, the image processing process is relatively simpler and less intensive. Thus, generally, for high-saturation imaging objects, severe color truncation does not occur in the preview image, so the problem of color overflow may not occur. And even if color overflow occurs due to color truncation, the severity of the color overflow will be relatively low. Therefore, in the following embodiments of this application, the provided image capture method will mainly be described by taking the shooting operation in response to a user clicking the shooting shutter as an example.

[0125] Figure 6 The flowchart shows the image capture method provided by an embodiment of the present application. Hereinafter, in combination with an electronic device and Figure 6 the following process, a brief introduction and description of the image capture method provided by an embodiment of the present application will be given.

[0126] Refer to Figure 6 , first, the electronic device displays a first interface, which includes a preview image captured by the electronic device and a capture shutter. Among them, the capture shutter is used to trigger the electronic device to capture an image. The first interface can be the capture interface of the camera application. After the electronic device detects that the user clicks the capture shutter on the first interface, it captures an image in response to the click operation.

[0127] Exemplarily, taking a mobile phone as an example of the electronic device, Figure 7 a schematic diagram of a first interface is shown, which includes a capture shutter 701. After the mobile phone detects a click operation 702 on the capture shutter 701 by the user, it captures an image in response to the click operation 702. The preview image captured by the mobile phone can be displayed within the viewfinder 703.

[0128] Currently, whether the electronic device captures an image in response to a click operation on the capture shutter or captures a preview image in response to an opening operation of the user to open the camera application, most of the processes are to first call the camera to collect the raw image, and then process this raw image according to the corresponding Image Signal Processing (ISP) process to obtain a displayable image.

[0129] If it is a preview image capture, the electronic device will process the image according to the preview corresponding process to obtain a displayable preview image. If it is an actual image capture, the electronic device will process the image according to the actual imaging process.

[0130] Among them, the main function of ISP is to perform post-processing on the signals output by the front-end image sensor. It can be understood that in the whole process of camera shooting and imaging, ISP is the first processing process of camera shooting. After the ISP unit (such as an ISP processor) receives the raw signal data (i.e., the raw image) collected by the photosensitive element (i.e., the image sensor) on the camera, it processes this raw signal data to obtain a visible image.

[0131] The existing ISP process generally includes: image rasterization (bayer) → black level compensation → lens shading correction → bad pixel correction → color interpolation (demosaic) → bayer noise removal → automatic white balance (AWB) → color correction → gamma correction → color space conversion (e.g., RGB conversion to YUV) → color noise removal and edge enhancement in the YUV color space → color and contrast enhancement → output data in RGB (or YUV) format.

[0132] It should be noted that the above ISP process is used in the examples of this application. Each processing step in this ISP process can be increased, decreased, or adjusted according to the actual situation, and the embodiments of this application do not limit this.

[0133] In the embodiments of this application, when the HDR mode is not enabled, the electronic device can process the original image collected by the camera according to the existing ISP process to obtain an image that can be displayed.

[0134] However, when the HDR mode is enabled, the electronic device is triggered to further detect the first pixels with color overflow in the first image. Here, the first image is the image output after the color correction processing step in the ISP process. That is to say, the first image is the image after color correction of the image collected by the camera.

[0135] Currently, the color correction processing step in the ISP process is mainly implemented using a 3×3 matrix, which is called the color correction matrix (CCM), and can also be called the color calibration matrix.

[0136] Each element in the CCM represents the linear relationship between a color channel (R, G, and B) in the input image and the corresponding color channel in the output image. By adjusting the elements in the CCM, the conversion between different color spaces can be achieved, so as to achieve the purpose of color correction of the image. That is, the core of the CCM lies in the elements in the matrix, which can generally be obtained through pre-calibration. For example, the CMM matrix can be calculated using the least squares method, and the specific implementation method can refer to any existing public method, and the embodiments of this application do not limit this.

[0137] For the CCM obtained in the existing well-known manner, it can be understood as the standard CCM used for color correction in this technical field. For the sake of easy distinction, the embodiments of this application are hereinafter referred to as the first CCM. Therefore, in some embodiments, the first image in the embodiments of this application can be an image after color correction by the first CCM.

[0138] After the electronic device obtains the first image, it obtains the second image based on this first image. Specifically, the electronic device first detects the first pixels with color overflow from this first image, and these first pixels are the pixels in the first image where the color overflow phenomenon occurs. Then, the electronic device re-performs color correction on this first pixel alone according to the color overflow degree of the first pixel, and obtains the second pixel corresponding to the first pixel. It can be understood that the second pixel is the pixel obtained by performing secondary color correction on the first pixel.

[0139] After the electronic device has re-completed color correction for each first pixel with a color overflow phenomenon in the first image based on its corresponding color overflow degree, the second image including the second pixels can be obtained. That is, the electronic device performs color correction on the first pixels in the first image alone to obtain the second image to avoid the problem that the subsequent image content becomes unclear due to color overflow.

[0140] Generally speaking, because it is mainly the high-saturation imaging objects that are prone to color overflow in the HDR mode, it can be determined that these first pixels are the pixels corresponding to the high-saturation imaging objects (i.e., the brightly colored imaging objects).

[0141] In the embodiments of this application, the color overflow degree of the first pixel can be determined according to the color overflow value of the first pixel. Among them, the color overflow value refers to the total pixel value that exceeds the pixel value range. Since this application is directed to image capture in the HDR mode, the pixel value range should correspond to the color depth of the HDR supported by the electronic device.

[0142] For example, if the color depth of the HDR supported by the configuration of the electronic device is 10 bit, then the corresponding pixel value range is (2 0 , 2 10 ), that is, (0, 1023). That is, the electronic device can re-perform color correction on this first pixel according to the color overflow value of the first pixel to obtain the corresponding second pixel.

[0143] In some embodiments, since color correction is generally implemented based on a 3×3 CCM, the electronic device can generate a second CCM corresponding to the first pixel according to the color overflow value of the first pixel, and then use the second CCM to re - perform color correction on the first pixel to obtain a second pixel. That is, the electronic device adaptively generates a new CCM corresponding to each first pixel in the first image according to the color overflow degree of the first pixel, and then uses the new CCM to perform secondary color correction on the first pixel. In other words, the second CCM can be understood as a CCM generated based on the color overflow degree of the first pixel and applicable to the color correction of this first pixel.

[0144] Specifically, after the electronic device obtains the first image corrected by the first CCM, it can generate a second CCM corresponding to each first pixel according to the color overflow value of the first pixel in the first image. Then, the electronic device uses these second CCMs to re - perform color correction on the corresponding first pixels in the first image, thereby obtaining a second image including the second pixels.

[0145] It can be understood that each first pixel in the first image has a corresponding second CCM, and the second CCM is used to perform secondary color correction on this first pixel to obtain the second pixel corresponding to this first pixel.

[0146] From this, it can be known that the second image is an image composed of the second pixels and the pixels in the first image that do not have color overflow (that is, the other pixels in the first image except the first pixels). The second pixel is the pixel obtained by performing color correction on the first pixel.

[0147] Therefore, after the electronic device obtains the second image including the second pixels, it means that the electronic device has completed color correction on the pixels with color overflow (that is, the first pixels) in the currently captured image. It can be understood that the second image in the embodiments of the present application refers to the image obtained after the electronic device performs color correction for the color overflow phenomenon. It is equivalent to performing color correction on the first image with the color overflow phenomenon to obtain the corresponding second image.

[0148] Subsequently, the electronic device can continue to normally perform subsequent image processing on the basis of the second image according to the ISP process to generate a visible image. Since the color overflow problem has been processed in the color correction stage, there will be no color overflow phenomenon in the high - saturation objects in the finally generated visible image.

[0149] For example, in the ISP process, the processing after color correction is usually gamma correction. After the electronic device re - performs color correction on the first pixel in the first image using the second CCM, the obtained second image including the second pixel is input to gamma correction to continue the subsequent image processing flow, and finally a visible image is generated. In the embodiments of the present application, this visible image can be understood as a third image that can be displayed and is generated based on the second image including the second pixel.

[0150] It should be noted that after the embodiments of the present application obtain the second image including the second pixel, the specific implementation of the subsequent image processing flow for obtaining the third image based on the second image can be carried out according to any existing well - known image - shooting process of an electronic device, and the present application does not make any limitations in this regard.

[0151] As Figures 8 - 9 shown, taking the same shooting scene as Figures 1 - 2 shown as an example, an image schematic diagram without color overflow phenomenon is provided, that is, a schematic diagram of the third image.

[0152] Referring to Figure 1 and Figure 8 , Figure 1 it can be understood as an image that is not re - processed and output by the second CCM of the embodiments of the present application (equivalent to the third image obtained based on the first image), while Figure 8 is the image finally output after being re - processed by the second CCM of the embodiments of the present application (that is, the third image obtained based on the above - mentioned second image).

[0153] By comparing Figure 1 and Figure 8 it can be seen that after the second CCM of the embodiments of the present application re - performs color correction, Figure 8 the content of the dashboard shown in Figure 1 is displayed more clearly compared to

[0154] Similarly, referring to Figure 2 and Figure 9 , by comparing Figure 2 and Figure 9 it can be seen that after the processing of the second CCM of the embodiments of the present application, Figure 9 the content of the scene shown in Figure 2 is also displayed more clearly compared to

[0155] In addition, for the visible third image finally formed based on the second image, the electronic device can further display it. For example, the third image can be displayed on a second interface. This second interface can be a shooting interface. According to the actual design of the camera application, the electronic device can display the third image in a large image form on the shooting interface, or can also display the third image in a small image (thumbnail) form on the shooting interface.

[0156] Exemplarily, Figure 10 A schematic diagram of a second interface including a third image is shown. The third image can be displayed in a large image in area 1001 (i.e., directly displayed within the viewfinder of the shooting interface). Or, the third image can also be displayed in a small image in area 1002 (i.e., the captured third image is directly stored in the gallery).

[0157] It should be noted that, Figure 10 The display manner of the shown third image is only used for the examples of this application, and it does not constitute a limitation on the display of the second image.

[0158] In addition, if the electronic device executes the image shooting method of the embodiments of this application in the scenario of responding to the user opening the camera application, then the third image finally obtained by the electronic device is a preview image, so the third image can be directly displayed within the viewfinder.

[0159] Thus, in order to avoid the phenomenon of color overflow resulting in unclear display of image content, the embodiments of this application re - perform color correction on the basis of the actual overflow situation of the first pixels with color overflow in the first image, so as to be able to avoid color overflow during subsequent compression, and ensure that the image content corresponding to high - saturation objects is clearly visible and easy to distinguish.

[0160] In addition, it should be emphasized that in the embodiments of this application, re - performing color correction is only for the first pixels in the first image. That is to say, the embodiments of this application perform local color correction on the color - overflow pixels (i.e., only correct the area where color overflows, without affecting the area where color does not overflow), so as to ensure that the content details of high - saturation imaging objects are clearly distinguishable while avoiding affecting other normal pixels.

[0161] Figure 11 A schematic structural diagram of an electronic device 100 supporting the HDR mode is shown.

[0162] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) connector 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera module 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A and a touch sensor 180B.

[0163] It can be understood that the structure illustrated in the embodiments of this application does not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0164] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.

[0165] The processor may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching and executing instructions. Exemplarily, the above image capture method may be implemented by the processor 110.

[0166] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 may be a cache memory. This memory may store instructions or data that have been used by the processor 110 or are used frequently. If the processor 110 needs to use this instruction or data, it can be directly called from this memory. This avoids repeated accesses and reduces the waiting time of the processor 110, thus improving the efficiency of the system.

[0167] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc. The processor 110 may connect to modules such as a touch sensor, an audio module, a wireless communication module, a display screen, a camera module, etc. through at least one of the above interfaces.

[0168] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present application are only illustrative descriptions and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0169] The external memory interface 120 may be used to connect to an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card. Or files such as music and videos are transferred from the electronic device to the external memory card.

[0170] The internal memory 121 can be used to store computer-executable program codes, which include instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.). In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional methods or data processing of the electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.

[0171] The electronic device 100 can implement a display function through a GPU, a display screen 194, an application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information. For example, the GPU can be used for rendering and the display screen 194 can be used to display the second image generated in the embodiments of the present application.

[0172] The display screen 194 is used to display images, videos, etc. For example, it is used to display a third image obtained based on the above-mentioned second image. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or more display screens 194.

[0173] The electronic device 100 can implement the camera function through the camera module 193, ISP, video codec, GPU, display screen 194, application processor AP, neural network processor NPU, etc. For example, the second image in the embodiments of the present application is generated by using the camera module 193 and ISP.

[0174] The camera module 193 can be used to collect the color image data and depth data of the photographed object. The ISP can be used to process the color image data collected by the camera module 193. For example, when taking a photo, the shutter is opened, and the light passes through the lens and is transmitted to the camera photosensitive element (i.e., the image sensor), and the optical signal is converted into an electrical signal. The camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also optimize the noise, brightness, and skin color of the image through algorithms. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene.

[0175] In some embodiments, the ISP can be disposed in the camera module 193.

[0176] In some embodiments, the camera module 193 can be composed of a color camera module and a 3D sensing module.

[0177] In some embodiments, the photosensitive element of the camera of the color camera module can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in standard RGB, YUV and other formats.

[0178] In some embodiments, the 3D sensing module may be a (time of flight, TOF) 3D sensing module or a structured light 3D sensing module. Among them, structured light 3D sensing is an active depth sensing technology. The basic components of a structured light 3D sensing module may include an infrared (Infrared) emitter, an IR camera module, etc. The working principle of a structured light 3D sensing module is to first emit a light spot with a specific pattern to the object to be photographed, then receive the light coding of the light spot pattern on the surface of the object, and then compare the similarities and differences with the original projected light spot, and use the triangulation principle to calculate the three-dimensional coordinates of the object. The three-dimensional coordinates include the distance between the electronic device 100 and the object to be photographed. Among them, TOF 3D sensing can be an active depth sensing technology. The basic components of a TOF 3D sensing module may include an infrared (Infrared) emitter, an IR camera module, etc. The working principle of a TOF 3D sensing module is to calculate the distance (i.e., depth) between the TOF 3D sensing module and the object to be photographed through the time of infrared reflection to obtain a 3D depth of field map.

[0179] The structured light 3D sensing module can also be applied to fields such as face recognition, body-sensing game consoles, and industrial machine vision detection. The TOF 3D sensing module can also be applied to fields such as game consoles, augmented reality (AR) / virtual reality (VR), etc.

[0180] In some other embodiments, the camera module 193 can also be composed of two or more cameras. These two or more cameras may include a color camera, and the color camera can be used to collect color image data of the object to be photographed. These two or more cameras can use stereovision technology to collect depth data of the object to be photographed. Stereovision technology is based on the principle of human eye parallax. Under natural light, images of the same object are taken from different angles through two or more cameras, and then operations such as triangulation are performed to obtain the distance information between the electronic device 100 and the object to be photographed, that is, depth information.

[0181] In some embodiments, the electronic device 100 may include one or more camera modules 193. Specifically, the electronic device 100 may include one front camera module 193 and one rear camera module 193. Among them, the front camera module 193 is usually used to collect color image data and depth data of the photographer facing the display screen 194, and the rear camera module can be used to collect color image data and depth data of the shooting object (such as a person, a landscape, etc.) faced by the photographer.

[0182] In some embodiments, the CPU, GPU, or NPU in the processor 110 may process the color image data and depth data collected by the camera module 193. In some embodiments, the NPU may identify the color image data collected by the camera module 193 (specifically, the color camera module) through a neural network algorithm based on the skeleton point recognition technology, such as the convolutional neural network algorithm (CNN), to determine the skeleton points of the photographed person. The CPU or GPU may also run the neural network algorithm to determine the skeleton points of the photographed person according to the color image data.

[0183] The digital signal processor is used to process digital signals and can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0184] The video codec is used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0185] The NPU is a neural-network (NN) computing processor that can quickly process input information by drawing on the biological neural network structure, such as the transmission mode between human brain neurons, and can also continuously learn on its own. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as: image recognition, face recognition, voice recognition, text understanding, etc.

[0186] The pressure sensor 180A is used to sense pressure signals and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor may include at least two parallel plates having conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, the instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.

[0187] The touch sensor 180B, also referred to as a "touch control device". The touch sensor 180B may be disposed on the display screen 194, and the touch sensor 180B and the display screen 194 form a touch screen, also referred to as a "touch control screen". The touch sensor 180K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100, at a different position from the display screen 194.

[0188] Specifically in the embodiments of the present application, the electronic device 100 can detect the user's click operation on the camera shutter and the user's operation to open the camera application through the pressure sensor 180A and the touch sensor 180B.

[0189] The USB connector 130 is an interface that conforms to the USB standard specification and can be used to connect the electronic device 100 and peripheral devices. Specifically, it can be a Mini USB connector, a Micro USB connector, a USB Type C connector, etc. The charging management module 140 is used to receive the charging input from the charger. Among them, the charger can be a wireless charger or a wired charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.

[0190] The wireless communication function of the electronic device 100 can be implemented by antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modulation and demodulation processor, baseband processor, etc.

[0191] The electronic device 100 can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor, etc. For example, music playback, recording, etc.

[0192] The button 190 can include a power-on button, volume buttons, etc. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light, which can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card.

[0193] It should be noted that the image capture methods described in the following embodiments can all be implemented in the electronic device 100 with the above hardware structure.

[0194] Next, in combination with Figure 12 the following flow schematic diagram, the image capture method proposed in the embodiments of the present application will be described in detail. Referring to Figure 12 , the image capture method provided by the embodiments of the present application mainly includes steps S1201 - S1207.

[0195] S1201, the electronic device acquires a first image that has been color-corrected using a first CCM.

[0196] The electronic device captures a preview image in response to the user's operation of opening the camera application. Alternatively, after the electronic device responds to the user's opening operation and opens the camera application to display a first interface including a preview image and a shooting shutter (the first interface can be the Figure 7 shown shooting interface), if the user clicks the shooting shutter on the first interface, the electronic device then responds to the user's click operation on the shooting shutter and starts actual image capture.

[0197] During the image capture process, the electronic device first calls the camera to collect the original image. Then, the electronic device performs imaging processing on the original image collected by the camera according to the ISP process.

[0198] When the ISP process reaches the color correction processing step, the electronic device acquires the image output after color correction, that is, the electronic device acquires a first image that has been color-corrected using a first CCM.

[0199] S1202, the electronic device detects the first pixels with color overflow in the first image.

[0200] After the electronic device obtains the first image, it separately detects color overflow for each pixel in the first image to determine the first pixel with color overflow in the first image.

[0201] In some embodiments, color overflow can actually be understood as the pixel value exceeding the pixel value range. That is to say, if the pixel value of a certain pixel exceeds the pixel value range, then this pixel can be determined as the first pixel with color overflow.

[0202] Meanwhile, an image pixel usually includes three color components, namely R, G, and B, and each color component corresponds to a pixel value respectively, hereinafter referred to as the component pixel value. Therefore, the electronic device can determine whether a pixel is the first pixel with color overflow by judging whether the three component pixel values corresponding to each pixel in the first image exceed the pixel value range. If the component pixel value of a pixel exceeds the pixel value range, then this pixel is the first pixel with color overflow.

[0203] Based on this, in S1202, for the electronic device to detect the first pixel with color overflow in the first image, it can include: the electronic device compares the component pixel values of each pixel in the first image with the pixel value range respectively; the electronic device regards the pixel with a component pixel value not within the pixel value range in the first image as the first pixel with color overflow.

[0204] It should be noted that the pixel value range in the embodiments of the present application corresponds to the color depth of the HDR mode. That is to say, the pixel value range is not the commonly used (0, 255) corresponding to 8bit. Because, although the image output and displayed after imaging processing conforms to the 8bit color depth that the display can display (i.e., 0 to 255). However, if the electronic device takes pictures in the HDR mode, then the color depth during the imaging processing of the image is still the color depth corresponding to HDR. That is to say, when taking pictures in the HDR mode, the color depth of the input image is usually higher than that of the output image.

[0205] And the color depth in the HDR mode is usually higher than the ordinary 8bit, for example, it can be 10bit, 12bit or 14bit, and the specific bit value depends on the product configuration of the actual electronic device.

[0206] Therefore, if the HDR supported by the electronic device is 10bit color depth, then the corresponding pixel value range is (0, 1023). Similarly, if the electronic device supports 14bit color depth, then the corresponding pixel value range is (0, 16383).

[0207] In the embodiment of the present application, the pixel value range can be expressed as (thre1, thre2), where thre1 is the minimum pixel value in the pixel value range and thre2 is the maximum pixel value in the pixel value range.

[0208] Then, the electronic device compares the component pixel values (R value, G value, and B value) of the three color components of the pixel with the pixel value range respectively, and the comparison is as follows:

[0209] R value > thre2 or R value < thre1;

[0210] G value > thre2 or G value < thre1;

[0211] B value > thre2 or B value < thre1;

[0212] Furthermore, as long as the RGB of the pixel satisfies any one or more of the above conditions, it can be determined that this pixel is the first pixel with color overflow. That is, as long as there is a situation where the component pixel value of the pixel in the first image is not within the pixel value range, then this pixel is the first pixel with color overflow phenomenon.

[0213] In addition, since image shooting is usually performed in HDR mode and high-saturation imaging objects often have color overflow, the first pixels detected by the electronic device can be determined to be the pixels corresponding to high-saturation imaging objects.

[0214] S1203, the electronic device calculates the color overflow value of the first pixel.

[0215] Color overflow means that the pixel value exceeds the pixel value range, and the color overflow value refers to the total pixel value exceeding the pixel value range (thre1, thre2). Since color overflow occurs because the pixel color is truncated during the process of compressing the dynamic range, if compressed, the color overflow value of the pixel can actually be understood as the truncated color of this pixel. That is, the larger the color overflow value of the first pixel, the greater the color truncation intensity of this first pixel if the dynamic range is compressed.

[0216] Therefore, after the electronic device detects the first pixels with color overflow in the first image, in order to accurately adjust the color of the first pixels and avoid the problem that the image content is unclear and indistinguishable due to color overflow caused by color truncation of the first pixels, the electronic device first calculates and determines the color overflow value of each first pixel respectively.

[0217] In some embodiments, since a pixel usually corresponds to three color components, namely R, G, and B, and each color component has a corresponding pixel value (i.e., component pixel value). Therefore, the electronic device can first calculate the absolute differences between the three component pixel values corresponding to the first pixel and the pixel value range respectively. Then, the electronic device sums up these three absolute differences to obtain the color overflow value of this first pixel (which can also be called the RGB color overflow value).

[0218] That is, the electronic device first calculates the pixel values exceeded by the three color components corresponding to the first pixel respectively, and then sums up the pixel values exceeded by these three color components to obtain the RGB color overflow value.

[0219] The RGB color overflow value sumN can be specifically calculated using the following formula:

[0220]

[0221] S1204. The electronic device generates a second CCM corresponding to the first pixel according to the color overflow value of the first pixel.

[0222] After the electronic device determines the color overflow value of the first pixel, it can adaptively generate a new CCM corresponding to this first pixel based on the color overflow value of each first pixel. That is to say, a second CCM that can be accurately used to adjust the color of this first pixel is generated based on the color overflow value of the first pixel.

[0223] Since a corresponding second CCM is generated for each first pixel, it can be understood that the number of second CCMs generated is the same as the number of first pixels in the first image, and these second CCMs correspond to the first pixels one by one.

[0224] Specifically, the larger the color overflow value of the first pixel, the more color the first pixel overflows. Then, in order to achieve a good color correction effect, the color correction strength of this first pixel can be increased accordingly.

[0225] Therefore, the electronic device can regard the ratio of the color overflow value of the first pixel to the maximum pixel value thre2 as the adjustment strength required for color correction of this first pixel. Furthermore, the electronic device generates a second CCM applicable to this first pixel through the determined adjustment strength.

[0226] For example, the ratio of the color overflow value of the first pixel to the maximum pixel value thre2 can be multiplied by the standard unit matrix I, and the resulting matrix is used as the second CCM.

[0227] In some embodiments, such as Figure 13As shown in S1204, for the electronic device to generate a second CCM based on the color overflow value of the first pixel, it may include: the electronic device determines the ratio of the color overflow value to the maximum pixel value in the pixel value range; the electronic device determines the first color adjustment weight according to the product of the ratio and the intensity adjustment threshold; the electronic device takes the product of the first color adjustment weight and the standard unit matrix as the second color correction matrix.

[0228] When the electronic device generates a second CCM based on the color overflow value sumN of the first pixel, it can first calculate the ratio sumN / thre2 of this color overflow value sumN of the first pixel to the maximum pixel value thre2 in the pixel value range (thre1, thre2). This ratio sumN / thre2 is the adjustment strength required for color correction of the first pixel to prevent color overflow of the first pixel.

[0229] Then, the electronic device calculates the product of this ratio sumN / thre2 and the preset intensity adjustment threshold rio3, and determines the first color adjustment weight according to the calculated product.

[0230] Among them, the intensity adjustment threshold rio3 is set based on experience and is a preset value used to adjust the intensity of color correction. In the embodiments of the present application, 10 ≤ rio3 ≤ 100. The larger rio3 is, the greater the intensity. Specifically, it can be set according to the adjustment intensity required by the actual business, and the present application does not limit this. And the first color adjustment weight is the adjustment strength finally determined by the electronic device for color correction of the first pixel.

[0231] That is, after the electronic device determines the adjustment strength required for the first pixel (i.e., the ratio sumN / thre2), it can be further multiplied by the set intensity adjustment threshold rio3 to obtain the first color adjustment weight that finally meets the adjustment requirements.

[0232] In some embodiments, determining the first color adjustment weight according to the product of the ratio and the intensity adjustment threshold may include: when the product of the ratio and the intensity adjustment threshold is less than or equal to 0, the first color adjustment weight is equal to 0; when the product of the ratio and the intensity adjustment threshold is greater than or equal to 1, the first color adjustment weight is equal to 1; when the product of the ratio and the intensity adjustment threshold is greater than or equal to 0 and less than or equal to 1, the first color adjustment weight is equal to the product of the ratio and the intensity adjustment threshold.

[0233] Because the conventional value range of the weight is usually [0, 1]. Therefore, when sumN / thre2 * rio3 ≤ 0, the first color adjustment weight Weight clip = 0.

[0234] When sumN / thre2 * rio3 ≥ 1, the first color adjustment weight Weightclip = 1.

[0235] When 0 < sumN / thre2 * rio3 < 1, the actual value can be used, and then the first color adjustment weight Weight clip = sumN / thre2 * rio3.

[0236] The electronic device obtains the first color adjustment weight Weight clip After that, the product of the first color weight Weight clip and the standard unit matrix I is used as the second CCM. That is, the second CCM = Weight clip * I. Among them, since the existing CCM is usually a 3×3 matrix, the standard unit matrix I in the embodiments of this application is expressed as follows:

[0237]

[0238] It can be seen that since the standard unit matrix I is a matrix with diagonal elements of 1 and other elements of 0. Therefore, using the product of the first color adjustment weight Weight clip and the standard unit matrix I as the second CCM can ensure that the obtained second CCM can simultaneously meet the adjustment strength required for the first pixel and the adjustment intensity required for the actual business.

[0239] Furthermore, the electronic device can achieve the best color correction effect by subsequently using this second CCM to re - correct the color of the first pixel.

[0240] S1205, the electronic device uses the second CCM to re - correct the color of the first pixel to obtain a second pixel.

[0241] After the electronic device obtains the new second CCM, it can re - correct the color of the corresponding first pixel using this second CCM in a traditional color correction manner to obtain a second pixel.

[0242] The RGB values of the second pixel obtained by re - correcting the color can be calculated according to the following formula:

[0243] R out = a 11 ×R in + a 12 ×G in + a 13 ×B in

[0244] G out = a 21 ×R in + a 22 ×G in + a23 ×B in

[0245] B out = a 31 ×R in + a 32 ×G in + a 33 ×B in

[0246] Wherein, R in , G in , B in are the RGB values of the pixels input before re - performing color correction (i.e., the RGB values of the first pixel). R out , G out , B out are the RGB values of the pixels output after re - performing color correction (i.e., the RGB values of the second pixel). a 11 , a 12 , a 13 , a 21 , a 22 , a 23 , a 31 , a 32 , a 32 are the elements in the second CCM, expressed as follows:

[0247]

[0248] Since the second CCM is a matrix obtained by multiplying the color adjustment weights by the standard unit matrix I, and the elements outside the diagonal in the standard unit matrix I are all 0, the elements a 12 , a 13 , a 21 , a 23 , a 31 , a 32 can actually be 0.

[0249] S1206, the electronic device obtains a second image including the second pixel.

[0250] S1207, the electronic device obtains a third image based on the second image and displays the third image.

[0251] After the electronic device re - performs color correction on the first pixel with color overflow in the first image using the second CCM, the adjustment of the pixel with color overflow has been completed at this time. Therefore, the electronic device can obtain an image on the basis of the second pixel that will not cause subsequent imaging compression to result in color overflow of high - saturation imaging objects, that is, the second image in the embodiments of the present application. That is, the second image includes the second pixel and other pixels in the first image except the first pixel.

[0252] It is understandable that the second image is an image obtained by performing secondary color correction on local pixels in the first image, and the local pixels subjected to secondary color correction are the first pixels detected to have color overflow.

[0253] After the electronic device obtains the second image, it can continue to perform subsequent imaging processing on the basis of the second image, so as to generate a third image that can be displayed.

[0254] It can be seen that in order to avoid the phenomenon of color overflow causing unclear display of image content, based on the actual overflow situation of the detected color overflow pixels, a new second CCM is generated accordingly in the embodiment of the present application. Then, this second CCM is used to re-correct the color overflow pixels, so as to avoid color overflow in subsequent compression, ensuring that the image content corresponding to high-saturation objects is clearly visible and easy to distinguish.

[0255] In addition, it should be emphasized that in the embodiment of the present application, the second CCM is a CCM adaptively generated for the first pixels, and the second CCM is only used to re-correct the corresponding first pixels. Other pixels in the first image except the first pixels will not be color-corrected after being color-corrected by the first CCM. That is to say, the embodiment of the present application performs local color correction on the color overflow pixels (that is, only corrects the area where color overflows, without affecting the area where color does not overflow), so as to ensure that the content details of high-saturation imaging objects are clearly distinguishable while avoiding affecting other normal pixels.

[0256] Figure 14 shows a schematic block diagram of the image shooting method provided by the embodiment of the present application. Combining Figure 14 and the above embodiments, it can be known that the principle of the image shooting method provided by the embodiment of the present application can be briefly described as follows:

[0257] The electronic device responds to the user's operation of opening the camera application or the shooting operation of the user clicking the shooting shutter to enter image shooting. During the process of collecting the original image according to the conventional image shooting principle and performing imaging processing and display according to the conventional ISP process, a secondary color correction processing step is added after the color correction (performed by the first CCM) in the ISP process.

[0258] Exemplarily, the ISP process during the image capture in the embodiments of the present application may include: image rasterization (bayer) → black level compensation → lens shading correction → bad pixel correction → color interpolation (demosaic) → bayer noise removal → automatic white balance (AWB) → color correction → secondary color correction → gamma correction → color space conversion (e.g., RGB conversion to YUV) → color noise removal and edge enhancement in the YUV color space → color and contrast enhancement → output data in RGB (or YUV) format.

[0259] It can be seen that compared with the above ISP process, the ISP process in the embodiments of the present application has one more processing step of secondary color correction.

[0260] In the embodiments of the present application, the principle of secondary color correction is to perform secondary color correction on the pixels with color overflow, that is, the electronic device performs local color correction separately on the pixels with color overflow, so as to avoid the problem of unclear image content caused by color overflow and avoid affecting other normal pixels in the first image at the same time.

[0261] This processing step of secondary color correction mainly includes: first, detecting the overflow pixels, that is, detecting the first pixels with color overflow in the first image output after the conventional color correction. Second, calculating the color overflow value, that is, calculating the RGB color overflow value of the first pixels. Third, determining the color adjustment weight, that is, determining the first color adjustment weight according to the RGB color overflow value. Fourth, generating a new CCM, that is, generating a second CCM according to the first color adjustment weight. Finally, performing color correction using the new CCM, that is, performing secondary color correction on the first pixels in the first image separately using the second CCM to obtain a second image including the second pixels.

[0262] Therefore, performing color correction again for the case of pixel color overflow can avoid color overflow during subsequent dynamic range compression, thereby ensuring that the image content corresponding to the high-saturation object is clearly visible.

[0263] In some embodiments, since the higher the pixel values corresponding to the R color component (red) and B color component (blue) of the pixel, the higher the color vividness of this pixel. And the probability of color overflow for the imaging object with more vivid color (the imaging object with higher saturation) is higher.

[0264] Therefore, the electronic device can further combine the RGB color ratio of the first pixel to generate a second CCM, thereby improving the calibration effect for calibrating the color overflow area. Among them, the RGB color ratio refers to the ratio between the pixel values corresponding to the R, G, and B color components of the pixel, that is, the ratio of the pixel values of the three components.

[0265] Figure 15 FIG. shows a schematic flowchart of an image capturing method provided by an embodiment of the present application, including steps S1501-S1507. By comparing Figure 12 and Figure 15 it can be seen that in the embodiment of the present application Figure 15 the provided image capturing method is based on the Figure 12 shown image capturing method, and adds a processing step of generating a second CCM according to the RGB color ratio of the first pixel.

[0266] That is, in the embodiment of the present application, the electronic device comprehensively considers the color overflow value and the RGB color ratio of the first pixel to generate the second CCM corresponding to the first pixel.

[0267] Therefore, the specific implementation of S1501-S1503, S1505-S1507 in the embodiment of the present application can refer to Figure 12 the description in the corresponding embodiment. For example, referring to the description of S1201-S1203, S1205-S1207 in the above embodiment, the principles of the two are the same, and the embodiment of the present application will not be elaborated here.

[0268] Hereinafter, the embodiment of the present application will elaborate on S1504, in which the electronic device generates a second CCM according to the color overflow value and the RGB color ratio of the first pixel.

[0269] Figure 16 FIG. shows a schematic flowchart of generating a second CCM according to the color overflow value and the RGB color ratio of the first pixel. Refer to Figure 16 , including steps S1601-S1604.

[0270] S1601, the electronic device calculates the RGB color ratio of the first pixel.

[0271] Since the embodiment of the present application mainly considers the influence of the R color component and the B color component on the color vividness. And, as long as one reference value is selected from the three values and the ratios with the remaining two values are calculated respectively, the relationship between the remaining two values can also be deduced according to the known ratios.

[0272] Therefore, in some embodiments, the RGB color ratio mainly includes the RG ratio and the BG ratio. That is to say, based on the G color component as a reference, the ratios of the R color component and the B color component to the G color component are calculated respectively. Therefore, the RG ratio (R value / G value) is the ratio of the pixel values of the R color component and the G color component, and the BG ratio (B value / G value) is the ratio of the pixel values of the B color component and the G color component.

[0273] S1602, the electronic device determines the second color adjustment weight according to the RGB color ratio.

[0274] Among them, this second color adjustment weight is the color adjustment weight determined based on the RGB color ratio.

[0275] In some embodiments, for the electronic device to determine the second color adjustment weight according to the RGB color ratio, it may include: determining the RG adjustment weight according to the RG ratio, and determining the BG adjustment weight according to the BG ratio; taking the product of the RG adjustment weight and the BG adjustment weight as the second color adjustment weight.

[0276] That is to say, the electronic device first determines the corresponding adjustment weights based on the RG ratio and the BG ratio respectively to obtain the RG adjustment weight and the BG adjustment weight. Then, the electronic device comprehensively combines the adjustment weights of the two color ratios and takes the product of the RG adjustment weight and the BG adjustment weight as the second color adjustment weight.

[0277] Among them, the RG ratio rio RG The corresponding RG adjustment weight Weight rioRG , and the BG ratio rio BG The corresponding BG adjustment weight Weight rioBG are weights set based on experience. The electronic device can obtain the weight parameters Weight rioRG and Weight rioBG by querying a preset weight table. That is to say, this weight table is an empirical parameter table, which can be specifically set according to actual business requirements. Generally speaking, the greater the difference between the RG ratio and the BG ratio and 1, the greater the difference between the R color component, the B color component and the G color component, and the higher the degree of color vividness. Furthermore, the corresponding adjustment weights Weight rioRG and Weight rioBG can be larger.

[0278] In the embodiments of the present application, the RG ratio rio RG and the BG ratio rio BG are closer to 0.1 or 10, the weight parameters Weight rioRG and Weight rioBG are closer to 1. And the RG ratio rioRG and the ratio rio of BG BG The closer it is to 1, the weight parameter Weight rioRG and Weight rioBG will be closer to 0.

[0279] In some embodiments, when the ratio rio of RG RG is greater than or equal to 10 or less than or equal to 0.1, the RG adjustment weight Weight rioRG equals 1. When the ratio rio of RG RG is greater than or equal to 1 and less than 10, the RG adjustment weight Weight rioRG equals the ratio of the second difference to the value 9, and the second difference is the difference between the ratio rio of RG RG and the value 1. When the ratio rio of RG RG is less than or equal to 1 and greater than 0.1, the RG adjustment weight Weight rioRG equals the product of the value 10 / 9 and the third difference, and the third difference is the difference between the value 1 and the ratio rio of RG RG .

[0280] The RG ratio rio can be calculated using the following formula RG for the corresponding RG adjustment weight Weight rioRG :

[0281]

[0282] Similarly, when the ratio rio of BG BG is greater than or equal to 10 or less than or equal to 0.1, the BG adjustment weight Weight rioBG equals 1. When the ratio rio of BG BG is greater than or equal to 1 and less than 10, the BG adjustment weight Weight rioBG equals the ratio of the fourth difference to the value 9, and the fourth difference is the difference between the ratio rio of BG BG and the value 1. When the ratio rio of BG BG is less than or equal to 1 and greater than 0.1, the BG adjustment weight Weight rioBG equals the product of the value 10 / 9 and the fifth difference, and the fifth difference is the difference between the value 1 and the ratio rio of BG BG .

[0283] The BG ratio rio can be calculated using the following formula BG for the corresponding BG adjustment weight Weight rioBG :

[0284]

[0285] The electronic device obtains the weight parameter WeightrioRG and Weight rioBG After that, take the product of the weight parameter Weight rioRG and Weight rioBG as the second color adjustment weight Weight rio . That is, Weight rio = Weight rioRG * Weight rioBG .

[0286] S1603. The electronic device takes the product of the first color adjustment weight and the second color adjustment weight as the new first color adjustment weight.

[0287] That is, after the electronic device obtains the second color adjustment weight determined according to the RGB color ratio, by combining the two color adjustment weights, it further takes the product of the first color adjustment weight Weight clip and the second color adjustment weight Weight rio as the new first color adjustment weight Weight total . That is, Weight total = Weight clip * Weight rio .

[0288] S1604. The electronic device takes the sum of the first product and the second product as the second CCM. Among them, the first product is the product of the new first color adjustment weight and the standard unit matrix; the second product is the product of the first color correction matrix and the first difference, and the first difference is the difference between the value 1 and the second color adjustment weight.

[0289] Specifically, the second CCM can be calculated using the formula:

[0290] CCM out = Weight total ×I+(1 - Weight rio )×CCM in

[0291] Among them, CCM out is the second CCM, CCM in is the first CCM, Weight rio is the first color adjustment weight, Weight total is the new first color adjustment weight, and I is the standard unit matrix. Finally, the electronic device can use the CCM out output by the embodiment of the present application to re - perform color correction on the first pixel.

[0292] It can be seen that the embodiment of the present application combines the RGB color ratio to generate the second CCM, which can further improve the color correction effect and ensure that the image content corresponding to the high-saturation imaging object is clearly distinguishable.

[0293] In some embodiments, there may be discrete noise pixels in the image. Therefore, in order to avoid the influence of discrete noise pixels, in the embodiment of the present application, after the electronic device detects the first pixel in the first image, it can further detect the first pixel belonging to the discrete noise pixels. If there is a first pixel that is a discrete noise pixel, then this first pixel is discarded.

[0294] Among them, the discrete noise pixels can be obtained by detecting the neighboring pixels. In the embodiment of the present application, the neighboring pixels of the first pixel can be obtained in the way of 4-neighborhood, 8-neighborhood or D-neighborhood, and the present application does not make a limitation on this.

[0295] In some embodiments, determining that the first pixel is a discrete noise pixel according to the neighboring pixels of the first pixel may include: converting the first image into a binary image, and the pixel value of the first pixel in the binary image is 1; in the binary image, dividing the first pixel and the neighboring pixels into pixel blocks; if there are n pixels with pixel value 1 in the pixel block, the first pixel is not a discrete noise pixel; if there are no n pixels with pixel value 1 in the pixel block, the first pixel is a discrete noise pixel. Among them, since the first pixel is the pixel corresponding to the high-saturation imaging object, after the first image is binarized, the pixel value of the first pixel is 1, which appears as white on the image.

[0296] Exemplarily, as Figure 17 shown, a schematic diagram of the binary image corresponding to the first image is provided. Referring to Figure 17 , the brightly colored red flower 1701 in the left figure appears as white on the binary image on the right after binarization.

[0297] Then, the electronic device divides the first pixel and the neighboring pixels into pixel blocks in the binary image. For example, when the neighboring pixels of the first pixel are obtained in the way of 8-neighborhood, then the pixel block composed of the first pixel and its neighboring pixels can be a nine-grid. As Figure 18 shown, a schematic diagram of the pixel block is provided. Among them, P represents the first pixel, and the 8 pixels Q around the first pixel P are the neighboring pixels of P.

[0298] Finally, the electronic device determines whether there are n pixels with a pixel value of 1 in the pixel block. If there are n pixels with a pixel value of 1 in the pixel block, it indicates that the first pixel is not a discrete noise pixel, and this first pixel is retained. If there are not n pixels with a pixel value of 1 in the pixel block, it indicates that the first pixel is a discrete noise pixel, and this first pixel is discarded. Taking the pixel block including 9 pixels as an example, that is, if the number of pixels with a pixel value of 1 among the 9 pixels is less than n, this first pixel is discarded. If the number of pixels with a pixel value of 1 among the 9 pixels is equal to or more than n, this first pixel is retained. Wherein, n is a quantity set according to actual experience and the situation of the neighboring pixels of the actual discrete noise, and can be configured according to specific situations. The embodiments of the present application do not limit this.

[0299] Thus, in the embodiments of the present application, the first pixel belonging to the discrete noise pixel is discarded based on the neighboring pixels, which can avoid the influence of the discrete noise pixel on color correction, thereby improving the effect of color correction.

[0300] Another embodiment of the present application provides an electronic device, including: one or more processors and a memory. The memory is coupled to the processor; one or more computer program codes are stored in the memory, and the computer program codes include computer instructions; when the processor executes the computer instructions, the electronic device implements the image capture method described in any of the above embodiments.

[0301] Another embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor in an electronic device, the electronic device implements the image capture method described in any of the above embodiments.

[0302] The embodiments of the present application also provide a computer program product. When the computer program product runs on a computer, the computer executes each function or step in the above method embodiments.

[0303] The embodiments of the present application also provide a chip system, as Figure 19 shown. The chip system 190 includes at least one processor 1901 and at least one interface circuit 1902. The processor 1901 and the interface circuit 1902 can be interconnected by a line. For example, the interface circuit 1902 can be used to receive signals from other devices (such as the memory of a computer). For another example, the interface circuit 1902 can be used to send signals to other devices (such as the processor 1901).

[0304] Exemplarily, the interface circuit 1902 can read the instructions stored in the memory and send the instructions to the processor 1901. When the instructions are executed by the processor 1901, the computer can be made to execute the respective steps in the above embodiments. Of course, the chip system may further include other discrete devices, and the embodiments of the present application do not make specific limitations thereto.

[0305] Through the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and conciseness of description, only the division of the above functional modules is used as an example for illustration. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0306] In several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.

[0307] The units described as separate components may or may not be physically separated. The components displayed as units may be one physical unit or multiple physical units, that is, they may be located in one place, or may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0308] In addition, each functional unit in the various embodiments of the present application can be integrated in one processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0309] When an integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiments of the present application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read only memory (ROM), random access memory (RAM), magnetic disks, or optical discs.

[0310] The above content is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be covered by the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. An image capturing method, characterized in that, applied to an electronic device, the electronic device includes a camera, the electronic device supports a high dynamic range imaging HDR mode, and the method includes: displaying a first interface; wherein, the first interface includes a preview image captured by the electronic device and a shooting shutter; in response to a click operation of the user on the shooting shutter, obtaining a first image in the HDR mode; wherein, the first image includes a first pixel with color overflow; the first image is an image obtained by color correction of the image collected by the camera; obtaining a second image based on the first image; wherein, the second image includes a second pixel corresponding to the first pixel, and the second pixel is obtained by color correction based on the color overflow value of the first pixel; the color overflow value is the total pixel value exceeding the pixel value range, and the pixel value range corresponds to the color depth of the HDR mode.

2. The method according to claim 1, characterized in that, the first image is an image obtained by color correction of the image collected by the camera through a first color correction matrix; wherein, the first color correction matrix is a standard color correction matrix for color correction; the obtaining the second image based on the first image includes: calculating the color overflow value of the first pixel; generating a second color correction matrix corresponding to the first pixel according to the color overflow value of the first pixel; using each of the second color correction matrices to respectively perform color correction on the corresponding first pixel in the first image to obtain the second image including the second pixel.

3. The method according to claim 2, characterized in that, the generating the second color correction matrix corresponding to the first pixel according to the color overflow value of the first pixel includes: determining the ratio of the color overflow value to the maximum pixel value in the pixel value range; determining a first color adjustment weight of the first pixel according to the product of the ratio and an intensity adjustment threshold; taking the product of the first color adjustment weight and the standard unit matrix as the second color correction matrix.

4. The method according to claim 3, characterized in that, the determining the first color adjustment weight of the first pixel according to the product of the ratio and the intensity adjustment threshold includes: if the product of the ratio and the intensity adjustment threshold is less than or equal to 0, the first color adjustment weight is equal to 0; if the product of the ratio and the intensity adjustment threshold is greater than or equal to 1, the first color adjustment weight is equal to 1; if the product of the ratio and the intensity adjustment threshold is greater than 0 and less than 1, the first color adjustment weight is equal to the product of the ratio and the intensity adjustment threshold.

5. The method according to claim 3 or 4, characterized in that, the calculating the color overflow value of the first pixel includes: respectively calculating the absolute differences between the three component pixel values of the first pixel and the pixel value range; wherein, the three component pixel values are the pixel values corresponding to the three RGB color components; Sum the absolute differences corresponding to the three component pixel values to obtain the color overflow value of the first pixel.

6. The method according to any one of claims 3-5, wherein, the method further includes: calculating the RGB color ratio of the first pixel, and determining a second color adjustment weight corresponding to the first pixel according to the RGB color ratio; wherein, the RGB color ratio is the ratio between the pixel values corresponding to the three RGB color components; The step of taking the product of the first color adjustment weight and the standard unit matrix as the second color correction matrix includes: taking the product of the second color adjustment weight and the first color adjustment weight as the new first color adjustment weight; taking the sum of the first product and the second product as the second color correction matrix; wherein, the first product is the product of the new first color adjustment weight and the standard unit matrix; the second product is the product of the first color correction matrix and the first difference, and the first difference is the difference between the value 1 and the second color adjustment weight.

7. The method according to claim 6, wherein, the RGB color ratio includes an RG ratio and a BG ratio; the RG ratio is the ratio of the pixel values corresponding to the R color component and the G color component, and the BG ratio is the ratio of the pixel values corresponding to the B color component and the G color component; The step of determining the second color adjustment weight corresponding to the first pixel according to the RGB color ratio includes: determining an RG adjustment weight according to the RG ratio corresponding to the first pixel, and determining a BG adjustment weight according to the BG ratio corresponding to the first pixel; taking the product of the RG adjustment weight and the BG adjustment weight as the second color adjustment weight corresponding to the first pixel.

8. The method according to claim 7, wherein, the step of determining the RG adjustment weight according to the RG ratio corresponding to the first pixel includes: when the RG ratio is greater than or equal to 10 or less than or equal to 0.1, the RG adjustment weight is equal to 1; when the RG ratio is greater than or equal to 1 and less than 10, the RG adjustment weight is equal to the ratio of the second difference to 9; the second difference is the difference between the RG ratio and 1; when the RG ratio is less than or equal to 1 and greater than 0.1, the RG adjustment weight is equal to the product of 10 / 9 and the third difference; the third difference is the difference between 1 and the RG ratio.

9. The method according to claim 7 or 8, wherein, the step of determining the BG adjustment weight according to the BG ratio corresponding to the first pixel includes: when the BG ratio is greater than or equal to 10 or less than or equal to 0.1, the BG adjustment weight is equal to 1; when the BG ratio is greater than or equal to 1 and less than 10, the BG adjustment weight is equal to the ratio of the fourth difference to 9; the fourth difference is the difference between the BG ratio and 1; when the BG ratio is less than or equal to 1 and greater than 0.1, the BG adjustment weight is equal to the product of 10 / 9 and the fifth difference; the fifth difference is the difference between 1 and the BG ratio.

10. The method according to any one of claims 1-9, characterized in that, the method further includes detecting first pixels with color overflow in the first image, including: comparing the component pixel values of each pixel in the first image with the pixel value range respectively; wherein, the component pixel values include the pixel values corresponding to the three color components of RGB; taking the pixels in the first image where the component pixel values are not within the pixel value range as the first pixels with color overflow.

11. The method according to any one of claims 2-10, characterized in that, using each of the second color correction matrices to respectively re-perform color correction on the corresponding first pixels in the first image to obtain the second image including the second pixels, including: the second pixels can be calculated using the following formula: R out = a 11 × R in + a 12 × G in + a 13 × B in G out = a 21 × R in + a 22 × G in + a 23 × B in B out = a 31 × R in + a 32 × G in + a 33 × B in wherein, R in 、G in 、B in are the RGB values of the first pixel; R out 、G out 、B out are the RGB values of the second pixel; a 11 、a 12 、a 13 、a 21 、a 22 、a 23 、a 31 、a 32 、a 32 are the elements in the second color correction matrix.

12. The method according to any one of claims 1-11, characterized in that, the method further includes: when determining that the first pixel is a discrete noise pixel according to the neighboring pixels of the first pixel, discarding the first pixel.

13. The method according to claim 12, characterized in that, determining that the first pixel is a discrete noise pixel according to the neighboring pixels of the first pixel, including: converting the first image into a binary image, and the pixel value of the first pixel in the binary image is 1; in the binary image, dividing the first pixel and the neighboring pixels into pixel blocks according to a preset block size; if there are n pixels with a pixel value of 1 in the pixel block, the first pixel is not a discrete noise pixel; if there are no n pixels with a pixel value of 1 in the pixel block, the first pixel is a discrete noise pixel.

14. An image capturing method, characterized in that, applied to an electronic device, the electronic device includes a camera, the electronic device supports a high dynamic range imaging HDR mode, and the method includes: receiving an opening operation of the camera application by the user; in response to the opening operation, obtaining a first image in the HDR mode; wherein, the first image includes first pixels with color overflow; the first image is an image obtained by performing color correction on the image collected by the camera; obtaining a second image based on the first image, and displaying a preview interface including the second image; wherein, the second image includes second pixels corresponding to the first pixels, and the second pixels are obtained by performing color correction based on the color overflow value of the first pixels; the color overflow value is the total pixel value exceeding the pixel value range, and the pixel value range corresponds to the color depth of the HDR mode.

15. The method according to claim 14, characterized in that, the first image is an image obtained by performing color correction on the image collected by the camera using a first color correction matrix; wherein, the first color correction matrix is a standard color correction matrix for color correction; obtaining the second image based on the first image, including: Calculate the color overflow value of the first pixel and calculate the RGB color ratio of the first pixel; wherein, the RGB color ratio is the ratio between the pixel values corresponding to the three RGB color components; Generate a second color correction matrix corresponding to the first pixel according to the color overflow value and the RGB color ratio of the first pixel; Use each of the second color correction matrices to respectively perform color correction on the corresponding first pixel in the first image to obtain the second image including the second pixel.

16. The method according to claim 15, wherein, The generating a second color correction matrix corresponding to the first pixel according to the color overflow value and the RGB color ratio of the first pixel includes: Calculate the ratio of the color overflow value to the maximum pixel value in the pixel value range, and determine the first color adjustment weight of the first pixel according to the product of the ratio and the intensity adjustment threshold; Calculate the second color adjustment weight of the first pixel according to the RGB color ratio corresponding to the first pixel; Take the product of the second color adjustment weight and the first color adjustment weight as the new first color adjustment weight; Take the sum of the first product and the second product as the second color correction matrix; wherein, the first product is the product of the new first color adjustment weight and the standard unit matrix; the second product is the product of the first color correction matrix and the first difference, and the first difference is the difference between the value 1 and the second color adjustment weight.

17. An electronic device, wherein, comprising: One or more processors and a memory, the memory is coupled to the processor; one or more computer program codes are stored in the memory, and the computer program codes include computer instructions; when the processor executes the computer instructions, the electronic device is caused to execute the image capturing method according to any one of claims 1-13 and / or 14-16.

18. A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor of an electronic device, the electronic device is caused to execute the image capturing method according to any one of claims 1-13 and / or 14-16.

Citation Information

Patent Citations

  • Image optimization method and device, equipment and storage medium

    CN114418896A

  • RGB-IR image color recovery and correction method and device

    CN116996786A

  • Method and device for encoding a HDR picture

    EP3169070A1

  • Tuning for deep-learning-based color enhancement systems

    US20190311464A1