Image processing method, electronic equipment and readable storage medium

By converting RAW images into grayscale images and correcting the RGB images after demosaic processing, the problem of image sharpness reduction in electronic devices is solved, and the effect of improving image details and clarity is achieved, while reducing configuration costs and calibration complexity is reduced. sex.

CN119299877AActive Publication Date: 2025-01-10HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410069945.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-17
Publication Date
2025-01-10
Estimated Expiration
2044-01-17

AI Technical Summary

Technical Problem

In the prior art, when the electronic device converts the RAW image into an RGB image, due to inaccurate interpolation of the color information of the demosaic algorithm, the RGB image has molar patterns and details loss at high-frequency positions, resulting in a decrease in clarity.

Method used

By converting the RAW image into a grayscale image and correcting the demosaic-processed RGB image based on the grayscale image, the details information are fused to the brightness channel of the YUV image, and the overall detail texture and clarity of the image are improved.

Benefits of technology

Effectively reduce the moiré pattern brought by demosaic processing, enhance the details of RGB images, improve the sharpness of the image, and reduce configuration costs, avoiding the need for additional black and white lenses and position calibration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119299877A_ABST
    Figure CN119299877A_ABST
Patent Text Reader

Abstract

The invention provides an image processing method, electronic equipment and a readable storage medium, and relates to the technical field of image processing.In the method, when the electronic equipment shoots, the following operations are executed: obtaining a RAW image; performing demosaicing processing on the RAW image to obtain a first RGB image; converting the RAW image into a grayscale image; and correcting the first RGB image based on the grayscale image to obtain a second RGB image. According to the method, the RGB image obtained through demosaicing processing is corrected by using the gray level image corresponding to the RAW image, and the gray level image corresponding to the RAW image is an image obtained without demosaicing processing, so that details in the RAW image can be reserved in the gray level image, and further, the image quality is improved. And the RGB image obtained by demosaicing processing is corrected based on the gray level image, so that the details of the RGB image can be enhanced, and the definition of the RGB image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Based on the current shooting algorithm, after the electronic device obtains the RAW image captured by the image sensor, it usually needs to use a demosaic algorithm to convert the RAW image into an RGB image (i.e., a color image). The image sensor is an image sensor covered with a color filter array (CFA), and each pixel in the RAW image output by the image sensor is monochrome; the demosaic algorithm is used to supplement other color information in each pixel of the RAW image by interpolation, thereby converting each pixel into color.

[0003] Since other color information in each pixel is supplemented by interpolation, this color information is usually not very accurate, resulting in the existence of moiré patterns and loss of details in high-frequency positions of the obtained RGB image, resulting in reduced clarity of the RGB image. Summary of the invention

[0004] The present application provides an image processing method, an electronic device and a readable storage medium, which can improve the clarity of RGB images.

[0005] In a first aspect, an embodiment of the present application provides an image processing method, which is applied to an electronic device, and the method includes: detecting a shooting instruction, where the shooting instruction is used to request the electronic device to shoot; in response to the shooting instruction, acquiring a RAW image; performing a demosaicing process on the RAW image to obtain a first RGB image; converting the RAW image into a grayscale image; and correcting the first RGB image based on the grayscale image to obtain a second RGB image.

[0006] The present application proposes to use the grayscale image corresponding to the RAW image to correct the RGB image obtained by demosaicing the RAW image. Since the grayscale image corresponding to the RAW image is an image obtained without demosaicing, the details in the RAW image can be retained in the grayscale image. Furthermore, by correcting the RGB image obtained by demosaicing based on the grayscale image, the details of the RGB image can be enhanced, the moiré caused by the demosaicing can be reduced, and the clarity of the RGB image can be improved.

[0007] In addition, it should be noted that the grayscale image in the current technology is usually obtained based on a black and white lens, which means that based on the current technology, if you want to use the grayscale image to correct the RGB image, you need to configure an additional black and white lens on the basis of the original camera. This will increase the configuration cost on the one hand, and on the other hand, there is a position deviation between the dual cameras, and the position deviation needs to be calibrated during shooting, and errors are prone to occur during the calibration process. However, this application obtains grayscale images and RGB images by performing different processing on the same RAW image, so there is no need to configure an additional black and white lens, and there is no need to calibrate the position deviation, thereby reducing the configuration cost while improving the efficiency of image processing and improving the quality of the final RGB image.

[0008] In combination with the above-mentioned first aspect, in certain implementation methods of the first aspect, correcting the first RGB image based on the grayscale image to obtain the second RGB image includes: converting the first RGB image into a first YUV image; fusing the grayscale image into the Y channel of the first YUV image to obtain the second YUV image; and converting the second YUV image into a second RGB image.

[0009] This application fuses the grayscale image into the Y channel of the YUV image, that is, without changing the color of the output image (that is, without changing the U and V channels), the details in the RAW image are fused into the brightness channel of the YUV image, thereby increasing the overall detail texture of the image and improving the final image effect.

