Image processing method, electronic device, and computer-readable storage medium

By generating and storing coded images containing original brightness information in electronic devices, the problem of illumination influence when non-professional users take photos is solved, and the display quality and detail retention of photos are improved.

CN119273780BActive Publication Date: 2025-09-30HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410042000.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-10
Publication Date
2025-09-30
Estimated Expiration
2044-01-10

AI Technical Summary

Technical Problem

Non-professional users ignore the influence of lighting when taking photos, which makes it difficult for electronic devices to take good photos, especially in low-light environments, where image details are easily lost.

Method used

By implementing an image processing method in an electronic device, a first coded image and a second coded image including original brightness information are generated and stored, and the first coded image is used to brighten the second coded image to retain the brightness information, thereby improving the photo display effect.

Benefits of technology

Improves the display quality of photos, preserves more image details and improves the display effect of image files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273780B_ABST
    Figure CN119273780B_ABST
Patent Text Reader

Abstract

The present application provides an image processing method, an electronic device, and a computer-readable storage medium, which relate to the field of terminal technology. The method is applied to an electronic device including an image sensor, and includes: displaying a shooting preview interface of a camera application, where the shooting preview interface includes a shooting control; storing an image file in response to a user triggering an operation on the shooting control; wherein the image file includes a first encoded image and a second encoded image obtained based on an original image, the first encoded image includes original brightness information in the original image, the first encoded image is used to brighten the second encoded image when displaying the image file, and the original image is acquired by the image sensor in response to the triggering operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of electronic technology, most electronic devices support the function of taking and displaying photos, making it convenient for users to carry electronic devices with them to record their lives.

[0003] However, most users of electronic devices are not professional photographers. Therefore, they do not consider the impact of lighting on photos. Furthermore, they do not control the aperture, shutter speed (i.e., exposure time), and light sensitivity (ISO) during the shooting process. As a result, electronic devices cannot capture good photos. For example, if the ambient light is low, electronic devices are likely to capture photos that lose image details. Summary of the Invention

[0004] In view of this, the present application provides an image processing method, an electronic device and a computer-readable storage medium, which can retain the brightness information obtained by shooting to improve the display effect of the photo.

[0005] In a first aspect, the present application provides an image processing method, applied to an electronic device including an image sensor, the method comprising: displaying a shooting preview interface of a camera application, the shooting preview interface including a shooting control;

[0006] storing an image file in response to a user triggering an operation on a shooting control;

[0007] The image file includes a first encoded image and a second encoded image obtained based on the original image. The first encoded image includes original brightness information in the original image. The first encoded image is used to brighten the second encoded image when displaying the image file. The original image is acquired by the image sensor in response to a trigger operation.

[0008] The original brightness information includes brightness contrast information.

[0009] The first coded image includes original brightness information, and the second coded image can be a processed version of the original image that can be displayed on a display screen of an electronic device. Because the original image includes noise, the brightness and content of the original image need to be adjusted during the processing to obtain the second coded image.

[0010] When a user taps the capture control in the capture preview interface, the electronic device can capture the original image through the image sensor and, based on the original image, generate an image file comprising a first coded image and a second coded image, wherein the first coded image includes the original brightness information of the original image. This preserves the brightness information obtained during the capture, improving the display quality of the photo.

[0011] In a possible implementation manner of the first aspect, the method further includes: in response to a user opening operation of opening the image file, displaying a brightened image, where the brightened image is obtained by brightening the second encoded image based on the first encoded image.

[0012] After storing the image file, the terminal device can display the image file in response to a user's opening operation. If the electronic device can read the first coded image and the second coded image in the image file, the electronic device can use the first coded image to brighten the second coded image, thereby displaying more image details when displaying the image file and improving the display quality of the image file.

[0013] In a possible implementation of the first aspect, in response to the current shooting mode being a preset shooting mode, or in response to the preview interface including a preset picture, the step of storing the image file is performed; wherein the preset shooting mode includes one or more of the following modes: landscape shooting mode, food shooting mode, night scene shooting mode; the preset picture is a picture that does not include a portrait.

[0014] Based on this, the image file including the first coded image and the second coded image may be stored in a preset shooting mode to improve storage efficiency.

[0015] In a possible implementation of the first aspect, determining a first coded image and a second coded image based on an original image includes: obtaining a first image and a second image in a YUV format based on the original image, wherein the first image includes original brightness information; and performing image encoding on the first image and the second image, respectively, to obtain a first coded image and a second coded image.

[0016] The original image includes a large amount of data, while the YUV format image includes a small amount of data. Therefore, the electronic device can first convert the original image into a first image in YUV format and a second image in YUV format, and encode based on the first image and the second image to improve encoding efficiency.

[0017] In a possible implementation of the first aspect, image encoding is performed on the first image and the second image respectively to obtain the first encoded image and the second encoded image, including: obtaining a rotation parameter, where the rotation parameter is determined based on the posture of the electronic device; rotating the first image and the second image based on the rotation parameter; and image encoding is performed on the rotated first image and the rotated second image respectively to obtain the first encoded image and the second encoded image.

[0018] When taking a photo, the posture of the electronic device may be in a rotated state. In order to ensure that the image file obtained by the capture can keep the direction of the actual captured object consistent with the scene viewed by the human eye when displayed, the electronic device can first determine the rotation parameters based on the posture of the electronic device, and then rotate the first image and the second image based on the rotation parameters to obtain the first encoded image and the second encoded image, thereby improving the display effect of the image file.

[0019] In a possible implementation of the first aspect, obtaining the first coded image and the second coded image includes:

[0020] When the format of the first image is the first format, the first image is encoded by the first hardware encoding module to obtain a first encoded image; the first format is an encoding format supported by the first hardware encoding module; when the format of the first image is not the first format, the first image is encoded by the first software encoding module to obtain the first encoded image; when the format of the second image is the second format, the second image is encoded by the second hardware encoding module to obtain a second encoded image; the second format is an encoding format supported by the second hardware encoding module; when the format of the second image is not the second format, the second image is encoded by the second software encoding module to obtain a second encoded image.

[0021] Among them, the hardware encoding module can be called an offline encoding module, and the software encoding module can be called an online encoding module.

[0022] If the first image is in the first format supported by the first hardware encoding module, then the first hardware encoding module can encode the first image to obtain the first encoded image. If the first image is in a format not supported by the first hardware encoding module, then the first software encoding module can be used to encode the first image to obtain the first encoded image. The same applies to the second image. The hardware encoding module has a fast encoding speed and a stable encoding process, which can improve encoding efficiency. The software encoding module supports a wide range of encoding formats. Therefore, the above solution can ensure that the first and second images can be encoded to obtain the first and second encoded images.

[0023] In a possible implementation of the first aspect, the original image is a RAW image, and a first image in YUV format and a second image in YUV format are respectively obtained based on the original image, including: converting the RAW image into the first image in YUV format through a first conversion module, and the first conversion module does not change the original brightness information; converting the RAW image into the second image in YUV format through a second conversion module, and the second conversion module changes the original brightness information.

[0024] In the above process, the first image is processed by the first module that does not change the original brightness information to ensure that the original brightness information can be retained in the first encoded image. In addition, the second image is processed by the second module that can change the original brightness information to ensure the display effect of the image file.

[0025] In a possible implementation of the first aspect, the method also includes: obtaining image editing parameters, the image editing parameters corresponding to the current shooting mode, the image editing parameters including a first parameter and a second parameter; the first parameter is used to indicate the image shape in the modified image, and the second parameter is used to indicate the color in the modified image; converting the RAW image into a first image in YUV format through a first conversion module, including: processing the RAW image based on the first parameter through the first conversion module to obtain the first image in YUV format; converting the RAW image into a second image in YUV format through a second conversion module, including: processing the RAW image based on the first parameter and the second parameter through the second conversion module to obtain the second image in YUV format.

[0026] The modified image shape refers to a situation where the image is changed due to operations such as perspective distortion and cropping, for example, lines are bent or stretched.

[0027] After the first conversion module processes the RAW image based on the first parameters, the image shape of the obtained YUV-formatted first image is modified. Therefore, the corresponding second conversion module also needs to process the RAW image based on the first parameters to obtain a second image with the modified image shape. Because the same first parameters are used, the content of the first and second images remains consistent. Furthermore, since the original image contains information such as noise, the second conversion module also needs to process the RAW image based on the second parameters to obtain a second image with higher display quality.

[0028] In a possible implementation of the first aspect, the original image is a RAW image, and a first image and a second image are respectively obtained based on the original image, including: converting the RAW image of the original image into a first image in a YUV format through a third conversion module, and the first conversion module does not change the original brightness information; converting the first image in the YUV format into the second image through a fourth conversion module, and the second conversion module changes the original brightness information in the first image.

[0029] In a possible implementation of the first aspect, the method further includes:

