Moon photography method, device and electronic equipment

By acquiring moon images of different focal lengths and performing image fusion, the problem of low moon images in the prior art is solved, and high-quality and natural moon images are generated.

CN119788970APending Publication Date: 2025-04-08VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202412000127.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-08

AI Technical Summary

Technical Problem

The prior art, without using professional shooting equipment, is low in image quality when shooting high-quality images of the moon and its surroundings, and the images synthesized by HDR are unnatural.

Method used

By acquiring moon images with different focal lengths, using the surrounding environment in the short focal length image and the moon details in the long focal length image, the image is fused to generate high-quality moon images.

Benefits of technology

It achieves a high-quality image that can not only display clear moon details, but also retains the surrounding environment of the moon, improving the naturalness and overall quality of the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788970A_ABST
    Figure CN119788970A_ABST
Patent Text Reader

Abstract

The present application discloses a moon shooting method, device and electronic device, which belongs to the field of image processing technology. The method comprises: obtaining a first image and a second image of the moon captured by a camera, wherein the shooting focal length of the second image is greater than the shooting focal length of the first image; based on the position of the moon in the first image and the second image, the first image and the second image are image-fused to obtain a moon image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and specifically relates to a moon shooting method, device and electronic equipment. Background Art

[0002] The moon is a favorite subject for many photography enthusiasts, but photographing only the moon is often too monotonous. Photography enthusiasts often want to get a high-quality image that includes both a clear moon and the surrounding environment.

[0003] Without the help of professional shooting equipment, the related technology usually takes multiple frames of photos under different exposure conditions, and then uses multiple frames of HDR synthesis to obtain an image that includes both a clear moon and the surrounding environment. However, the image quality of the HDR synthesis is not natural enough and the image quality is low. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a moon shooting method, device and electronic equipment, which can improve the image quality of the moon image.

[0005] In a first aspect, an embodiment of the present application provides a method for photographing the moon, the method comprising:

[0006] Acquire a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image;

[0007] Based on the positions of the moon in the first image and the second image, the first image and the second image are fused to obtain a moon image.

[0008] In a second aspect, an embodiment of the present application provides a device for photographing the moon, the device comprising:

[0009] An acquisition module, used to acquire a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image;

[0010] A fusion module is used to fuse the first image and the second image based on the position of the moon in the first image and the second image to obtain a moon image.

[0011] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the method provided in the first aspect are implemented.

[0012] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method provided in the first aspect are implemented.

[0013] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method provided in the first aspect.

[0014] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method provided in the first aspect.

[0015] In the moon shooting method, device and electronic device of the present application, the moon can be photographed with different focal lengths to obtain a second image shot with a long focus and a first image shot with a short focus, and then the position of the moon is located in the first image and the second image respectively. Based on the position of the moon in the first image and the second image, the clear moon in the second image is fused with the moon in the first image to obtain a moon image, and the moon details in the second image are combined with the photographed objects in the surrounding environment of the moon in the first image, so that the moon image can show clear moon details and retain the photographed objects in the surrounding environment of the moon in the first image, thereby improving the image quality of the fused moon image. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a flowchart of a moon photographing method provided by some embodiments of the present application;

[0017] Figure 2 is a schematic diagram of a shooting preview interface of a moon shooting method provided in some embodiments of the present application;

[0018] Figure 3 is a schematic diagram of a shooting preview interface of a moon shooting method provided in some embodiments of the present application;

[0019] Figure 4 is a schematic diagram of an interface of an image processing interface of a moon photographing method provided in some embodiments of the present application;

[0020] Figure 5 is a schematic diagram of an interface of an image processing interface of a moon photographing method provided in some embodiments of the present application;

[0021] Figure 6 is a schematic diagram of an interface of an image processing interface of a moon photographing method provided in some embodiments of the present application;

[0022] Figure 7is a schematic diagram of an interface of an image processing interface of a moon photographing method provided in some embodiments of the present application;

[0023] Figure 8 is a schematic diagram of the structure of a moon photographing device provided in some embodiments of the present application;

[0024] Fig. 9 is a schematic diagram of the structure of an electronic device provided by some embodiments of the present application;

[0025] Fig.10 It is a schematic diagram of the hardware structure of the electronic device provided in some embodiments of the present application. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.

[0027] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the terms used in this way are interchangeable where appropriate, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0028] The control in the embodiments of the present application (usually referred to as a "component", "UI control", widget or control) is a graphical user interface element, which is a basic building block of the user interface, such as a window or text box, displayed in the program interface of any application. The control can be a button, text box, label, etc., which can receive user input and respond to events.

[0029] In order to solve the above technical problems, the present application provides a method for photographing the moon. The following is a detailed description of the method for photographing the moon provided by the present application embodiment through specific embodiments and application scenarios in conjunction with the accompanying drawings.

[0030] like Figure 1 As shown, Figure 1 : is a flow chart of a moon photographing method provided by an embodiment of the present application. The present application embodiment provides a moon photographing method, which may include:

[0031] Step 101, obtaining a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image;

[0032] In an embodiment of the present application, the camera may include a telephoto lens and a short focal length lens. The first image may be an image obtained by photographing the moon through a short focal length lens. Since the shooting focal length of the first image is relatively short, the shooting angle of the first image is relatively wide, and the first image can relatively completely capture the shooting object in the surrounding environment of the moon, wherein the shooting object includes but is not limited to people, plants, buildings and animals, but the moon image in the first image may lack details. The second image may be an image obtained by photographing the moon through a telephoto lens. Since the shooting focal length of the second image is relatively long, the second image can capture more details and textures of the moon, but since the shooting angle of the second image is relatively narrow, the shooting object in the surrounding environment of the moon cannot be photographed.

[0033] Specifically, in some embodiments, step 101 includes:

[0034] Displaying a shooting preview interface, wherein the shooting preview interface includes the moon;

[0035] receiving a first shooting control input;

[0036] In response to the first shooting control input, collecting a first image of the moon through a camera;

[0037] Receiving a focus input on the shooting preview interface;

[0038] In response to the focus input, enlarging and displaying the moon in the shooting preview interface;

[0039] receiving a second shooting control input;

[0040] In response to the second shooting control input, a second image of the moon is captured by the camera.

[0041] In an embodiment of the present application, the shooting preview interface is a user interface of a camera device that displays a shooting picture in real time, and is used to provide a framing and composition reference before shooting. After the user observes a picture containing the moon in the shooting preview interface, a first image of the moon can be captured through a first shooting control input.