[0010] In combination with the above-mentioned first aspect and the above-mentioned implementation method, in some implementation methods of the first aspect, converting the RAW image into a grayscale image includes: counting the pixel value of each pixel in the RAW image; determining the conversion coefficient of the RAW image according to the pixel value of each pixel; and converting the RAW image according to the conversion coefficient to obtain a grayscale image.

[0011] Compared with the traditional method of obtaining grayscale images using a black and white lens, the present application determines the conversion coefficient of the RAW image based on the pixel value in the RAW image, and then converts the RAW image based on the conversion coefficient to obtain a grayscale image, which can reduce the configuration cost while obtaining the grayscale image.

[0012] In combination with the above-mentioned first aspect and the above-mentioned implementation method, in some implementation methods of the first aspect, the pixel value of each pixel corresponds to an R value, a G value or a B value, and determining the conversion coefficient of the RAW image according to the pixel value of each pixel includes: respectively calculating the average value R' of all pixel values ​​corresponding to the R value, the average value G' of all pixel values ​​corresponding to the G value, and the average value B' of all pixel values ​​corresponding to the B value in the RAW image; and obtaining the conversion coefficient G' / R' of the pixel value corresponding to the R value, the conversion coefficient 1 of the pixel value corresponding to the G value, and the conversion coefficient G' / B' of the pixel value corresponding to the B value according to the average value R', the average value G' and the average value B'.

[0013] In combination with the above-mentioned first aspect and the above-mentioned implementation method, in some implementation methods of the first aspect, converting the RAW image according to the conversion coefficient to obtain a grayscale image includes: converting the pixel values ​​corresponding to the R value in the RAW image according to the conversion coefficient G' / R' to obtain a first conversion result; converting the pixel values ​​corresponding to the G value in the RAW image according to the conversion coefficient 1 to obtain a second conversion result; converting the pixel values ​​corresponding to the B value in the RAW image according to the conversion coefficient G' / B' to obtain a third conversion result; and obtaining a grayscale image according to the first conversion result, the second conversion result and the third conversion result.

[0014] Among them, when converting the pixel value according to the conversion coefficient, it can be achieved by multiplication, that is, multiplying each pixel value with its corresponding conversion coefficient (for example, multiplying the pixel value corresponding to the R value with the conversion coefficient G' / R', multiplying the pixel value corresponding to the G value with the conversion coefficient 1, and multiplying the pixel value corresponding to the B value with the conversion coefficient G' / B'), so that the pixel value of each pixel is approximately equal to the G value, thereby converting the RAW image into a grayscale image.

[0015] In combination with the above-mentioned first aspect and the above-mentioned implementation method, in some implementation methods of the first aspect, converting the pixel value corresponding to the R value in the RAW image according to the conversion coefficient G' / R' includes: multiplying the conversion coefficient G' / R' by the pixel value corresponding to the R value in the RAW image; converting the pixel value corresponding to the G value in the RAW image according to the conversion coefficient 1 includes: multiplying the conversion coefficient 1 by the pixel value corresponding to the G value in the RAW image; converting the pixel value corresponding to the B value in the RAW image according to the conversion coefficient G' / B' includes: multiplying the conversion coefficient G' / B' by the pixel value corresponding to the B value in the RAW image.

[0016] In a second aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; one or more memories; the memory stores one or more programs, and when one or more programs are executed by the processor, the electronic device executes any possible method in the above-mentioned first aspect.

[0017] In a third aspect, an embodiment of the present application provides a device, which is included in an electronic device, and the device has the function of realizing the above-mentioned aspects and the electronic device behavior in the possible implementation methods of the above-mentioned aspects. The function can be implemented by hardware, or the corresponding software can be implemented by hardware. The hardware or software includes one or more modules or units corresponding to the above-mentioned functions. For example, a detection module or unit, an acquisition module or unit, a processing module or unit, etc.

[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the method described in the first aspect above.

[0019] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect above.

[0020] The technical effects obtained by the above-mentioned second, third, fourth and fifth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of an interface for opening a photo taking mode in a camera application provided in an embodiment of the present application is shown;

[0022] Figure 2 A schematic diagram of an image before and after de-mosaicing provided in an embodiment of the present application is shown;

[0023] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown;

[0024] Figure 4 A schematic diagram of the software structure of an electronic device provided in an embodiment of the present application is shown;

[0025] Figure 5 A schematic diagram of a flow chart of an image processing method provided in an embodiment of the present application is shown;

[0026] Figure 6 A schematic diagram of a method for generating a grayscale image provided in an embodiment of the present application is shown;

[0027] Figure 7 A schematic diagram showing a flow chart of another image processing method provided in an embodiment of the present application is shown;

[0028] Figure 8 A schematic diagram showing the difference between an RGB image before and after correction provided in an embodiment of the present application is shown;

[0029] Fig. 9 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application is shown;

[0030] Fig.10 A schematic diagram of the structure of a chip provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0031] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first" and "second" are used to distinguish the same items or similar items with basically the same functions and effects. For example, the first chip and the second chip are only used to distinguish different chips, and their order is not limited. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not necessarily limit them to be different.

