Image processing method, electronic device, storage medium and computer program product
By displaying and merging preview images with different exposures on an electronic device and adjusting the brightness, the problem of unclear imaging of background objects in the moon-viewing shooting mode is solved, generating high-quality images of the moon and clear background objects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2025-01-21
- Publication Date
- 2026-07-21
AI Technical Summary
When electronic devices are in the moon-viewing mode, the moon image is clear, but other background objects cannot be imaged or are not imaged clearly, resulting in poor image quality.
By employing image processing methods, the clarity of background objects is improved and the effects of moon jitter and occlusion are eliminated through the fusion of the first and second preview images and brightness adjustment, thereby generating a high-quality image.
It improves the image clarity of the moon and other background objects within the same viewfinder, and enhances the image display effect in the moon-viewing shooting mode.
Smart Images

Figure CN122437993A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of terminal technology, and in particular to an image processing method, electronic device, storage medium, and computer program product. Background Technology
[0002] With the development of terminal technology, the camera functions of electronic devices are becoming increasingly sophisticated. For example, electronic devices can offer a moon-viewing mode, in which they can capture clear images of the moon using their cameras.
[0003] However, while electronic devices capture clear images of the moon in moon-viewing mode, other background objects within the same frame as the moon may not be captured, or may be captured unclearly, resulting in poor image quality. Summary of the Invention
[0004] This application provides an image processing method, an electronic device, a storage medium, and a computer program product, which can be used to improve image display effects. The technical solution is as follows:
[0005] Firstly, an image processing method is provided for use in electronic devices, the method comprising:
[0006] During the image acquisition process via the electronic device's first camera, if the electronic device enters the moon-viewing shooting mode, it will display the first preview image and the second preview image.
[0007] The first preview image and the second preview image both contain the moon. The second preview image is displayed in the first preview image in a picture-in-picture manner. The exposure of the moon in the first preview image is less than that of the moon in the second preview image. The sharpness of foreground objects other than the moon in the second preview image is greater than that of foreground objects other than the moon in the first preview image. The second preview image contains scenes of moon shaking and / or scenes of the moon being partially obscured.
[0008] In response to the shooting operation, the first preview image and the second preview image are merged to obtain the first target image;
[0009] The brightness of the first target image is adjusted to obtain the second target image. The second target image does not contain any scenes of moon shaking or scenes where the moon is partially obscured.
[0010] Thus, since the first preview image contains a clear image of the moon, and the clarity of other objects besides the moon in the second preview image is greater than that of other objects besides the moon in the first preview image, and the brightness of the first target image can be adjusted, the second target image obtained by fusing the first and second preview images is an image with high clarity including the moon and other objects. This improves the image clarity of other background objects within the same frame as the moon and enhances the overall image capture effect. Furthermore, for scenes with moon shaking or partial obstruction, specific processing steps ensure that these visually unaffected issues are eliminated in the final image, thereby guaranteeing the display quality of the image captured in the moon-viewing shooting mode.
[0011] As an example of this application, the operation of an electronic device in response to a shooting operation to fuse a first preview image and a second preview image to obtain a first target image includes:
[0012] In response to the shooting operation, the moon display area in the second preview image is eliminated to obtain the third preview image;
[0013] The third preview image is fused with the second preview image to obtain the first target image.
[0014] In this way, by eliminating the moon display area in the second preview image, the merged image retains the clarity of the foreground objects in the second preview image while removing any possible flaws in the moon display area, thus improving the impact of the moon and lunar halo on the image display during the fusion process.
[0015] As an example of this application, the operation of the electronic device in response to a shooting operation to eliminate the moon display area in the second preview image and obtain the third preview image includes:
[0016] In response to the shooting operation, the second preview image is input into the moon removal model, which is a pre-trained neural network model for removing the moon and halo present in the image;
[0017] The moon and its halo are removed from the moon display area using the moon removal model.
[0018] Thus, using a neural network model to remove the moon and its halo enables targeted processing based on image features, improving the accuracy and efficiency of image processing.
[0019] As an example of this application, the electronic device can also obtain the moon removal model through iterative training before inputting the second preview image into the moon removal model in response to the shooting operation.
[0020] For example, an electronic device can acquire a first training set, which includes multiple first sample images and multiple second sample images. Each of the multiple first sample images includes the moon and a halo in an overexposed state, and the moon size, halo size and / or lunar phase contained in the multiple first sample images are different. Each of the multiple second sample images does not include the moon and a halo, and the multiple first sample images correspond one-to-one with the multiple second sample images.
[0021] The initial elimination model is iteratively trained based on the first training set;
[0022] During iterative training, a first loss value is determined between the moon-removed image obtained after each training iteration and the second sample image input each time.
[0023] If the first loss value converges, the elimination model obtained at convergence is determined as the moon elimination model.
[0024] In this way, by calculating the first loss value, iterative training can be completed in a timely manner, thus improving the efficiency of model iterative training.
[0025] As an example of this application, in response to the shooting operation, the electronic device eliminates the moon display area in the second preview image to obtain a third preview image, including:
[0026] In response to the shooting operation, the phase of the moon in the second preview image is identified, and the size of the moon and the size of the halo are determined;
[0027] The elimination area is determined based on the phase of the moon, the size of the moon, and the size of the lunar halo;
[0028] The objects within the elimination area are then eliminated to obtain the third preview image.
[0029] Thus, by removing the moon and lunar halo from the second preview image in different ways, the diversity and accuracy of moon and lunar halo removal are improved.
[0030] As an example of this application, the operation of an electronic device to adjust the brightness of a first target image to obtain a second target image includes:
[0031] The first target image is input into the brightness adjustment model, which is a pre-trained neural network module. The brightness adjustment model is used to increase the brightness of the moon and foreground objects in the first target image, except for the sky, and to decrease the brightness of the sky.
[0032] The brightness of the first target image is adjusted using a brightness adjustment model to obtain the second target image.
[0033] It should be noted that the brightness adjustment model is also based on a deep learning neural network model. For example, the brightness adjustment model could be an improved U-Net model.
[0034] In some embodiments, the electronic device may acquire a second training set, which may include multiple third sample images and multiple fourth sample images. The multiple third sample images correspond one-to-one with the multiple fourth sample images, and each of the multiple third sample images is an image without brightness adjustment (the moon and foreground objects are relatively low in brightness, while the sky is relatively high in brightness), while each of the multiple fourth sample images is an image with adjusted brightness (the moon and foreground objects are relatively high in brightness, while the sky is relatively low in brightness). An initial adjustment model is iteratively trained based on the second training model. During iterative training, a second loss value is determined between the brightness-adjusted image obtained after each training iteration and the input fourth sample image. If the second loss value converges, the adjustment model obtained at convergence is determined as the brightness adjustment model.
[0035] In this way, by increasing the brightness of the moon and foreground objects (excluding the sky) and decreasing the brightness of the sky, the contrast of the moon and the clarity of the sky are improved, thereby enhancing the image display effect.
[0036] As an example of this application, an electronic device adjusts the brightness of the first target image to obtain a second target image, including:
[0037] Obtain the first mask image, the second mask image, and the third mask image. The first mask image is the mask image corresponding to the moon in the first target image, the second mask image is the mask image corresponding to the sky in the first target image, and the third mask image is the mask image corresponding to the foreground objects in the first target image other than the moon and the sky.
[0038] Based on the first mask image, adjust the brightness of the moon's location in the first target image;
[0039] Based on the second mask image, adjust the brightness of the sky area in the first target image;
[0040] Adjust the brightness of the foreground object in the first target image based on the third mask image.
[0041] As an example, an electronic device can obtain a first mask image, a second mask image, and a third mask image using image segmentation techniques. All three mask images are black and white images (or binary images).
[0042] In this way, by adjusting the brightness of different objects using different mask images, a high-quality second target image is finally obtained, which meets the user's demand for high-quality images when taking pictures of the moon.
[0043] As an example of this application, during image acquisition via the first camera of an electronic device, if the electronic device enters a moon-viewing mode, the operation of displaying the first preview image and the second preview image includes:
[0044] During the image acquisition process using the first camera, if the zoom ratio of the first camera is detected to be greater than or equal to the first zoom ratio threshold, then moon detection is performed on the fourth preview image acquired by the first camera.
[0045] If the moon is detected in the fourth preview image, the second preview image captured by the second camera of the electronic device is displayed in a picture-in-picture manner in the fourth preview image;
[0046] The fourth preview image is updated to the first preview image, whose exposure is less than that of the fourth preview image.
[0047] Thus, if the moon is detected in the fourth preview image, the second preview image is displayed in the fourth preview image in a picture-in-picture manner. After the fourth preview image is updated to the first preview image, if the imaging effect of other objects in the first preview image is poor, the user can adjust the shooting angle by observing the imaging effect of the second preview image so that the captured image meets their own needs, thereby improving the user's shooting convenience and user engagement.
[0048] Secondly, an image processing apparatus is provided, which has the function of implementing the image processing method behavior described in the first aspect. The image processing apparatus includes at least one module for implementing the image processing method provided in the first aspect. The image processing apparatus includes:
[0049] The display module is used to display a first preview image and a second preview image when the electronic device enters the moon-viewing shooting mode during the image acquisition process via the first camera of the electronic device.
[0050] The first preview image and the second preview image both contain the moon. The second preview image is displayed in the first preview image in a picture-in-picture manner. The exposure of the moon in the first preview image is less than that of the moon in the second preview image. The sharpness of foreground objects other than the moon in the second preview image is greater than that of foreground objects other than the moon in the first preview image. The second preview image contains scenes of moon shaking and / or scenes of the moon being partially obscured.
[0051] The fusion module is used to fuse the first preview image and the second preview image in response to the shooting operation to obtain the first target image;
[0052] The adjustment module is used to adjust the brightness of the first target image to obtain the second target image. The second target image does not contain any scenes of moon shaking or scenes where the moon is partially obscured.
[0053] Thirdly, an electronic device is provided, comprising a processor and a memory. The memory stores a program that supports the electronic device in executing the image processing method provided in the first aspect, and stores data related to implementing the image processing method described in the first aspect. The processor is configured to execute the program stored in the memory. The electronic device may further include a communication bus for establishing a connection between the processor and the memory.
[0054] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer, cause the computer to perform the image processing method described in the first aspect.
[0055] Fifthly, a computer program product containing instructions is provided, which, when run on a computer, causes the computer to perform the image processing method described in the first aspect.
[0056] The technical effects achieved by the second, third, fourth, and fifth aspects mentioned above are similar to those achieved by the corresponding technical means in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0057] Figure 1 This is a schematic diagram illustrating an application scenario of a related technology provided in an embodiment of this application;
[0058] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0059] Figure 3 This is a block diagram of a software system for an electronic device provided in an embodiment of this application;
[0060] Figure 4 This is a schematic diagram illustrating an application scenario provided in an embodiment of this application;
[0061] Figure 5 This is a schematic diagram illustrating another application scenario provided by an embodiment of this application;
[0062] Figure 6 This is a schematic flowchart of an image processing method provided in an embodiment of this application;
[0063] Figure 7 This is a flowchart illustrating another image processing method provided in an embodiment of this application;
[0064] Figure 8 This is a schematic diagram illustrating a moon removal model for removing the moon display area from an image, as provided in an embodiment of this application.
[0065] Figure 9 This is a schematic diagram illustrating another moon removal model provided in this application for removing the moon display area in an image;
[0066] Figure 10 This is a schematic diagram of a first sample image obtained through actual sampling, provided in an embodiment of this application;
[0067] Figure 11 This is a schematic diagram of a synthesized first sample image provided in an embodiment of this application;
[0068] Figure 12 This is a flowchart illustrating another image processing method provided in an embodiment of this application;
[0069] Figure 13 This is a schematic diagram illustrating another moon removal model provided in this application for removing the moon display area in an image;
[0070] Figure 14 This is a schematic diagram illustrating a brightness adjustment model for adjusting image brightness according to an embodiment of this application;
[0071] Figure 15 This is a schematic diagram of a mask image provided in an embodiment of this application. Detailed Implementation
[0072] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0073] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.
[0074] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0075] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0076] In one application scenario, a user might use an electronic device to photograph the moon. To enable these devices to capture clear images of the moon, an increasing number of electronic devices are offering a moon-viewing mode (also known as a moon-shooting mode or simply a moon mode). For example, when a user photographs the moon using an electronic device, they can capture images such as... Figure 1 The image in Figure (a) is an overexposed and out-of-focus image of the moon. Therefore, in order to enable mobile phones to capture clear images of the moon, more and more types of electronic devices have begun to offer a moon-viewing mode (also known as a moon-shooting mode or moon mode, etc.).
[0077] As an example, an electronic device can automatically enter moon-viewing mode when it detects the presence of the moon in the preview image captured by the camera; alternatively, it can enter moon-viewing mode upon receiving a user's mode selection operation that indicates the moon is in the shooting mode. In moon-viewing mode, the electronic device can capture clear images of the moon.
[0078] Currently, electronic devices can fuse short-frame and long-frame images containing the moon to obtain a clear image of the moon. However, due to factors such as strong lunar halos or camera shake during image capture, the resulting moon image may not be ideal during multi-frame fusion. (See also...) Figure 1 In Figure (b), the resulting image of the moon has a strong lunar halo, or, as shown in Figure (b), the moon image ... Figure 1In image (c), the moon image appears ghosted because the user manually captured it; or, Figure 1 In image (d), an error occurred during image fusion, resulting in an abnormal display of the moon image. Alternatively, see [link to image]. Figure 1 In Figure (e), a clear image of the moon was captured, but other background objects within the same frame as the moon could not be imaged or were not clearly imaged, resulting in poor image quality.
[0079] To improve image clarity and shooting effect, this application provides an image processing method. In this method, after an electronic device enters a moon-viewing shooting mode, the device can display a first preview image and a second preview image. Both the first and second preview images contain the moon. The second preview image is displayed in a picture-in-picture manner within the first preview image. The exposure of the moon in the first preview image is less than that in the second preview image. The second preview image contains scenes of moon shaking and / or scenes where the moon is partially obscured. In response to a shooting operation, the first and second preview images are merged to obtain a first target image. The brightness of the first target image is adjusted to obtain a second target image. The second target image does not contain scenes of moon shaking or scenes where the moon is partially obscured. Because the first preview image contains a clear image of the moon, and the clarity of other objects besides the moon in the second preview image is greater than that of other objects besides the moon in the first preview image, and the brightness of the first target image can be adjusted, the resulting second target image, obtained by merging the first and second preview images, is an image with high clarity including the moon and other objects. This improves the image clarity of other background objects within the same frame as the moon, and enhances the overall image capture effect. Furthermore, specific processing steps are used to address scenes with moon movement or partial obstruction, ensuring that these visually unaffected issues are eliminated in the final image, thus guaranteeing the display quality of the image captured in the moon-viewing shooting mode.
[0080] Before providing a detailed explanation of the image processing method provided in the embodiments of this application, the electronic equipment involved in the embodiments of this application will be described first.
[0081] As an example, this method can be applied to an electronic device equipped with multiple cameras, including a telephoto camera and a main camera. As an example and not a limitation, the electronic device can be, but is not limited to, tablet computers, desktop computers, laptop computers, handheld computers, laptops, in-vehicle devices, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), mobile phones, smartwatches, smart cameras, etc., and this application embodiment does not limit this.
[0082] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. See also... Figure 2 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, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0083] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0084] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0085] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0086] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from this memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0087] In some embodiments, the processor 110 may include one or more interfaces, such as an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0088] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0089] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0090] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0091] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is an integer greater than 1.
[0092] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0093] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's image sensor. The light signal is converted into an electrical signal, and the image sensor transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimizations on image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be integrated into the camera 193.
[0094] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is an integer greater than 1.
[0095] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP performs Fourier transforms on the frequency energy.
[0096] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.
[0097] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0098] The external storage 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 storage interface 120 to perform data storage functions, such as saving music, video, and other files on the external memory card.
[0099] Internal memory 121 can be used to store computer-executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created by electronic device 100 during use (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0100] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D and application processor.
[0101] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0102] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.
[0103] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.
[0104] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0105] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0106] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch operation intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than the pressure threshold is applied to the SMS application icon, a command to view an SMS message is executed. When a touch operation with an intensity greater than or equal to the pressure threshold is applied to the SMS application icon, a command to create a new SMS message is executed.
[0107] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.
[0108] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0109] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Based on the detected opening and closing state of the cover or the flip cover, the electronic device 100 can set features such as automatic flip unlocking.
[0110] The accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in various directions (generally three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. The accelerometer 180E can also be used to identify the attitude of electronic device 100, and can be applied to applications such as screen orientation switching and pedometers.
[0111] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scenario, electronic device 100 can utilize the distance sensor 180F for distance measurement to achieve fast focusing.
[0112] The proximity sensor 180G may include a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, the electronic device 100 can determine that an object is nearby. When insufficient reflected light is detected, it can determine that no object is nearby. The electronic device 100 can use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a phone call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.
[0113] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0114] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.
[0115] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 reduces the performance of a processor located near temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.
[0116] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touch display." Touch sensor 180K detects touch operations applied to or near it. Touch sensor 180K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.
[0117] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.
[0118] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0119] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can be corresponding to touch operations applied to different applications (such as taking photos, playing audio, etc.). Touch operations applied to different areas of the display screen 194 can also correspond to different vibration feedback effects. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0120] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0121] The software system of electronic device 100 will be described next.
[0122] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered Android system as an example to illustrate the software system of electronic device 100.
[0123] Figure 3 This is a block diagram of a software system for an electronic device 100 provided in an embodiment of this application. See also... Figure 3 A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime, the system layer, and the kernel layer.
[0124] The application layer can include a series of application packages. For example... Figure 3 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0125] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. For example... Figure 3As shown, the application framework layer can include a window manager, content providers, a view system, a phone manager, a resource manager, and a notification manager. The window manager manages window programs. It can obtain the screen size, determine if a status bar is present, lock the screen, and capture the screen. The content provider stores and retrieves data, making this data accessible to the application. This data can include videos, images, audio, made and received phone calls, browsing history and bookmarks, and phone books. The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build the application's display interface, which can consist of one or more views, such as a view displaying SMS notification icons, a view displaying text, and a view displaying images. The phone manager provides communication functions for the electronic device 100, such as managing call status (including connection and disconnection). The resource manager provides the application with various resources, such as localized strings, icons, images, layout files, and video files. The notification manager allows the application to display notification information in the status bar, which can be used to convey informational messages and can disappear automatically after a short pause without user interaction. For example, the notification manager is used to notify users of download completions and message alerts. The notification manager can also display notifications as icons or scrolling text in the system's top status bar, such as notifications from background applications. Furthermore, the notification manager can appear as dialog boxes on the screen, such as displaying text messages in the status bar, emitting sounds, causing electronic devices to vibrate, or flashing indicator lights.
[0126] The Android Runtime consists of the core libraries and the virtual machine. The Android runtime is responsible for scheduling and managing the Android system. The core libraries consist of two parts: one part contains the functionalities that Java needs to call, and the other part is the core Android library itself. The application layer and application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0127] The system library can include multiple functional modules, such as a surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The surface manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support various audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing libraries are used for 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D graphics.
[0128] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0129] The following example, using a scene of capturing a photograph, illustrates the workflow of the software and hardware of the electronic device 100.
[0130] When touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, touch operation timestamp, etc.). The raw input event is stored in the kernel layer. The application framework layer retrieves the raw input event from the kernel layer and identifies the control corresponding to the raw input event. Taking a single-click operation as an example, where the corresponding control is the camera application icon, the camera application calls the interface of the application framework layer to launch the camera application, and then calls the kernel layer to launch the camera driver, capturing still images or videos through camera 193.
[0131] To facilitate understanding, before providing a detailed description of the methods provided in the embodiments of this application, the application scenarios involved in the embodiments of this application will be introduced below, with mobile phones as an example of the electronic devices used in the application scenarios of this application.
[0132] Please refer to Figure 4 , Figure 4 This is a schematic diagram illustrating an application scenario provided by an embodiment of this application. In one application scenario, a user may take photos using any of the cameras on an electronic device. After activating the camera, the electronic device can display the following on the screen: Figure 4The shooting interface shown in Figure (a) displays a preview image A captured by camera S1. During the shooting process, the user can adjust the zoom level of camera S1; for example, by clicking the zoom control, the zoom level can be changed from 1× to 10×. In response to the zoom level adjustment, the phone captures an image using camera S1 at the adjusted zoom level, resulting in an image like... Figure 4 In the preview image B shown in Figure (b), the electronic device can detect whether the preview image B contains the moon, and if the moon is detected, it reduces the exposure of the preview image B, resulting in the image shown. Figure 4 The preview image C shown in Figure (c) is used, and the preview image D captured by the electronic device's camera S2 is displayed in preview image C in a picture-in-picture manner. Due to the shaking of the electronic device, the moon appears as a ghost image in preview image D. If the user clicks the shooting control P1 in this situation, the electronic device responds to the click operation on the shooting control P1 and performs image exposure based on preview image D and preview image C. See then... Figure 4 In Figure (d), the user can click the image viewing control P2 in the shooting interface. In response to the click operation on the image viewing control P2, the electronic device can display, as shown below. Figure 4 The image E shown in Figure (e) shows a clear image of the moon without any moon jitter.
[0133] It should be noted that camera S1 can be the telephoto camera of the phone, and camera S2 can be the main camera of the phone.
[0134] In yet another possible scenario, see Figure 5 In Figure (a), after the electronic device enters the moon-viewing shooting mode, it displays preview image F in a picture-in-picture format within preview image G. In preview image F, the moon is partially obscured. If the user clicks the shooting control P1, the electronic device responds to the click by adjusting the image exposure based on preview images F and G. To view the captured image, see [reference needed]. Figure 5 In Figure (b), the user can click on the image viewing control P2 in the shooting interface. In response to the click on the image viewing control P2, the electronic device can display, as shown below. Figure 5 The image H shown in Figure (c) shows a scene where the moon is not obscured, meaning the moon image is clear and the objects that were partially obscuring the moon have been eliminated.
[0135] It should be noted that the embodiments in this application are only based on the above. Figure 4 and Figure 5The application scenarios shown are illustrated as examples and do not constitute a limitation on the embodiments of this application.
[0136] Based on the application scenarios provided in the above embodiments, the image processing method provided in this application will be described below. Please refer to... Figure 6 , Figure 6 This is a flowchart illustrating an image processing method by way of example, not limitation. The method is described with reference to its application in an electronic device and may include some or all of the following:
[0137] Step 601: During the image acquisition process using the first camera of the electronic device, if the zoom ratio of the first camera is greater than or equal to the first zoom ratio threshold, then perform moon detection on the fourth preview image acquired by the first camera.
[0138] During image capture using the electronic device's first camera, the user may adjust the zoom level of the first camera. If the zoom level is greater than or equal to a first zoom threshold, the electronic device can perform moon detection on the fourth preview image captured by the first camera. For example, this fourth preview image can be the aforementioned... Figure 4 The preview image B shown in Figure (b) is the fourth preview image, which was acquired when the zoom ratio of the first camera was greater than or equal to the first zoom ratio threshold.
[0139] As an example, the first camera can be a telephoto camera of an electronic device. Exemplarily, the first camera can be camera A as described in the above application scenario.
[0140] It should be noted that the electronic device may have a zoom detection module installed inside, so that the electronic device can monitor the zoom ratio of the first camera in real time through the zoom detection module.
[0141] In some embodiments, the electronic device can set not only a first zoom level but also a second zoom level. When the zoom level of the first camera is greater than or equal to a first zoom level threshold and less than or equal to a second zoom level threshold, the electronic device can perform moon detection on the fourth preview image captured by the first camera. When the zoom level of the first camera is less than the first zoom level threshold or greater than the second zoom level threshold, the electronic device can continue to display a single preview image appropriate to the current zoom level, without displaying multiple preview images; that is, the electronic device uses only one camera for image capture.
[0142] It should be noted that the first and second magnification thresholds can be preset according to requirements. For example, the first magnification threshold can be 10x (or written as 10X), 15x, 20x, or 30x, etc. The second magnification threshold can be 30x or 40x, etc., and the second magnification threshold is greater than the first magnification threshold.
[0143] In some embodiments, the zoom ratio of the first camera can be manually adjusted by the user to any zoom ratio greater than or equal to the first zoom ratio threshold, or it can be automatically adjusted by the electronic device to any zoom ratio greater than or equal to the first zoom ratio threshold.
[0144] For example, when the electronic device switches to certain shooting modes, it automatically increases the zoom level of the first camera. For instance, when the electronic device switches to the moon-viewing shooting mode, in order to obtain a clear image of the moon, the electronic device can adjust the zoom level of the first camera to a first magnification, which is greater than or equal to a first magnification threshold.
[0145] In some embodiments, the electronic device can perform moon detection on the fourth preview image captured by the first camera in various ways. For example, the electronic device may be equipped with a moon recognition model or an object recognition model. The moon recognition model is a pre-trained model for identifying whether the moon exists in the image, and the object recognition model is a pre-trained model for recognizing various objects (including the moon). Thus, if a moon recognition model exists, the electronic device can use it to identify whether the moon exists in the fourth preview image. If an object recognition model exists, the electronic device can use it to identify various objects in the fourth preview image and detect whether the moon exists by recognizing each object. Alternatively, the electronic device may have AI (artificial intelligence) recognition capabilities. In this case, the electronic device can use AI recognition to identify various objects in the fourth preview image to detect whether the moon exists in the fourth preview image. This application embodiment does not impose specific limitations on this approach.
[0146] Step 602: If the moon is present in the fourth preview image, display the second preview image captured by the second camera of the electronic device in the fourth preview image in a picture-in-picture manner.
[0147] It should be noted that both the second and fourth preview images include the moon, and the image capture area shown in the second preview image is larger than that shown in the fourth preview image. The second camera and the first camera capture images of the same shooting scene.
[0148] As an example, if the moon is present in the fourth preview image, the electronic device can simultaneously capture images of the same scene using both the first and second cameras. After capturing the image using the second camera to obtain the second preview image, this second preview image can be displayed in a picture-in-picture format within the fourth preview image. For example, this scenario can be described as described above. Figure 4 The application scenario shown in Figure (c) is... Figure 5 The application scenario is shown in Figure (a).
[0149] It should be noted that the second camera can be the main camera of the electronic device, and the second camera can be camera B as described in the above scenario.
[0150] Step 603: Update the fourth preview image to the first preview image.
[0151] It should be noted that the exposure of the first preview image is less than that of the fourth preview image, and the sharpness of objects other than the moon in the second preview image is greater than that of objects other than the moon in the first preview image.
[0152] As an example, updating the fourth preview image to the first preview image may include: reducing the exposure and / or exposure duration of the fourth preview image to obtain the first preview image.
[0153] Because the moon's brightness was high when the electronic device's first camera captured the fourth preview image, the moon's display area in the fourth preview image was blurry. Normally, images with lower exposure and / or shorter exposure times are clearer when displaying areas in strong light. Therefore, to obtain a clear image of the moon, the electronic device can obtain the first preview image by reducing the exposure and / or exposure time of the fourth preview image.
[0154] Because the moon's light is strong in the fourth preview image while other objects are weakly lit, reducing the exposure and / or exposure time of the fourth preview image results in a very clear moon in the first preview image, but other objects may not be imaged or may be blurry. However, when the electronic device captures the second preview image, the automatic exposure (AE) algorithm converges, meaning the second preview image is normally exposed, and the electronic device does not reduce the exposure and / or exposure time of the second preview image.
[0155] Since images with higher exposure and / or longer exposure times are generally clearer when displaying image areas with low light, the moon appears blurry in the second preview image. However, the other objects in the second preview image are clearer than the other objects in the first preview image.
[0156] It should be noted that, in the case where the moon is present in the fourth preview image, the execution order of steps 602 and 603 in this embodiment of the application is not specifically limited. That is, in the case where the moon is present in the fourth preview image, the electronic device may execute the operation of step 602 first and then the operation of step 603, or it may execute the operation of step 603 first and then the operation of step 602, or it may execute the operations of steps 602 and 603 simultaneously.
[0157] As an example, when the fourth preview image is updated to the first preview image, the second preview image is displayed on top of the first preview image in a picture-in-picture manner.
[0158] As described above, the electronic device can automatically increase the zoom level of the first camera after entering certain shooting modes, or the user can manually adjust the zoom level of the first camera. When the zoom level of the first camera is manually adjusted by the user, if the moon is present in the fourth preview image, the electronic device can enter the moon-viewing shooting mode. In the moon-viewing shooting mode, the electronic device can display the first preview image and the second preview image, with the second preview image displayed in a picture-in-picture format within the first preview image; that is, the electronic device executes steps 602 and 603.
[0159] In some embodiments, when the electronic device enters the moon-viewing shooting mode, a prompt message can be displayed on the shooting interface to indicate the current shooting mode. This prompt message can be in the form of at least one of text, an image, or a control.
[0160] It is worth noting that when the moon is detected in the fourth preview image, the second preview image is displayed in the fourth preview image in a picture-in-picture manner. This allows users to adjust their shooting angle by observing the imaging effect of the second preview image after the fourth preview image is updated to the first preview image, if the imaging effect of other objects in the first preview image is poor, so that the shooting image can meet their own needs. This improves the convenience of shooting and user engagement.
[0161] Step 604: In response to the shooting operation, the first preview image and the second preview image are merged to obtain the first target image.
[0162] While displaying the first and second preview images, the user may trigger a shooting action. This shooting action could be the user clicking the shooting control in photo mode, or the user clicking the recording or shooting control in video mode, etc. Thus, upon receiving the shooting action, in order to obtain a clear image of the moon and other objects besides the moon, the electronic device, in response to the shooting action, can merge the first and second preview images.
[0163] In some embodiments, in response to a shooting operation, the electronic device can directly fuse the first preview image and the second preview image to obtain a first target image. Alternatively, in response to a shooting operation, the electronic device can determine the moon display area in the first preview image and the moon display area in the second preview image, and cover the moon display area in the first preview image with the moon display area in the second preview image to achieve the fusion of the first preview image and the second preview image to obtain the first target image.
[0164] In some embodiments, to avoid ghosting of the moon in the fused image, the electronic device can determine a first focus position and a second focus position, where the first focus position is the focus position of the moon in the first preview image, and the second focus position is the focus position of the moon in the second preview image. If the deviation between the first and second focus positions is small (the deviation value is less than or equal to a deviation threshold), the electronic device can directly fuse the second and first preview images to obtain the first target image. If the deviation between the first and second focus positions is large (the deviation value is greater than a deviation threshold), the position of the moon in the first preview image is adjusted first, and then image fusion is performed to obtain the first target image.
[0165] For example, see Figure 7 In response to the shooting operation, the electronic device can acquire a first preview image (data stream X) in YUV format (YUV format is a photo format or image format) and a second preview image (data stream Y) in raw format (raw format is a photo format or image format). The electronic device can process the first preview image in YUV format into a first exposure image in RGB1 format, process the second preview image in raw format into raw2rgb format, and then process it into a second exposure image in RGB2 format. After that, the electronic device can detect the position of the moon, obtain the first focus position and the second focus position, and fuse the first exposure image and the second exposure image according to the first focus position and the second focus position.
[0166] It should be noted that electronic devices can not only fuse the first preview image and the second preview image in the manner described above, but also use other fusion methods.
[0167] For example, in response to a shooting operation, the electronic device can eliminate the moon display area in the second preview image to obtain a third preview image; and fuse the third preview image with the second preview image to obtain a first target image.
[0168] Since the moon's exposure in the second preview image is greater than that in the first preview image, and the moon usually has a halo with a large coverage area, directly merging the second preview image with the first preview image may affect the display effect of the merged image due to the moon and / or halo in the second preview image. Therefore, in order to improve the display effect of the merged image, the electronic device can eliminate the moon display area in the second preview image to obtain a third preview image, and then merge the third preview image with the second preview image to obtain the first target image.
[0169] It is worth noting that by eliminating the moon display area in the second preview image, the merged image retains the clarity of the foreground objects in the second preview image while removing any potential flaws in the moon display area, thus improving the impact of the moon and lunar halo on the image display during the fusion process.
[0170] It should be noted that the electronic device can employ various image fusion algorithms when fusing the third preview image with the second preview image to obtain the first target image. For example, the electronic device can fuse the third preview image and the second preview image using a weighted average. Alternatively, the electronic device can fuse different images using the Laplacian pyramid algorithm, thereby better preserving the image's detail information and overall structure, resulting in a smooth transition at the edges of the fused image. That is, the electronic device can use the Laplacian pyramid algorithm to fuse the second preview image and the third preview image. Of course, the electronic device can also achieve image fusion using other fusion algorithms, and this application embodiment does not impose specific limitations on this.
[0171] In one possible implementation, the operation of fusing the third preview image and the second preview image by weighted averaging to obtain the first target image includes: acquiring the color value of each pixel in the second preview image to obtain multiple first color values, and acquiring the color value of each pixel in the third preview image to obtain multiple second color values, wherein each pixel in the second preview image has a corresponding pixel in the third preview image. A first weight corresponding to each first color value and a second weight corresponding to each second color value are acquired. Each first color value is multiplied by its first weight to obtain multiple first products, and each second color value is multiplied by its second weight to obtain multiple second products. The first products and second products of each corresponding pixel are added together to obtain the color value of each pixel in the first target image.
[0172] As an example, the first weight and the second weight can be the same or different, and in order to highlight the clarity of the foreground objects in the second preview image, the first weight can usually be set to be greater than the second weight.
[0173] It should be noted that the electronic device can fuse the second preview image and the third preview image in the above manner, and of course, it can also fuse the first preview image and the second preview image in the above manner. This application embodiment will not elaborate on these aspects.
[0174] Since the moon and lunar halo are absent in the second preview image, the electronic device can directly merge the second and third preview images without determining the focus position of the moon. The moon can be displayed at any position in the merged image, improving the randomness of image fusion and the richness of image display.
[0175] Of course, in order to ensure the authenticity of the image, the electronic device can also determine the second focus position of the moon in the second preview image and the third focus position of the moon in the third preview image. Based on the second focus position and the third focus position, the second preview image and the third preview image are merged. During the merging process, the second focus position and the third focus position do not need to be perfectly aligned.
[0176] Next, the operation of the electronic device to remove the moon display area from the second preview image will be explained.
[0177] As an example, the operation of an electronic device in response to a shooting operation to eliminate the moon display area in a second preview image to obtain a third preview image includes: in response to the shooting operation, inputting the second preview image into a moon elimination model, which is a pre-trained neural network model for eliminating the moon and moon halo present in the image; and eliminating the moon and moon halo in the moon display area by the moon elimination model.
[0178] For example, see Figure 8 The electronic device inputs the second preview image Y1 into the moon removal model, which can remove the moon and halo from the second preview image Y1 and output the third preview image Y2.
[0179] It is worth noting that using a neural network model to remove the moon and its halo enables targeted processing based on image features, improving the accuracy and efficiency of image processing.
[0180] It should be noted that the moon removal model is based on a deep learning neural network model, such as a convolutional neural network (CNN).
[0181] In some embodiments, the electronic device may also obtain the moon removal model through iterative training before inputting the second preview image into the moon removal model in response to the shooting operation.
[0182] As an example, the operation of obtaining a moon removal model through iterative training of an electronic device includes: acquiring a first training set, which includes multiple first sample images and multiple second sample images. Each of the multiple first sample images includes an overexposed moon and a lunar halo, and the moon size, lunar halo size, and / or lunar phase contained in the multiple first sample images are different. For example, the first sample images may contain images of a large moon with a large lunar halo in a full moon state, or images of a small moon with a small lunar halo in a waxing crescent moon state, etc. Each of the multiple second sample images does not contain the moon and lunar halo, and the multiple first sample images correspond one-to-one with the multiple second sample images. The initial removal model is iteratively trained based on the first training set; during the iterative training process, a first loss value is determined between the moon removal image obtained after each training and the input second sample image each time; if the first loss value converges, the removal model obtained at convergence is determined as the moon removal model.
[0183] It should be noted that the first sample image can be a sample image containing the moon and a lunar halo but not containing foreground objects, or it can be a sample image containing the moon and a lunar halo and containing foreground objects. Generally, the first sample image is a sample image containing the moon and a lunar halo but not containing foreground objects. This application does not impose specific limitations on this.
[0184] As an example, electronic devices can employ loss functions such as Mean Squared Error (MSE) to determine the first loss value. The MES loss function measures the difference between the predicted image after removing the moon and halo and the true image (i.e., the labeled image after removing the moon and halo). See, for example... Figure 9The first sample image S1 is an image with a moon and a halo but no foreground object. The second sample image S2 is the image corresponding to the first sample image S1 but without a moon and a halo and containing a foreground object. In this case, the electronic device can synthesize the first sample image S1 and the second sample image S2 to obtain the third image S3. That is, the third image S3 is the image obtained by synthesizing the first sample image S1 and the second sample image S2. The fourth image S4 is the image obtained after the moon and halo are removed from the third image S3 by the moon removal model. The electronic device can determine the first loss value between the second sample image S2 and the fourth image S4 through the loss function.
[0185] In some embodiments, the electronic device can construct a first training set. For example, the electronic device can collect first sample images (images of the moon including the moon and its halo) and second sample images (images without the moon and its halo) of various typical scenes from different astrophotography resources. These scenes include, but are not limited to, different shooting locations (such as mountains, plains, and seashores), different times (different seasons and different moments), different weather conditions (clear skies, thin clouds, etc.), and different moon phases (also known as lunar phases, such as gibbous moon, full moon, and first quarter moon). This ensures that the collected first sample images are diverse, covering a wide range of possible lunar imaging scenarios. For example, Figure 10 Images (a), (b), (c), and (d) are all first sample images collected in the actual dataset.
[0186] It should be noted that, after acquiring a large number of first and second sample images, the electronic device can also filter these images. For example, it can remove first sample images that do not meet overexposure requirements or where foreground objects are not completely removed. Then, based on the quality, sharpness, and the prominence of the moon and halo features, the electronic device can filter and retain representative first sample images and corresponding second sample images, ensuring the quality and diversity of the acquired data.
[0187] In some embodiments, the electronic device can not only acquire existing first sample images and second sample images, but also continue to construct other first sample images. For example, the electronic device can use a random number generator to randomly select values for the radius of the moon and the radius of the halo within a preset range of the moon's radius and a preset range of the halo's radius to synthesize the first sample image.
[0188] It should be noted that the radius of the moon can be determined based on the common size range of the moon as observed in images, for example, the minimum radius can be set to 10 pixels and the maximum radius to 50 pixels. The radius of the halo can be set to between 1.5 and 3 times the radius of the moon.
[0189] In some embodiments, in order to ensure the authenticity of the synthesized sample image, the electronic device may also construct the first sample image based on the brightness data of the lunar halo in the first sample image.
[0190] For example, for each acquired first sample image, the electronic device can sample the brightness from the center of the lunar halo outwards. For instance, it can sample brightness values at certain intervals (e.g., every 5 pixels), and record these values to obtain detailed information about the decreasing brightness of the lunar halo from the center outwards. In constructing other first sample images, the electronic device can use a randomly generated center position of the moon as a reference, determine the moon's range based on its radius, and set a fixed brightness value within this range to represent the main body of the moon. For the lunar halo, based on the statistically calculated brightness decrease data, starting from the edge of the moon, the brightness value gradually decreases outwards according to the halo's radius, thereby generating a realistic lunar halo effect and obtaining other first sample images. See also... Figure 11 , Figure 11 The first sample image synthesized for an electronic device.
[0191] As described above, the first training set may include first sample images acquired in real-world scenarios and / or synthetic first sample images. In the case of including both acquired and synthetic first sample images, the electronic device can also mix the two types of first sample images in a certain proportion. For example, synthetic first sample images may account for 60%, and acquired first sample images may account for 40%, to fully utilize the controllability of synthetic first sample images and the authenticity of acquired first sample images.
[0192] As an example, the electronic device can also number and label the integrated first training set, such as labeling whether it is synthetic data, the weather conditions during the shooting, the shape of the moon, etc., so as to facilitate data management and use in subsequent iterative training processes.
[0193] In some embodiments, after acquiring the first training set, the electronic device can input the first sample images and the second sample images from the first training set into the initial removal model in batches. For each batch of images, the current removal model performs forward propagation based on the current parameters to calculate the predicted image after removing the moon and halo, and then calculates the first loss value using a loss function. Next, backpropagation is performed using an optimizer to calculate the gradient and update the parameters of the removal model, causing the first loss value to gradually decrease. If the first loss value converges, the removal model obtained at convergence can be determined as the moon removal model.
[0194] It should be noted that the convergence of the first loss value can refer to the situation where the first loss value no longer changes, or changes only slightly (less than a certain threshold).
[0195] Of course, the electronic device can determine the moon removal model not only when the first loss value converges, but also when the number of iterations is greater than or equal to a threshold. This application does not impose specific limitations on this.
[0196] In some embodiments, the electronic device can eliminate the moon display area in the second preview image not only through the methods described above, but also through other methods. For example, in response to a shooting operation, the electronic device identifies the phase of the moon in the second preview image and determines the size of the moon and the size of the halo; according to the phase of the moon, the size of the moon, and the size of the halo, it determines the elimination area; and it performs elimination processing on the objects within the elimination area to obtain the third preview image.
[0197] It should be noted that the size of the area to be eliminated is greater than or equal to the size of the area where the moon is displayed in the second preview image.
[0198] As an example, the operation of an electronic device to identify the phase of the moon in a second preview image can be achieved by analyzing the shape features of the moon. For example, the outline of the moon can be extracted using an edge detection algorithm, and then the shape of the outline can be matched with templates of different phases of the moon to identify the phase of the moon in the second preview image.
[0199] As an example, an electronic device can determine the size of the moon by calculating the number of pixels occupied by the moon's pixel area or diameter in a second preview image, and determine the size of the lunar halo by detecting the edge range of the lunar halo.
[0200] It should be noted that the size of the elimination area determined by the electronic device varies depending on the identified moon phase, the size of the moon, and the size of the halo. For example, if the moon phase is identified as a full moon, and the moon is large with a wide halo, then the elimination area will be relatively large; if the moon phase is identified as a new moon, and the moon is small with a narrow halo, then the elimination area will be smaller.
[0201] In some embodiments, the electronic device can use an image inpainting algorithm to remove objects within the removal area and fill the removal area with image information (such as texture, color information, etc.) surrounding the removal area to obtain a third preview image.
[0202] It should be noted that image inpainting algorithms can include image inpainting methods based on partial differential equations or image inpainting methods based on samples. Thus, by using image inpainting algorithms to remove unwanted regions, the third preview image can appear natural and coherent.
[0203] For example, see Figure 12During the processing of data stream X and data stream Y, after the second exposure image in RGB2 format, the electronic device can eliminate the moon display area in the second exposure image to obtain a third preview image (also known as a third exposure image). Then, the electronic device can detect the position of the moon to obtain the first focus position and the second focus position, and fuse the first exposure image and the second exposure image according to the first focus position and the second focus position.
[0204] In some embodiments, the second preview image may contain a scene of moon shaking and / or a scene where the moon is partially obscured. In this case, the electronic device eliminates the moon display area in the second preview image, that is, it eliminates the scene of moon shaking and the scene where the moon is partially obscured. Thus, the first target image will not contain a scene of moon shaking or a scene where the moon is partially obscured.
[0205] For example, see Figure 13 The electronic device inputs a second preview image Y1 containing a scene where the moon is partially obscured to the moon elimination model. The moon elimination model can eliminate the moon and halo in the second preview image Y1 and output a third preview image Y2. The third preview image Y2 does not contain a scene where the moon is partially obscured, which means that the object that obscures the moon in the second preview image Y1 is also eliminated.
[0206] Of course, if there is no moon shaking scene and / or moon partially obscured scene in the second preview image, the electronic device can also eliminate the moon display area in the second preview area to obtain the first target image, which does not have a moon shaking scene and does not have a scene where the moon is partially obscured.
[0207] Step 605: Adjust the brightness of the first target image to obtain the second target image.
[0208] As described above, the second preview image may contain scenes of moon shaking and / or partial obscuring of the moon, or it may not contain either. In either case, after the electronic device eliminates the moon display area in the second preview image, the first target image will not contain either moon shaking or partial obscuring. Therefore, the second target image will also not contain either moon shaking or partial obscuring. This ensures that the final image does not contain these visually impactful issues, thus guaranteeing the display quality of the image captured in the moon-viewing shooting mode.
[0209] Since layered color levels still remain around the moon display area after removing the moon and its surrounding halo from the second preview image, the electronic device can adjust the brightness of the first target image to obtain the second target image in order to improve the image display effect.
[0210] In some embodiments, the operation of the electronic device to adjust the brightness of a first target image to obtain a second target image includes: inputting the first target image into a brightness adjustment model, which is a pre-trained neural network module, and the brightness adjustment model is used to increase the brightness of the moon and foreground objects in the first target image except for the sky, and to decrease the brightness of the sky; adjusting the brightness of the first target image through the brightness adjustment model to obtain the second target image.
[0211] For example, see Figure 14 The electronic device inputs the first target image M1 into the brightness adjustment model. The brightness adjustment model can increase the brightness of the moon and foreground objects in the first target image M1, except for the sky, and decrease the brightness of the sky. Then, it outputs the second target image M2. In the second target image M2, the brightness of the moon and foreground objects is increased, and the brightness of the sky is decreased.
[0212] It should be noted that the brightness adjustment model is also based on a deep learning neural network model. For example, the brightness adjustment model could be an improved U-Net model.
[0213] It is worth noting that by increasing the brightness of the moon and foreground objects (excluding the sky) and decreasing the brightness of the sky, the contrast of the moon and the clarity of the sky are improved, thereby enhancing the image display effect.
[0214] In some embodiments, the electronic device may acquire a second training set, which may include multiple third sample images and multiple fourth sample images. The multiple third sample images correspond one-to-one with the multiple fourth sample images, and each of the multiple third sample images is an image without brightness adjustment (the moon and foreground objects are relatively low in brightness, while the sky is relatively high in brightness), while each of the multiple fourth sample images is an image with adjusted brightness (the moon and foreground objects are relatively high in brightness, while the sky is relatively low in brightness). An initial adjustment model is iteratively trained based on the second training model. During iterative training, a second loss value is determined between the brightness-adjusted image obtained after each training iteration and the input fourth sample image. If the second loss value converges, the adjustment model obtained at convergence is determined as the brightness adjustment model.
[0215] It should be noted that during model training, the electronic device can learn from a large number of image samples, accurately increasing the brightness of the moon and foreground objects (excluding the sky) in the first target image while decreasing the brightness of the sky. The brightness of the first target image is then adjusted using a brightness adjustment model to obtain the second target image. In this process, the brightness adjustment module adaptively adjusts the brightness based on the characteristics of different regions in the image, resulting in a clear, bright, and visually appealing image of the moon.
[0216] In some embodiments, the electronic device can not only adjust the brightness of the first target image to obtain the second target image in the manner described above, but also adjust the brightness of the first target image to obtain the second target image in other ways. For example, the electronic device can acquire a first mask image, a second mask image, and a third mask image, wherein the first mask image is the mask image corresponding to the moon in the first target image, the second mask image is the mask image corresponding to the sky in the first target image, and the third mask image is the mask image corresponding to foreground objects in the first target image other than the moon and the sky; adjust the brightness of the position of the moon in the first target image according to the first mask image; adjust the brightness of the position of the sky in the first target image according to the second mask image; and adjust the brightness of the position of the foreground objects in the first target image according to the third mask image.
[0217] As an example, an electronic device can acquire a first mask image, a second mask image, and a third mask image using image segmentation technology. This image segmentation technology can be a deep learning-based semantic segmentation algorithm, such as the Mask R-CNN algorithm (or mask acquisition model, Mask R-CNN model). Through image segmentation technology, the electronic device can accurately segment different objects in an image and generate corresponding mask images.
[0218] For example, for a first target image containing the moon, an electronic device can input the target image into a trained Mask R-CNN model. The Mask R-CNN model can output a binary mask image of the same size as the image, where the pixel value corresponding to the moon display area is 1 (or other values representing the foreground), and the pixel value corresponding to the non-moon display area is 0 (or other values representing the background). This mask image is the first mask image corresponding to the moon, which can accurately delineate the position and shape of the moon in the first target image. Of course, the Mask R-CNN model can not only output the first mask image, but also output a binary mask image corresponding to the sky area (i.e., the second mask image) and a binary mask image corresponding to the foreground objects (i.e., the third mask image). In the second mask image, the pixel values of the sky area are also marked with specific values to distinguish it from other areas. In the third mask image, the pixel values of the foreground object area are also marked with specific values, while the pixel values of other areas (the moon and sky areas) are 0.
[0219] It should be noted that the first mask image, the second mask image, and the third mask image are all black and white images (or binary images). For example, the first target image can be as follows: Figure 15 As shown in Figure (a); see also Figure 15 In Figure (b), the first mask image can be a black and white image where the area around the moon is white and all other areas are black; see also Figure 15 In Figure (c), the second mask image can be a black and white image where the sky is white and all other areas are black; see also... Figure 15 In Figure (d), the third mask image can be a black and white image where the foreground object is white and the other areas are black.
[0220] Thus, the electronic device can adjust the brightness of the moon's location in the first target image based on the first mask image. For example, if the brightness of the moon's location is low, it can be increased appropriately; if the brightness of the moon's location is too high, it can be decreased. The electronic device can adjust the brightness of the sky's location in the first target image based on the second mask image; for example, the electronic device can decrease the brightness of the sky to highlight the moon and foreground objects. The electronic device can adjust the brightness of the foreground object's location in the first target image based on the third mask image to ensure that the foreground object details are clear and the brightness is moderate.
[0221] It is worth noting that by adjusting the brightness of different objects using different mask images, a high-quality second target image is ultimately obtained, meeting the user's demand for high-quality images when capturing moon-viewing shots.
[0222] As an example, the operation of adjusting the brightness of the moon's location in the first target image based on the first mask image may include: determining the moon display area through the first mask function, and performing a brightness adjustment operation (usually a brightness increase operation) on the moon display area through a brightness adjustment function.
[0223] As an example, the brightness adjustment function can be a linear transformation function, an exponential transformation function, a histogram equalization-based method, etc.
[0224] It should be noted that during the brightness adjustment process, since the first mask image precisely defines the moon display area, the brightness adjustment operation will only be applied to the moon display area and will not affect other parts of the image.
[0225] Similarly, when adjusting the brightness of the sky, it is necessary to reduce the brightness of the sky in order to highlight the moon and foreground objects. Electronic devices can use a similar method to adjust the brightness of the moon, and due to the presence of a second mask image, the brightness adjustment operation only applies to the sky area.
[0226] In some embodiments, the electronic device may adjust the brightness of foreground objects using a method similar to that used for adjusting the brightness of the moon. Of course, the electronic device may also adjust the brightness according to specific circumstances to ensure that the details of the foreground objects are clearly visible while maintaining harmony with the brightness of the moon and sky.
[0227] For example, an electronic device can use a histogram equalization-based method to locally adjust the brightness of a foreground object. Specifically, the electronic device can perform a masking operation on a first target image based on a third mask image to extract the foreground object region from the first target image; the extracted foreground object image is then subjected to histogram equalization to enhance its contrast and details. Subsequently, the processed foreground object image is merged with other regions of the first target image besides the foreground object image (through a reverse masking operation using the third mask image) to obtain an image with adjusted foreground object brightness.
[0228] It should be noted that the brightness adjustment operations performed by the electronic device on the position of the moon in the first target image, the brightness adjustment operations on the position of the sky, and the brightness adjustment operations on the position of the foreground object in the first target image can be performed simultaneously or not simultaneously. This application embodiment does not impose specific limitations on this.
[0229] In some embodiments, when the brightness adjustment operations for the moon's position in the first target image, the brightness adjustment operations for the sky's position, and the brightness adjustment operations for the foreground object's position in the first target image can be performed simultaneously, the electronic device can perform these operations within the same first target image. In this way, the brightness of the three objects can be adjusted at once to directly obtain the second target image.
[0230] Alternatively, the electronic device adjusts the brightness of the moon's location, the sky's location, and the foreground object's location in the three first target images respectively, to obtain a first adjusted image (the moon's brightness has been adjusted), a second adjusted image (the sky's brightness has been adjusted), and a third adjusted image (the foreground object's brightness has been adjusted); the first adjusted image, the second adjusted image, and the third adjusted image are then fused to obtain the second target image.
[0231] In some embodiments, when the brightness adjustment operations on the position of the moon in the first target image, the brightness adjustment operations on the position of the sky, and the brightness adjustment operations on the position of the foreground object in the first target image are not performed simultaneously, the electronic device may first adjust the brightness of the position of the moon in the first target image to obtain a fourth adjusted image; then adjust the brightness of the position of the sky in the fourth adjusted image to obtain a fifth adjusted image; and finally adjust the foreground object in the fifth adjusted image to obtain a second target image.
[0232] Alternatively, the electronic device can first adjust the brightness of the moon's position in the first target image to obtain the fourth adjusted image; then adjust the brightness of the sky's position in the first target image to obtain the seventh adjusted image; finally adjust the foreground objects in the first target image to obtain the eighth target image; and then merge the fourth, seventh, and eighth adjusted images to obtain the second target image.
[0233] It should be noted that the order in which the electronic device adjusts the brightness of the moon's position, the sky's position, and the foreground object's position in the first target image is variable, and this application embodiment does not impose specific limitations on this.
[0234] It is worth noting that by adjusting the brightness of the moon's position, the sky's position, and the foreground object's position in the first target image respectively, the brightness of different areas of the first target image can be precisely adjusted, ultimately resulting in a high-quality second target image. Furthermore, the brightness distribution of the moon, sky, and foreground object in the second target image is more reasonable, resulting in a better visual effect.
[0235] In some embodiments, the brightness adjustment model described above may include a mask acquisition model, and this application embodiment does not impose specific limitations on this.
[0236] In this embodiment, since the first preview image contains a clear image of the moon, and the clarity of other objects besides the moon in the second preview image is greater than that of other objects besides the moon in the first preview image, and the brightness of the first target image can be adjusted, the second target image obtained by fusing the first and second preview images is an image with high clarity including the moon and other objects. This improves the imaging clarity of other background objects within the same frame as the moon and enhances the image shooting effect. Furthermore, for scenes with moon shaking or partial obstruction, specific processing steps ensure that these visually unaffected issues are eliminated in the final image, thus guaranteeing the display effect of the image in the moon-viewing shooting mode.
[0237] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line, DSL) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer, or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Versatile Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0238] The above-described embodiments are optional embodiments provided by this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the technical scope disclosed in this application should be included within the protection scope of this application.
Claims
1. An image processing method, characterized in that, When applied to electronic devices, the method includes: During the image acquisition process via the first camera of the electronic device, if the electronic device enters the moon-viewing shooting mode, a first preview image and a second preview image are displayed; The first preview image and the second preview image both contain the moon. The second preview image is displayed in the first preview image in a picture-in-picture manner. The exposure of the moon in the first preview image is less than that of the moon in the second preview image. The sharpness of foreground objects other than the moon in the second preview image is greater than that of foreground objects other than the moon in the first preview image. The second preview image contains scenes of moon shaking and / or scenes of the moon being partially obscured. In response to the shooting operation, the first preview image and the second preview image are fused together to obtain the first target image; The brightness of the first target image is adjusted to obtain a second target image. The second target image does not contain the scene of the moon shaking or the scene of the moon being partially obscured.
2. The method as described in claim 1, characterized in that, The step of fusing the first preview image and the second preview image in response to the shooting operation to obtain the first target image includes: In response to the shooting operation, the moon display area in the second preview image is eliminated to obtain the third preview image; The third preview image is fused with the second preview image to obtain the first target image.
3. The method as described in claim 2, characterized in that, In response to the shooting operation, the moon display area in the second preview image is eliminated to obtain a third preview image, including: In response to the shooting operation, the second preview image is input to the moon removal model, which is a pre-trained neural network model for removing the moon and halo present in the image; The moon and its halo are removed from the moon display area using the moon removal model.
4. The method as described in claim 3, characterized in that, Before inputting the second preview image into the moon removal model in response to the shooting operation, the method further includes: Obtain a first training set, which includes multiple first sample images and multiple second sample images. Each of the multiple first sample images includes the moon and a halo in an overexposed state, and the moon size, halo size and / or lunar phase contained in the multiple first sample images are different. Each of the multiple second sample images does not include the moon and a halo, and the multiple first sample images correspond one-to-one with the multiple second sample images. The initial elimination model is iteratively trained based on the first training set; During iterative training, a first loss value is determined between the moon-removed image obtained after each training iteration and the second sample image input each time. If the first loss value converges, the elimination model obtained at the time of convergence is determined as the moon elimination model.
5. The method as described in claim 2, characterized in that, In response to the shooting operation, the moon display area in the second preview image is eliminated to obtain a third preview image, including: In response to the shooting operation, the phase of the moon in the second preview image is identified, and the size of the moon and the size of the halo are determined; The elimination area is determined according to the lunar phase, the size of the moon, and the size of the lunar halo; The objects within the elimination area are eliminated to obtain the third preview image.
6. The method according to any one of claims 1-5, characterized in that, The step of adjusting the brightness of the first target image to obtain the second target image includes: The first target image is input into a brightness adjustment model, which is a pre-trained neural network module. The brightness adjustment model is used to increase the brightness of the moon and foreground objects in the first target image, excluding the sky, and to decrease the brightness of the sky. The brightness of the first target image is adjusted using the brightness adjustment model to obtain the second target image.
7. The method according to any one of claims 1-5, characterized in that, The step of adjusting the brightness of the first target image to obtain the second target image includes: Obtain a first mask image, a second mask image, and a third mask image. The first mask image is the mask image corresponding to the moon in the first target image. The second mask image is the mask image corresponding to the sky in the first target image. The third mask image is the mask image corresponding to the foreground objects in the first target image other than the moon and the sky. Based on the first mask image, adjust the brightness of the position of the moon in the first target image; Based on the second mask image, adjust the brightness of the sky location in the first target image; Based on the third mask image, adjust the brightness of the position of the foreground object in the first target image.
8. The method according to any one of claims 1-7, characterized in that, During the image acquisition process via the first camera of the electronic device, if the electronic device enters the moon-viewing shooting mode, it displays a first preview image and a second preview image, including: During the process of image acquisition through the first camera, if the zoom ratio of the first camera is detected to be greater than or equal to the first zoom ratio threshold, then moon detection is performed on the fourth preview image acquired by the first camera. If the moon is detected in the fourth preview image, the second preview image captured by the second camera of the electronic device is displayed in the fourth preview image in a picture-in-picture manner; The fourth preview image is updated to the first preview image, wherein the exposure of the first preview image is less than that of the fourth preview image.
9. An electronic device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the computer program, the electronic device performs the method as described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the method as described in any one of claims 1-8.
11. A computer program product, characterized in that, Includes a computer program, which, when run, causes the method as described in any one of claims 1-8 to be performed.