Image processing method and electronic device
By identifying multiple objects in the image and selecting different LUT processing, the problem of a single image processing style on mobile phones is solved and diversified image display effects are achieved.
Patent Information
- Application Number
- CN202110877394.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-31
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-07-31
AI Technical Summary
Existing mobile phones can only use one color lookup table (LUT) when processing images, resulting in single-style photos or videos that cannot meet diverse shooting needs.
By identifying multiple objects in the image, determining their corresponding shooting scenes, and selecting different LUTs for processing according to different scenes, multiple processed images are synthesized to enrich the display effect.
It realizes the diversity of image processing, enriches the display effect of taking photos or videos, makes the styles and effects of photos or videos more diverse, and meets the diverse shooting needs of users.
Smart Images

Figure CN115701129B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and in particular to an image processing method and electronic equipment. Background Art
[0002] Existing mobile phones generally have the functions of taking photos and recording videos. More and more people use mobile phones to take photos and videos to record every detail of their lives. At present, when a mobile phone processes a captured image, it can only use a color lookup table (LUT) determined by the mobile phone's image recognition or a LUT selected by the user to process the image. In this way, the mobile phone can only take photos or videos with the style or display effect corresponding to the above LUT, and the style or display effect of the photos or videos taken by the mobile phone is single. Summary of the invention
[0003] The present application provides an image processing method and electronic device, which can use a variety of different LUTs to process images of different shooting objects in an image, and can enrich the display effects obtained by taking photos or recording videos.
[0004] In a first aspect, the present application provides an image processing method, where an electronic device can obtain a first image, which is an image captured by a camera of the electronic device, and the first image includes a first shooting object and a second shooting object. That is, the first image can include multiple shooting objects. The electronic device can determine that the first shooting object corresponds to a first scene and the second shooting object corresponds to a second scene. The first scene is used to identify the shooting scene corresponding to the first shooting object, and the second scene is used to identify the shooting scene corresponding to the second shooting object. Different shooting objects can correspond to different shooting scenes. The electronic device can determine a first LUT according to the first scene and determine a second LUT according to the second scene. Different shooting scenes can correspond to different LUTs. The electronic device processes the first image according to the first LUT to obtain a second image, and processes the first image according to the second LUT to obtain a third image. Among them, the display effect of the second image corresponds to the first LUT, and the display effect of the third image corresponds to the second LUT. Finally, the electronic device can display a fourth image, and the fourth image includes part of the second image and part of the third image. Part of the second image includes an image of the first shooting object, and the display effect of part of the second image corresponds to the first LUT, and part of the third image includes an image of the second shooting object, and the display effect of part of the third image corresponds to the second LUT. The second LUT is different from the first LUT.
[0005] In this solution, the electronic device can use a variety of different LUTs to process images of different shooting objects in an image, which can enrich the display effect obtained by taking photos or recording videos.
[0006] In a possible design of the first aspect, the fourth image may be obtained by synthesizing the second image and the third image. The electronic device may synthesize the second image and the third image according to the mask image of the first photographed object (i.e., the first mask image) and the mask image of the second photographed object (i.e., the second mask image) to obtain the fourth image. The first mask image may be used to characterize the pixel points corresponding to the first photographed object in the second image, and the second mask image may be used to characterize the pixel points corresponding to the second photographed object in the third image. Therefore, the electronic device may synthesize the second image and the third image according to the first mask image and the second mask image to obtain the fourth image.
[0007] Specifically, before the electronic device displays the fourth image, the electronic device may process the first image to obtain a first mask image of the first photographed object and a second mask image of the second photographed object. Afterwards, the electronic device may perform image synthesis on the second image and the third image based on the first mask image and the second mask image to obtain the fourth image. Part of the second image is the image corresponding to the first mask image in the second image; and part of the third image is the image corresponding to the second mask image in the third image.
[0008] In the first Mask image, the pixel value of the pixel in the image of the first photographed object may be a first value, and the pixel value of the pixel in the image other than the image of the first photographed object in the first Mask image may be a second value. The first value is different from the second value and is used to distinguish the image of the first photographed object from other images in the second image. In the second Mask image, the pixel value of the pixel in the image of the second photographed object may be a first value, and the pixel value of the pixel in the image other than the image of the second photographed object in the second Mask image may be a second value. The first value is different from the second value and is used to distinguish the image of the second photographed object from other images in the third image.
[0009] In another possible design method of the first aspect, in order to improve the image effect of the fourth image finally displayed by the electronic device, make the fourth image look more comfortable to the human eye and better express the information and features of the original image; the electronic device can perform tone mapping on the first image before processing the first image to obtain the second image and the third image, so as to obtain the first image after tone mapping.
[0010] Correspondingly, the electronic device processes the first image according to the first LUT to obtain the second image, and the electronic device processes the first image according to the second LUT to obtain the third image, including: the electronic device processes the first image after tone mapping according to the first LUT to obtain the second image, and the electronic device processes the first image after tone mapping according to the second LUT to obtain the third image.
[0011] In another possible design of the first aspect, the electronic device performs tone mapping on the image to obtain a tone-mapped first image, including: the electronic device performs tone mapping on the first image using a gamma curve to obtain the tone-mapped first image. This design provides a specific method for the electronic device to perform tone mapping on the first image.
[0012] That is, the tone mapping may include gamma correction. Gamma correction refers to using a gamma curve to perform image correction (ie, tone mapping). The gamma curve (ie, gamma curve) may be pre-configured in the electronic device.
[0013] In another possible design of the first aspect, the electronic device uses a gamma curve to perform tone mapping on the first image, and before obtaining the tone-mapped first image, the brightness value of each pixel in the first image can be normalized to obtain the normalized first image. The electronic device uses a gamma curve to perform tone mapping on the normalized first image to obtain the tone-mapped second image.
[0014] In another possible design of the first aspect, the electronic device recognizes the first image to determine the first scene and the second scene, and the electronic device processes the first image to obtain the first mask image and the second mask image. This may cause the electronic device to have a large amount of calculation due to the high pixel density of the first image, thereby increasing the power consumption of the electronic device.
[0015] Based on this, before the electronic device determines that the first photographed object corresponds to the first scene and the second photographed object corresponds to the second scene, the electronic device can use the first preset ratio to perform proportional downsampling on the first image to obtain the downsampled first image. Afterwards, the electronic device can identify the downsampled first image and determine that the first photographed object corresponds to the first scene and the second photographed object corresponds to the second scene; the electronic device processes the downsampled first image to obtain a first mask image of the first photographed object and a second mask image of the second photographed object.
[0016] Wherein, downsampling may also be referred to as down sampling. Downsampling the first image may reduce the size of the first image. For example, the number of pixels of the first image before downsampling may be 4000*3000, and the number of pixels of the first image after downsampling may be 2000*1500.
[0017] It should be understood that the "downsampling" in the present application refers to equal-proportional downsampling, so that the first image after downsampling can be prevented from being deformed compared to the first image before downsampling.
[0018] In another possible design manner of the first aspect, in order to make the sizes of the first Mask image and the second Mask image match the sizes of the second image and the third image, the electronic device may upsample the first Mask image and the second Mask image.
[0019] Specifically, before the electronic device synthesizes the second image and the third image according to the first Mask image and the second Mask image to obtain the fourth image, the electronic device may respectively upsample the first Mask image and the second Mask image in equal proportion using a second preset ratio to obtain the upsampled first Mask image and the second Mask image. Afterwards, the electronic device may synthesize the second image and the third image according to the upsampled first Mask image and the upsampled second Mask image to obtain the fourth image.
[0020] It should be understood that the "up-sampling" in this application refers to up-sampling in equal proportions, so that the deformed image after up-sampling can be avoided.
[0021] In another possible design manner of the first aspect, the electronic device synthesizes the second image and the third image according to the first Mask image and the second Mask image to obtain a fourth image, which may include: the electronic device determines a first Mask area from the second image according to the first Mask image, and the electronic device determines a second Mask area from the third image according to the second Mask image; the electronic device merges the image of the first Mask area with the image of the second Mask area to obtain the fourth image.
[0022] In another possible design of the first aspect, in order to improve the display effect of the fourth image, the electronic device may feather the image of the mask area. Image feathering refers to the gradual blurring or blurring of the image edge in a gradual manner. In this way, the image changes in the edge areas of each mask area in the fourth image can be made smoother and more natural.
[0023] Specifically, the electronic device merges the image of the first Mask area and the image of the second Mask area to obtain a fourth image, including: the electronic device performs feathering processing on the edge area of the image of the first Mask area and the edge area of the image of the second Mask area to obtain the image of the first Mask area after feathering and the image of the second Mask area after feathering; the electronic device merges the image of the first Mask area after feathering and the image of the second Mask area after feathering to obtain the fourth image.
[0024] In a second aspect, the present application provides an electronic device, which includes a memory, a display screen, one or more cameras, and one or more processors. The memory, the display screen, and the camera are coupled to the processor. The memory stores a computer program code, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the method described in the first aspect and any possible design thereof.
[0025] In a third aspect, the present application provides an electronic device, which includes a memory, a display screen, one or more cameras, and one or more processors. The memory, the display screen, and the camera are coupled to the processor. In the memory, a computer program code is stored, and the computer program code includes computer instructions. When the computer instructions are executed by the processor, the electronic device performs the following steps: the electronic device acquires a first image, the first image is an image captured by the camera of the electronic device, and the first image includes a first photographing object and a second photographing object; the electronic device determines that the first photographing object corresponds to a first scene and the second photographing object corresponds to a second scene, wherein the first scene is used to identify the photographing scene corresponding to the first photographing object, and the second scene is used to identify the photographing scene corresponding to the second photographing object; the electronic device determines a first LUT according to the first scene, and determines a second LUT according to the second scene; the electronic device processes the first image according to the first LUT to obtain a second image, and the electronic device processes the first image according to the second LUT to obtain a third image; wherein the display effect of the second image corresponds to the first LUT, and the display effect of the third image corresponds to the second LUT; the electronic device displays a fourth image, and the fourth image includes part of the second image and part of the third image.
[0026] Part of the second image includes an image of the first photographed object, and a display effect of the part of the second image corresponds to the first LUT; part of the third image includes an image of the second photographed object, and a display effect of the part of the third image corresponds to the second LUT.
[0027] In a possible design manner of the third aspect, when the computer instruction is executed by the processor, the electronic device further performs the following steps: before displaying the fourth image, processing the first image to obtain a first mask image of the first photographed object and a second mask image of the second photographed object; based on the first mask image and the second mask image, performing image synthesis on the second image and the third image to obtain a fourth image.
[0028] Among them, part of the second image is the image corresponding to the first Mask image in the second image; part of the third image is the image corresponding to the second Mask image in the third image.
[0029] In another possible design manner of the third aspect, when the computer instruction is executed by the processor, the electronic device further executes the following step: performing tone mapping on the first image to obtain a tone mapped first image.
[0030] When the computer instruction is executed by the processor, the electronic device further executes the following steps: processing the tone-mapped first image according to the first LUT to obtain a second image, and processing the tone-mapped first image according to the second LUT to obtain a third image.
[0031] In another possible design of the third aspect, when the computer instruction is executed by the processor, the electronic device further executes the following steps: performing tone mapping on the first image using a gamma curve to obtain a tone mapped first image.
[0032] In another possible design of the third aspect, when the computer instruction is executed by the processor, the electronic device further performs the following steps: before using the gamma curve to perform tone mapping on the first image to obtain the tone mapped first image, normalizing the brightness value of each pixel in the first image to obtain a normalized first image; and using the gamma curve to perform tone mapping on the normalized first image to obtain a tone mapped second image.
[0033] In another possible design of the third aspect, when the computer instruction is executed by the processor, the electronic device further performs the following steps: before determining that the first photographed object corresponds to the first scene and the second photographed object corresponds to the second scene, proportionally down-sample the first image using a first preset ratio to obtain a down-sampled first image.
[0034] Among them, the electronic device recognizes the downsampled first image, determines that the first photographed object corresponds to the first scene and the second photographed object corresponds to the second scene; the electronic device processes the downsampled first image to obtain a first Mask image of the first photographed object and a second Mask image of the second photographed object.
[0035] In another possible design manner of the third aspect, when the computer instruction is executed by the processor, the electronic device further performs the following steps: before synthesizing the second image and the third image based on the first Mask image and the second Mask image to obtain the fourth image, the first Mask image and the second Mask image are respectively up-sampled in equal proportion using a second preset ratio to obtain the up-sampled first Mask image and second Mask image.
[0036] The electronic device performs image synthesis on the second image and the third image according to the upsampled first Mask image and the upsampled second Mask image to obtain a fourth image.
[0037] In another possible design manner of the third aspect, when the computer instruction is executed by the processor, the electronic device further performs the following steps: determining a first mask area from the second image based on the first mask image, and determining a second mask area from the third image based on the second mask image; and merging the image of the first mask area and the image of the second mask area to obtain a fourth image.
[0038] In another possible design of the third aspect, when the computer instruction is executed by the processor, the electronic device further performs the following steps: performing feathering processing on the edge area of the image of the first Mask area and the edge area of the image of the second Mask area to obtain the image of the first Mask area after feathering and the image of the second Mask area after feathering; merging the image of the first Mask area after feathering and the image of the second Mask area after feathering to obtain a fourth image.
[0039] In a fourth aspect, the present application provides a computer-readable storage medium, which includes 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.
[0040] In a fifth aspect, the present application provides a computer program product, which, when executed on a computer, enables the computer to execute the method described in the first aspect and any possible design manner. The computer may be the electronic device described above.
[0041] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect, the third aspect and any possible design method thereof, the computer storage medium described in the fourth aspect, and the computer program product described in the fifth aspect can be referred to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 Schematic diagram of the display effects or styles corresponding to various LUTs;
[0043] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0044] Figure 3 A flow chart of an image processing method provided in an embodiment of the present application;
[0045] Figure 4 A schematic diagram of a display interface of a mobile phone provided in an embodiment of the present application;
[0046] Figure 5 A schematic diagram of a display interface of another mobile phone provided in an embodiment of the present application;
[0047] Figure 6 A schematic diagram of a display interface of another mobile phone provided in an embodiment of the present application;
[0048] Figure 7 A schematic diagram of a display interface of another mobile phone provided in an embodiment of the present application;
[0049] Figure 8 A schematic diagram of a display interface of another mobile phone provided in an embodiment of the present application;
[0050] Fig. 9 A schematic diagram of a display interface of another mobile phone provided in an embodiment of the present application;
[0051] Fig.10 A schematic diagram of a display interface of another mobile phone provided in an embodiment of the present application;
[0052] Fig.11 A schematic diagram of the principle of an image processing method provided in an embodiment of the present application;
[0053] Fig.12 A schematic diagram of the principle of an image processing method provided in an embodiment of the present application;
[0054] Fig.13 A flow chart of an image processing method provided in an embodiment of the present application;
[0055] Fig.14 A schematic diagram of the effect of a Mask image obtained by image segmentation (such as portrait segmentation) of a target object provided in an embodiment of the present application;
[0056] Fig.15 A schematic diagram of the principle of image synthesis provided in an embodiment of the present application;
[0057] Fig.16 A schematic diagram of another principle of image synthesis provided in an embodiment of the present application;
[0058] Fig.17 A schematic diagram of another image processing method provided in an embodiment of the present application;
[0059] Fig.18 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. 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, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0061] For ease of understanding, the following terms are introduced in this application:
[0062] (1) Red, Green, and Blue (RGB): The three primary colors RGB include red, green, and blue. By mixing these three colors of light in different proportions, we can get rich colors.
[0063] The image captured by the camera is composed of pixels, and each pixel is composed of red sub-pixels, green sub-pixels, and blue sub-pixels. Assume that the value range of R, G, and B is 0-255, such as RGB (255, 0, 0) represents pure red, Green (0, 255, 0) represents pure green, and Blue (0, 0, 255) represents pure blue. In short, by mixing these three colors in different proportions, you can get rich colors.
[0064] (2) Color Lookup Table (LUT): Also called LUT file or LUT parameter, it is a red, green, and blue (RGB) mapping table.
[0065] An image consists of many pixels, each represented by an RGB value. The display screen of an electronic device can display the image based on the RGB value of each pixel in the image. In other words, these RGB values tell the display screen how to emit light to mix a variety of colors for the user. If you want to change the color (or style, effect) of the image, you can adjust these RGB values.
[0066] LUT is a RGB mapping table that represents the correspondence between RGB values before and after adjustment. For example, please refer to Figure 1 , which shows an example of a LUT.
[0067] Table 1
[0068]
[0069] When the original RGB value is (14, 22, 24), after the mapping of the LUT shown in Table 1, the output RGB value is (6, 9, 4,). When the original RGB value is (61, 34, 67), after the mapping of the LUT shown in Table 1, the output RGB value is (66, 17, 47). When the original RGB value is (94, 14, 171), after the mapping of the LUT shown in Table 1, the output RGB value is (117, 82, 187). When the original RGB value is (241, 216, 222), after the mapping of the LUT shown in Table 1, the output RGB value is (255, 247, 243).
[0070] It should be noted that for the same image, the display effect of the image not processed by LUT is different from that of the image processed by LUT; using different LUTs to process the same image can obtain display effects of different styles. The "display effect" of the image described in the embodiments of the present application refers to the image effect that can be observed by the human eye after the image is displayed on the display screen. For example, Figure 1 LUT 1, LUT 2 and LUT 3 are different color lookup tables. By using LUT 1 to process the original image 100 captured by the camera, we can get Figure 1 The image 101 shown in FIG. 1 is processed by LUT 2 to obtain Figure 1 The image 102 shown. By using LUT 3 to process the original image 100, we can get Figure 1 The image shown is 103. Contrast Figure 1 It can be seen from the images 101 , 102 and 103 that the display effects of the images 101 , 102 and 103 are different.
[0071] In conventional technology, a mobile phone can only use one LUT to process an image. That is, no matter what objects are included in the image to be processed, the mobile phone only uses one LUT to process the image.
[0072] For example, suppose a target image includes images of multiple objects such as people, plants, animals, and buildings. The mobile phone may identify the shooting scene (such as a portrait scene) corresponding to the target image based on factors such as the proportion of the images of these objects in the target image. Then, the mobile phone can use the LUT corresponding to the portrait scene to process the target image. Alternatively, the mobile phone can use the LUT corresponding to the shooting scene (such as a portrait scene) selected by the user to process the target image.
[0073] However, when a mobile phone processes a target image of the above complex scene (i.e., a target image including multiple objects), only the LUT corresponding to the shooting scene of one object (such as a person) is used to process the target image, which may affect the display effect of other objects (such as green plants, animals, and buildings) in the target image. In this way, the shooting style / effect of photos or videos is single, which cannot meet the diverse shooting needs of current users.
[0074] Based on this, an embodiment of the present application provides an image processing method, which can be applied to an electronic device including a camera. The electronic device can identify a first image including multiple target objects (such as a first shooting object and a second shooting object), and obtain the LUT (such as a first LUT and a second LUT) of the shooting scene corresponding to the multiple target objects, and each LUT can correspond to a display effect under a shooting scene. Then, the electronic device can segment the above-mentioned target object (such as a portrait) on the first image to obtain multiple Mask images. In addition, the electronic device can respectively use the LUT corresponding to each shooting scene to process the first image to obtain multiple processed images (such as using the first LUT to process the first image to obtain the second image, and using the second LUT to process the first image to obtain the third image). Finally, the electronic device can perform image synthesis on the above-mentioned multiple processed images to obtain and display a fourth image including a portion of the second image and a portion of the third image. Among them, in the fourth image, the display effect of the portion of the second image corresponds to the first LUT, and the display effect of the portion of the third image corresponds to the second LUT.
[0075] In this solution, the electronic device can use a variety of different LUTs to process images of different shooting objects in an image, which can enrich the display effect obtained by taking photos or recording videos.
[0076] Exemplarily, the electronic device in the embodiments of the present application can be a portable computer (such as a mobile phone), a tablet computer, a laptop computer, a personal computer (PC), a wearable electronic device (such as a smart watch), an augmented reality (AR) device, a virtual reality (VR) device, a car computer, etc. The following embodiments do not impose any special restrictions on the specific form of the electronic device.
[0077] For example, the electronic device is a mobile phone. Figure 2, which shows a schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
[0078] Among them, the above-mentioned sensor module 180 may include a pressure sensor, a gyroscope sensor, an air pressure sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor 180A, a temperature sensor, a touch sensor 180B, an ambient light sensor, a bone conduction sensor, etc.
[0079] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0080] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, a neural-network processing unit (NPU), and / or a micro controller unit (MCU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0081] 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.
[0082] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0083] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, a serial peripheral interface (SPI), an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0084] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0085] The charging management module 140 is used to receive charging input from the charger. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0086] The wireless communication function of the electronic device 100 can be implemented by antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. For example, antenna 1 can be reused as a diversity antenna of a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0087] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The wireless communication module 160 can provide solutions for wireless communications including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared technology (IR), etc., applied to the electronic device 100.
[0088] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0089] The display screen 194 is used to display images, videos, etc. The display screen is a touch screen. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0090] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor. The ISP is used to process the data fed back by the camera 193. The camera 193 is used to capture a static image or a video. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0091] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. NPU can realize applications such as intelligent cognition of electronic device 100, such as: film state recognition, image restoration, image recognition, face recognition, voice recognition, text understanding, etc.
[0092] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[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 may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0094] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0095] The fingerprint sensor 180A is used to collect fingerprint information. The electronic device 100 can use the fingerprint characteristics of the collected fingerprint information to perform user identity verification (i.e. fingerprint recognition) to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc.
[0096] The touch sensor 180B is also called a "touch panel (TP)". The touch sensor 180B can be set on the display screen 194, and the touch sensor 180B and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180B is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180B can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0097] The buttons 190 include a power button, a volume button, etc. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power change, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card.
[0098] The present application embodiment provides a shooting method, which can be applied to an electronic device including a camera. In the following embodiment, the method of the present application embodiment is introduced by taking the electronic device as a mobile phone as an example. Figure 3 As shown, the shooting method may include S301-S305.
[0099] S301: A mobile phone acquires a first image. The first image is an image captured by a camera of the mobile phone, and the first image includes a first photographed object and a second photographed object.
[0100] For example, the method of the embodiment of the present application can be applied to the scene of taking photos or recording videos by mobile phones. Alternatively, the method of the embodiment of the present application can also be applied to the scene of the mobile phone performing image processing on photos or videos in the mobile phone gallery (or album).
[0101] In some embodiments, the method of the embodiments of the present application can be applied to a scenario in which a mobile phone takes photos (referred to as a photo-taking scenario).
[0102] In the photo-taking scenario, the phone can display a Figure 4 The preview interface 401 of the photo taking as shown in (b) of FIG. 4 is shown in FIG. 4. For example, the operation of opening the camera application may be a user's Figure 4The click operation of the application icon of the camera application shown in (a) in the figure. The preview interface 401 for taking photos may include a preview image 402. Among them, the preview image 402 may be the fourth image described in S305 obtained by the mobile phone executing S301-S305 to process the image (i.e., the first image) captured by the camera. The first image may be the original (RAW) image captured by the camera. Specifically, the mobile phone may execute S301-S305 in response to the user's operation of turning on the camera application. That is, the mobile phone may execute S301 to capture the first image in response to the user's operation of turning on the camera application.
[0103] Alternatively, in a photo-taking scenario, the mobile phone may display a Figure 5 The preview interface 501 for taking a photo as shown in (a) of FIG. 5 . The preview image 502 displayed in the preview interface 501 for taking a photo may be a preview image captured by the camera of the mobile phone. The preview image 502 (i.e., the first image) may be a RAW image captured by the camera and has not been processed by the mobile phone. In response to the user clicking the "shoot shutter" 503 in the preview interface 501, the mobile phone may execute the method of the embodiment of the present application to process the preview image (i.e., the first image) captured by the camera to obtain Figure 5 504 shown in (b) of FIG. 504. Specifically, the mobile phone can execute S301-S305 in response to the user's click operation on the "shoot shutter" 503. In other words, the mobile phone can execute S301 to obtain the first image in response to the user's click operation on the "shoot shutter" 503, and then execute S302-S305 to display the fourth image.
[0104] In other embodiments, the method of the embodiments of the present application can be applied to a scenario of mobile phone video recording (referred to as: video recording scenario).
[0105] In the video recording scenario, the mobile phone responds to the user's operation of turning on the video recording mode and can display Figure 6 The video preview interface 601 shown in FIG. 601 may include a preview image 602. For example, the operation of turning on the video mode may be a user's Figure 5 The click operation of the video recording mode option 505 shown in (a) in the figure. Among them, the preview image 602 can be the fourth image described in S305 obtained by the mobile phone executing S301-S305 and processing the image (i.e., the first image) captured by the camera. The first image can be a RAW image captured by the camera. Specifically, the mobile phone can execute S301-S305 in response to the user's operation of turning on the video recording mode. That is, in response to the user's operation of turning on the video recording mode, the mobile phone can execute S301 to capture the first image, and then execute S302-S305 to display the fourth image.
[0106] Alternatively, in a video recording scenario, the phone can display Figure 7 The video viewfinder interface 701 shown in (a) of FIG. The video viewfinder interface 701 includes a preview image 702, which may be a RAW image captured by a camera. The preview image 702 may be used as a first image. Figure 7 By clicking the “video shutter” 703 shown in (a) of FIG. 1 , the mobile phone can execute the method of the embodiment of the present application to process the image captured by the camera (i.e., the first image mentioned above) to obtain Figure 7 Specifically, in response to the user clicking the “recording shutter” 703, the mobile phone may execute S301-S305. In other words, in response to the user clicking the “recording shutter” 703, the mobile phone may execute S301 to capture the first image (such as the preview image 702), and then execute S302-S305 to display the fourth image.
[0107] In other embodiments, the method of the embodiments of the present application can be applied to a scenario in which a mobile phone performs image processing on photos or videos in a mobile phone gallery (or album) (referred to as: post-shooting image processing scenario).
[0108] In the image processing scenario after shooting, the mobile phone can execute S301-S305 in response to the user clicking any photo in the album to obtain and display the fourth image.
[0109] For example, a mobile phone can display Figure 8 The album list interface 801 shown in (a) in the figure includes preview items of multiple photos. Generally speaking, the mobile phone can respond to the user's click operation on the preview item 802 of the "little girl" photo (equivalent to the first image) in the album list interface 801, and can directly display the "little girl" photo (equivalent to the first image) corresponding to the preview item 802. In the embodiment of the present application, the mobile phone can respond to the user's click operation on the preview item 802 of the "little girl" photo (equivalent to the first image) and can execute S301-S305 to obtain and display Figure 8 The fourth image 803 shown in (b) in FIG. Figure 8 The photo details page shown in (b) includes not only the fourth image 803 but also an edit button 804. The edit button 804 is used to trigger the mobile phone to edit the fourth image 803.
[0110] Alternatively, in a post-photographing image processing scenario, the user may trigger the mobile phone to execute S301 - S305 in a photo editing interface to obtain and display the fourth image.
[0111] For example, a mobile phone can display Fig. 9The mobile phone responds to the user's Fig. 9 Clicking the edit button 802 shown in (a) of FIG. Fig. 9 The editing interface 903 shown in (b) of FIG. The editing interface 903 includes an “Intelligent AI” button 905, a “Crop” button, a “Filter” button, and an “Adjust” button. The “Intelligent AI” button 905 is used to trigger the mobile phone to adjust the LUT of the first image. The “Crop” button is used to trigger the mobile phone to crop the first image. The “Filter” button is used to trigger the mobile phone to add a filter effect to the first image. The “Adjust” button is used to trigger the mobile phone to adjust the contrast, saturation, brightness and other parameters of the first image.
[0112] In response to the user clicking the "Smart AI" button 905, the mobile phone can execute S301-S305 to obtain and display Fig. 9 The fourth image 907 shown in (c) in FIG. Fig. 9 The editing interface shown in (c) of FIG. 1 includes not only the fourth image 907 but also a save button 906. The save button 906 is used to trigger the mobile phone to save the fourth image 907. In response to the user clicking the save button 906, the mobile phone can save the fourth image 907 and display the Fig.10 The photo details page of the fourth image 907 is shown.
[0113] It should be noted that the method of image processing of a video in a mobile phone gallery (or album) is similar to the method of image processing of a photo in a mobile phone gallery, and the present application embodiment will not be described in detail here. The difference is that the mobile phone needs to process each frame of the video.
[0114] In the embodiment of the present application, the first shooting object and the second shooting object may represent two different shooting objects. For example, the first shooting object and the second shooting object may be any two of multiple shooting objects such as portraits, landscapes, food, buildings, and pets.
[0115] It should be noted that the first photographed object and the second photographed object may be target objects pre-configured or set in the mobile phone. In this embodiment, the first image may include one or more first photographed objects and one or more second photographed objects. Of course, the photographed objects included in the first image are not limited to two categories. The embodiment of the present application only takes the first image including the first photographed object and the second photographed object as an example to illustrate the method of the embodiment of the present application.
[0116] S302: The mobile phone determines a first scene corresponding to a first photographed object and a second scene corresponding to a second photographed object. The first scene is used to identify the photographing scene corresponding to the first photographed object, and the second scene is used to identify the photographing scene corresponding to the second photographed object.
[0117] In the embodiment of the present application, a plurality of shooting scenes may be pre-configured in the mobile phone, such as a portrait scene, a travel scene, a food scene, a landscape scene, a building scene or a pet scene, etc. The first scene and the second scene may be any two of the plurality of shooting scenes.
[0118] Among them, the mobile phone can recognize the first image and determine the first scene corresponding to the first photographed object in the first image and the second scene corresponding to the second photographed object. For example, the mobile phone can use a pre-configured image shooting scene detection algorithm to recognize the first image to determine the first scene and the second scene. It should be noted that the method for the mobile phone to recognize the first image and determine the first scene and the second scene can refer to the relevant methods in the conventional technology, and the embodiments of the present application will not be repeated here.
[0119] S303: The mobile phone determines a first LUT according to the first scenario, and determines a second LUT according to the second scenario.
[0120] Among them, multiple LUTs (which can be called multiple preset LUTs) can be pre-configured in the mobile phone, and the multiple preset LUTs are used to process the images collected by the camera to obtain images with different display effects. The multiple preset LUTs correspond one-to-one to the above-mentioned multiple shooting scenes, and each preset LUT corresponds to the display effect under a shooting scene.
[0121] For example, Figure 1 As shown, image 101 is obtained by processing original image 100 using LUT 1 (i.e., preset LUT 1), image 102 is obtained by processing original image 100 using LUT 2 (i.e., preset LUT 2), and image 103 is obtained by processing original image 100 using LUT 3 (i.e., preset LUT 3). Comparison of image 101, image 102, and image 103 shows different display effects. In other words, preset LUT 1, preset LUT 2, and preset LUT 3 can correspond to different display effects or styles.
[0122] In the embodiment of the present application, different display effects may be display effects in different shooting scenes. For example, the shooting scene may be: a portrait scene, a travel scene, a food scene, a landscape scene, a building scene, a pet scene, or other scenes. It should be noted that the shooting scenes described in the embodiment of the present application correspond to the display effects or styles one by one. In different shooting scenes, the corresponding LUT may be used to process the preview image to obtain the corresponding display effect or style.
[0123] The mobile phone may determine the preset LUT corresponding to the first scene as the first LUT, and determine the preset LUT corresponding to the second scene as the second LUT.
[0124] Exemplarily, it is assumed that the above-mentioned multiple preset LUTs can correspond to the display effects in the following shooting scenes, such as portrait scenes, travel scenes, food scenes, landscape scenes, architectural scenes and pet scenes. The mobile phone can identify whether the first image includes the preset shooting objects in the above-mentioned shooting scenes to identify the corresponding shooting scenes. For example, it is assumed that the first image includes the following preset shooting objects, such as people (ie, the first shooting object) and scenery (ie, the second shooting object). Then, when the mobile phone recognizes the first image, it can determine the portrait scene (ie, the first scene) and the landscape scene (ie, the second scene), and obtain 2 LUTs, including the preset LUT for the portrait scene (ie, the first LUT) and the preset LUT for the landscape scene (ie, the second LUT).
[0125] In one implementation, a preset AI model may be pre-stored in the mobile phone. The preset AI model has the ability to recognize an image and determine one or more shooting scenes corresponding to the image.
[0126] In an embodiment of the present application, the preset AI model can be trained in the following manner. First, a plurality of preset images are obtained, and the image features of each of the plurality of preset images are extracted respectively, and the image features of each preset image are classified. Among them, the image features of the preset images can be classified according to the image features of the images captured in each of the plurality of shooting scenes. Then, the classification label of each preset image can be obtained. Finally, each preset image can be used as an input sample, and the classification label of the preset image can be used as an output sample to train the preset AI model, so that the preset AI model has the ability to specifically identify the classification label of the image.
[0127] In this implementation, the mobile phone can use the above-mentioned first image as input, run the preset AI model, and obtain the classification label of the first image. Then, the mobile phone can identify the n shooting scenes (including the first scene and the second scene) of the first image based on the classification label of the first image. Finally, the mobile phone can determine the n LUTs (including the first LUT and the second LUT) corresponding to the n shooting scenes from multiple preset LUTs.
[0128] In another implementation, each preset image can be used as an input sample, and the identification of the shooting scene corresponding to the classification label of the preset image can be used as an output sample to train the above-mentioned preset AI model so that the preset AI model has the ability to specifically identify the shooting scene of the image.
[0129] In this implementation, the mobile phone can use the first image as input, run the preset AI model, and obtain the identification of multiple shooting scenes (such as the first scene and the second scene) of the first image. Then, the mobile phone can determine multiple LUTs (including the first LUT and the second LUT) corresponding to the multiple shooting scenes from multiple preset LUTs.
[0130] In another implementation method, each preset image can be used as an input sample, and the identifier of the shooting scene corresponding to the classification label of the preset image and the probability that the preset image belongs to each shooting scene can be used as output samples to train the above-mentioned preset AI model so that the preset AI model has the ability to specifically identify the shooting scene of the image and the probability that the image belongs to different shooting scenes.
[0131] For this implementation, the mobile phone can use the above-mentioned first image as input, run the preset AI model, and obtain the identification of multiple shooting scenes of the first image and the probability that the first image belongs to each shooting scene. Then, the mobile phone can select n shooting scenes (such as the first scene and the second scene) whose probabilities are arranged in the top n positions in descending order from the multiple shooting scenes. Finally, the mobile phone can determine the n LUTs (including the first LUT and the second LUT) corresponding to the n shooting scenes from multiple preset LUTs.
[0132] For example, it is assumed that the shooting scenes pre-configured in the mobile phone include portrait scenes, and the mobile phone is pre-configured with multiple preset LUTs such as preset LUT 1, preset LUT 2 (such as background LUT) and preset LUT 3 (such as portrait LUT). Fig.11 , introducing the method for a mobile phone to execute S301-S303.
[0133] Among them, the mobile phone can execute S301 to collect Fig.11 The first image 1101 shown in FIG. 1 includes a first photographed object (such as a person) and a second photographed object (such as a landscape). Afterwards, the mobile phone may execute S302 to perform a Fig.11 The scene recognition 1102 shown in the figure determines that the shooting scene corresponding to the first image 1101 includes a portrait scene (i.e., a first scene) and a landscape scene (i.e., a second scene). Then, as Fig.11 As shown, the mobile phone can select preset LUT 3 for portrait scenes (such as portrait LUT, i.e., the first LUT) and preset LUT 2 for landscape scenes (such as landscape LUT, i.e., the second LUT) from multiple preset LUTs, such as preset LUT 1, preset LUT 2 (such as background LUT) and preset LUT 3 (such as portrait LUT).
[0134] S304: The mobile phone processes the first image according to the first LUT to obtain a second image, and processes the first image according to the second LUT to obtain a third image. The display effect of the second image corresponds to the first LUT, and the display effect of the third image corresponds to the second LUT.
[0135] The present application embodiment is combined here Fig.11 , introduces the method for the mobile phone to execute S304. Fig.11 The portrait LUT shown above processes the first image and gives Fig.11 The portrait LUT image (i.e., the second image) shown in FIG. Fig.11 The second image is processed with the landscape LUT shown, and we get Fig.11 The landscape LUT image (ie, the third image) shown in the figure. The method for the mobile phone to process the image using the LUT to obtain the processed image can refer to the relevant methods in the conventional technology, and the embodiment of the present application will not be described in detail here.
[0136] S305: The mobile phone displays a fourth image, wherein the fourth image includes a portion of the second image and a portion of the third image, wherein the portion of the second image includes an image of the first photographed object, and a display effect of the portion of the second image corresponds to the first LUT, and the portion of the third image includes an image of the second photographed object, and a display effect of the portion of the third image corresponds to the second LUT.
[0137] like Fig.11 As shown, the mobile phone can perform image synthesis 1105 on the portrait LUT image (i.e., the second image) and the landscape LUT image (i.e., the third image) to obtain a fourth image 1106. Among them, by comparing the first image 1101 and the fourth image 1106, it can be seen that the display effect of the portrait in the fourth image 1106 is better than the display effect of the portrait in the first image 1101, and the display effect of the background image other than the portrait in the fourth image 1106 is better than the display effect of the background image other than the portrait in the first image 1101.
[0138] It should be noted that the portrait and the background image excluding the portrait in the fourth image 1106 are obtained by processing the first image 1101 according to different LUTs. The portrait in the fourth image 1106 is obtained by processing the first image 1101 according to the LUT corresponding to the character scene, and the display effect of the portrait can be highlighted based on the display effect of the character scene. The background image excluding the portrait in the fourth image 1106 is obtained by processing the first image 1101 according to the LUT corresponding to the landscape scene, and the display effect of the background image can be highlighted based on the display effect of the landscape scene.
[0139] An embodiment of the present application provides an image processing method, and a mobile phone can use multiple different LUTs to process images of different shooting objects in an image, which can enrich the display effect obtained by taking photos or recording videos.
[0140] In some embodiments, in order to improve the image effect of the fourth image finally displayed by the mobile phone, make the fourth image more comfortable to human eyes, and better express the information and features of the original image; before the mobile phone executes S304, the first image may be tone mapped. Then, the mobile phone may execute S304, process the tone mapped first image according to the first LUT to obtain the second image, and process the tone mapped first image according to the second LUT to obtain the third image.
[0141] For example, the embodiments of the present application are combined with Fig.11 ,pass Fig.12 The method of this embodiment is introduced. Fig.12 As shown, the mobile phone can perform tone mapping (such as gamma correction) 1104 on the first image to obtain the tone mapped first image. Tone mapping refers to adjusting the grayscale of the image so that the processed image looks more comfortable to the human eye and can better express the information and features in the original image.
[0142] Exemplarily, the tone mapping described in the embodiments of the present application may include gamma correction. Gamma correction refers to image correction (i.e., tone mapping) using a gamma curve. In other words, the mobile phone may use a gamma curve to perform tone mapping on the first image to obtain a tone mapped first image.
[0143] The gamma curve (i.e., the Gamma curve) can be pre-configured in the mobile phone. For example, the Gamma curve can be pre-configured in the image signal processor (ISP) of the mobile phone. The ISP can include a Gamma module, and the Gamma module is configured with a Gamma curve for tone mapping of the image.
[0144] It should be understood that the hue change of each pixel in the image captured by the camera (called the original image) is linear, while the hue change that the human eye can accept is nonlinear. Through the above tone mapping (such as Gamma correction), the image can be converted from linear to nonlinear, and the converted image is more in line with the input characteristics of the human eye.
[0145] The gamma curve can be used to perform tone mapping on the normalized image. Therefore, before S304, the method of the embodiment of the present application also includes: the mobile phone normalizes the brightness value of each pixel in the first image to obtain a normalized first image. The mobile phone can use the gamma curve to perform tone mapping on the normalized first image to obtain the tone mapped first image.
[0146] The fourth image in the above S305 may be obtained by synthesizing the second image and the third image. Optionally, in some embodiments, the mobile phone may synthesize the second image and the third image according to the mask image of the first photographed object (i.e., the first mask image) and the mask image of the second photographed object (i.e., the second mask image) to obtain the fourth image. The detailed introduction of the first mask image and the second mask image can be referred to the content of the following embodiments, which will not be repeated here. Specifically, Fig.13 As shown, before S305, the method of the embodiment of the present application may further include S1301-S1302.
[0147] S1301: The mobile phone processes a first image to obtain a first mask image of a first photographed object and a second mask image of a second photographed object.
[0148] The mobile phone may segment the image of the first photographed object from the first image, process the image of the first photographed object, and obtain a first mask image. The first mask image may represent the pixel points corresponding to the first photographed object in the first image.
[0149] The mobile phone can segment the image of the second photographed object from the first image, process the image of the second photographed object, and obtain a second mask image. The second mask image can represent the pixel points corresponding to the second photographed object in the first image.
[0150] Exemplarily, the first Mask image described above is taken as an example in the embodiment of the present application to introduce the Mask image described in the embodiment of the present application. For example, assuming that the first photographed object is a portrait, the first Mask image can be a Mask image of the portrait. Fig.14 As shown, the mobile phone can perform portrait segmentation on the first image 1401 to obtain a Mask image 1402 of the portrait.
[0151] Exemplarily, in the first Mask image described in the embodiment of the present application, the pixel value of a pixel in the image of the first photographed object may be a first value, and the pixel value of a pixel in an image other than the image of the first photographed object in the first Mask image may be a second value. The first value is different from the second value and is used to distinguish the image of the first photographed object from other images in the second image. For example, the first value may be 1 and the second value may be 0.
[0152] For example, Fig.14 In the figure, the portrait is the portion filled with black in the Mask image 1402, and its pixel value may be 1. Fig.14 In the figure, the other images outside the portrait are the white filled parts in the Mask image 1402, and the pixel value thereof may be 0.
[0153] S1302: The electronic device synthesizes the second image and the third image according to the first Mask image and the second Mask image to obtain a fourth image.
[0154] Among them, part of the second image in S305 is the image corresponding to the first Mask image in the second image; part of the third image is the image corresponding to the second Mask image in the third image.
[0155] For example, the first photographed object is a portrait, and the second photographed object is a landscape. Fig.15 introduce Fig.11 or Fig.12 The principle of image synthesis 1105. Fig.15 As shown, the phone can execute Fig.11 or Fig.12 The target object segmentation 1103 shown in the figure segments a mask image of the target object from the first image 1101. For example, the mobile phone can segment a first mask image of a first photographed object (such as a portrait) and a second mask image of a second photographed object (such as a landscape). Fig.15 The first Mask image (i.e., portrait Mask) 1503 shown in FIG. 1 can obtain a portrait image 1505 from the portrait LUT image (i.e., second image) 1502. Fig.15 As shown, the mobile phone can obtain a landscape image 1504 from a landscape LUT image (i.e., a third image) 1501 according to a second Mask image (i.e., a landscape Mask) 1506. Fig.15 The portrait image 1505 shown includes the portrait but does not include the background image; Fig.15 The background image 1504 shown includes a landscape image but does not include a portrait. Fig.15 As shown, the mobile phone can synthesize the background image 1504 and the portrait image 1505 to obtain the fourth image 1106.
[0156] Exemplarily, S1302 may include S1302a-S1302b.
[0157] S1302a: The mobile phone determines a first mask area from the second image according to the first mask image, and determines a second mask area from the third image according to the second mask image.
[0158] For example, Fig.15As shown, the mobile phone can determine a first Mask area 1507 from a portrait LUT image 1502 (i.e., the second image) according to a first Mask image (e.g., a portrait MASK) 1503. The first Mask area 1507 is the area indicated by the first Mask image 1503 in the portrait LUT image 1502 (i.e., the second image).
[0159] like Fig.15 As shown, the mobile phone can determine a second Mask area 1508 from the landscape LUT image 1501 (ie, the third image) according to the second Mask image (eg, landscape MASK) 1506. The second Mask area 1508 is the area indicated by the second Mask image 1506 in the landscape LUT image 1501 (ie, the third image).
[0160] It should be noted that Fig.15 The third image 1501 shown is Fig.15 The second image 1502 shown is obtained by processing the same image (i.e., the first image) using a different LUT. Fig.15 It can be seen that the image effect of the third image 1501 is different from the display effect of the second image 1502. The "display effect" of the image described in the embodiment of the present application refers to the image effect that can be observed by human eyes after the image is displayed on the display screen.
[0161] S1302b: The electronic device combines the image of the first Mask area and the image of the second Mask area to obtain a fourth image.
[0162] For example, the mobile phone may merge the image 1505 of the first mask area 1507 with the image 1504 of the second mask area 1508 to obtain the fourth image 1106 .
[0163] In some embodiments, in order to improve the display effect of the fourth image, the mobile phone can perform feathering on the image of the mask area. Image feathering refers to the gradual blurring or blurring of the image edge in a gradual manner. In this way, the image changes of the edge areas of each mask area in the fourth image can be made smoother and more natural.
[0164] Specifically, the mobile phone can perform feathering on the edge area of the image of the first Mask area to obtain the feathered image of the first Mask area; the mobile phone can perform feathering on the edge area of the image of the second Mask area to obtain the feathered image of the second Mask area. Then, the mobile phone can merge the feathered image of the first Mask area and the feathered image of the second Mask area to obtain a fourth image.
[0165] It can be seen from the above embodiments that in the first Mask image, the pixel values of the pixels in the image of the first Mask area are the first value, while the pixel values of the pixels in the images of other areas are the second value. In the second Mask image, the pixel values of the pixels in the image of the second Mask area are the first value, while the pixel values of the pixels in the images of other areas are the second value. For example, the first value may be 1, and the second value may be 0.
[0166] For example, in the first Mask image, the pixel value of the pixel in the image of the first Mask area is 1, while the pixel value of the pixel in the image of other areas is 0. Feathering is performed on the edge area of the image of the first Mask area in the first Mask image, so that the pixel value of the pixel in the edge area is between 0 and 1, which is a floating point decimal.
[0167] It is understandable that feathering the image of the edge area of the first Mask area and the second Mask area can make the image change of the edge area of the first Mask area and the second Mask area (that is, the adjacent area of the first Mask area and the second Mask area) smoother and more natural. In this way, the display effect of the fourth image can be improved.
[0168] Among them, the mobile phone recognizes the first image to determine the first scene and the second scene, and the mobile phone processes the first image to obtain the first Mask image and the second Mask image. This may cause the mobile phone to have a large amount of calculation due to the high pixel of the first image, thereby increasing the power consumption of the mobile phone.
[0169] Based on this, in some embodiments, the mobile phone may further downsample the first image before executing S302 and S1301. Specifically, after S301 and before S302 and S1301, the method of the embodiment of the present application may further include: the mobile phone downsamples the first image in equal proportion using a first preset ratio to obtain a downsampled first image.
[0170] Wherein, downsampling may also be referred to as down sampling. Downsampling the first image may reduce the size of the first image. For example, the number of pixels of the first image before downsampling may be 4000*3000, and the number of pixels of the first image after downsampling may be 2000*1500.
[0171] Specifically, there are two main purposes of downsampling: (1) making the image fit the size of the display area; and (2) generating a thumbnail of the corresponding image. In the embodiment of the present application, the purpose of downsampling the first image is to generate a thumbnail of the first image. In this way, the amount of calculation required by the mobile phone to execute S302 and S1301 can be reduced.
[0172] It should be understood that the “down sampling” described in the embodiments of the present application is proportional down sampling. In this way, it is possible to avoid the situation where the first image after down sampling is deformed compared with the first image before down sampling.
[0173] Exemplarily, the first preset ratio may be a ratio pre-configured in the mobile phone such as 4:1, 2:1 or 3:1. Taking the first preset ratio of 4:1 as an example, assuming that the number of pixels of the first image before downsampling is 4000*3000, the number of pixels of the first image after downsampling is 2000*1500. Taking the first preset ratio of 9:1 as an example, assuming that the number of pixels of the first image before downsampling is 9000*3000, the number of pixels of the first image after downsampling is 3000*1000.
[0174] In the embodiment of the present application, the mobile phone can perform multiple equal-proportional downsampling on the first image to obtain the effect of downsampling the first image. For example, assuming that the first preset ratio is 16:1, the number of pixels of the first image before downsampling is 6000*2000. The mobile phone can first use 4:1 to downsample the first image with a resolution of 6000*2000 to obtain a first image with a resolution of 3000*1000; then, the mobile phone can use 4:1 to downsample the first image with a resolution of 3000*1000 to obtain a first image with a resolution of 1500*500.
[0175] It should be noted that, although downsampling the first image will affect the image quality of the first image. However, in the embodiment of the present application, the sampled first image is used to identify the mask image of the shooting scene and the target object. The quality of the image will not have a great impact on the recognition result, but can greatly reduce the amount of calculation of the mobile phone and reduce the power consumption of the mobile phone.
[0176] In the embodiment of the present application, the specific method for the mobile phone to down-sample the first image can refer to the relevant method in the conventional technology, and the example of the present application will not be repeated here.
[0177] Accordingly, the above S302 can be replaced by: the mobile phone determines that the first photographed object in the downsampled first image corresponds to the first scene and the second photographed object corresponds to the second scene. S1301 can be replaced by: the mobile phone processes the downsampled first image to obtain a first mask image of the first photographed object and a second mask image of the second photographed object.
[0178] It can be understood that the first Mask image and the second Mask image (referred to as: the Mask image after downsampling) obtained by the mobile phone processing the first image after downsampling are thumbnails of the Mask image obtained by the mobile phone executing S1301 to process the first image before downsampling (referred to as: the m Mask images before downsampling). The mobile phone executes S304 to process the first image before downsampling to obtain the second image and the third image; therefore, the size of the second image and the third image obtained by the mobile phone executing S304 does not match the size of the Mask image after downsampling. The size of the second image and the third image is larger than the size of the Mask image after downsampling. In this way, it is difficult for the mobile phone to perform image synthesis on the second image and the third image based on the first Mask image and the second Mask image when executing S1302.
[0179] Based on this, in an embodiment of the present application, before the mobile phone executes S1302 "synthesize the second image and the third image according to the first Mask image and the second Mask image to obtain the fourth image", the first Mask image and the second Mask image may also be upsampled. Exemplarily, before S1302, the method of the embodiment of the present application may also include: the mobile phone uses the second preset ratio to upsample the first Mask image in equal proportions to obtain the upsampled first Mask image; the mobile phone uses the second preset ratio to upsample the second Mask image in equal proportions to obtain the upsampled second Mask image. Then, the mobile phone may synthesize the second image and the third image according to the upsampled first Mask image and the upsampled second Mask image to obtain the fourth image.
[0180] Among them, upsampling can also be called image interpolation. Upsampling the mask image can enlarge the mask image. For example, the number of pixels of the mask image before upsampling can be 2000*1500, and the number of pixels of the mask image after upsampling can be 4000*3000.
[0181] It should be understood that the "up sampling" described in the embodiments of the present application is proportional up sampling. In this way, it is possible to avoid the situation where the mask image after up sampling is deformed compared with the mask image before up sampling.
[0182] In order to ensure that the size of the upsampled Mask image is the same as the sizes of the second image and the third image, the second preset ratio and the first preset ratio may be reciprocals of each other.
[0183] For example, in the following examples Fig.12 Based on this, the present application embodiment is combined here Fig.16, the method of this embodiment is introduced.
[0184] Among them, the mobile phone can execute S301 to obtain Fig.16 The first image 1601 shown. Afterwards, the mobile phone can perform Fig.16 The downsampling 1602 shown yields Fig.16 The downsampled first image 1603 is shown. Then, the mobile phone can perform Fig.16 The scene recognition 1102 shown in FIG. 1 identifies that the shooting scenes corresponding to the downsampled first image 1603 include a portrait scene (ie, a first scene) and a landscape scene (ie, a second scene). Fig.16 As shown, the mobile phone can select preset LUT 3 for portrait scenes (such as portrait LUT, i.e., the first LUT) and preset LUT 2 for landscape scenes (such as background LUT, i.e., the second LUT) from multiple preset LUTs such as preset LUT 1, preset LUT 2 (such as landscape LUT) and preset LUT 3 (such as portrait LUT).
[0185] Mobile phone can Fig.16 As shown, tone mapping (such as gamma correction) 1104 is performed on the first image 1601 to obtain the first image after tone mapping. Fig.16 The portrait LUT shown above processes the first image after tone mapping to obtain Fig.16 The portrait LUT image (i.e., the second image) shown in the figure can be used by the mobile phone. Fig.16 The first image after tone mapping is processed by the landscape LUT shown, resulting in Fig.16 The landscape LUT image (ie the third image) is shown.
[0186] The phone can also perform Fig.16 The target object segmentation 1103 shown is to segment the mask image of the target object from the downsampled first image 1603. For example, the mobile phone can segment a first mask image of a first photographed object (such as a portrait) and a second mask image of a second photographed object (such as a landscape).
[0187] like Fig.16 As shown, the mobile phone can upsample the segmented Mask image 1604 to obtain the upsampled Mask image. Finally, the mobile phone can perform image synthesis 1105 on the third image and the second image according to the upsampled MASK to obtain the fourth image 1106. Among them, by comparing the first image 1101 and the fourth image 1106, it can be seen that the display effect of the portrait in the fourth image 1106 is better than the display effect of the portrait in the first image 1101.
[0188] It should be noted that the photographed objects included in the first image are not limited to two categories. The embodiment of the present application only takes the first image including the first photographed object and the second photographed object as an example to illustrate the method of the embodiment of the present application. In the following embodiments, the method of the embodiment of the present application is introduced by taking the first image including the photographed object as an example.
[0189] For example, it is assumed that the shooting scenes pre-configured in the mobile phone include portrait scenes, sky scenes, and building scenes. Fig.16 The preset LUT 1 (such as portrait LUT), preset LUT 2 (such as building LUT), preset LUT 3 (such as sky LUT), preset LUT 4 and preset LUT 3 are shown. Fig.17 , introduces the method of the embodiment of the present application.
[0190] Among them, mobile phones can obtain Fig.17 The first image 1701 shown. Afterwards, the mobile phone can perform Fig.17 The downsampling 1702 shown yields Fig.17 The downsampled first image 1703 is shown. Then, the mobile phone can perform Fig.17 The scene recognition 1704 shown in the figure recognizes that the shooting scenes corresponding to the downsampled first image 1703 include: a portrait scene, a sky scene, and a building scene. Fig.17 As shown, the mobile phone can select preset LUT 1 (such as portrait LUT) 1705, preset LUT 3 (such as sky LUT) 1706 and preset LUT 2 (such as building LUT) 1707 for portrait scenes from multiple preset LUTs such as preset LUT 1, preset LUT 2, preset LUT 3, preset LUT 4 and preset LUT 3.
[0191] It is understandable that scene recognition may be performed on the first image 1701 without downsampling and upsampling; the same is applicable to other embodiments.
[0192] Mobile phone can Fig.17 As shown, the first image 1701 is subjected to tone mapping (such as gamma correction) 1710 to obtain the first image after tone mapping. Then, the mobile phone can use Fig.17 The image after the portrait LUT 1705 processes the tone mapping can be obtained. Fig.17 The portrait LUT image shown. The phone can use Fig.17 After the sky LUT 1706 is processed with tone mapping, the sky LUT 1706 shown in FIG. Fig.17 The mobile phone can execute S305 using Fig.17The architectural LUT 1707 shown below, after tone mapping, can be obtained Fig.17 Architectural LUT image shown.
[0193] The phone can also perform Fig.17 The target object segmentation 1709 shown is to segment the mask image of the target object from the downsampled first image 1703. For example, the mobile phone can segment the mask image 1 (such as a portrait mask image), the mask image 2 (such as a building mask image) and the mask image 3 (such as a sky mask image).
[0194] like Fig.17 As shown, the mobile phone can upsample the MASK image 1 (such as the portrait MASK) to obtain the upsampled MASK image 1; upsample the MASK image 3 (such as the sky MASK) to obtain the upsampled MASK image 3; upsample the MASK image 2 (such as the sky MASK) to obtain the upsampled MASK image 2. Finally, the mobile phone can perform image synthesis 1711 on the portrait LUT image, the sky LUT image and the building LUT image according to the MASK image 1, the MASK image 3 and the MASK image 2, and then obtain the fourth image 1708. Among them, by comparing the first image 1701 and the fourth image 1708, it can be seen that the display effect of the portrait in the fourth image 1708 is better than the display effect of the portrait in the first image 1701.
[0195] It can be understood that, optionally, for the first image including a first photographed object (such as a portrait), a second photographed object (such as a building) and a background object (such as the sky, including all objects other than the first photographed object and the second photographed object), the mobile phone can obtain a portrait mask and a building mask without having to obtain a sky mask; during synthesis, it can be synthesized based on the portrait LUT image and the portrait mask, the building LUT image and the building mask, and the sky LUT image.
[0196] It can be understood that the synthesis in the embodiment of the present application can be fusion, and the fusion algorithm in the prior art is used to achieve image fusion, which will not be described in detail here.
[0197] Some other embodiments of the present application provide an electronic device, which may include: a memory, a display screen, one or more cameras, and one or more processors.
[0198] The memory, display screen, and camera are coupled to a processor. The memory stores a computer program code, which includes computer instructions. When the computer instructions are executed by the processor, the electronic device executes the functions or steps executed by the mobile phone in the above method embodiment. The structure of the electronic device can refer to Figure 2 The structure of the electronic device 100 is shown.
[0199] The present application also provides a chip system, such as Fig.18 As shown, the chip system 1800 includes at least one processor 1801 and at least one interface circuit 1802 .
[0200] The processor 1801 and the interface circuit 1802 can be interconnected via lines. For example, the interface circuit 1802 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 1802 can be used to send signals to other devices (such as the processor 1801). Exemplarily, the interface circuit 1802 can read instructions stored in the memory and send the instructions to the processor 1801. When the instructions are executed by the processor 1801, the electronic device can execute the various steps performed by the mobile phone 180 in the above embodiment. Of course, the chip system can also include other discrete devices, which is not specifically limited in the embodiments of the present application.
[0201] An embodiment of the present application also provides a computer 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 executed by the mobile phone in the above-mentioned method embodiment.
[0202] The present application also provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile phone in the above method embodiment. For example, the computer may be the above mobile phone.
[0203] 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.
[0204] In the several embodiments provided in the present 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 only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, 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.
[0205] The units described as separate components may or may not be physically separated, 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 different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0206] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0207] 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, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0208] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. An image processing method, characterized in that: The method comprises: The electronic device displays a first interface, where the first interface is a video framing interface of a camera APP; In response to a first operation of a user on the first interface, the electronic device starts recording and executes the following method: The electronic device acquires a first image, where the first image is a RAW image captured by a camera of the electronic device, and the first image includes a first photographed object and a second photographed object; The electronic device performs proportional downsampling on the first image using a first preset ratio to obtain a downsampled first image; The electronic device identifies the downsampled first image, and determines that the first photographed object corresponds to a first scene and the second photographed object corresponds to a second scene, wherein the first scene is used to identify the photographing scene corresponding to the first photographed object, and the second scene is used to identify the photographing scene corresponding to the second photographed object; The electronic device determines a first LUT according to the first scene, the first LUT corresponds to the first scene, and determines a second LUT according to the second scene, the second LUT corresponds to the second scene, and the second LUT is different from the first LUT; The electronic device processes the first image according to the first LUT to obtain a second image, and the electronic device processes the first image according to the second LUT to obtain a third image; wherein a display effect of the second image corresponds to the first LUT, and a display effect of the third image corresponds to the second LUT; The electronic device obtains a first mask image of the first photographed object and a second mask image of the second photographed object according to the downsampled first image; The electronic device performs image synthesis on the second image and the third image according to the first Mask image and the second Mask image to obtain a fourth image; The electronic device displays the fourth image, where the fourth image includes an image corresponding to the first Mask image in the second image and an image corresponding to the second Mask image in the third image; Among them, the image corresponding to the first Mask image in the second image includes the first photographed object, and the display effect of the image corresponding to the first Mask image in the second image corresponds to the first LUT, and the image corresponding to the second Mask image in the third image includes the second photographed object, and the display effect of the image corresponding to the second Mask image in the third image corresponds to the second LUT.
2. The method according to claim 1, characterized in that The method further comprises: The electronic device performs tone mapping on the first image to obtain a tone mapped first image; The electronic device processes the first image according to the first LUT to obtain a second image, and the electronic device processes the first image according to the second LUT to obtain a third image, including: The electronic device processes the tone-mapped first image according to the first LUT to obtain the second image, and the electronic device processes the tone-mapped first image according to the second LUT to obtain the third image.
3. The method according to claim 2, characterized in that The electronic device performs tone mapping on the first image to obtain a tone mapped first image, including: The electronic device performs tone mapping on the first image using a gamma curve to obtain the tone mapped first image.
4. The method according to claim 3, characterized in that Before the electronic device performs tone mapping on the first image using a gamma curve to obtain the tone mapped first image, the method further includes: The electronic device normalizes the brightness value of each pixel in the first image to obtain a normalized first image; The electronic device uses the gamma curve to perform tone mapping on the normalized first image to obtain the tone mapped second image.
5. The method according to claim 1, characterized in that Before the electronic device performs image synthesis on the second image and the third image according to the first Mask image and the second Mask image to obtain the fourth image, the method further includes: The electronic device uses a second preset ratio to upsample the first mask image and the second mask image in equal proportions to obtain the upsampled first mask image and the second mask image; The electronic device performs image synthesis on the second image and the third image according to the upsampled first Mask image and the upsampled second Mask image to obtain the fourth image.
6. The method according to any one of claims 1 to 5, characterized in that: The electronic device synthesizes the second image and the third image according to the first Mask image and the second Mask image to obtain the fourth image, including: The electronic device determines a first Mask area from the second image according to the first Mask image, and the electronic device determines a second Mask area from the third image according to the second Mask image; The electronic device combines the image of the first Mask area and the image of the second Mask area to obtain the fourth image.
7. The method according to claim 6, characterized in that The electronic device combines the image of the first Mask area and the image of the second Mask area to obtain the fourth image, including: The electronic device performs feathering processing on an edge area of the image of the first Mask area and an edge area of the image of the second Mask area to obtain an image of the first Mask area after feathering and an image of the second Mask area after feathering; The electronic device combines the feathered image of the first Mask area and the feathered image of the second Mask area to obtain the fourth image.
8. An electronic device, characterized in that: The electronic device includes a memory, a display screen, one or more cameras and one or more processors; the memory, the display screen, and the camera are coupled to the processor; wherein the camera is used to capture images, and the display screen is used to display images captured by the camera or images generated by the processor, and the memory stores computer program code, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the electronic device executes the method as described in any one of claims 1 to 7.
9. 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 as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method for processing input high dynamic range image and display device
CN108024104A
Image processing method and device, storage medium and electronic equipment
CN109741280A
Image processing method and system, computer device, storage medium and terminal
CN109754375A
Image processing method and device, electronic equipment and computer readable storage medium
CN110110778A
Image color adjustment method, device, equipment and medium
CN112529808A