[0032] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0033] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0034] To facilitate understanding, some terms involved in the embodiments of the present application are first explained below.

[0035] RAW image: refers to the original image obtained by converting the captured light source signal into a digital signal by the image sensor in the electronic device. The image sensor is an image sensor covered with a color filter array (CFA), and the original image output by the image sensor is in Bayer format, and each pixel in the original image is monochrome (for example, red, green or blue).

[0036] De-mosaic algorithm: It is an image interpolation algorithm commonly used in image processing, which is used to convert the RAW image collected by the sensor into an RGB image (i.e., a color image). Specifically, other color information is added to each pixel in the RAW image by interpolation, so that each pixel is converted into color. For example, red and blue information is added to the green pixel to convert it into color.

[0037] RGB image: a color image, refers to an image in which each pixel is composed of three components: R, G, and B, where R refers to red, G refers to green, and B refers to blue. It should be understood that any color image can be composed of different proportions of red, green, and blue.

[0038] Grayscale image: refers to an image in which the information of each pixel is described by a quantized grayscale, and there is no color information in the image. Grayscale is also called color scale or grayscale, which refers to the degree of brightness. In other words, grayscale refers to pure white, pure black, and a series of transitional colors from black to white. In the RGB mode, the three primary colors of light each have 256 levels, and grayscale is formed when the R, G, and B values ​​of the pixel are equal. There are 256 permutations and combinations of equal R, G, and B values, so the number of grayscales is 256 levels.

[0039] YUV image: YUV is a color coding model, also called YCbCr. YUV coding uses brightness and chroma to represent the color of each pixel. Y represents brightness (luminance, luma), which is the grayscale value; U and V represent chrominance (chrominance or chroma), which describes the hue and saturation respectively.

[0040] Using the YUV color coding model can reduce the memory usage of image data and improve data processing efficiency. In addition, the image data of the YUV coding model cannot be used directly for display, and it needs to be converted into RGB format to be displayed normally.

[0041] Moiré: A type of high-frequency irregular stripes that can cause colorful images to appear.

[0042] High dynamic range (HDR): is a technology that uses multiple consecutive frames of images with different exposures to synthesize images with high dynamic range. Compared with ordinary images, high dynamic range images have bright areas that are not overexposed and dark details that are clearly visible, providing more dynamic range and image details. "Dynamic range" refers to the ratio of signal intensity (for example, brightness), which can also be called "light ratio" or "contrast" in photography.

[0043] The above is a brief introduction to the terms involved in the embodiments of the present application, which will not be repeated below.

[0044] The image processing method provided in the embodiments of the present application can be applied to various electronic devices with shooting functions. The shooting function can take photos or videos. The electronic device can be, but is not limited to, a mobile phone, a tablet computer, a desktop, a laptop, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) / virtual reality (VR) device, etc., and the embodiments of the present application are not limited to this.

[0045] For example, taking a mobile phone as an electronic device, Figure 1 A schematic diagram of an interface for starting shooting in a camera application provided in an embodiment of the present application is shown.

[0046] See also Figure 1 When the user turns on the screen of the phone and keeps the phone unlocked, the phone can display the following Figure 1 The interface shown in (a) above may be the desktop of a mobile phone, on which icons of multiple installed applications are displayed, such as a clock application icon, a calendar application icon, a gallery application icon, a memo application icon, a file management application icon, an email application icon, a music application icon, a calculator application icon, a video application icon, a sports and health application icon, a weather application icon, a browser application icon, a smart life application icon, a settings application icon, a recorder application icon, an application store application icon, an address book application icon, a phone application icon, a message application icon, and a camera application icon 10, etc.

[0047] The user can perform a touch operation on the camera application icon 10, and the touch operation can be a click operation, a long press operation, etc. Accordingly, the mobile phone receives the user's touch operation on the camera application icon 10, and in response to the user's touch operation on the camera application icon 10, the mobile phone starts the camera application.

[0048] After the camera app is launched, the phone can display Figure 1 The default shooting interface shown in (b) in FIG. The shooting interface includes a preview image currently captured, a shooting control 11, and function controls corresponding to various shooting modes, wherein the function controls corresponding to various shooting modes may include, for example, night scene mode controls, portrait mode controls, photo mode controls, video mode controls, aperture mode controls, and more controls for opening more functions in the camera application. Among them, the shooting control 11 is used to trigger the shooting operation of the mobile phone. It should be understood that the arrangement order of the various shooting modes on the mobile phone interface can be set and changed as needed, and the embodiments of the present application do not impose any restrictions on this.