[0042] Among them, the first shooting control input can be a touch input of the electronic device by the user through a finger or a touch device such as a stylus, for example, the touch input can be a touch click operation, or a sliding operation, or other operations. The first shooting control input can also be an input operation performed by the user with the help of other input devices such as a mouse, a remote control device, a keyboard, etc. connected to the first electronic device. In some embodiments of the present application, the above-mentioned first shooting control input is used to instruct the camera to collect the first image of the moon, and the first shooting control input can be a second operation. Exemplarily, the above-mentioned first shooting control input includes but is not limited to: the user touch input of the first shooting control in the shooting preview interface through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs, which can be determined according to actual use requirements, and the embodiment of the present invention is not limited. The specific gesture in the embodiment of the present application can be any one of a single-click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double press gesture, and a double-click gesture; the click input in the embodiment of the present application can be a single-click input, a double-click input, or any number of click inputs, etc., and can also be a long press input or a short press input. For example, the first shooting control input may be: a click input of the user on the first shooting control in the shooting preview interface.

[0043] Subsequently, after acquiring the first image of the moon, the user may adjust the focal length of the shooting preview interface through the focus input, and magnify the moon in the shooting preview interface so as to capture the detailed features of the moon more clearly.

[0044] Among them, the focus input can be a touch input of the electronic device by the user through a finger or a touch device such as a stylus, for example, the touch input can be a touch click operation, or a sliding operation, or other operations. The focus input can also be an input operation performed by the user with the help of other input devices such as a mouse, a remote control device, a keyboard, etc. connected to the first electronic device. In some embodiments of the present application, the above-mentioned focus input is used to indicate the adjustment of the focal length of the camera, and the focus input can be a third operation. Exemplarily, the above-mentioned focus input includes but is not limited to: the user touch input of the focus control in the shooting preview interface through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined according to actual use requirements, and the embodiment of the present invention is not limited. The specific gesture in the embodiment of the present application can be any one of a single-click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double-press gesture, and a double-click gesture; the click input in the embodiment of the present application can be a single-click input, a double-click input, or any number of click inputs, etc., and can also be a long press input or a short press input. For example, the above-mentioned focus input may be: a user sliding input on a focus slider on a focal length bar control in a shooting preview interface.

[0045] After the moon is magnified and displayed, the user can perform a second shooting control input on the shooting preview interface to capture a second image of the moon, which records detailed information of the moon at a higher magnification.

[0046] Among them, the second shooting control input can be a touch input of the electronic device by the user through a finger or a touch device such as a stylus, for example, the touch input can be a touch click operation, or a sliding operation, or other operations. The second shooting control input can also be an input operation performed by the user with the help of other input devices such as a mouse, a remote control device, a keyboard, etc. connected to the first electronic device. In some embodiments of the present application, the above-mentioned second shooting control input is used to instruct the camera to collect a second image of the moon, and the second shooting control input can be a fourth operation. Exemplarily, the above-mentioned second shooting control input includes but is not limited to: a touch input of the second shooting control in the shooting preview interface by a user through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs, which can be determined according to actual use requirements, and the embodiment of the present invention is not limited. The specific gesture in the embodiment of the present application can be any one of a single-click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double press gesture, and a double-click gesture; the click input in the embodiment of the present application can be a single-click input, a double-click input, or any number of click inputs, etc., and can also be a long press input or a short press input. For example, the second shooting control input may be: a click input of the user on the second shooting control in the shooting preview interface.

[0047] As an optional embodiment, the electronic device may include a main camera and a sub-camera, the main camera being a short-focus camera, and the sub-camera being a long-focus camera. First, the shooting mode may be started through the main camera, at which time the electronic device displays a shooting preview interface, and the user adjusts the angle and composition through the viewfinder to ensure that the shooting objects in the moon and the surrounding environment of the moon in the scene are appropriate. Under appropriate circumstances, a first shooting control input is made to the shooting preview interface to control the acquisition of a first image of the moon through the main camera, and then the first image shot may be pre-processed by noise reduction, brightness adjustment, and contrast enhancement, and then the image analysis algorithm is used to detect the position of the moon in the first image.

[0048] Specifically, the image analysis algorithm may include a color and edge-based image analysis algorithm, a feature-based matching algorithm, and a template matching algorithm.

[0049] For example, in an image analysis algorithm based on color and edge, the color features of the moon in the first image may be extracted first, and then the boundary of the moon in the first image may be accurately located through an edge detection algorithm, and finally the position of the moon in the first image may be determined.

[0050] Afterwards, you can input the focus on the shooting preview interface, and the system will start the telephoto camera, which is the secondary camera. The user then adjusts the viewfinder of the secondary camera and uses the secondary camera to focus on the moon. If the layout is appropriate, the user inputs the second shooting control on the shooting preview interface to capture the second image.

[0051] Among them, the third shooting control input can be a touch input of the electronic device by the user through a finger or a touch device such as a stylus, for example, the touch input can be a touch click operation, or a sliding operation, or other operations. The third shooting control input can also be an input operation performed by the user with the help of other input devices such as a mouse, a remote control device, a keyboard, etc. connected to the first electronic device. In some embodiments of the present application, the above-mentioned third shooting control input is used to instruct the camera to simultaneously capture the first image and the second image of the moon at different focal lengths, and the third shooting control input can be the fifth operation. Exemplarily, the above-mentioned third shooting control input includes but is not limited to: the user touch input of the third shooting control in the shooting preview interface through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible inputs, which can be determined according to actual use requirements, and the embodiment of the present invention is not limited. The specific gesture in the embodiment of the present application can be any one of a single-click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double press gesture, and a double-click gesture; the click input in the embodiment of the present application can be a single-click input, a double-click input, or any number of click inputs, etc., and can also be a long press input or a short press input. For example, the third shooting control input may be: a click input of the user on the third shooting control in the shooting preview interface.

[0052] For example, the initial shooting preview interface is as follows Figure 2As shown, the shooting preview interface of the electronic device includes a shooting preview frame and a shooting control 202, wherein the shooting preview frame is used to display the image obtained by the camera in real time, and the shooting control 202 is used to control the camera of the electronic device to shoot the image. The electronic device is also provided with two physical buttons, namely, a volume up key 203 and a volume down key, wherein the basic function of the volume up key 203 is to increase the volume of the incoming call ringtone, audio or video, and the basic function of the volume down key is to reduce the volume of the incoming call ringtone, audio or video. The user can observe the picture containing the moon and the shooting object in the surrounding environment of the moon through the image displayed in the shooting preview frame, and then the user can make a first shooting control input to the shooting control to control the short-focus first camera of the electronic device to capture the first image 201 of the moon. Among them, the initial shooting preview interface refers to the original shooting preview interface that the user has not processed or adjusted after entering the shooting preview interface. When the electronic device displays the shooting preview interface, the volume up key 203 is also used to focus to enlarge the image in the shooting preview frame.