[0030] Obtaining image editing parameters, where the image editing parameters correspond to the current shooting mode and include a first parameter and a second parameter; the first parameter is used to instruct the electronic device to modify the image shape in the image, and the second parameter is used to instruct the electronic device to modify the color in the image;

[0031] Converting the RAW image of the original image into a first image in YUV format by a third conversion module includes:

[0032] Processing the RAW image based on the first parameter by a third conversion module to obtain a first image in a YUV format;

[0033] Converting the first image in YUV format into a second image in YUV format by a fourth conversion module includes:

[0034] The first image in the YUV format is processed based on the second parameter by the fourth conversion module to obtain a second image in the YUV format.

[0035] After the third conversion module processes the RAW image based on the first parameters, the image shape of the obtained YUV-formatted first image is modified. The fourth conversion module can then directly process the first image based on the second parameters to obtain the second image. This ensures that the image shapes of the first and second images are completely consistent, improving processing efficiency by requiring only the third conversion module to process the first parameters.

[0036] In one possible implementation of the first aspect, the first parameter includes wide-angle distortion processing parameters and / or cropping parameters, and the second parameter includes color enhancement parameters. Wide-angle distortion can easily occur due to perspective and image size can be excessive during the shooting process. Therefore, the first parameter may include wide-angle distortion processing parameters and / or cropping parameters. The original image may contain noise and color inconsistencies. Therefore, the second parameter may include color enhancement parameters.

[0037] In a possible implementation of the first aspect, storing the image file includes: storing the first encoded image and the second encoded image in a first buffer, or splicing the second buffer corresponding to the first encoded image and the third buffer corresponding to the second encoded image into a first buffer; and storing the image file in the first buffer.

[0038] In the above manner, the first encoded image and the second encoded image can be stored in the same first buffer, thereby obtaining a complete image file.

[0039] In a possible implementation of the first aspect, determining the first coded image and the second coded image based on the original image includes: determining the first coded image based on the original image using a first thread; and determining the second coded image based on the original image using a second thread.

[0040] By adopting the above method and adopting the multi-threaded method to perform encoding, the encoding efficiency can be improved.

[0041] In a possible implementation manner of the first aspect, the first coded image is a single-channel coded image, and the second coded image is a three-channel color coded image.

[0042] Because the first encoded image retains the original brightness information, it can be a single-channel encoded image to reduce the memory occupied by the image file. The third encoded image is a three-channel color-encoded image, which can display the image file with richer colors and ensure image display quality.

[0043] In a second aspect, the present application provides an electronic device, comprising a display screen, a memory, and one or more processors; the display screen, the memory, and the processor are coupled; the display screen is used to display an image generated by the processor, and the memory is used to store computer program code, wherein the computer program code comprises computer instructions; when the processor executes the computer instructions, the electronic device executes the method described in the first aspect and any possible design method thereof.

[0044] In a third aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect and any possible design thereof.

[0045] In a fourth aspect, the present application provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the method described in the first aspect and any possible design thereof.

[0046] In a fifth aspect, the present application provides a device, which is included in an electronic device, and has the function of implementing the electronic device behavior in any of the above aspects and possible implementation methods. This function can be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes at least one module or unit corresponding to the above function. For example, an allocation module or unit, a scanning module or unit, a recycling module or unit, a movement module or unit, and a storage module or unit, etc.

[0047] In a sixth aspect, an embodiment of the present application provides a chip system, which includes a processor and may also include a memory, for implementing any one of the methods provided in the first aspect. The chip system may be composed of a chip or may include a chip and other discrete devices.

[0048] It can be understood that the electronic device described in the second aspect and any possible design method provided above, the computer-readable storage medium described in the third aspect, and the computer program product described in the fourth aspect are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 A schematic diagram of photo processing related to an embodiment of the present application;

[0050] Figure 2 A schematic diagram of photo processing provided in an embodiment of the present application;

[0051] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application

[0052] Figure 4 A software structure block diagram of an electronic device provided in an embodiment of the present application;

[0053] Figure 5 A schematic diagram of an image processing method provided in an embodiment of the present application Figure 1 ;

[0054] Figure 6 A schematic diagram of a rotating camera for an electronic device provided in an embodiment of the present application;

[0055] Figure 7 A schematic diagram of an image file provided in an embodiment of the present application;

[0056] Figure 8 A schematic diagram of an image processing method provided in an embodiment of the present application Figure 2 ;

[0057] Figure 9 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application Figure 1 ;

[0058] Figure 10 A schematic diagram of an image processing method provided in an embodiment of the present application Figure 3 ;

[0059] Figure 11 A schematic diagram of the structure of an image processing device provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION

[0060] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, "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 mean: 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 associated objects before and after are in an "or" relationship. "At least one of the following items" 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 mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0061] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0062] Before introducing the embodiments of the present application, the technologies involved in the embodiments of the present application are first introduced in detail.

[0063] 1. Image channels, single-channel images, and multi-channel images

[0064] In different image modes, image channels have different meanings. Generally, in the red, green, and blue (RGB) color mode, image channels are used to store image color data, with one channel representing the brightness information of one color.

[0065] A single-channel image refers to an image with only one channel. Since one channel only represents one color, each pixel in a single channel has only one pixel value.

[0066] For example, each pixel in a single-channel image uses a value to represent its color. The pixel value of each pixel ranges from 0 to 255. A pixel with a value of 0 appears black, a pixel with a value of 255 appears white, and pixel values ​​between 0 and 255 appear in varying shades of gray. The closer the pixel value is to 255, the lighter the gray. Therefore, a single-channel image is generally a grayscale image. Since each pixel in a single-channel image has only one value to represent its color, and the magnitude of the value can represent brightness information, each pixel in a single-channel image can be considered an image that carries only brightness information.

[0067] A multi-channel image refers to an image with multiple channels. Since one channel only represents one color, each pixel in a multi-channel image uses multiple pixel values ​​to represent different colors.

[0068] Common three-channel images include RGB images. Each pixel in an RGB image consists of three pixel values, one for red, one for green, and one for blue. The magnitude of the pixel value represents the brightness of that color. The pixel value for each channel in a pixel represents a color, and the magnitude of each pixel value represents the brightness of that color. For example, a pixel with the RGB values ​​of [0, 0, 255] appears blue, a pixel with the values ​​of [255, 0, 0] appears red, and a pixel with the values ​​of [0, 255, 0] appears green. Pixels composed of three colors with different brightnesses can appear as different colors. For example, red, green, and blue light can be added to white light. In this case, a pixel with the values ​​of [255, 255, 255] appears white. Alternatively, in the absence of red, green, and blue light, the color black is obtained. In other words, a pixel with the values ​​of [0, 0, 0] appears black.

[0069] In the related art, since the display screen of an electronic device generally uses light-emitting diodes of three colors, red, green, and blue, to realize the display function, the image displayed on the display screen is generally an RGB image.

[0070] Another common three-channel image is the YUV image. In a YUV image, Y represents luminance (Luma), and U and V represent chrominance (Chroma). Each pixel in a YUV image contains Y, U, and V components, where the Y component is independent of the U and V components. If each pixel in a YUV image does not have a U and V component, then the YUV image is a grayscale image.

[0071] YUV images generally retain the Y component completely, while the U and V components can be obtained through sampling. Therefore, when the image quality is not significantly reduced, YUV images can effectively reduce the memory space they occupy. Therefore, in the process of transmission and image processing, YUV images are generally used to improve efficiency.

[0072] 2. Image Coding

[0073] Image coding is also called image compression. The main purpose of image coding format is to reduce redundant information in image data, retain image quality and details, and make the image as small as possible, so as to more efficiently store and transmit digital images.

[0074] Currently, image encoding formats include the JPEG format developed by the Joint Photographic Experts Group, the Portable Network Graphics (PNG) format, and the Graphics Interchange Format (GIF). It should be noted that the above list only includes some common image encoding formats. For more details, please refer to the introduction of related technologies and will not be repeated here.

[0075] Because JPEG encoding uses lossy compression to remove redundant image data, it can achieve better image quality with less disk space. JPEG encoding also allows files to be compressed using different compression ratios, thus supporting multiple compression levels. Furthermore, JPEG encoding primarily compresses high-frequency information, effectively preserving color information. Therefore, JPEG encoding is currently commonly used in photos taken by electronic devices. Thus, the subsequent embodiments will use JPEG encoding to introduce the present application scheme. However, the encoding methods involved in the embodiments of the present application are not limited to JPEG encoding, and other encoding methods may also be selected based on actual application requirements.

[0076] The image processing method provided in the embodiments of the present application is introduced below with reference to the accompanying drawings.