[0049] When the user needs to use the default mode of the mobile phone to shoot an image, the user can directly click the shooting control 11. In response to the user's click operation, the mobile phone enables the default shooting mode for shooting; when the user needs to use the night mode to shoot an image, the user can first click the night mode control to start the night mode, and then click the shooting control 11. In response to the user's click operation, the mobile phone enables the night mode for shooting; when the user needs to use the portrait mode to shoot an image, the user can first click the portrait mode control to start the night mode, and then click the shooting control 11. In response to the user's click operation, the mobile phone enables the portrait mode for shooting.

[0050] Based on the current shooting algorithm, after the electronic device obtains the RAW image captured by the image sensor, it usually needs to use a demosaicing algorithm to convert the RAW image into an RGB image. The demosaicing algorithm is used to supplement other color information in each monochrome pixel in the RAW image by interpolation, thereby converting each pixel into color.

[0051] Since other color information in each pixel is supplemented by interpolation, this color information is usually not very accurate, resulting in the existence of moiré patterns and loss of details in high-frequency positions of the obtained RGB image, resulting in reduced clarity of the RGB image. Figure 2 FIG. 2 shows a schematic diagram of an image before and after de-mosaicing provided in an embodiment of the present application. Figure 2 As shown, the RGB image obtained after the RAW image is processed by the demosaicing algorithm has problems such as loss of detail texture and the appearance of moiré.

[0052] Based on this, the present application proposes to use the grayscale image corresponding to the RAW image to correct the RGB image obtained by demosaicing the RAW image. Since the grayscale image corresponding to the RAW image is an image obtained without demosaicing, the details of the RAW image can be retained in the grayscale image. Furthermore, by correcting the RGB image obtained by demosaicing based on the grayscale image, the details of the RGB image can be enhanced, the moiré caused by the demosaicing can be reduced, and the clarity of the RGB image can be improved.

[0053] The following is a schematic diagram of the hardware structure of an electronic device 100 that can implement the solution of the present application. Figure 3 A schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of the present application is shown.

[0054] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 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, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0055] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0056] 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 processor (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. Different processing units may be independent devices or integrated into one or more processors.

[0057] Among them, the controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and execution.

[0058] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0059] In some embodiments, the processor 110 may include one or more interfaces. The interface 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.

[0060] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.

[0061] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.

[0062] The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.

[0063] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.

[0064] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.

[0065] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0066] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0067] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does 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.

[0068] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0069] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0070] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0071] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0072] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0073] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0074] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0075] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0076] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0077] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be 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), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0078] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0079] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0080] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element 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 passes the electrical signal to the ISP to be converted 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 a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0081] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0082] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

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

[0084] The external memory interface 120 can be used to connect 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 a data storage function, such as storing music, video and other files in the external memory card.

[0085] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may 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 applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0086] The electronic device 100 can implement audio functions such as music playing, recording, voice calls, video calls, etc. through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0087] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0088] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0089] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0090] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, realize directional recording function, etc.

[0091] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130 or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0092] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set 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 can be a parallel plate including at least two 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 touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position 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 can 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, an 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, an instruction to create a new short message is executed.

[0093] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0094] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.

[0095] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.

[0096] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.

[0097] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0098] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.

[0099] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0100] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.

[0101] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 performs a boost on the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.

[0102] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass 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 other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0103] The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.

[0104] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0105] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0106] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0107] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.

[0108] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present invention takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device 100. It should be noted that in the embodiment of the present application, the operator system of the electronic device may include but is not limited to (Symbian), (Android), (iOS), (Blackberry), Hongmeng (HarmonyOS) and other operating systems, this application does not make any limitation.

[0109] Figure 4 A software structure block diagram of an example of an electronic device 100 provided in an embodiment of the present application is shown.

[0110] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into the application layer, application framework layer (Application Framework), hardware abstract layer (HAL), kernel layer, and hardware layer from top to bottom.

[0111] The application layer may include a camera application or other applications, including but not limited to: music, gallery, Bluetooth, calendar, short message, call, navigation and other applications.

[0112] The application framework layer may provide an application programming interface (API) and a programming framework to the application programs of the application layer; the application framework layer may include some predefined functions.

[0113] For example, the application framework layer may include a camera access interface; the camera access interface may include camera management and camera equipment; wherein, camera management may be used to provide an access interface for managing the camera; and camera equipment may be used to provide an interface for accessing the camera.

[0114] The hardware abstraction layer is used to abstract the hardware. For example, the hardware abstraction layer can include the camera hardware abstraction layer and other hardware device abstraction layers; the camera hardware abstraction layer includes image processing algorithms, etc. After the camera's image sensor obtains RAW image data, the RAW image data is processed by the image processing algorithm to obtain an RGB image. In addition, the camera abstraction layer also stores the captured image in the gallery application for users to view.

[0115] The kernel layer is used to provide drivers for different hardware devices. For example, the driver layer may include camera drivers, display drivers, and image processor drivers.

[0116] The hardware layer may include multiple image sensors, multiple image signal processors, cameras, display screens, and other hardware devices.