[0053] Then, the user can input the volume up key 203 of the electronic device to adjust the focus so as to enlarge the moon in the shooting preview frame. The focusing input can be input by short pressing the volume up key 203. Figure 3 As shown in the shooting preview box, due to the increase in focal length, the area of ​​the moon in the shooting preview box becomes larger, the texture and details of the moon become clearer, and the shooting objects in the surrounding environment of the moon cannot be displayed in the shooting preview box. Similarly, the user can make a second shooting control input to the shooting control 202 to control the second camera with a long focal length of the electronic device to capture a second image 301 of the moon.

[0054] In this way, by collecting two images at different focal lengths respectively, the global perspective and local details of the moon can be accurately obtained, and then by fusing the first image and the second image, a clearer and more delicate image of the moon can be generated.

[0055] Specifically, in some embodiments, step 101 includes:

[0056] Displaying a shooting preview interface, wherein the shooting preview interface includes the moon;

[0057] receiving a third shooting control input;

[0058] In response to the third shooting control input, a first image of the moon is captured by the first camera, and a second image of the moon is captured by the second camera;

[0059] Wherein, the focal length of the first camera is smaller than the focal length of the second camera.

[0060] In an embodiment of the present application, after the electronic device displays the shooting preview interface, the user can adjust the angle and composition through the viewfinder until the moon displayed in the shooting preview interface and the shooting objects in the moon's surrounding environment meet the user's needs, and the user can make a third shooting control input to the shooting preview interface.

[0061] In response to the third shooting control input, the electronic device can shoot a first image of the moon with a smaller focal length to capture a wider range of background information, while the second camera shoots a second image of the moon with a larger focal length to obtain a close-up of the details of the moon.

[0062] For example, the electronic device includes a first camera and a second camera, the first camera is a short focal length camera, and the second camera is a variable focal length camera. The moon and the photographed objects in the surrounding environment of the moon can be displayed in the shooting preview interface of the electronic device. When the displayed moon and the photographed objects in the surrounding environment of the moon meet the needs of the user, the user can make a third shooting control input to the shooting preview interface, and the electronic device can shoot a first image of the moon with a smaller focal length through the first camera in response to the third shooting control input.

[0063] Then, the electronic device can automatically adjust the focal length of the second camera, gradually zoom in the picture, and focus more on the details of the moon itself. In addition, when the focal length of the second camera is adjusted, the focus of the lens of the second camera is also automatically adjusted to ensure that the focus can always be on the moon, so that the moon always remains clear. After the zoom is completed, the second image of the moon can be captured with a larger focal length through the second camera.

[0064] In this way, the characteristics of dual cameras in electronic devices can be fully utilized, and the global view and local close-up can be collected in one shot, which is helpful for the subsequent multi-resolution fusion of images. Compared with the method of switching the focal length of a single camera, this solution greatly improves the shooting efficiency and can capture images of the moon from different perspectives at the same time.

[0065] Step 102: Based on the positions of the moon in the first image and the second image, the first image and the second image are fused to obtain a moon image.

[0066] In the embodiment of the present application, after the first image is captured, the specific position of the moon in the first image and the second image can be determined by analyzing the first image and the second image respectively.

[0067] After determining the specific positions of the moon in the first image and the second image, since the second image is taken with a long focal length, the moon in the second image includes clear moon details, while the first image is taken with a short focal length, so the first image also includes the photographed objects in the surrounding environment of the photographed moon. Based on the positions of the moon in the first image and the second image, the second image and the first image can be fused.

[0068] In the process of image fusion, the image fusion algorithm can be used to seamlessly combine the clear moon in the moon area with the surrounding environment in the first image, so that the fused moon image is naturally connected in brightness, texture and details, and looks like a complete scene. In this way, a high-quality moon image that contains both a clear moon and a natural environment can be obtained.

[0069] Specifically, in some embodiments, step 102 further includes:

[0070] Determine the position of the moon; wherein the position of the moon is the position of the moon in the first image;

[0071] Cropping the second image to obtain an image to be fused, wherein the image to be fused is an image of the moon region in the second image; wherein the moon region is an image region where the moon is located in the second image;

[0072] The image to be fused is fused to the moon position in the first image to obtain a moon image.

[0073] In the embodiment of the present application, the position of the moon in the first image, that is, the moon position, may be determined first.

[0074] Specifically, in some embodiments, determining the position of the moon includes:

[0075] Determine N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold;

[0076] When the N overexposed pixels form a connected area, the center of gravity position of the connected area is determined as the moon position.

[0077] In the embodiment of the present application, overexposed pixels refer to pixels in the image whose brightness value exceeds a certain threshold, which usually appear as very bright or even pure white areas. The connected area composed of overexposed pixels refers to a continuous area in which adjacent pixels in the image all satisfy a brightness value greater than a specified threshold. Since the background area is usually darker during night scene shooting and the brightness of the moon is much higher than its background environment, the area where the moon is located can be determined by determining the overexposed pixels in the first image and the connected area composed of the overexposed pixels.

[0078] Specifically, the brightness value of each pixel in the first image can be calculated according to the R, G, and B three-channel values ​​of the pixel. The range of R, G, and B is 0 to 255, and the calculation formula of the brightness value can be:

[0079] Y=0.229R+0.587G+0.114B (1)

[0080] Among them, Y is used to represent the brightness value of the pixel.

[0081] Through the above formula, the conversion from RGB space to brightness can be realized, and the brightness value can simplify the color information, reducing the dimension from three-channel data to single-channel data, which is convenient for storage and calculation, and thus convenient for subsequent processing.

[0082] After calculating the brightness value of each pixel, the brightness value of each pixel can be compared with a preset first threshold. If the brightness value of a pixel is greater than the first threshold, the pixel can be determined as an overexposed pixel. The value range of the first threshold can be [210, 240].

[0083] For example, the first threshold can be set to 230. For a pure red pixel, that is, a pixel with R of 255, G of 0, and B of 0, the brightness value of the pixel can be calculated to be 58.395. Since it is less than the first threshold, the pixel is not an overexposed pixel. For another pixel, the R and G of the pixel are both 250, and B is 240. According to the calculation formula of the brightness value, the brightness value Y of the pixel can be calculated to be 231.36, which is greater than the first threshold, so the pixel is an overexposed pixel.

[0084] After all the overexposed pixels in the first image are obtained, morphological processing can be performed on all the overexposed pixels in the image to eliminate isolated overexposed pixels and obtain a complete connected region composed of overexposed pixels. Each connected region is composed of a plurality of adjacent overexposed pixels. The morphological processing can include erosion and dilation. Through erosion, isolated overexposed pixels can be regarded as noise and removed, and through dilation, the boundaries of overexposed pixels can be expanded to enhance the connectivity of the region composed of overexposed pixels.