[0077] In the scenario where users take photos with electronic devices in daily life, after the photosensitive element in the electronic device outputs the original image (RAW) according to the user's photo operation, the photo processing module in the electronic device can process the RAW to obtain a photo. Generally, users expect the photos they take to be in color. Therefore, if Figure 1 As shown in FIG, after the RAW image is processed by the photo processing module, the obtained photo is a three-channel image that can be expressed as a color image. In addition, in general, the photo needs to be displayed on a display screen for users to view, so the three-channel image is generally an RGB image that is convenient for display on a display screen.

[0078] Since most people who use electronic devices to take photos are not professional photographers, they don't control the aperture, shutter speed, and ISO to improve the quality of photos taken with electronic devices. For example, in low-light conditions, if a user directly presses the shutter button on an electronic device, the resulting photo may be too dark, with a loss of detail, and unclear images.

[0079] Currently, electronic devices generally have built-in photo processing algorithms to address the above-mentioned problems. For example, in a low-light photography environment, when a user presses the shutter of an electronic device to take a photo, the electronic device brightens the photo obtained after the shutter is pressed based on the built-in photo processing algorithm to enhance the missing details and unclear issues in the photo, thereby improving the display effect of the photo.

[0080] However, in general, the processing logic of the photo processing algorithm built into electronic devices is fixed and cannot be adaptively processed according to the actual conditions of different photos. Therefore, when electronic devices use photo processing algorithms to process different photos, some photos may display well while others may not. For example, the processing logic of the built-in photo processing algorithm is to increase the brightness to achieve the effect of making the details of the photo clear. Electronic devices use this method to process darker images and can obtain a photo with clear details. However, when electronic devices use this method to process brighter images, the image will become brighter, and the brighter areas will be blurred, resulting in a photo with unclear details.

[0081] Moreover, when an electronic device processes a photo using a built-in photo algorithm, the brightness information of the original photo is changed, and the resulting photo does not contain the original brightness information. Afterwards, the electronic device cannot obtain the original brightness information again to process the photo using other algorithms, thereby failing to improve the quality of the photo.

[0082] For example, a photo processing algorithm brightens a photo by adjusting the brightness, and adjusts the contrast to change the difference between light and dark in the photo, thereby changing the clarity of the photo. Since electronic devices cannot adaptively adjust the brightness and contrast of photos according to the actual content of the photo, inappropriate brightening operations result in missing details and unclear images. For example, when an electronic device uses built-in photo algorithm processing and filtering to brighten the image in a photo, it will amplify noise that was not originally obvious in the photo, making it more prominent, thereby reducing the quality of the photo. In particular, for darker areas in the photo, due to the low signal-to-noise ratio, when the electronic device brightens the area, the noise in the area will be more obviously amplified. In other words, electronic devices cannot guarantee the quality of photos using this photo processing method.

[0083] Furthermore, if it is found that the processed photo has missing details and unclear images due to changes in brightness information, the difficulty of restoring the missing details in the photo and improving the clarity of the photo through other image processing algorithms will also increase.

[0084] To this end, this application provides an image processing method, such as Figure 2 As shown, after the photo processing module of the electronic device processes the original image using this method, it can obtain a three-channel image and a single-channel image. The three-channel image retains the color information of the photo, and the single-channel image retains the brightness information of the original image. In this way, the electronic device can first brighten the three-channel image based on the brightness information in the single-channel image, and then display the resulting brightened image.

[0085] In order to better understand the embodiments of the present application, the electronic device provided by the embodiments of the present application is first introduced.

[0086] The electronic device may specifically be a mobile phone, tablet computer, smart screen, laptop computer, in-vehicle device, wearable device (such as a smart watch), ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), artificial intelligence (AI) device, or other terminal device with image processing capabilities. The embodiments of the present application do not limit the specific type of electronic device or the installed operating system.

[0087] Figure 3 A schematic structural diagram of the electronic device 100 is shown.

[0088] 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 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.

[0089] It should be understood that the structure illustrated in the embodiments 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, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0090] 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 memory, a video codec, an image codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0091] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0092] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0093] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can 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 can 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.

[0094] 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 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0095] 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.

[0096] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While charging the battery 142, the charging management module 140 can also power the electronic device through the power management module 141.

[0097] 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 to provide power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160.

[0098] The wireless communication function of the electronic device 100 can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, a modem processor, and a baseband processor. 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.

[0099] 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 antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0100] The mobile communication module 150 can provide wireless communication solutions for electronic device 100, including 2G / 3G / 4G / 5G. 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 antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modem processor for demodulation.

[0101] The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via 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.

[0102] The wireless communication module 160 can provide wireless communication solutions for application on the electronic device 100, 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 technology (NFC), infrared technology (IR), etc.

[0103] Wireless communication module 160 can be one or more devices that integrate at least one communication processing module. Wireless communication module 160 receives electromagnetic waves via antenna 2, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to processor 110. Wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency-modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

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

[0105] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0106] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, an image codec, a GPU, a display screen 194, and an application processor.

[0107] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.

[0108] 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 light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion 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. In some embodiments, the photosensitive element may also be referred to as an image sensor. For ease of description in subsequent embodiments, the image sensor is directly referred to as a sensor.

[0109] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0110] Image codecs are used to compress or decompress digital images. Electronic device 100 may support one or more image codecs. This allows electronic device 100 to display or capture photos in a variety of encoding formats, such as JPEG, PNG, and GIF.

[0111] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it 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.

[0112] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0113] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, a speaker, a receiver, a microphone, a headphone jack, and an application processor. The speaker converts electrical audio signals into sound signals. The receiver converts electrical audio signals into sound signals. The microphone converts sound signals into electrical signals. The headphone jack is used to connect wired headphones.

[0114] 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 provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0115] The sensor module 180 may include an acceleration sensor 180E, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, and the like.

[0116] Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). It can also detect the magnitude and direction of gravity when electronic device 100 is stationary. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.

[0117] The buttons 190 include a power button, a volume button, etc. The buttons 190 can be mechanical buttons or touch buttons.

[0118] SIM card interface 195 is used to connect a SIM card. A SIM card can be connected to and disconnected from electronic device 100 by inserting or removing it from SIM card interface 195. Electronic device 100 may support one or N SIM card interfaces, where N is a positive integer greater than 1. SIM card interface 195 is compatible with different types of SIM cards. SIM card interface 195 is also compatible with external memory cards. Electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communications.

[0119] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. In the embodiment of the present invention, an operating system with a layered architecture is used as an example to illustrate the software structure of the electronic device 100.

[0120] Figure 4 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.

[0121] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other via software interfaces. In some embodiments, the operating system is divided into four layers: application layer, framework layer, hardware abstraction layer (HAL), and kernel layer, from top to bottom.

[0122] For ease of explanation, Figure 4 Also shown is the hardware layer that interfaces with the software architecture.

[0123] It should be noted that the embodiment of the present application is illustrated by taking a common operating system as an example. In other operating systems, as long as the functions implemented by each functional module are similar to those of the embodiment of the present application, the solution of the present application can also be implemented.

[0124] The application layer can include a series of application packages. Figure 4 As shown, the application package may include applications such as a camera, a display application, etc. Among them, the display application may be a common gallery, a photo viewing application, a photo beautification and editing application, etc.

[0125] The framework layer provides an application programming interface (API) and programming framework for the application layer's applications. The framework layer includes some predefined functions.

[0126] like Figure 4 As shown, the framework layer may include a camera service. The camera service is used to connect the camera application and the relevant hardware of the hardware layer. In some embodiments, the camera service can realize the connection between the camera application and the hardware layer by calling the hardware interface.

[0127] It is understandable that the framework layer may also include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like. The window manager is used to manage window programs. The content provider is used to store and retrieve data and make the data accessible to applications. The view system includes visual controls, such as controls for displaying text and controls for displaying pictures. The phone manager is used to provide communication functions for the electronic device 100. The resource manager provides various resources for applications. The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.

[0128] The HAL layer is located above the kernel layer. The HAL layer can abstract the hardware of the hardware layer, hide the differences between different hardware, and provide a unified hardware interface for the upper layer.

[0129] like Figure 4As shown, the HAL layer includes camera devices, perception engines, and image processing.

[0130] The camera device is used to connect the camera service to the underlying camera driver and camera.

[0131] The perception engine is used to obtain the current photo scene, which can include the phone's shooting angle, the content of the photo, etc.

[0132] Image processing is used to perform operations such as format conversion, content processing, and encoding on images.

[0133] The kernel layer is the layer between the hardware layer and the software layer. Figure 4 As shown, the kernel layer includes a camera driver, which is used to control the camera of the hardware layer to perform shooting actions.

[0134] It is understandable that the kernel layer may also include display drivers, audio drivers, sensor drivers, etc., which will not be described in detail here.

[0135] The following describes the workflow of the software and hardware of the electronic device 100 in conjunction with a shooting scene.