[0117] In this application, by calling the hardware abstraction layer interface in the hardware abstraction layer, the application layer and application framework layer above the hardware abstraction layer can be connected with the driver layer and hardware layer below, thereby realizing camera data transmission and function control.

[0118] In the camera hardware interface layer in the hardware abstraction layer, manufacturers can customize functions according to their needs. Compared with the hardware abstraction layer interface, the camera hardware interface layer is more efficient, flexible, and has low latency. It can also call ISP and GPU more richly to achieve image processing. The image input to the hardware abstraction layer can come from an image sensor or a stored picture.

[0119] The scheduling layer in the hardware abstraction layer contains a general functional interface for management and control.

[0120] The camera service layer in the hardware abstraction layer is used to access the interface of the ISP and other hardware.

[0121] Combine the following Figures 5 to 8 The image processing method provided in this application is described in detail. Figure 5 A flowchart of an image processing method provided in an embodiment of the present application is shown. Figure 5The image processing method shown can be Figure 3 The electronic device shown in , or, configured in Figure 3 The chip in the electronic device shown executes; Figure 5 The image processing method shown includes steps S510 to S560, and S510 to S560 are described in detail below.

[0122] S510: The electronic device starts a camera application and turns on a shooting mode.

[0123] When the user wants to launch the camera app, the user can tap Figure 1 The camera application icon 10 shown in (a) of FIG. 1 can enable the electronic device to receive a user's touch operation on the camera application icon 10, and the electronic device starts the camera application in response to the touch operation, and displays the following after the camera application is started: Figure 1 In the shooting interface shown in (b) in the figure, users can Figure 1 The interface shown in (b) further selects the desired shooting mode.

[0124] For example, the user can select the default shooting mode of the camera, or can select night scene, portrait or HDR mode, which is not limited in this application. Among them, the HDR mode opening control can be turned on when the user clicks Figure 1 The “More” control on the interface shown in (b) is displayed on the interface of the electronic device.

[0125] It is understandable that there are many ways to start the camera application. In addition to the above-mentioned touch operation on the camera application icon to start the camera application, the camera application can also be started by voice triggering or sliding triggering. For example, when the electronic device is in a lock screen state, the user can instruct the electronic device to start the camera application by sliding the gesture to the right on the display screen of the electronic device. Alternatively, the electronic device is in a lock screen state, and the lock screen interface includes an icon of the camera application. The user instructs the electronic device to start the camera application by clicking the icon of the camera application. Alternatively, when the electronic device is running other applications, the application has the permission to call the camera application; the user can instruct the electronic device to start the camera application by clicking the corresponding control. For example, when the electronic device is running an instant messaging application, the user can instruct the electronic device to start the camera application by using the control of the camera function. The embodiment of the present application does not limit the specific operation method of starting the camera application.

[0126] S520: The electronic device detects a shooting instruction, where the shooting instruction is used to request the electronic device to take a picture.

[0127] After the shooting mode of the electronic device is confirmed, the user can issue a shooting instruction to request the electronic device to shoot. For example, the shooting instruction can be a user's click operation on the shooting control, and the shooting control can be such as Figure 1 The shooting control 11 shown in (b) in FIG. It should be understood that the user can also trigger the electronic device to shoot through voice commands, gesture commands, etc., and this application does not make any limitation to this.

[0128] S530: In response to the shooting instruction, the electronic device acquires a RAW image.

[0129] The RAW image is a Bayer format image obtained based on an image sensor covered with a CFA, and each pixel in the RAW image is a monochrome pixel, that is, each pixel corresponds to a color (for example, R, G, or B). In other words, the pixel value of each pixel can correspond to an R value, a G value, or a B value. For example, Figure 6 (a) and (c) in the figure show an arrangement of a Bayer array:

[0130]

[0131] It should be understood that Figure 6 The Bayer arrays shown in (a) and (c) are only examples, and other arrangements are possible in practice, which are not limited in this application.

[0132] Optionally, in the camera's default shooting mode, portrait mode or night scene mode, a single-frame image acquired by the sensor can be used as the RAW image; in the HDR shooting mode, multiple-frame images acquired by the sensor can be fused and the fused image can be used as the RAW image, and the multiple-frame images correspond to different exposure amounts.

[0133] S540: The electronic device performs a demosaicing process on the RAW image to obtain a first RGB image.

[0134] That is, other color information is supplemented in each pixel in the RAW image by interpolation to convert each pixel into color, thereby converting the RAW image into a color image (ie, the first RGB image).

[0135] For example, red and blue information is added to a green pixel, converting it into color. Figure 6 The monochrome pixel G in the Bayer array shown in (a) 23 For example, interpolation is to use the monochrome pixel G 23 The R value and the B value are inserted into the two color information. The inserted R value can be determined based on the R values ​​of the pixels around the position, for example, based on R 13 and R33 The interpolated B value can be determined based on the B values ​​of the pixels around the position, for example, based on B 22 and B 24 It should be understood that the above interpolation method is only an example, and other interpolation methods may be used in practice, and this application does not limit this.