[0085] After the connected region composed of overexposed pixels is determined, if there is only one connected region, the centroid position of the connected region can be directly determined as the position of the moon in the first image.

[0086] In the embodiment of the present application, in the scene of night scene shooting, the connected area of ​​overexposed pixels can be identified and the center of gravity of the connected area can be calculated to accurately locate the position of the moon in the image, thereby simplifying the detection process of the moon position. This method improves the efficiency and accuracy of moon position recognition.

[0087] In some embodiments, after determining N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold, the method further includes:

[0088] In a case where the N overexposed pixel points form at least two connected areas, the centroid position of the connected area with the highest roundness among the at least two connected areas is determined as the moon position.

[0089] In the embodiment of the present application, if the connected areas formed by N overexposed pixels in the first image include at least two, the circularity of each connected area can be calculated to screen the connected area closest to a circle, and the connected area closest to a circle is determined as the position of the moon in the first image. The calculation formula of the circularity can be:

[0090]

[0091] Among them, AreaL is used to characterize the perimeter of the connected region, AreaS is used to characterize the area of ​​the connected region, and C is used to characterize the circularity of the connected region. The closer the circularity is to 1, the closer the connected region is to a circle.

[0092] The circularity calculation formula (2) can be used to combine the perimeter and area of ​​the connected region to effectively evaluate the shape characteristics of the connected region. Since a circularity close to 1 indicates that the region shape is close to a circle, circularity is helpful to accurately identify the position of the moon in the first image.

[0093] For example, assuming that the perimeter of a connected region of an overexposed pixel in the first image is 31.4 and the area is 25, then the roundness of the connected region is approximately equal to 1; while the perimeter of another connected region is 50 and the area is 25, the roundness of the connected region is 0.63.

[0094] After determining the circularity of each connected area in the first image, the connected area with the highest circularity can be further determined, and the center of gravity position of the connected area with the highest circularity is calculated, and the center of gravity position of the connected area with the highest circularity is determined as the position of the moon in the first image.

[0095] For example, if the first image includes a connected region consisting of two overexposed pixels, the perimeter of the connected region of the first overexposed pixel is 31.4 and the area is 25, so the circularity of the connected region is approximately equal to 1; while the perimeter of the second connected region is 50 and the area is 25, and the circularity of the connected region is 0.63. Since the circularity of the first connected region is closer to 1, the center of gravity of the first connected region can be determined as the position of the moon.

[0096] In the above method, the overexposed pixels in the first image can be screened out by the first threshold of brightness, and multiple connected regions composed of the overexposed pixels can be determined. The connected region that best matches the shape of the moon is selected from the multiple connected regions by calculating the circularity of the connected regions as the region where the moon is located, thereby accurately determining the position of the moon in the first image.

[0097] Furthermore, in some embodiments, determining the position of the moon includes:

[0098] receiving a first input of the first image by a user;

[0099] In response to the first input, an input position of the first input is determined as a moon position.

[0100] In an embodiment of the present application, after a first image including the moon is captured, the first image can be displayed on a display interface of an electronic device. A user can make a first input for the position of the moon in the first image, and in response to the first input, the system can determine the position indicated by the user's first input as the moon position where the moon is located.

[0101] Among them, the first input can be a touch input of the electronic device by the user through a finger or a touch device such as a stylus, for example, the touch input can be a touch click operation, or a sliding operation, or other operations. The first input can also be an input operation performed by the user with the help of other input devices such as a mouse, a remote control device, a keyboard, etc. connected to the first electronic device. In the embodiment of the present application, the first input can be an input indicating the position of the moon in the first image. In some embodiments of the present application, the above-mentioned first input is used to indicate the position of the moon in the first image, and the first input can be a first operation. Exemplarily, the above-mentioned first input includes but is not limited to: the user touch input of the position of the moon in the first image through a touch device such as a finger or a stylus, or a voice command input by the user, or a specific gesture input by the user, or other feasible input, which can be determined according to actual use requirements, and the embodiment of the present invention is not limited. The specific gesture in the embodiment of the present application can be any one of a single-click gesture, a sliding gesture, a drag gesture, a pressure recognition gesture, a long press gesture, an area change gesture, a double-press gesture, and a double-click gesture; the click input in the embodiment of the present application can be a single-click input, a double-click input, or any number of click inputs, etc., and can also be a long press input or a short press input. For example, the first input mentioned above may be: a click input by the user on the position of the moon in the first image.

[0102] Through the above method, the user can quickly and accurately indicate the location of the moon image directly in the electronic device.

[0103] After the position of the moon in the first image is determined in the above manner, the moon area in the second image may also be determined.

[0104] In the present application embodiment, Figure 3 As shown in FIG. 1 , since the second image 301 is obtained by shooting with a long focal length, the area occupied by the moon in the second image is relatively large, that is, the moon region 302 in the second image is large, so the moon region where the moon is located can be determined from the second image, and as shown in FIG. Figure 6 As shown, the image of the moon region 302 is cropped from the second image to obtain the image 601 to be fused.

[0105] Specifically, in some embodiments, before cropping the second image to obtain the image to be fused, the method further includes:

[0106] Determine pixels in the second image whose brightness values ​​are greater than a second threshold as foreground pixels, and determine pixels in the second image whose brightness values ​​are less than or equal to the second threshold as background pixels;

[0107] Performing a morphological operation on foreground pixels in the second image to obtain a mask area covering the foreground pixels;

[0108] The moon region is determined according to the mask region.

[0109] In the embodiment of the present application, after the second image is captured, the brightness value of each pixel in the second image can also be calculated, and then the second threshold of brightness is dynamically selected by Otsu's Method. Pixels with brightness values ​​greater than the second threshold are determined as foreground pixels, and pixels with brightness values ​​less than or equal to the second threshold in the second image are determined as background pixels.

[0110] After distinguishing the foreground pixels and the background pixels in the second image, morphological operations can be performed on the foreground pixels in the second image. For example, the foreground pixels can be first dilated to expand the connected area composed of the foreground pixels and fill the small holes that may exist on the surface of the moon. Then, the foreground pixels are eroded to shrink the boundaries of the connected area composed of the foreground pixels to remove noise and irregular parts in the second image and obtain a clear and complete mask area.

[0111] Subsequently, the mask area can be used as the moon area, or an area including the mask area can be determined as the moon area according to the set rules. The moon area is the area where the moon is located in the second image. After determining the moon area, the moon area can be cropped out from the original second image to obtain the image to be fused.