[0136] For example, a camera application located in the application layer displays a capture interface on an electronic device, where the user can tap the capture control. When the touch sensor receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, touch operation timestamp, and other information). The raw input event is stored in the kernel layer. The framework layer obtains the raw input event from the kernel layer and can identify the control corresponding to the input event as a capture control. The camera then calls the interface provided by the framework layer's camera service. After the interface provided by the camera service is called, the camera device in the HAL layer can call the kernel layer's camera driver, which can then capture a raw image from the camera. The camera driver then sends the raw image to the HAL layer's image processing, which can process the raw image into a photo including a three-channel image and a single-channel image.

[0137] Figure 5 A schematic diagram of an image processing method provided in an embodiment of the present application Figure 1 The method is executed by an electronic device and includes the following steps:

[0138] S501: Obtain RAW and image processing parameters.

[0139] RAW is the image data directly output from the image sensor of a digital camera, scanner, film scanner, or mobile phone. It is equivalent to a file containing image information. The image sensor of an electronic device converts light signals into electrical signals when the shutter is pressed. Therefore, the image data output by the image sensor contains all the image information. Therefore, the RAW output of the image sensor is also called a digital negative.

[0140] In some scenarios, when the camera application starts running, the electronic device can start to acquire RAW in real time. Afterwards, the electronic device performs an image processing process of the preview stream on the RAW to obtain the preview stream. Afterwards, the processed preview stream can be displayed in the viewfinder on the display screen for the user to view. In other scenarios, when the camera application starts running, the electronic device can start to acquire RAW in real time, but the electronic device does not process the acquired RAW. Afterwards, when the user presses the shutter in the camera application display interface to start running, the electronic device performs an image processing process of the data stream on the RAW acquired at the moment the user presses the shutter, and finally obtains an image file stored in the electronic device, that is, the photo is taken.

[0141] Among them, the interface that displays the processed preview stream in the viewfinder of the display screen in the embodiment of the present application is the shooting preview interface. The shutter in the embodiment of the present application can be called a shooting control in the shooting preview interface.

[0142] In some embodiments, the image processing parameters include cropping parameters, wide-angle distortion processing parameters, beautification parameters, etc. When an electronic device processes an image based on cropping parameters and wide-angle distortion processing parameters, the shape of the content in the image will change. For example, when an electronic device processes an image based on cropping parameters, the field of view (FOV) in the image will change, such as a circular object in the image becomes a semicircle after being cropped. For another example, when an electronic device processes an image based on wide-angle distortion processing parameters, it will repair the distortion in the image due to perspective, such as repairing the edge that appears as a curve in the picture due to perspective into a straight line. When an electronic device processes an image based on beautification parameters, the color in the image will change, but the shape of the content in the image will not change. For example, the beautification parameters may include at least one of exposure value, brightness value, contrast, saturation, color temperature value, etc. Among them, the beautification parameters in the embodiments of the present application may also be referred to as color beautification parameters.

[0143] Among them, the image processing parameters in the embodiment of the present application can be the image editing parameters in the present application, and the first parameter included in the image editing parameters in the present application can be a cropping parameter and a wide-angle distortion processing parameter, and the second parameter can be a beautification parameter.

[0144] Furthermore, generally speaking, electronic devices cannot display images directly based on RAW, and RAW must first be converted into an image format that can be displayed on the electronic device.

[0145] The RAW image may be converted into a preset image format that can be displayed in an electronic device, such as a YUV format or other formats, through the following steps. Specifically, the electronic device converts the RAW image into an image format that can be displayed in the electronic device, including S502-S505.

[0146] S502 : Acquire, based on RAW, a YUV format image A that retains original brightness information and a YUV format image B that does not retain original brightness information.

[0147] Since YUV format images occupy less memory space, YUV images are generally used in the process of transmission and image processing. Therefore, electronic devices can first convert RAW images into YUV format images to improve processing efficiency.

[0148] In some embodiments, since the image processing method provided in the embodiments of the present application requires a single-channel image that retains the original brightness information and a three-channel image that retains the color information, the electronic device needs to perform two conversion processes separately when converting RAW into a YUV format image that is easy to process.

[0149] In the above-described embodiment, the electronic device converts the RAW image into a YUV-formatted image A that retains the original brightness information. Specifically, the electronic device does not perform any processing on the original brightness information in the RAW image. For example, the electronic device does not perform any processing on the RAW image that would alter the original brightness information, such as color correction matrix (CCM) or gamma correction. Furthermore, during this process, the YUV-formatted image A obtained by the electronic device may or may not retain color information.

[0150] In another conversion process in the above embodiment, the electronic device converts the RAW image into a YUV format image B that does not retain the original brightness information. Specifically, the electronic device may adjust the original brightness information and color information of the RAW image based on the beautification parameters corresponding to the camera mode selected by the user, or based on the beautification parameters corresponding to the filter selected by the user, and then convert the RAW image with the adjusted original brightness information and color information into the YUV format image B.

[0151] The original brightness information in the original image includes brightness contrast information.

[0152] In this embodiment, the YUV format image A that retains the original brightness information may be the first image of this application, and the YUV format image B that does not retain the original brightness information may be the second image of this application.

[0153] S503 : Process the YUV format image A and the YUV format image B respectively based on the image processing parameters to obtain a YUV format image A′ and a YUV format image B′.

[0154] When an electronic device processes a YUV format image based on image processing parameters, the shape of the content in the YUV format image may change. Therefore, the electronic device needs to perform the same processing on YUV format image A and YUV format image B based on the image processing parameters to ensure that the content of the processed YUV format image A' and YUV format image B' is the same.

[0155] In some embodiments, the image processing parameters include cropping parameters and wide-angle distortion processing parameters. The electronic device crops and performs wide-angle distortion processing on the YUV format image A and the YUV format image B respectively based on the cropping parameters and wide-angle distortion processing parameters.

[0156] It should be noted that in the process of an electronic device acquiring a YUV format image based on RAW, in addition to performing the operation of converting RAW into YUV format, the electronic device can also crop RAW based on cropping parameters. In this way, a YUV format image with a size that meets the requirements can be acquired based on RAW, and the storage space occupied can be reduced, thereby improving the efficiency of subsequent transmission and processing.

[0157] S504 , performing image encoding on the YUV format image A′ to obtain a single-channel image, and performing image encoding on the YUV format image B′ to obtain a three-channel image.

[0158] The single-channel image in this embodiment may be the first encoded image in this application, and the three-channel image may be the second encoded image in this application.

[0159] When an electronic device encodes YUV format image A' and YUV format image B', the resulting single-channel image and three-channel image have the same encoding format, which facilitates subsequent decoding and processing by the electronic device or other electronic devices based on the single-channel image and three-channel image with the same encoding format.

[0160] In some embodiments, when the hardware structure of the electronic device includes an image codec, the image codec can be used to perform image encoding on the YUV format image A' and the YUV format image B' to obtain a single-channel image and a three-channel image, respectively.

[0161] In some embodiments, when a software codec module is configured in the electronic device, the electronic device can use the software codec module to perform image encoding on the YUV format image A' and the YUV format image B' to obtain a single-channel image and a three-channel image, respectively.

[0162] The software encoding and decoding module in the above embodiment may include the first software encoding module and the second software encoding module in this application.

[0163] In some embodiments, when the hardware structure of the electronic device includes an image codec and the electronic device is configured with a software codec module, the electronic device can perform image encoding on a YUV format image A' using the software codec module to obtain a single-channel image, and perform image encoding on a YUV format image B' using the image codec to obtain a three-channel image. The software codec module can be the first software encoding module in this application, and the image codec can be the second hardware encoding module in this application.

[0164] Alternatively, the electronic device may perform image encoding on the YUV format image A' using an image codec to obtain a single-channel image, and perform image encoding on the YUV format image B' using a software codec module to obtain a three-channel image. The image codec may be the first hardware encoding module in the present application, and the software codec module may be the second software encoding module in the present application.

[0165] It should be noted that the image codec and software codec modules share the same encoding logic. The image codec is an additional hardware structure. Image encoding using the image codec does not consume the computing resources of the electronic device's processor. However, image encoding using a software codec module does require computing resources. Therefore, the decision to choose between an image codec and a software codec module for image encoding can be made based on actual circumstances.

[0166] It can be understood that the image codec used to encode the YUV format image A' is the first hardware encoding module, the software encoding and decoding module used to encode the YUV format image A' is the first software encoding module, the image codec used to encode the YUV format image B' is the second hardware encoding module, and the software encoding and decoding module used to encode the YUV format image B' is the second software encoding module.

[0167] In some embodiments, when the electronic device uses the same image encoding method for the YUV format image A' and the YUV format image B', only the original brightness information can be retained in the YUV format image A corresponding to the YUV format image A'. Therefore, the single-channel image obtained by the electronic device through image encoding of the YUV format image A' only includes the original brightness information, and the three-channel image obtained by image encoding of the YUV format image B' may include brightness information and / or color information.