[0136] S550, the electronic device converts the RAW image into a grayscale image.

[0137] It should be noted that the grayscale images in the current technology are usually acquired based on black and white lenses, which means that based on the current technology, if you want to use grayscale images to correct RGB images, you need to configure an additional black and white lens on the basis of the original camera. This will increase the configuration cost on the one hand, and on the other hand, there is a position deviation between the dual cameras. The position deviation needs to be calibrated during shooting, and errors are prone to occur during the calibration process.

[0138] Based on this, the present application proposes to use an electronic device to count the pixel value of each pixel in the RAW image; then determine the conversion coefficient of the RAW image according to the pixel value of each pixel; and then convert the RAW image according to the conversion coefficient to obtain a grayscale image. Compared with the traditional method of obtaining a grayscale image using a black and white lens, it can reduce the configuration cost while obtaining a grayscale image.

[0139] In a specific implementation, the electronic device can respectively calculate the average value R' of all pixel values ​​corresponding to the R value, the average value G' of all pixel values ​​corresponding to the G value, and the average value B' of all pixel values ​​corresponding to the B value in the RAW image; and then obtain the conversion coefficient G' / R' of the pixel value corresponding to the R value, the conversion coefficient 1 of the pixel value corresponding to the G value, and the conversion coefficient G' / B' of the pixel value corresponding to the B value based on the average value R', the average value G', and the average value B'.

[0140] As Figure 6 Taking the Bayer array shown in (a) as an example, the average value R' can be R 11 , R 13 , R 31 and R 33 The average value G' can be G 12 , G 14 , G 21 , G 23 , G 32 , G 34 , G 41 and G 43 The average value B' can be B 22 , B 24 , B 42 and B44 The average value of .

[0141] Converting the RAW image according to the conversion coefficient to obtain a grayscale image may include: converting the pixel values ​​corresponding to the R value in the RAW image according to the conversion coefficient G' / R' to obtain a first conversion result; converting the pixel values ​​corresponding to the G value in the RAW image according to the conversion coefficient 1 to obtain a second conversion result; converting the pixel values ​​corresponding to the B value in the RAW image according to the conversion coefficient G' / B' to obtain a third conversion result; and obtaining the grayscale image according to the first conversion result, the second conversion result, and the third conversion result.

[0142] For example, Figure 6 As shown in (b) in FIG. 1 , when converting the pixel value according to the conversion coefficient, it can be achieved by multiplication, that is, multiplying the pixel value of each pixel by its corresponding conversion coefficient (for example, multiplying the pixel value corresponding to the R value by the conversion coefficient G' / R', multiplying the pixel value corresponding to the G value by the conversion coefficient 1, and multiplying the pixel value corresponding to the B value by the conversion coefficient G' / B'), so that the pixel value of each pixel is approximately equal to the G value, thereby making Figure 6 The RAW image shown in (c) is converted to Figure 6 The grayscale image shown in (d).

[0143] It should be understood that since the grayscale image corresponding to the RAW image is an image obtained without demosaicing, the details in the RAW image can be retained in the grayscale image.

[0144] It should be understood that the above method of converting a RAW image into a grayscale image is only an example, and in practice other methods may also be used to convert a RAW image into a grayscale image, which is not limited in this application.

[0145] S560: The electronic device corrects the first RGB image based on the grayscale image to obtain a second RGB image.

[0146] Specifically, Figure 7 As shown, the first RGB image can be converted into a first YUV image first; then the grayscale image can be merged into the Y channel of the first YUV image to obtain a second YUV image. The present application merges the grayscale image that can retain the details of the RAW image into the Y channel of the YUV image, that is, without changing the color of the output image (that is, without changing the U and V channels), the details in the RAW image are merged into the brightness channel of the YUV image, thereby increasing the overall detail texture of the image and improving the final image effect.

[0147] In addition, since YUV image data cannot generally be used directly for display, it needs to be converted into RGB format before the image can be displayed normally, that is, the second YUV image needs to be converted into a second RGB image before it can be displayed normally.

[0148] Figure 8 : is a schematic diagram of the difference between an RGB image before and after correction provided in an embodiment of the present application. It can be seen that correcting the RGB image obtained by de-mosaicing based on the grayscale image can enhance the overall detail texture of the image and improve the final image clarity.

[0149] In summary, the present application uses the grayscale image corresponding to the RAW image to correct the RGB image obtained by demosaicing the RAW image. Since the grayscale image corresponding to the RAW image is an image obtained without demosaicing, the details in the RAW image can be retained in the grayscale image. Furthermore, by correcting the RGB image obtained by demosaicing based on the grayscale image, the details of the RGB image can be enhanced, the moiré caused by the demosaicing can be reduced, and the clarity of the RGB image can be improved.

[0150] In addition, the present application obtains grayscale images and RGB images by performing different processing on the same RAW image, so that there is no need to configure an additional black and white lens, and there is no need to calibrate the position deviation, thereby reducing the configuration cost while improving the efficiency of image processing and improving the quality of the final RGB image.