[0112] In the above method, the pixels of the moon in the second image can be determined as foreground pixels by comparing the brightness values ​​of each pixel, so as to separate the area where the moon image is located from the background. Then, the foreground pixels are further optimized in combination with morphological operations to eliminate noise and generate a complete moon mask area, and finally the mask area is determined as the moon area where the moon image is located. This method can accurately locate the moon area from the second image.

[0113] In some embodiments, determining the moon region according to the mask region includes:

[0114] Determine the mask area as the moon area;

[0115] Alternatively, the smallest rectangular area in the second image that includes the mask area is determined as the moon area.

[0116] In the embodiment of the present application, since the mask area can cover the moon in the second image, the mask area can be directly determined as the moon area in the second image, or the mask area can be extended to a certain extent to obtain the moon area.

[0117] Specifically, since the moon is round, the foreground area composed of foreground pixels in the second image is also an area approximately circular. After performing morphological operations on the foreground pixels, the obtained mask area is often an irregular shape close to a circle.

[0118] Since the mask area is an irregular shape close to a circle, if the mask area is directly extracted from the second image, a lot of computing power will be consumed and the extraction accuracy will be low. Therefore, the minimum rectangular frame of the mask area can be calculated, the mask area can be wrapped with the minimum rectangular frame, and the minimum rectangular area containing the mask area where the minimum rectangular frame is located is determined as the moon area.

[0119] like Figure 3 As shown, Figure 3 For the second image 301 including the moon, morphological processing can be performed on the foreground pixels in the second image to obtain Figure 4 The second image 401 after binarization is shown. Figure 4 In the binary image, the brightness value of the mask area is 1, and the brightness value of the background outside the mask area is 0. Since the mask area is an irregular shape close to a circle, it can be Figure 5 As shown in the second image 501 in FIG. 1 , a minimum rectangular frame 502 including the mask area is calculated as the final moon area.

[0120] Then, in the process of extracting the area where the moon image is located from the second image, the mask area can be directly and efficiently determined as the moon area, or the minimum rectangular area containing the mask area can be determined as the moon area. In this way, only simple standard geometric figures, that is, the minimum rectangular area, are extracted from the second figure; directly processing the irregular shape area of ​​the load is avoided, the computational complexity of the extraction is reduced, and at the same time, complete coverage of the moon image can be guaranteed.

[0121] In some embodiments, after determining the pixels in the second image whose brightness values ​​are greater than the second threshold as foreground pixels, and determining the pixels in the second image whose brightness values ​​are less than or equal to the second threshold as background pixels, the method further includes:

[0122] Binarizing the second image to obtain a binary image; wherein the pixel value of the foreground pixel is set to a first value, and the pixel value of the background pixel is set to a second value, and the first value is greater than the second value;

[0123] A morphological operation is performed on pixel points in the binary image whose pixel values ​​are the first value to obtain a mask area.

[0124] In an embodiment of the present application, after distinguishing the foreground pixels from the background pixels based on the brightness values ​​in the second image, morphological operations can be performed directly on the foreground pixels on the second image, or the second image can be binarized to obtain a binary image, and the moon area can be screened out in the binary image.

[0125] For example, during the binarization process, the first value may be 1 and the second value may be 0, that is, the pixel value of the foreground pixel in the second image may be set to 1 and the pixel value of the background pixel may be set to 0, thus obtaining a binarized image. Then, a morphological operation may be performed on the pixel with a pixel value of 1 in the binarized image to obtain a mask area, and then the moon area may be determined based on the mask area.

[0126] For another example, during the binarization process, the first value may be 0.2 and the second value may be 0.8, that is, the pixel value of the foreground pixel in the second image may be set to 0.2 and the pixel value of the background pixel may be set to 0.8, thus obtaining a binarized image. Then, a morphological operation may be performed on the pixel with a pixel value of 0.2 in the binarized image to obtain a mask region, and then the moon region may be determined based on the mask region.

[0127] In the above manner, binarization processing can more clearly distinguish the foreground and background in the image. Since the second image is an RGB image, subsequent operations directly performed on the original second image to determine the moon area may be affected by the complexity of the pixel values, resulting in unstable processing results or difficulty in accurately distinguishing the mask area. Binarization processing can simplify subsequent operations by setting a unified pixel value, making the image processing algorithm more efficient.

[0128] After determining the position of the moon in the first image and cropping the image to be fused including the moon region from the second image, the image to be fused can be fused to the position of the moon in the first image to obtain the moon image.

[0129] Specifically, after locating the moon position from the first image and cropping the image to be fused including the moon area from the second image, since the moon area in the image to be fused comes from the telephoto shooting of the second image and contains clear moon details, and the moon position in the first image is the precise position of the moon in the first image, the image to be fused can be fused to the moon position of the first image, and the image to be fused and the first image are fused to ensure that in the fused moon image, the clear area of ​​the moon in the second image accurately covers the moon position in the first image.

[0130] In the fusion process, the image fusion algorithm can be used to seamlessly combine the clear moon in the moon area of ​​the second image with the surrounding environment in the first image, so that the fused moon image is naturally connected in brightness, texture and details, and looks like a complete scene. In this way, a high-quality moon image that contains both a clear moon and a natural environment can be obtained.

[0131] Specifically, in some embodiments, fusing the image to be fused to the moon position in the first image to obtain the moon image includes:

[0132] Performing image alignment processing on the image to be fused and the first image so that the center point of the image to be fused coincides with the position of the moon;

[0133] The image to be fused after the image alignment process is fused to the moon position in the first image to obtain a moon image.

[0134] In the embodiment of the present application, the image to be fused and the first image may be first aligned to make the center point of the image to be fused coincide with the position of the moon, thereby achieving accurate spatial positioning.

[0135] Specifically, during the image alignment process, the position of the moon in the first image can be used as a reference point, and the center of gravity of the image to be fused can be determined as the corresponding alignment point. Then, the alignment point of the image to be fused is made to coincide with the position of the moon in the first image, thereby achieving alignment of the image to be fused and the first image.

[0136] Subsequently, the aligned image to be fused can be replaced or superimposed on the position of the moon in the first image to complete the image fusion operation. This method can ensure that the image to be fused and the position of the moon are visually seamlessly connected, improve the accuracy of the fusion result, and obtain a moon image with a natural fusion effect, which is suitable for the enhancement of moon images or special effects production scenes.

[0137] For example, the first image and the image to be fused can be fused by Poisson fusion. Poisson fusion is an algorithm that makes image splicing natural through gradient reconstruction, which can adjust pixel values ​​by using gradient field information of the target area and the background area to achieve seamless transition of brightness and edges between the area and the overall image.