[0168] When the electronic device encodes only the original brightness information of the YUV format image A' and does not restrict the image encoding method of the YUV format image B', the single-channel image obtained by the electronic device through image encoding of the YUV format image A' includes only the original brightness information, and the three-channel image obtained through image encoding of the YUV format image B' may include brightness information and / or color information. For example, in addition to retaining the original brightness information, the YUV format image B corresponding to the YUV format image B' also retains other color information. During the image encoding process of the YUV format image A', the electronic device encodes only the original brightness information, and other color information is deleted. Therefore, a single-channel image including only the original brightness information can be obtained.

[0169] In some embodiments, the image encoding process of the image codec and the software encoding and decoding module includes an image rotation process and an encoding process. The image rotation process can determine whether rotation is required based on the shooting posture of the electronic device. The rotation is briefly described by taking the center of the electronic device display screen as the rotation center a as an example. When the shutter of the electronic device is pressed, as shown in FIG. Figure 6 As shown, if the electronic device is in a vertical position, the rotation parameter is 0°, indicating that the image rotation process during the image encoding process requires the image to be rotated 0° or not rotated. If the electronic device changes from a vertical position to a horizontal position, at this time, the electronic device in the vertical position is rotated 90° counterclockwise on the plane where the display screen is located with the rotation center a as the rotation point, and becomes a horizontal electronic device. In this case, the rotation parameter is -90°. Then, during the image encoding process, the image captured by the electronic device needs to be rotated 90° counterclockwise on the display plane with the image center as the rotation point to obtain the rotated image, thereby ensuring the user's viewing effect.

[0170] After the electronic device executes S504 to obtain the three-channel image and the single-channel image, it executes S505 to obtain an image file including the three-channel image and the single-channel image:

[0171] S505 : Store the single-channel image and the three-channel image in the same buffer to obtain an image file.

[0172] like Figure 7 As shown, the electronic device stores the single-channel image and the three-channel image in a buffer, thereby presenting them as one image file. The buffer in which the single-channel image and the three-channel image are stored together may be a first buffer.

[0173] Alternatively, the electronic device can combine the buffer storing the single-channel image and the buffer storing the three-channel image into one buffer, which can also achieve the following effect: Figure 7 As shown, the effect of including a three-channel image and a single-channel image in one image file.

[0174] In the case of stitching, the buffer storing the single-channel image may be the second buffer, and the buffer storing the three-channel image may be the third buffer.

[0175] Through S505 , the electronic device may store the image file.

[0176] Optionally, after executing S505, the electronic device may further execute the following S506:

[0177] S506: Read and display the image file.

[0178] In some embodiments, after the electronic device reads the image file, if the electronic device only recognizes the three-channel image in the image file, then the electronic device may display the three-channel image in the image file on the display screen of the electronic device.

[0179] In some embodiments, after the electronic device reads the image file, if the electronic device only recognizes a single-channel image in the image file, the electronic device may display the single-channel image in the image file on a display screen of the electronic device.

[0180] In some embodiments, after the electronic device reads the image file, if the electronic device recognizes a three-channel image and a single-channel image in the image file, and the electronic device only supports displaying three-channel images, then the electronic device can only display the three-channel image in the image file on the display screen of the electronic device.

[0181] In some embodiments, after the electronic device reads the image file, if the electronic device recognizes a three-channel image and a single-channel image in the image file, and the electronic device only supports displaying single-channel images, then the electronic device can only display the single-channel image in the image file on the display screen of the electronic device.

[0182] In some embodiments, after the electronic device reads the image file, if the electronic device recognizes a three-channel image and a single-channel image in the image file, and the electronic device can process and display the three-channel image and the single-channel image, then the electronic device can adjust the three-channel image based on the single-channel image and display the adjusted image.

[0183] In the above embodiment, since the original brightness information is retained in the single-channel image, the electronic device can use the original brightness information in the single-channel image to adjust the brightness of the three-channel image. For example, the electronic device brightens the three-channel image based on the original brightness information. For another example, the electronic device can fuse the single-channel image with the three-channel image, thereby brightening the three-channel image using the original brightness information retained in the single-channel image. The brightened three-channel image does not change the image content of the three-channel image itself, but rather superimposes the original brightness information of the single channel based on the image content of the three-channel image itself. In this way, the display effect of the three-channel image can be improved while retaining the details of the three-channel image.

[0184] Specifically, after a user takes a photo with a mobile phone, an image file is obtained such as Figure 7 As shown, when the user views the image file through the gallery, if the display algorithm in the gallery can read the single-channel image and the three-channel image in the image file and fuse the single-channel image and the three-channel image, then when the gallery running in the electronic device reads the image file, it can display the image after the fusion of the single-channel image and the three-channel image. The fused image has a higher brightness range and contrast, and compared with the three-channel image, it can provide more dynamic range and image details, so the display effect is better.

[0185] Figure 8 A schematic diagram of an image processing method provided in an embodiment of the present application Figure 2 The method is executed by an electronic device and includes the following steps:

[0186] S801: Obtain the RAW image captured by the sensor and image processing parameters.

[0187] In some embodiments, the RAW image captured by the sensor is packed RAW, so Figure 9 As shown, the packed RAW (packed raw) needs to be processed into RAW through the image data parsing (rawUnpack) module.

[0188] Packed raw can generally be RAW stored in MIPI format (hereinafter referred to as "MIPI RAW"). Since RAW includes all the information of the image, the RAW directly captured by a general image sensor is usually 10 bits, and 1 byte has 8 bits, so the 10-bit RAW needs to occupy 2 bytes. In this way, 6 bits of the 2 bytes occupied by RAW are empty, resulting in a waste of storage space and reducing the transmission and processing speed. Therefore, the MIPI RAW storage rule of storing 4 10-bit RAW data in 5 bytes (40 bits in total) is adopted to achieve lossless packing of RAW, so as to reduce the storage size of RAW and improve the transmission and processing speed. Therefore, current image sensors generally output packed raw to improve transmission and processing speed.

[0189] The image processing parameters in S801 may include at least one of a beautification parameter and a wide-angle distortion processing parameter. The beautification parameter is used to adjust the color and brightness of the image, and the wide-angle distortion processing parameter is used to correct the perspective deformation of the image.

[0190] In some embodiments, the image processing parameters include parameters specifically corresponding to settings for shooting with the electronic device. For example, if the electronic device is in portrait mode, the corresponding image processing parameters include only beautification parameters and do not include wide-angle distortion processing parameters. For another example, if the electronic device is in landscape mode, the corresponding image processing parameters include not only beautification parameters but also wide-angle distortion processing parameters.

[0191] In other embodiments, when an electronic device uses a wide-angle lens to take photos, the corresponding image processing parameters include wide-angle distortion processing parameters. For example, in landscape photography mode, some electronic devices use a wide-angle lens to take photos. In this case, because photos taken with a wide-angle lens may be distorted due to perspective, these electronic devices include wide-angle distortion processing parameters in their image processing parameters when the landscape photography mode with a wide-angle lens is enabled. In landscape photography mode, some electronic devices do not use a wide-angle lens to take photos. In this case, these electronic devices do not include wide-angle distortion processing parameters in their image processing parameters when in landscape photography mode.

[0192] For another example, some electronic devices include a wide-angle shooting mode in their shooting modes. When a user selects the wide-angle shooting mode, the electronic device uses a wide-angle lens to shoot a photo. In this case, the image processing parameters include wide-angle distortion processing parameters. Alternatively, some electronic devices include a wide-angle shooting mode in their shooting modes. When a user selects the wide-angle shooting mode, the user is prompted whether to perform wide-angle distortion processing on the photo. If the user selects wide-angle distortion processing, the image processing parameters include the wide-angle distortion processing parameters. If the user selects not to perform wide-angle distortion processing on the photo, the image processing parameters do not include the wide-angle distortion processing parameters.

[0193] It will be appreciated that in the above embodiment, the beautification parameters corresponding to different shooting modes may be different. For example, the beautification parameters corresponding to the portrait shooting mode include a saturation of -10 and a brightness of +15, while the beautification parameters corresponding to the landscape shooting mode include a saturation of +15 and a brightness of -15. The beautification parameters in the above examples are merely illustrative and do not limit the specific values ​​of the beautification parameters.

[0194] After obtaining the RAW image captured by the sensor and the image processing parameters, it can be determined whether the current shot requires a single-channel image. If the current shot does not require a single-channel image, the electronic device can only capture an image file containing a three-channel image, avoiding the redundant single-channel image from occupying storage space. If the current shot requires a single-channel image, the electronic device can capture an image file containing both the single-channel image and the three-channel image, thereby preserving the original brightness information of the image and improving the image display effect.

[0195] S802: Determine whether the current shooting scene requires a single-channel image.