[0151] Combined with the above Figures 5 to 8 , an embodiment of the method of the present application is explained, and the device for executing the above method provided by the embodiment of the present application is described below.

[0152] like Fig. 9 As shown, Fig. 9 FIG. 1 is a schematic diagram showing the structure of an image processing device provided in an embodiment of the present application. Fig. 9 As shown, the device 900 includes a detection unit 910 , an acquisition unit 920 and a processing unit 930 .

[0153] Among them, the detection unit 910 is used to detect a shooting instruction, which is used to request the electronic device to take a picture; in response to the shooting instruction, the acquisition unit 920 is used to acquire a RAW image; the processing unit 930 is used to: de-mosaic the RAW image to obtain a first RGB image; convert the RAW image into a grayscale image; and, based on the grayscale image, correct the first RGB image to obtain a second RGB image.

[0154] In a possible implementation, the processing unit 930 is further used to: convert the first RGB image into a first YUV image; merge the grayscale image into the Y channel of the first YUV image to obtain a second YUV image; and convert the second YUV image into a second RGB image.

[0155] In a possible implementation, the processing unit 930 is further used to: count the pixel value of each pixel in the RAW image; determine the conversion coefficient of the RAW image according to the pixel value of each pixel; and convert the RAW image according to the conversion coefficient to obtain a grayscale image.

[0156] In a possible implementation, the pixel value of each pixel corresponds to an R value, a G value or a B value, and the processing unit 930 is further used to: respectively calculate the average value R' of all pixel values ​​corresponding to the R value, the average value G' of all pixel values ​​corresponding to the G value, and the average value B' of all pixel values ​​corresponding to the B value in the RAW image; and obtain the conversion coefficient G' / R' of the pixel value corresponding to the R value, the conversion coefficient 1 of the pixel value corresponding to the G value, and the conversion coefficient G' / B' of the pixel value corresponding to the B value according to the average value R', the average value G' and the average value B'.

[0157] In one possible implementation, the processing unit 930 is further used to: convert the pixel values ​​corresponding to the R value in the RAW image according to the conversion coefficient G' / R' to obtain a first conversion result; convert the pixel values ​​corresponding to the G value in the RAW image according to the conversion coefficient 1 to obtain a second conversion result; convert the pixel values ​​corresponding to the B value in the RAW image according to the conversion coefficient G' / B' to obtain a third conversion result; and obtain a grayscale image according to the first conversion result, the second conversion result and the third conversion result.

[0158] In one possible implementation, the processing unit 930 is further used to: multiply the conversion coefficient G' / R' by the pixel value corresponding to the R value in the RAW image; multiply the conversion coefficient 1 by the pixel value corresponding to the G value in the RAW image; and multiply the conversion coefficient G' / B' by the pixel value corresponding to the B value in the RAW image.

[0159] In a possible implementation, the device 900 may further include a storage unit. The storage unit is connected to the detection unit 910, the acquisition unit 920, and the processing unit 930 via a line. The storage unit may include one or more memories, and the memory may be a device used to store programs or data in one or more devices or circuits. The storage unit may exist independently and be connected to the processing unit via a communication bus. The storage unit may also be integrated with the detection unit 910, the acquisition unit 920, and the processing unit 930.

[0160] The storage unit may store computer-executable instructions of the method in the apparatus 900 so that the apparatus 900 executes the method in the above-mentioned embodiment. The storage unit may be a register, a cache memory, or a random access memory (RAM), etc. The storage unit may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions.

[0161] Fig.10 FIG. 1 shows a schematic diagram of the structure of a chip provided in an embodiment of the present application. Fig.10 As shown, the chip 1000 includes one or more (including two) processors 1001 , a communication line 1002 and a communication interface 1003 . Optionally, the chip 1000 also includes a memory 1004 .

[0162] In some implementations, the memory 1004 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.

[0163] The method described in the above embodiment of the present application can be applied to the processor 1001, or implemented by the processor 1001. The processor 1001 may be an integrated circuit chip with signal processing capabilities. In the implementation process, the steps of the above method can be completed by the hardware integrated logic circuit in the processor 1001 or the instructions in the form of software. The above processor 1001 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor, an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components.

[0164] The steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. Among them, the software module can be located in a mature storage medium in the field such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read only memory (EEPROM). The storage medium is located in the memory 1004, and the processor 1001 reads the information in the memory 1004 and completes the steps of the above method in combination with its hardware.

[0165] The processor 1001 , the memory 1004 , and the communication interface 1003 may communicate with each other via the communication line 1002 .

[0166] In the above embodiments, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory, or may be downloaded and installed in the memory in the form of software.

[0167] The present application embodiment also provides a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server, a data center, etc. that includes one or more available media integrated. For example, the available medium can include a magnetic medium (e.g., a floppy disk, a hard disk or a tape), an optical medium (e.g., a digital versatile disc (digital versatiledisc, DVD)), or a semiconductor medium (e.g., a solid state drive (solid state disk, SSD)), etc.