[0138] Specifically, first, the gradient field of the moon region in the image to be fused and the gradient field outside the region to be fused in the first image can be calculated respectively, and the gradient field can be calculated by convolution using a first-order operator. The gradient field can represent the direction and magnitude of brightness change.

[0139] For example, the first-order operator can be a sobel operator, such as Figure 6 As shown, R1 represents the original image to be fused 601, Gx and Gy represent the edge gradients in the horizontal direction and the vertical direction respectively, and the convolution calculation formula is as follows:

[0140]

[0141]

[0142] Since Gx and Gy represent the edge gradients in the horizontal and vertical directions respectively, the gradient field of the image can be approximately calculated using the following formula.

[0143]

[0144] Among them, G is the gradient field of the moon area.

[0145] Through the calculation formula of the gradient field above, the Sobel operator can be used to calculate the edge gradients of the image in the horizontal and vertical directions respectively, and the edge strength of the image can be obtained by synthesizing the gradient. In this way, the edge features of the moon can be accurately extracted, thereby detecting the contour of the moon area and improving the accuracy and clarity of image processing.

[0146] After obtaining the gradient field of the moon region in the image to be fused, the gradient field outside the area to be fused in the first image can be calculated in the same way, and the gradient field of the moon region is superimposed with the gradient field outside the area to be fused in the first image to generate a superimposed gradient field of the fused moon image. The divergence of the fused area in the moon image is calculated based on the superimposed gradient field. The divergence can describe the trend of the brightness change of each pixel in the fused area. After obtaining the divergence, the system will calculate the brightness value of each point in the entire fused area pixel by pixel, so that the brightness change in the area meets the requirements of the gradient field, and construct the fused area based on the calculated brightness value of the pixel points in the fused area, and use the fused area to replace the original area to be fused in the first image, so that the replaced fused area contains both the details of the moon area in terms of brightness and texture, and is consistent with the background of the first image.

[0147] Specifically, the Poisson equation can be used to construct the fusion area, and the pixel value of the fusion area is adjusted by taking the superimposed gradient field as a constraint. The Poisson equation is:

[0148] Ax=b (6)

[0149] Among them, A is a sparse matrix representing the relationship between pixels in the fusion area, and b is a constraint condition based on the superimposed gradient field.

[0150] For example, Figure 7 As shown, Figure 7 The moon image 701 in FIG. 7 is the fused moon image, in which the region to be fused in the first image is covered by the image to be fused obtained by cutting during the fusion process. Therefore, the moon image includes both the details of the moon in the second image and the photographed objects in the surrounding environment of the moon in the first image.

[0151] In this way, the clear moon in the second image can be accurately aligned with the position of the moon in the first image, and a seamless connection of brightness and details can be achieved during the fusion process.

[0152] In an embodiment of the present application, the moon can be photographed using different focal lengths to obtain a second image photographed with a long focal length and a first image photographed with a short focal length. The moon image is then located in the first image and the second image, respectively. The clear moon area in the second image is aligned with the moon position in the first image to perform image fusion to obtain a moon image. The moon details in the second image and the photographed objects in the surrounding environment of the moon in the first image are combined, so that the moon image can show clear moon details and retain the photographed objects in the surrounding environment of the moon in the first image, thereby improving the image quality of the fused moon image.

[0153] Figure 8FIG. 8 is a schematic diagram of a moon photographing device 800 provided in another embodiment of the present application. Figure 8 As shown, the moon shooting device may include:

[0154] An acquisition module 801 is used to acquire a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image;

[0155] The fusion module 802 is used to fuse the first image and the second image based on the position of the moon in the first image and the second image to obtain a moon image.

[0156] In the present application, the moon can be photographed using different focal lengths to obtain a second image photographed with a long focal length and a first image photographed with a short focal length. The position of the moon is then located in the first image and the second image, respectively. Based on the position of the moon in the first image and the second image, the clear moon in the second image is fused with the moon in the first image to obtain a moon image. The moon details in the second image are combined with the photographed objects in the surrounding environment of the moon in the first image, so that the moon image can show clear moon details and retain the photographed objects in the surrounding environment of the moon in the first image, thereby improving the image quality of the fused moon image.

[0157] In another optional example, the fusion module 802 is specifically used for:

[0158] Determine the position of the moon; wherein the position of the moon is the position of the moon in the first image;

[0159] Cropping the second image to obtain an image to be fused, wherein the image to be fused is an image of the moon region in the second image; wherein the moon region is an image region where the moon is located in the second image;

[0160] The image to be fused is fused to the moon position in the first image to obtain a moon image.

[0161] In another optional example, the acquisition module 801 is specifically used for:

[0162] Displaying a shooting preview interface, wherein the shooting preview interface includes the moon;

[0163] receiving a first shooting control input;

[0164] In response to the first shooting control input, collecting a first image of the moon through a camera;

[0165] Receiving a focus input on the shooting preview interface;

[0166] In response to the focus input, enlarging and displaying the moon in the shooting preview interface;

[0167] receiving a second shooting control input;

[0168] In response to the second shooting control input, a second image of the moon is captured by the camera.

[0169] In another optional example, the acquisition module 801 is specifically used for:

[0170] Displaying a shooting preview interface, wherein the shooting preview interface includes the moon;

[0171] receiving a third shooting control input;

[0172] In response to the third shooting control input, a first image of the moon is captured by the first camera, and a second image of the moon is captured by the second camera;

[0173] Wherein, the focal length of the first camera is smaller than the focal length of the second camera.

[0174] In another optional example, the fusion module 802 is specifically used for:

[0175] Determine N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold;

[0176] When the N overexposed pixels form a connected area, the center of gravity position of the connected area is determined as the moon position.

[0177] In another optional example, the moon photographing device further includes:

[0178] A processing module is used to determine the center of gravity position of the connected area with the highest roundness among the at least two connected areas as the moon position when the N overexposed pixel points form at least two connected areas.

[0179] In another optional example, the fusion module 802 is specifically used for:

[0180] receiving a first input of the first image by a user;

[0181] In response to the first input, an input position of the first input is determined as a moon position.

[0182] In another optional example, the moon photographing device further includes:

[0183] a processing module, configured to determine pixel points in the second image whose brightness value is greater than a second threshold as foreground pixel points, and to determine pixel points in the second image whose brightness value is less than or equal to the second threshold as background pixel points;

[0184] A processing module, configured to perform a morphological operation on the foreground pixels in the second image to obtain a mask area covering the foreground pixels;

[0185] The processing module is used to determine the moon area according to the mask area.

[0186] In another optional example, the processing module is specifically used for:

[0187] Determine the mask area as the area where the moon is located;

[0188] Alternatively, the smallest rectangular area in the second image that includes the mask area is determined as the moon area.