[0196] In some embodiments, the electronic device can determine whether the current shooting scene requires a single-channel image based on the shooting mode. For example, the portrait shooting mode is a shooting scene that does not require a single-channel image, and the landscape mode is a shooting scene that requires a single-channel image. Then, the electronic device can determine that the current shooting scene does not require a single-channel image when the current shooting mode is the portrait shooting mode, and the electronic device can determine that the current shooting scene requires a single-channel image when the current shooting mode is the landscape shooting mode. For another example, the electronic device may consider that a scene that can obtain a high-dynamic range (HDR) image in the current shooting mode is a shooting scene that requires a single-channel image. The single-channel image obtained by processing can achieve a larger brightness range and contrast display.

[0197] It is understandable that the electronic device can also shoot in other shooting modes and can be configured according to the actual application. For example, the electronic device can also shoot in the food shooting mode or the night scene shooting mode, which are also shooting scenes that require single-channel images. We will not list them one by one here. In addition, due to the differences in shooting modes of different mobile phones, only some of these modes are used as examples here, and the shooting situation of a certain mode is not limited to a single-channel image shooting scene.

[0198] In some embodiments, the electronic device can determine whether the current shooting scene requires a single-channel image based on the captured image. For example, it is assumed that shooting a portrait is a shooting scene that does not require a single-channel image, and shooting a landscape without a portrait is a shooting scene that requires a single-channel image. If the electronic device recognizes that the currently captured image includes a portrait, the electronic device can determine that the current shooting scene does not require a single-channel image. If the electronic device recognizes that the currently captured image is a landscape without a portrait, the electronic device can determine that the current shooting scene requires a single-channel image.

[0199] In some embodiments, a single-channel shooting option may be provided in the electronic device. When the single-channel shooting option is selected, the electronic device determines that the current shooting scene requires a single-channel image. When the single-channel shooting option is not selected, the electronic device determines that the current shooting scene does not require a single-channel image.

[0200] In some examples, when the electronic device's single-channel shooting option is not selected and the electronic device determines based on the captured image that the current shooting scene requires a single-channel image, the electronic device may display a prompt message to remind the user whether to select the single-channel shooting option. When the electronic device's single-channel shooting option is selected and the electronic device determines based on the captured image that the current shooting scene does not require a single-channel image, the electronic device may also display a prompt message to remind the user whether to cancel the selected single-channel shooting option.

[0201] In some embodiments, when the shooting mode of the electronic device is a landscape shooting mode, that is, a scene requiring a single-channel image, such as Figure 4 The camera application shown can send the single-channel shooting identifier to the perception engine at the HAL layer through the camera service. The perception engine sends the single-channel shooting identifier to the image processing so that the image processing can perform image processing on the RAW transmitted from the photosensitive element to obtain an image file including a single-channel image and a three-channel image.

[0202] It is understandable that other third-party camera applications can also send a single-channel shooting identifier so that image processing can obtain an image file including a single-channel image and a three-channel image after image processing, thereby improving the display effect of the image file.

[0203] When it is determined that a single channel is not currently required, the electronic device may continue to execute the following S803 to S807.

[0204] S803 : Convert the RAW image into a YUV format image C based on the beautification parameters in the image processing parameters.

[0205] In some embodiments, as Figure 9 As shown, in a scenario where a single channel is not required, the RAW image is input to the raw image (RAW) to YUV domain module 1. The processing process in the RAW to YUV domain module 1 includes a format conversion process and a brightness information processing process. The format conversion process may be the electronic device converting the RAW image into a YUV format image. Subsequently, the brightness information processing process may be the electronic device adjusting the original brightness information and color information based on the beautification parameters to obtain the adjusted image in the YUV format.

[0206] In some embodiments, as Figure 9 The RAW to YUV domain module 1 shown in the figure includes a format conversion process and a simple brightness information processing process. The format conversion process can be an electronic device converting a RAW image into a YUV format image. After that, the simple brightness information processing process can be an electronic device adjusting the original brightness information to obtain the adjusted original brightness information. After the RAW to YUV domain module 1 outputs the YUV image with the brightness information simply processed, as shown in FIG. Figure 9 The YUV domain algorithm processing module shown can further adjust the YUV image using beautification parameters.

[0207] Among them, the RAW to YUV domain module 1 can be the second conversion module in this application.

[0208] In the above embodiment, the beautification parameter may include at least one of an exposure value, a brightness value, a contrast, a saturation, a color temperature value, and the like.

[0209] S804: Determine whether the image processing parameters include wide-angle distortion processing parameters.

[0210] When the image processing parameters include wide-angle distortion processing parameters, the electronic device executes S805:

[0211] S805 : Perform wide-angle distortion processing on the YUV format image C based on the wide-angle distortion processing parameters.

[0212] The wide-angle distortion processing parameters are used to correct perspective deformation in an image. The process of performing wide-angle distortion processing by an electronic device based on the wide-angle distortion processing parameters can be referred to related technologies and will not be described in detail here.

[0213] After the electronic device performs wide-angle distortion processing on the YUV format image C to obtain the YUV format image C′, S806 may be executed to perform three-channel encoding on the YUV format image C′.

[0214] S806: Three-channel encoding to obtain a three-channel encoded image.

[0215] In S806, the electronic device may perform three-channel encoding in encoding formats such as JPEG, PNG, and GIF. For example, when the electronic device adopts the JPEG format, the electronic device may obtain a three-channel JPEG format image.

[0216] In some embodiments, RGB images are generally used for display on electronic devices. Therefore, the three-channel encoded image obtained in S806 may be an RGB three-channel encoded image. It is understandable that when the three-channel encoded image is an RGB image and the electronic device uses the JPEG format, the electronic device may obtain a three-channel RGB JPEG format image.

[0217] In the case that the image processing parameters do not include wide-angle distortion processing parameters, the electronic device may directly execute S806 to perform three-channel encoding on the YUV format image C that has not undergone wide-angle distortion processing.

[0218] In some embodiments, when it is determined that a single channel is currently required, the electronic device, in addition to executing S803-S806 above, further executes S807-S810:

[0219] S807 : Convert the RAW image into a YUV format image D that retains the original brightness information.

[0220] In some embodiments, as Figure 9 As shown, in the current scenario where a single channel is required, the RAW image is input to the raw image (RAW) to YUV domain module 2. The processing process in the RAW to YUV domain module 2 only includes a format conversion process. The format conversion process can be the process of the electronic device converting the RAW image into a YUV format image. After this format conversion process, the resulting YUV format image retains the original brightness information in the RAW image.

[0221] In other embodiments, Figure 9As shown, in the current scenario where a single channel is required, the RAW image is input into the raw image (RAW) to YUV domain module 2. The processing process in this RAW to YUV domain module 2 includes a format conversion process and a color information removal process. The format conversion process is the same as the above embodiment and will not be repeated here. The color information removal process can be the electronic device deleting the color information in the RAW image, so that the converted YUV format image only contains the original brightness information.

[0222] In some embodiments, as Figure 9 The RAW-to-YUV domain module 1 shown may be an online RAW-to-YUV module, i.e., the RAW-to-YUV domain module 1 is a software module in a processor or image processor of an electronic device. The RAW-to-YUV domain module 2 may be an offline RAW-to-YUV module, i.e., the RAW-to-YUV domain module 2 is a hardware module in an electronic device.

[0223] It should be noted that the RAW to YUV domain module 1 can be an offline RAW to YUV module, and the RAW to YUV domain module 2 can be an online RAW to YUV module, or the RAW to YUV domain module 1 and the RAW to YUV domain module 2 can both be online RAW to YUV modules, or the RAW to YUV domain module 1 and the RAW to YUV domain module 2 can both be online RAW to YUV modules or offline RAW to YUV modules.

[0224] Using either the online RAW to YUV conversion module or the offline RAW to YUV conversion module allows the RAW to YUV domain module 1 to include both format conversion and brightness information processing, or both. Using either the online RAW to YUV conversion module or the offline RAW to YUV conversion module allows the RAW to YUV domain module 2 to include only format conversion, or both format conversion and color removal.

[0225] Among them, the RAW to YUV domain module 2 can be the first conversion module in this application.

[0226] In some embodiments, in S803 and S807, the electronic device can also crop the RAW based on cropping parameters during the process of converting the RAW to the YUV format. In this way, a YUV format image with a size that meets the requirements can be obtained based on the RAW, and the storage space occupied can be reduced, thereby improving the efficiency of subsequent transmission and processing.

[0227] The electronic device may determine the cropping parameters according to the shooting mode. For example, Figure 4As shown in the figure, the shooting mode of the camera application during shooting is the landscape shooting mode, and its corresponding cropping parameter is 16:9. Then, the camera application can send the cropping parameter to the perception engine through the camera service, and the perception engine sends the cropping parameter to the image processing, so that the image processing can crop the image according to the 16:9 cropping parameter during the process of converting the RAW format image to the YUV format image, thereby obtaining a YUV format image with a size of 16:9.