[0168] The present application provides an image processing device, which is a first electronic device or is included in a first electronic device, and includes: one or more processors; one or more memories; the memories store one or more programs, and when the one or more programs are executed by the processors, the device executes the technical solution in the above method embodiment.

[0169] The embodiment of the present application provides a chip. The chip includes a processor, and the processor is used to call a computer program in a memory to execute the technical solution in the above method embodiment. Its implementation principle and technical effect are similar to those of the above related embodiments, and will not be repeated here.

[0170] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program or instruction. The above method is implemented when the computer program or instruction is executed by the processor. The method described in the above embodiment can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. If implemented in software, the function can be stored as one or more instructions or codes on a computer-readable medium or transmitted on a computer-readable medium. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one place to another. The storage medium can be any target medium that can be accessed by a computer.

[0171] As a possible design, the computer-readable medium may include a compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; the computer-readable medium may include a magnetic disk storage or other magnetic disk storage device. Moreover, any connecting line may also be appropriately referred to as a computer-readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology (such as infrared, radio and microwave), the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technology such as infrared, radio and microwave are included in the definition of the medium. Disks and optical discs as used herein include compact discs (CDs), laser discs, optical discs, DVDs, floppy disks and Blu-ray discs, where disks generally reproduce data magnetically, while optical discs reproduce data optically using lasers. Combinations of the above should also be included in the scope of computer-readable media.

[0172] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processing unit of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0173] The above specific implementation methods further illustrate the purpose, technical solutions and beneficial effects of the present application in detail. It should be understood that the above are only specific implementation methods of the present application and are not used to limit the protection scope of the present application. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.

Claims

1. An image processing method, characterized in that: The method is applied to an electronic device, and the method comprises: detecting a shooting instruction, wherein the shooting instruction is used to request the electronic device to shoot; In response to the shooting instruction, acquiring a RAW image; Performing demosaicing on the RAW image to obtain a first RGB image; Convert the RAW image into a grayscale image; The first RGB image is corrected based on the grayscale image to obtain a second RGB image.

2. The method according to claim 1, characterized in that The correcting the first RGB image based on the grayscale image to obtain a second RGB image comprises: Convert the first RGB image into a first YUV image; Merging the grayscale image into the Y channel of the first YUV image to obtain a second YUV image; The second YUV image is converted into the second RGB image.

3. The method according to claim 1 or 2, characterized in that: The converting the RAW image into a grayscale image comprises: Counting the pixel value of each pixel in the RAW image; Determine a conversion coefficient of the RAW image according to the pixel value of each pixel; The RAW image is converted according to the conversion coefficient to obtain the grayscale image.

4. The method according to claim 3, characterized in that The pixel value of each pixel corresponds to an R value, a G value or a B value, and determining the conversion coefficient of the RAW image according to the pixel value of each pixel includes: Calculate the average value R' of all pixel values ​​corresponding to the R value, the average value G' of all pixel values ​​corresponding to the G value, and the average value B' of all pixel values ​​corresponding to the B value in the RAW image respectively; According to the average value R', the average value G' and the average value B', a conversion coefficient G' / R' of the pixel value corresponding to the R value, a conversion coefficient 1 of the pixel value corresponding to the G value and a conversion coefficient G' / B' of the pixel value corresponding to the B value are obtained.

5. The method according to claim 4, characterized in that The converting the RAW image according to the conversion coefficient to obtain the grayscale image comprises: Convert the pixel value corresponding to the R value in the RAW image according to the conversion coefficient G' / R' to obtain a first conversion result; Convert the pixel value corresponding to the G value in the RAW image according to the conversion coefficient 1 to obtain a second conversion result; Convert the pixel value corresponding to the B value in the RAW image according to the conversion coefficient G' / B' to obtain a third conversion result; The grayscale image is obtained according to the first conversion result, the second conversion result and the third conversion result.

6. The method according to claim 5, characterized in that The converting the pixel value corresponding to the R value in the RAW image according to the conversion coefficient G' / R' comprises: multiplying the conversion coefficient G' / R' by the pixel value corresponding to the R value in the RAW image; The converting the pixel value corresponding to the G value in the RAW image according to the conversion coefficient 1 comprises: Multiplying the conversion coefficient 1 by the pixel value corresponding to the G value in the RAW image; The converting the pixel value corresponding to the B value in the RAW image according to the conversion coefficient G' / B' comprises: The conversion coefficient G' / B' is multiplied by the pixel value corresponding to the B value in the RAW image.

7. An electronic device, characterized in that: include: one or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes the method according to any one of claims 1 to 6.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • True color high definition night vision imaging method

    CN107563971A

  • Image processing method and device, and equipment for information code identification

    CN117077707A

  • Image processing apparatus, image processing method, and computer-readable recording medium

    US20150379696A1

  • Camera device

    WO2021184353A1