[0189] In another optional example, the processing module is specifically used for:

[0190] Binarizing the second image to obtain a binary image; wherein the pixel value of the foreground pixel is set to a first value, and the pixel value of the background pixel is set to a second value, and the first value is greater than the second value;

[0191] A morphological operation is performed on pixel points in the binary image whose pixel values ​​are the first value to obtain a mask area.

[0192] In another optional example, the fusion module 802 is specifically used for:

[0193] Performing image alignment processing on the image to be fused and the first image so that the center point of the image to be fused coincides with the position of the moon;

[0194] The image to be fused after the image alignment process is fused to the moon position in the first image to obtain a moon image.

[0195] The moon shooting device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a car-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., and the embodiment of the present application does not specifically limit it.

[0196] The moon shooting device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0197] The moon shooting device provided in the embodiment of the present application can achieve Figure 1 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0198] Alternatively, if Fig. 9 As shown, an embodiment of the present application further provides an electronic device 100, including a processor 110, a memory 119, and a program or instruction stored in the memory 119 and executable on the processor 110. When the program or instruction is executed by the processor 110, each process of the above-mentioned moon photographing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0199] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0200] Please refer to Fig.10 , Fig.10 The hardware structure diagram of an electronic device for implementing an embodiment of the present application is shown in FIG. The electronic device 100 includes, but is not limited to, a radio frequency unit 121, a network module 122, an audio output unit 123, an input unit 124, a sensor 125, a display unit 126, a user input unit 127, an interface unit 128, a memory 129, and a processor 120.

[0201] Those skilled in the art will appreciate that the electronic device 100 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 120 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.10 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0202] The processor 120 is configured to obtain a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image;

[0203] The processor 120 is used to fuse the first image and the second image based on the position of the moon in the first image and the second image to obtain a moon image.

[0204] In the present application, the moon can be photographed using different focal lengths to obtain a second image photographed with a long focal length and a first image photographed with a short focal length. The position of the moon is then located in the first image and the second image, respectively. Based on the position of the moon in the first image and the second image, the clear moon in the second image is fused with the moon in the first image to obtain a moon image. The moon details in the second image are combined with the photographed objects in the surrounding environment of the moon in the first image, so that the moon image can show clear moon details and retain the photographed objects in the surrounding environment of the moon in the first image, thereby improving the image quality of the fused moon image.

[0205] In another optional example, the processor 120 is specifically configured to:

[0206] Determine the position of the moon; wherein the position of the moon is the position of the moon in the first image;

[0207] Cropping the second image to obtain an image to be fused, wherein the image to be fused is an image of the moon region in the second image; wherein the moon region is an image region where the moon is located in the second image;

[0208] The image to be fused is fused to the moon position in the first image to obtain a moon image.

[0209] In another optional example, the display unit 126 is used to display a shooting preview interface, and the shooting preview interface includes the moon;

[0210] The user input unit 127 is used to receive a first shooting control input;

[0211] The processor 120 is configured to capture a first image of the moon through a camera in response to the first shooting control input;

[0212] A user input unit 127, used to receive a focus input on the shooting preview interface;

[0213] The processor 120 is configured to, in response to the focus input, enlarge and display the moon in the shooting preview interface;

[0214] The user input unit 127 is used to receive a second shooting control input;

[0215] The processor 120 is configured to capture a second image of the moon through the camera in response to the second shooting control input.

[0216] In another optional example, the display unit 126 is used to display a shooting preview interface, and the shooting preview interface includes the moon;

[0217] The user input unit 127 is used to receive a third shooting control input;

[0218] The processor 120 is configured to, in response to the third shooting control input, capture a first image of the moon through the first camera and capture a second image of the moon through the second camera;

[0219] Wherein, the focal length of the first camera is smaller than the focal length of the second camera.

[0220] In another optional example, the processor 120 is specifically configured to:

[0221] Determine N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold;

[0222] When the N overexposed pixels form a connected area, the center of gravity position of the connected area is determined as the moon position.

[0223] In another optional example, the moon photographing device further includes:

[0224] A processing module is used to determine the center of gravity position of the connected area with the highest roundness among the at least two connected areas as the moon position when the N overexposed pixel points form at least two connected areas.

[0225] In another optional example, the user input unit 127 is used to receive a first input of the user on the first image;

[0226] The processor 120 is configured to determine, in response to the first input, an input position of the first input as a position of the moon.

[0227] In another optional example, the processor 120 is further configured to:

[0228] Determine pixels in the second image whose brightness values ​​are greater than a second threshold as foreground pixels, and determine pixels in the second image whose brightness values ​​are less than or equal to the second threshold as background pixels;

[0229] Performing a morphological operation on foreground pixels in the second image to obtain a mask area covering the foreground pixels;

[0230] The moon region is determined according to the mask region.

[0231] In another optional example, the processor 120 is further configured to:

[0232] Determine the mask area as the area where the moon is located;

[0233] Alternatively, the smallest rectangular area in the second image that includes the mask area is determined as the moon area.

[0234] In another optional example, the processor 120 is further configured to:

[0235] Binarizing the second image to obtain a binary image; wherein the pixel value of the foreground pixel is set to a first value, and the pixel value of the background pixel is set to a second value, and the first value is greater than the second value;

[0236] A morphological operation is performed on pixel points in the binary image whose pixel values ​​are the first value to obtain a mask area.

[0237] In another optional example, the processor 120 is further configured to:

[0238] Performing image alignment processing on the image to be fused and the first image so that the center point of the image to be fused coincides with the position of the moon;

[0239] The image to be fused after the image alignment process is fused to the moon position in the first image to obtain a moon image.

[0240] It should be understood that in the embodiment of the present application, the input unit 124 may include a graphics processor (Graphics Processing Unit, GPU) 1241 and a microphone 1242, and the graphics processor 1241 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 126 may include a display panel 1261, and the display panel 1261 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 127 includes a touch panel 1271 and at least one of other input devices 1272. The touch panel 1271 is also called a touch screen. The touch panel 1271 may include two parts: a touch detection device and a touch controller. Other input devices 1272 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0241] The memory 129 can be used to store software programs and various data. The memory 129 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 129 may include a volatile memory or a non-volatile memory, or the memory 129 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 129 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0242] The processor 120 may include one or more processing units; optionally, the processor 120 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 120.

[0243] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned moon photography method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0244] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0245] An embodiment of the present application further provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned moon photography method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0246] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0247] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned moon photography method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0248] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0249] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0250] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for photographing the moon, characterized in that: include: Acquire a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image; Based on the positions of the moon in the first image and the second image, the first image and the second image are fused to obtain a moon image.