[0228] It should be noted that if the RAW needs to be cropped according to the cropping parameters in the S803 process, then the RAW must also be cropped according to the cropping parameters in the S807 process. In this way, it can be ensured that the final three-channel image has the same size as the single-channel image, which facilitates the subsequent brightening of the three-channel image based on the single-channel image.

[0229] S808: Determine whether the image processing parameters include wide-angle distortion processing parameters.

[0230] When the image processing parameters include wide-angle distortion processing parameters, the next step S809 is executed.

[0231] S809 : Perform wide-angle distortion processing on the YUV format image D based on the wide-angle distortion processing parameters.

[0232] The electronic device performs wide-angle distortion processing on the YUV format image D, which can be seen in the embodiments and related technologies related to S501 and S805 and will not be described in detail here.

[0233] It should be noted that, after the electronic device performs wide-angle distortion processing according to the wide-angle distortion processing parameters, it will correct the deformation caused by perspective in the YUV format image D, that is, the shape of the content in the YUV format image D' changes. For example, the curved portion in the YUV format image D appears as a straight line in the YUV format image D' after wide-angle distortion processing. Therefore, in order to ensure that the final three-channel image has the same shape as the image content in the single-channel image, if the electronic device executes S805, it must execute S809, and S805 and S809 can avoid the straight line portion in the single-channel image appearing as a curve in the three-channel image, resulting in the inability to merge the three-channel image and the single-channel image.

[0234] After executing S809, the electronic device may execute step S810:

[0235] S810: Single-channel encoding to obtain a single-channel encoded image.

[0236] Similar to S806, the electronic device may perform single-channel encoding in encoding formats such as JPEG, PNG, and GIF. For example, when the electronic device adopts the JPEG format, the electronic device may obtain a single-channel JPEG format image.

[0237] In some embodiments, RGB images are generally used for display on electronic devices. Therefore, the single-channel encoded image obtained in S806 may be an RGB single-channel encoded image. It is understandable that when the single-channel encoded image is an RGB image and the electronic device uses the JPEG format, the electronic device may obtain a single-channel RGB JPEG format image.

[0238] In a case where the image processing parameters do not include wide-angle distortion processing parameters, the electronic device may directly execute S810 to perform three-channel encoding on the YUV format image C that has not undergone wide-angle distortion processing.

[0239] It should be noted that the electronic device can use an image codec to perform S806 or a software codec module. Correspondingly, the electronic device can use an image codec to perform S810 or a software codec module. For details, please refer to the embodiment related to S504.

[0240] In some embodiments, the electronic device implements the encoding process using an image codec and a software encoding module, which can be determined based on the functions of the image codec and the software encoding module. If the image codec only supports three-channel encoding and the software encoding module only supports single-channel encoding, the electronic device can use the image codec for three-channel encoding and use the software encoding module for single-channel encoding.

[0241] In some embodiments, after executing S808 and determining that the image processing parameters do not include wide-angle distortion processing parameters, the electronic device may directly execute S810.

[0242] In the above process, the electronic device executes S803-S806 and S807-S810 synchronously. For example, when the electronic device determines that the current scene requires a single channel, it can create two threads, one of which is a three-channel encoding thread for executing S803-S806, and the other is a single-channel encoding thread for executing S807-S810.

[0243] Among them, in the embodiment of the present application, the single-channel encoding thread can be the first thread, and the three-channel encoding thread can be the second thread.

[0244] After the electronic device executes S806 and S810 , a single-channel coded image and a three-channel coded image may be obtained, and then the electronic device proceeds to execute S811 .

[0245] S811. Store the single-channel image and the three-channel image in the same buffer.

[0246] S811 is the same as S505. Please refer to the embodiment related to S505 here, and no further details will be given here.

[0247] In some embodiments, when the wide-angle distortion processing described above is performed on YUV format images, the electronic device must first convert the RAW image into a YUV format image. If the wide-angle distortion processing can be performed on RAW, the electronic device may first perform the wide-angle distortion processing on the RAW image and then convert the processed RAW image into a YUV format image.

[0248] It can be understood that the image encoding process in the above embodiment may also include a rotation process. For details, please refer to the above S504 and will not be described in detail here.

[0249] In the above embodiment, when the electronic device does not execute S809, the YUV format image D may be the first image in this application, and when the electronic device does not execute S805, the YUV format image C may be the second image in this application.

[0250] When the electronic device executes S809, the YUV format image D after wide-angle distortion processing can be the first image in this application. When the electronic device executes S805, the YUV format image C after wide-angle distortion processing can be the second image in this application.

[0251] Figure 10 A schematic diagram of an image processing method provided in an embodiment of the present application Figure 3 The method is executed by an electronic device and includes the following steps:

[0252] S1001: Obtain the RAW image captured by the sensor and image processing parameters.

[0253] S1001 is the same as S801, and reference may be made to the relevant embodiments of S801, such as Figure 11 As shown, the RAW captured by the sensor is also packed raw, and the packed raw is also processed into RAW through the rawUnpack module, which will not be repeated here.

[0254] After obtaining the RAW, the electronic device may execute S1002:

[0255] S1002: Convert the RAW image into a YUV format image E.

[0256] like Figure 11 As shown, the RAW image can be converted into a YUV format image E through the original image (RAW) to YUV domain conversion module 3, and the YUV format image E retains the original brightness information.

[0257] In some embodiments, the raw image (RAW) to YUV domain conversion module 3 may further include a dynamic range extension (DRE) processing module. After the RAW is processed by the DRE processing module, a YUV format image E may be obtained.

[0258] After the electronic device executes S1002, S1003 may be executed to determine whether the electronic device needs to perform a single-channel image processing process. S1003:

[0259] S1003: Determine whether the current shooting scene requires a single-channel image.

[0260] S1003 is the same as S802. Please refer to the relevant embodiments of S802 and will not be described again here.

[0261] When it is determined that a single channel is not needed in the current scenario, the electronic device executes the following S1004 to S1007 to obtain a three-channel image.

[0262] S1004 : Process the YUV format image E based on the beautification parameters in the image processing parameters.

[0263] like Figure 11 As shown, the YUV format conversion module in the raw image (RAW) to YUV domain conversion module 3 can convert the RAW image into a YUV format image E. Subsequently, the brightness information processing module in the raw image (RAW) to YUV domain conversion module 3 can process the brightness information of the YUV format image E. For details about brightness processing based on beautification parameters, please refer to the above embodiment and will not be repeated here.

[0264] In some embodiments, the raw image (RAW) to YUV domain module 3 may further include a dynamic range expansion (DRC) processing module. After the DRE processing module processes the RAW, the raw image (RAW) to YUV domain module 3 may convert the RAW into a YUV format image. Thereafter, the DRC processing module may process the YUV format image E based on the beautification parameters.

[0265] S1005: Determine whether the image processing parameters include wide-angle distortion processing parameters.

[0266] When the image processing parameters include wide-angle distortion processing parameters, the next step S806 is executed.

[0267] S1006 : Perform wide-angle distortion processing on the YUV format image E based on the wide-angle distortion processing parameters.

[0268] S1007: Three-channel encoding to obtain a three-channel encoded image.

[0269] S1005-S1007 are similar to S803-S807. For details, please refer to the above-mentioned relevant embodiments and will not be repeated here.

[0270] When it is determined that a single channel is currently required, the electronic device executes S1008-S1011 in addition to executing the above S1004-S1007.

[0271] S1008 : Convert the YUV format image E into a grayscale image F that only retains the original brightness information.

[0272] like Figure 11 As shown, the YUV format conversion module in the original image (RAW) to YUV domain module 3 can convert the RAW into a YUV format image E, and the YUV format image E retains the original brightness information.

[0273] In some embodiments, Figure 11 The single-channel encoding module in [1] supports encoding 8-bit grayscale images. Therefore, the YUV format image E must be an 8-bit grayscale image. If the YUV format conversion module in [1] in [2] outputs a 14-bit grayscale image, the grayscale values ​​of the original image can be compressed and requantized to convert the 14-bit grayscale image to an 8-bit grayscale image.

[0274] Specifically, the electronic device can calculate the grayscale range based on the maximum and minimum grayscale values ​​of the 14-bit grayscale image, and then calculate the quantization factor based on the 8-bit grayscale range (0-255). The grayscale range length of the 14-bit grayscale image is divided by the 8-bit grayscale range length to obtain the quantization factor of each grayscale range. Afterwards, the grayscale value of each pixel in the 14-bit grayscale image is requantized using the quantization factor, that is, the grayscale value of each pixel in the 14-bit grayscale image is divided by the quantization factor and rounded. Finally, the calculated result is written as an 8-bit grayscale image.