2. The method according to claim 1, characterized in that The step of fusing the first image and the second image based on the positions of the moon in the first image and the second image to obtain the moon image includes: Determine the position of the moon; wherein the position of the moon is the position of the moon in the first image; Cropping the second image to obtain an image to be fused, wherein the image to be fused is an image of the moon region in the second image; wherein the moon region is an image region where the moon is located in the second image; The image to be fused is fused to the moon position in the first image to obtain a moon image.

3. The method according to claim 1, characterized in that The step of acquiring a first image and a second image of the moon captured by a camera comprises: Displaying a shooting preview interface, wherein the shooting preview interface includes the moon; receiving a first shooting control input; In response to the first shooting control input, collecting a first image of the moon through a camera; Receiving a focus input on the shooting preview interface; In response to the focus input, enlarging and displaying the moon in the shooting preview interface; receiving a second shooting control input; In response to the second shooting control input, a second image of the moon is captured by the camera.

4. The method according to claim 1, characterized in that: The step of acquiring the first image and the second image of the moon captured by the camera comprises: Displaying a shooting preview interface, wherein the shooting preview interface includes the moon; receiving a third shooting control input; In response to the third shooting control input, a first image of the moon is captured by the first camera, and a second image of the moon is captured by the second camera; Wherein, the focal length of the first camera is smaller than the focal length of the second camera.

5. The method according to claim 2, characterized in that: Determining the position of the moon comprises: Determine N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold; When the N overexposed pixels form a connected area, the center of gravity position of the connected area is determined as the moon position.

6. The method according to claim 5, characterized in that After determining N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold, the method further includes: In the case where the N overexposed pixel points form at least two connected areas, the centroid position of the connected area with the highest roundness among the at least two connected areas is determined as the moon position.

7. The method according to claim 2, characterized in that: Determining the position of the moon comprises: receiving a first input of the user regarding the first image; In response to the first input, an input position of the first input is determined as a moon position.

8. The method according to claim 2, characterized in that: Before cropping the second image to obtain the image to be fused, the method further includes: Determine pixels in the second image whose brightness values ​​are greater than a second threshold as foreground pixels, and determine pixels in the second image whose brightness values ​​are less than or equal to the second threshold as background pixels; Performing a morphological operation on foreground pixels in the second image to obtain a mask area covering the foreground pixels; The moon region is determined according to the mask region.

9. The method according to claim 8, characterized in that Determining the moon region according to the mask region includes: Determine the mask area as the moon area; Alternatively, the smallest rectangular area in the second image that includes the mask area is determined as the moon area.

10. The method according to claim 8, characterized in that The performing a morphological operation on the foreground pixel points in the second image to obtain a mask area covering the foreground pixel points includes: Binarizing the second image to obtain a binary image; wherein the pixel value of the foreground pixel is set to a first value, and the pixel value of the background pixel is set to a second value, and the first value is greater than the second value; A morphological operation is performed on pixel points in the binary image whose pixel values ​​are the first value to obtain a mask area.

11. The method according to claim 2, characterized in that The step of fusing the image to be fused to the moon position in the first image to obtain a moon image includes: Performing image alignment processing on the image to be fused and the first image so that the center point of the image to be fused coincides with the position of the moon; The image to be fused after the image alignment process is fused to the moon position in the first image to obtain a moon image.

12. A moon photographing device, characterized in that: include: An acquisition module, used to acquire a first image and a second image of the moon captured by a camera, wherein a shooting focal length of the second image is greater than a shooting focal length of the first image; A fusion module is used to fuse the first image and the second image based on the position of the moon in the first image and the second image to obtain a moon image.

13. The device according to claim 12, characterized in that The fusion module is specifically used for: Determine the position of the moon; wherein the position of the moon is the position of the moon in the first image; Cropping the second image to obtain an image to be fused, wherein the image to be fused is an image of the moon region in the second image; wherein the moon region is an image region where the moon is located in the second image; The image to be fused is fused to the moon position in the first image to obtain a moon image.

14. The device according to claim 12, characterized in that The acquisition module is specifically used for: Displaying a shooting preview interface, wherein the shooting preview interface includes the moon; receiving a first shooting control input; In response to the first shooting control input, collecting a first image of the moon through a camera; Receiving a focus input on the shooting preview interface; In response to the focus input, enlarging and displaying the moon in the shooting preview interface; receiving a second shooting control input; In response to the second shooting control input, a second image of the moon is captured by the camera.

15. The device according to claim 12, characterized in that The acquisition module is specifically used for: Displaying a shooting preview interface, wherein the shooting preview interface includes the moon; receiving a third shooting control input; In response to the third shooting control input, a first image of the moon is captured by the first camera, and a second image of the moon is captured by the second camera; Wherein, the focal length of the first camera is smaller than the focal length of the second camera.

16. The device according to claim 13, characterized in that The fusion module is specifically used for: Determine N overexposed pixels in the first image whose brightness values ​​are greater than a first threshold; When the N overexposed pixels form a connected area, the center of gravity position of the connected area is determined as the moon position.

17. The device according to claim 16, characterized in that The moon shooting device also includes: A processing module is used to determine the center of gravity position of the connected area with the highest roundness among the at least two connected areas as the moon position when the N overexposed pixel points form at least two connected areas.

18. The device according to claim 12, characterized in that The fusion module is specifically used for: receiving a first input of the user regarding the first image; In response to the first input, an input position of the first input is determined as a moon position.

19. The device according to claim 12, characterized in that The moon shooting device also includes: a processing module, configured to determine pixel points in the second image whose brightness value is greater than a second threshold as foreground pixel points, and to determine pixel points in the second image whose brightness value is less than or equal to the second threshold as background pixel points; A processing module, configured to perform a morphological operation on the foreground pixels in the second image to obtain a mask area covering the foreground pixels; The processing module is used to determine the moon area according to the mask area.

20. The device according to claim 19, characterized in that The processing module is specifically used for: Determine the mask area as the area where the moon is located; Alternatively, the smallest rectangular area in the second image that includes the mask area is determined as the moon area.

21. The device according to claim 19, characterized in that The processing module is specifically used for: Binarizing the second image to obtain a binary image; wherein the pixel value of the foreground pixel is set to a first value, and the pixel value of the background pixel is set to a second value, and the first value is greater than the second value; A morphological operation is performed on pixel points in the binary image whose pixel values ​​are the first value to obtain a mask area.

22. The device according to claim 12, characterized in that The fusion module is specifically used for: Performing image alignment processing on the image to be fused and the first image so that the center point of the image to be fused coincides with the position of the moon; The image to be fused after the image alignment process is fused to the moon position in the first image to obtain a moon image.

23. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the moon photographing method as described in any one of claims 1 to 11 are implemented.