[0275] In the corresponding embodiments of S1002-S1008, the YUV format conversion module in the original image (RAW) to YUV domain module 3 can be the third conversion module in this application, and the brightness information processing module in the original image (RAW) to YUV domain module 3 can be the fourth conversion module in this application.

[0276] S1009: Determine whether the image processing parameters include wide-angle distortion processing parameters.

[0277] When the image processing parameters include wide-angle distortion processing parameters, the next step S1009 is executed.

[0278] S1010 : Perform wide-angle distortion processing on the YUV format image F based on wide-angle distortion processing parameters.

[0279] S1011: Single-channel encoding to obtain a single-channel encoded image.

[0280] When the image processing parameters do not include wide-angle distortion processing parameters, S1011 may be directly executed.

[0281] After the electronic device completes executing S1007 and S1011 and obtains a single-channel coded image and a three-channel coded image, it proceeds to execute S1012.

[0282] S1012: Store the single-channel image and the three-channel image in the same buffer.

[0283] S1009-S1011 are similar to S808-S810. For details, please refer to the above-mentioned relevant embodiments and will not be repeated here.

[0284] In the above embodiment, the electronic device executes S1004-S1007 and S1008-S1011 synchronously. For example, when the electronic device determines that the current scenario requires a single channel, it can create two threads, one of which is a three-channel encoding thread for executing S1004-S1007, and the other is a single-channel encoding thread for executing S1008-S1011.

[0285] The YUV format E obtained by the electronic device in S1002 can be sent to the three-channel encoding thread for executing S1004-S1007 and the single-channel encoding thread for executing S1008-S1011 in a shared memory manner.

[0286] In the above embodiment, when the electronic device does not execute S1009, the YUV format image F may be the first image in this application, and when the electronic device does not execute S1005, the YUV format image E may be the second image in this application.

[0287] When the electronic device executes S1009, the YUV format image F after wide-angle distortion processing can be the first image in this application. When the electronic device executes S1005, the YUV format image E after wide-angle distortion processing can be the second image in this application.

[0288] In some embodiments, the present application uses the above Figure 5 The image processing process in can obtain an image file including a three-channel image and a single-channel image. According to the above-mentioned image processing logic, when the electronic device performs image encoding, it can also encode the image in other ways to obtain image files in other forms. For example, in S504, the YUV format image A' is single-channel encoded in one way, and the YUV format image B' is single-channel encoded in another way, to obtain an image file including two single-channel images of different encoding types. For another example, when the electronic device performs image encoding, such as in S504, the electronic device performs three-channel encoding on the YUV format image A' as a grayscale image, and performs YUV encoding on the YUV format image B' with a filter effect, thereby obtaining a three-channel encoded image as a grayscale image and a YUV encoded image with a filter effect. Specifically, this scheme can be used for encoding according to actual needs, and will not be described in detail here.

[0289] Understandably, Figure 8 as well as Figure 10 The encoding process in the encoding method can also be modified according to actual needs to obtain an image file that meets actual needs.

[0290] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step in the above-mentioned method embodiment.

[0291] An embodiment of the present application further provides a computer program product, including a computer program. When the computer program runs on an electronic device, the electronic device executes each function or step in the above method embodiment.

[0292] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0293] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

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

[0295] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0296] If the 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 embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0297] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. An image processing method, characterized in that: Applied to an electronic device including an image sensor, the method includes: Display a shooting preview interface of the camera application, wherein the shooting preview interface includes shooting controls; storing an image file in response to a user triggering operation on the shooting control; In which, the image file includes a first encoded image and a second encoded image obtained based on the original image, the first encoded image includes the original brightness information in the original image, the original brightness information represents the brightness information corresponding to when the original image is captured, the first encoded image is used to brighten the second encoded image when displaying the image file, the brightness information of the second encoded image is adjusted according to the original brightness information, and the brightness information of the second encoded image is different from the original brightness information, and the original image is collected and acquired by the image sensor in response to the trigger operation.

2. The method according to claim 1, characterized in that The method further comprises: In response to a user opening operation of opening the image file, a brightened image is displayed, where the brightened image is obtained by brightening the second encoded image based on the first encoded image.

3. The method according to claim 1 or 2, characterized in that In response to the current shooting mode being a preset shooting mode, or in response to the preview interface including a preset picture, executing the step of storing the image file; Among them, the preset shooting mode includes one or more of the following modes: landscape shooting mode, food shooting mode, night scene shooting mode; the preset picture is a picture that does not include a portrait.

4. The method according to claim 3, characterized in that Determining the first coded image and the second coded image based on the original image includes: Acquire a first image in a YUV format and a second image in a YUV format based on the original image, wherein the first image includes original brightness information; Image encoding is performed on the first image and the second image respectively to obtain the first encoded image and the second encoded image.

5. The method according to claim 4, characterized in that The performing image encoding on the first image and the second image respectively to obtain a first encoded image and a second encoded image includes: Obtaining a rotation parameter, wherein the rotation parameter is determined based on a posture of the electronic device; rotating the first image and the second image based on the rotation parameter; Image encoding is performed on the rotated first image and the rotated second image to obtain a first encoded image and a second encoded image respectively.

6. The method according to claim 4, characterized in that The acquiring the first coded image and the second coded image includes: When the format of the first image is a first format, encoding the first image by a first hardware encoding module to obtain a first encoded image; the first format is an encoding format supported by the first hardware encoding module; when the format of the first image is not the first format, encoding the first image by a first software encoding module to obtain the first encoded image; When the format of the second image is the second format, the second image is encoded by the second hardware encoding module to obtain a second encoded image; the second format is an encoding format supported by the second hardware encoding module; when the format of the second image is not the second format, the second image is encoded by the second software encoding module to obtain a second encoded image.

7. The method according to claim 5 or 6, characterized in that The original image is a RAW image, and acquiring a first image in a YUV format and a second image in a YUV format based on the original image includes: Converting the RAW image into a first image in YUV format by a first conversion module, wherein the first conversion module does not change the original brightness information; The RAW image is converted into a second image in YUV format by a second conversion module, and the second conversion module changes the original brightness information.

8. The method according to claim 7, characterized in that The method further comprises: Obtaining image editing parameters, where the image editing parameters correspond to a current shooting mode and include a first parameter and a second parameter; the first parameter is used to indicate modification of an image shape in an image, and the second parameter is used to indicate modification of a color in an image; The converting of the RAW image into a first image in YUV format by a first conversion module includes: Processing the RAW image based on the first parameters by the first conversion module to obtain the first image in YUV format; The converting the RAW image into the second image in YUV format by the second conversion module includes: The second conversion module processes the RAW image based on the first parameter and the second parameter to obtain the second image in YUV format.

9. The method according to claim 5 or 6, characterized in that The original image is a RAW image, and acquiring the first image and the second image based on the original image respectively includes: Converting the RAW image of the original image into a first image in YUV format by a third conversion module, wherein the first conversion module does not change the original brightness information; The first image in the YUV format is converted into the second image by a fourth conversion module, and the second conversion module changes original brightness information in the first image.

10. The method according to claim 9, characterized in that The method further comprises: Obtaining image editing parameters, where the image editing parameters correspond to a current shooting mode and include a first parameter and a second parameter; the first parameter is used to instruct the electronic device to modify an image shape in an image, and the second parameter is used to instruct the electronic device to modify a color in an image; The converting of the RAW image of the original image into a first image in YUV format by the third conversion module includes: Processing the RAW image based on the first parameter by the third conversion module to obtain the first image in YUV format; The converting the first image in YUV format into the second image in YUV format by the fourth conversion module includes: The first image in the YUV format is processed by the fourth conversion module based on the second parameter to obtain the second image in the YUV format.

11. The method according to claim 8 or 10, characterized in that The first parameters include wide-angle distortion processing parameters and / or cropping parameters, and the second parameters include color beautification parameters.

12. The method according to claim 11, characterized in that The stored image file includes: storing the first coded image and the second coded image in a first buffer, or concatenating a second buffer corresponding to the first coded image and a third buffer corresponding to the second coded image into the first buffer; The image file in the first buffer is stored.

13. The method according to claim 12, characterized in that Determining the first coded image and the second coded image based on the original image includes: Determine the first encoded image based on the original image using a first thread; A second thread is used to determine the second encoded image based on the original image.

14. The method according to claim 13, characterized in that The first coded image is a single-channel coded image, and the second coded image is a three-channel color coded image.

15. An electronic device, characterized in that: The electronic device includes a display screen, a memory, and one or more processors; the display screen, the memory, and the processor are coupled; the display screen is used to display an image generated by the processor, and the memory is used to store computer program code, wherein the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1 to 14.

16. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 14.

17. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 14 is implemented.

Citation Information

Patent Citations

  • Image enhancement method and device, computer equipment and storage medium

    CN116258644A