Image processing method, electronic equipment and readable storage medium
By using the image processing methods of the first and second cameras in the moon-looking shooting mode of the electronic device, the preview images of the moon and other objects are detected and processed, and the problem of it being difficult to clearly image the moon and other background objects at the same time in the moon-looking shooting mode is solved, and better image shooting effect and user experience are achieved.
Patent Information
- Application Number
- CN202311407572.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-26
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2043-10-26
AI Technical Summary
In the moon-looking shooting mode, it is difficult for electronic devices to clearly image the moon and other background objects at the same time, resulting in poor image shooting effects.
By detecting the moon in the preview image captured by the first camera of the electronic device, and in the presence of the moon, the preview image captured by the second camera is displayed in the first preview image in a picture-in-picture manner, and updated to the third preview image, the exposure of the third preview image is reduced to improve the clarity of the moon, and at the same time, the third preview image is processed through the second preview image to enhance the clarity of other objects.
It improves the imaging clarity of the moon and other objects in the same view frame, improves the image shooting effect, and improves the user's shooting convenience and user viscosity.
Smart Images

Figure CN119946416A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to an image processing method, an electronic device and a readable storage medium. Background Art
[0002] With the development of terminal technology, the camera functions of electronic devices are becoming more and more abundant. For example, electronic devices can provide a moon-viewing shooting mode, in which the electronic device can capture a clear image of the moon through a camera.
[0003] However, when the electronic device captures a clear image of the moon in the moon-gazing shooting mode, other background objects in the same viewfinder as the moon cannot be imaged or are not clearly imaged, resulting in poor image capture effects. Summary of the invention
[0004] The present application provides an image processing method, an electronic device and a readable storage medium, which can improve the imaging clarity of the moon and other objects. The technical solution is as follows:
[0005] In a first aspect, an image processing method is provided, which is applied to an electronic device, and the method includes:
[0006] During image acquisition through a first camera of an electronic device, if a zoom ratio of the first camera is greater than or equal to a first ratio threshold, moon detection is performed on a first preview image acquired by the first camera; when there is a moon in the first preview image, a second preview image acquired by a second camera of the electronic device is displayed in a picture-in-picture manner in the first preview image, and both the second preview image and the first preview image contain the moon; the first preview image is updated to a third preview image, the exposure of the third preview image is less than the exposure of the first preview image, and the clarity of objects other than the moon in the second preview image is greater than the clarity of objects other than the moon in the third preview image; in response to a shooting operation, the third preview image is processed based on the second preview image to obtain a target image.
[0007] Among them, the first camera and the second camera capture images of the same shooting scene, and the image capture ranges of the first camera and the second camera are basically the same, and the image capture range displayed by the second preview image in the shooting interface is larger than the image capture range displayed by the third preview image.
[0008] It should be noted that the first camera may be a telephoto camera of the electronic device, and the second camera may be a main camera of the electronic device.
[0009] It is worth noting that, since the exposure of the third preview image is lower than that of the first preview image, a clear image of the moon can be obtained in the third preview image; and since the clarity of objects other than the moon in the second preview image is higher than the clarity of objects other than the moon in the third preview image, the target image obtained by processing the third preview image through the second preview image is an image with higher clarity including the moon and other objects, thereby improving the imaging clarity of other background objects in the same viewfinder as the moon and improving the image shooting effect.
[0010] In addition, when the presence of the moon is detected in the first preview image, the second preview image is displayed in the first preview image in a picture-in-picture manner. After the first preview image is updated to the third preview image, if the imaging effect of other objects in the third 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 his or her own needs, thereby improving user shooting convenience and user stickiness.
[0011] As an example of the present application, the electronic device processes the third preview image based on the second preview image in response to a shooting operation, and before obtaining the target image, it can also focus on objects other than the moon within the image acquisition range of the second camera; after the focusing is completed, the focus distance of the second camera is determined.
[0012] It should be noted that the electronic device can focus on objects other than the moon within the image acquisition range of the second camera through a set distance sensor or a motor corresponding to the second camera.
[0013] As an example, when a motor corresponding to the second camera is provided in the electronic device, the electronic device can determine the focus distance by the indication code value of the current corresponding to the motor stroke. Alternatively, the electronic device can measure the distance between other objects and the electronic device by using a distance measurement sensor according to the time-of-flight technology; and determine the measured distance as the focus distance.
[0014] Based on this, the electronic device processes the third preview image based on the second preview image in response to the shooting operation to obtain the target image, including:
[0015] In response to the shooting operation, the third preview image is processed based on the second preview image according to the focus distance to obtain a target image.
[0016] It is worth noting that, through the focusing distance of the second camera, the distance between other objects other than the moon within the image acquisition range of the second camera and the electronic device can be accurately determined, so that the subsequent method of determining the target image has data support.
[0017] As an example of the present application, the exposure parameters include an exposure value and an exposure duration;
[0018] Based on this, the electronic device processes the third preview image based on the second preview image in response to the shooting operation according to the focus distance to obtain the target image, including:
[0019] In response to the shooting operation, according to the exposure parameters of the second preview image, an S frame corresponding to the second preview image is obtained, the S frame is a preview image captured by the second camera before the second preview image is captured, and the exposure value of the S frame is less than the exposure value of the second preview image, and the exposure time of the S frame is less than the exposure time of the second preview image; when the focus distance is greater than the distance threshold, the third preview image is updated based on the S frame and the second preview image, and the updated third preview image is fused with the third preview image to obtain a target image; when the focus distance is less than or equal to the distance threshold, the S frame, the second preview image and the third preview image are fused to obtain the target image.
[0020] It is worth noting that the electronic device can select different methods to determine the target image according to different focusing distances, so that the operation of determining the target image is more targeted.
[0021] As an example of the present application, when the focus distance is greater than the distance threshold, based on the S frame and the second preview image, the third preview image is updated, and the updated third preview image is fused with the third preview image to obtain the target image, including:
[0022] When the focus distance is greater than the distance threshold, the S frame is fused with the second preview image to obtain the first image; the exposure parameters of the third preview image are updated according to the exposure parameters of the first image; and the updated third preview image is fused with the third preview image to obtain the target image.
[0023] It should be noted that the electronic device may re-expose the third preview image according to the exposure parameters of the first image to obtain an updated third preview image.
[0024] It is worth noting that, since the exposure of the S frame is less than the exposure of the second preview image, after the S frame is fused with the second preview image to obtain the first image, the clarity of the moon area in the first image is improved, and at the same time, the clarity of other objects except the moon is not affected. In this way, the exposure parameters of the third preview image are updated by the exposure parameters of the first image, so that the clarity of other objects in the updated third preview image is improved, thereby ensuring the clarity of each object in the target image.
[0025] As an example of the present application, when the focus distance is greater than the distance threshold, the third preview image is updated based on the S frame and the second preview image, and the updated third preview image is fused with the third preview image to obtain the target image. The L frame corresponding to the second preview image can also be obtained according to the exposure parameters of the second preview image. The L frame is a preview image captured after the second camera captures the second preview image, and the exposure value of the L frame is greater than the exposure value of the second preview image, and the exposure duration of the L frame is greater than the exposure duration of the second preview image.
[0026] Based on this, when the focus distance is greater than the distance threshold, based on the S frame and the second preview image, the third preview image is updated, and the updated third preview image is fused with the third preview image to obtain the target image, including:
[0027] The S frame, the second preview image and the L frame are merged to obtain a second image; the exposure parameters of the third preview image are updated according to the exposure parameters of the second image; and the updated third preview image is merged with the third preview image to obtain a target image.
[0028] It is worth noting that by acquiring the L frame of the second preview image and fusing the L frame, the S frame and the second preview image, the image signal-to-noise ratio of the second image is improved, the noise in the second image is reduced, and the clarity of the target image is improved.
[0029] As an example of the present application, the operation of fusing the updated third preview image with the third preview image to obtain the target image includes:
[0030] Determine a first focus position of the moon in the third preview image and a second focus position of the moon in the updated third preview image; when the first focus position is inconsistent with the second focus position, adjust the focus position of the moon in the updated third preview image according to a deviation value between the first focus position and the second focus position; and fuse the third preview image after the focus position adjustment with the third preview image according to a target value to obtain a target image, wherein the target value is used to indicate a display size of the moon in the target image.
[0031] It is worth noting that by adjusting the display position of the moon, the problem of ghosting of the moon in the fused image is avoided, thereby improving the clarity of the target image.
[0032] As an example of the present application, according to the target value, the operation of fusing the third preview image after the focus position is adjusted with the third preview image to obtain the target image includes:
[0033] When the target value is a preset value, the third preview image after the focus position is adjusted and the third preview image are merged to obtain the target image; when the target value is the target value, the display size of the moon in the third preview image is adjusted to the size indicated by the target value, and the third preview image after the display size of the moon is adjusted and the third preview image after the focus position is adjusted are merged to obtain the target image, and the target value is determined in response to the user operation of adjusting the display size of the moon received before the shooting operation.
[0034] In this way, the moon display size is adjusted after the focus position of the moon is adjusted, thereby reducing the possibility of moon ghosting in the target image and improving the display clarity and display effect of the target image.
[0035] As an example of the present application, during image acquisition through a first camera of an electronic device, if the zoom magnification of the first camera is greater than or equal to a first magnification threshold, then after performing moon detection on a first preview image acquired by the first camera, the electronic device may also display a moon adjustment control in a shooting interface when there is a moon in the first preview image, and the moon adjustment control is used to adjust the display size of the moon in the target image; in response to a user operation on the moon adjustment control, a target value selected by the user operation is stored, and the target value is used to indicate the display size of the moon in the target image.
[0036] It should be noted that the moon adjustment control may be composed of at least one of a pattern, text, or a number.
[0037] As an example, in response to a user operation on the moon adjustment control, the electronic device stores the target value selected by the user operation, and the display size of the moon in the third preview image does not change.
[0038] Alternatively, in response to a user operation on the moon adjustment control, the electronic device may adjust the display size of the moon in the third preview image to the size indicated by the target value while storing a new target value selected by the user operation.
[0039] It is worth noting that the display size of the moon in the target image is adjusted through the moon adjustment control, thereby improving the coordination between the moon and other objects in the target image and improving the interactivity with the user.
[0040] As an example of the present application, when the focus distance is less than or equal to the distance threshold, the operation of fusing the S frame, the second preview image, and the third preview image to obtain the target image includes:
[0041] When the focus distance is less than or equal to the distance threshold, the S frame is fused with the second preview image to obtain a third image; and the third preview image is fused with the third image to obtain a target image.
[0042] It is worth noting that by fusing the S frame, the second preview image and the third preview image, when objects other than the moon are close to the electronic device, a target image with a clear moon and other clear objects can also be obtained, that is, the imaging clarity of the target image is improved.
[0043] In a second aspect, an electronic device is provided, wherein the structure of the electronic device includes a processor and a memory, wherein the memory is used to store a program that supports the electronic device to execute the image processing method provided in the first aspect, and to store data involved in 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 also include a communication bus, wherein the communication bus is used to establish a connection between the processor and the memory.
[0044] In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the image processing method described in the first aspect.
[0045] In a fourth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the image processing method described in the first aspect.
[0046] The technical effects obtained by the above-mentioned second aspect, third aspect and fourth aspect are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;
[0048] Figure 2 is a schematic diagram of another application scenario provided by an embodiment of the present application;
[0049] Figure 3 is a schematic diagram of another application scenario provided by an embodiment of the present application;
[0050] Figure 4 It is a flowchart of an image processing method provided in an embodiment of the present application;
[0051] Figure 5 It is a statistical graph of grayscale values of image pixels provided in an embodiment of the present application;
[0052] Figure 6 is a flowchart of another image processing method provided in an embodiment of the present application;
[0053] Figure 7 is a flowchart of another image processing method provided in an embodiment of the present application;
[0054] Figure 8 is a flowchart of another image processing method provided in an embodiment of the present application;
[0055] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0056] Fig.10 It is a block diagram of a software system of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0058] It should be understood that the "multiple" mentioned in this application refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in order to facilitate the clear description of the technical solution of this application, the words "first" and "second" are used to distinguish between the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first" and "second" do not limit the quantity and execution order, and the words "first" and "second" do not limit them to be different.
[0059] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0060] In one application scenario, a user may use a mobile phone to take a photo of the moon. Usually, a mobile phone can take a photo of the moon. Figure 1 The overexposed and out-of-focus moon image is shown in Figure (a) in the figure. Therefore, in order to enable mobile phones to capture clear moon images, more and more types of mobile phones begin to provide moon-viewing shooting modes (also known as moon shooting modes or moon modes, etc.).
[0061] As an example, the mobile phone can automatically enter the moon-gazing shooting mode when it detects that there is a moon in the preview image captured by the camera; or the mobile phone can enter the moon-gazing shooting mode when it receives the shooting mode selected by the user's mode selection operation. In the moon-gazing shooting mode, see Figure 1 In Figure (b), the mobile phone can capture a clear image of the moon. Figure 1 Figures (a) and (b) are images of different resolutions obtained by shooting the same scene.
[0062] However, through Figure 1 As can be seen from Figures (a) and (b), while the mobile phone captures a clear image of the moon in the moon-viewing shooting mode, other background objects in the same frame as the moon cannot be imaged or are not clearly imaged, resulting in poor image capture effects.
[0063] In order to improve the image clarity and the image shooting effect, the embodiment of the present application provides an image processing method, in which, when there is a moon in the first preview image captured by the first camera of the electronic device and the zoom ratio of the first camera is large, the second preview image captured by the second camera of the electronic device for the same shooting scene can be displayed in the first preview image in a picture-in-picture manner, and the first preview image can also be updated to a third preview image. In response to the shooting operation, the electronic device can process the third preview image based on the second preview image to obtain a target image. Since the exposure of the third preview image is less than that of the first preview image, a clear moon image can be obtained in the third preview image; and since the clarity of other objects except the moon in the second preview image is greater than the clarity of other objects except the moon in the third preview image, the target image obtained by processing the third preview image through the second preview image is an image with high clarity including the moon and other objects, thereby improving the imaging clarity of other background objects in the same viewfinder as the moon, and improving the image shooting effect.
[0064] For ease of understanding, before introducing the method provided in the embodiments of the present application in detail, the application scenarios involved in the embodiments of the present application are introduced below.
[0065] Please refer to Figure 2 , Figure 2A schematic diagram of an application scenario provided by an embodiment of the present application. In an application scenario, a user may take a photo through any camera of the mobile phone while using the mobile phone. After the mobile phone starts the camera, the display screen may display the following Figure 2 The shooting interface shown in Figure (a) in FIG. 1 shows a preview image A captured by camera S1. When shooting with a mobile phone, the user can adjust the zoom ratio of the current camera S1. For example, the user can click the zoom control to change the zoom ratio from 1× to 10×. In response to the adjustment operation of the zoom ratio of camera S1, the mobile phone captures an image through camera S1 according to the adjusted zoom ratio, and obtains the following image: Figure 2 In the preview image B shown in FIG. (b), in this case, the mobile phone can detect whether the preview image B contains the moon, and when the preview image B is detected to contain the moon, the exposure of the preview image B is reduced to obtain the following Figure 2 The preview image C shown in FIG. (c) is displayed, and the preview image D captured by the mobile phone camera S2 is displayed in the preview image C in a picture-in-picture manner. If the user clicks the shooting control P1 in this case, the mobile phone responds to the click operation of the shooting control P1 and performs image exposure based on the preview image D and the preview image C. If the user needs to view the captured image, see Figure 2 In the 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 mobile phone can display the following Figure 2 The target image E is shown in Figure (e).
[0066] It should be noted that the camera S1 can be a telephoto camera of a mobile phone, and the camera S2 can be a main camera of the mobile phone.
[0067] In another possible scenario, see Figure 3 In Figure (a), when the mobile phone displays the preview image D in the preview image C in a picture-in-picture manner, the shooting interface can also display a moon adjustment control P3, and the user can use the moon adjustment control P3 to adjust the display size of the moon in the target image E. If the user can use the moon adjustment control P3 to control the display size of the moon to be 3 times that of the currently captured moon, then the target image E displayed later can be as follows Figure 3 As shown in Figure (b) in FIG. 1 ; if the user can control the moon display size to be twice the current collected moon through the moon adjustment control P3, then the target image E displayed subsequently can be as follows Figure 3 As shown in Figure (c) in FIG. 1 ; if the user can control the moon display size to be 1.5 times the current collected moon through the moon adjustment control P3, then the target image E displayed subsequently can be as follows Figure 3If the user does not control the display size of the moon through the moon adjustment control P3, the target image E can be as follows: Figure 2 As shown in Figure (d).
[0068] It should be noted that the embodiments of the present application are only based on the above Figure 2 and Figure 3 The application scenario shown is used as an example for illustration and does not constitute a limitation on the embodiments of the present application.
[0069] Based on the application scenarios provided by the above embodiments, the image processing method provided by the embodiments of the present application is introduced below. Figure 4 , Figure 4 The following is a flowchart of an image processing method according to an exemplary embodiment. As an example but not a limitation, the method is described by taking application in an electronic device as an example. The method may include part or all of the following contents:
[0070] Step 401: During image acquisition by a first camera of an electronic device, if a zoom ratio of the first camera is greater than or equal to a first ratio threshold, moon detection is performed on a first preview image acquired by the first camera.
[0071] When the user uses the first camera of the electronic device to collect images, the user may adjust the zoom ratio of the first camera. When the zoom ratio of the first camera is greater than or equal to the first ratio threshold, the electronic device may perform moon detection on the first preview image collected by the first camera. For example, the first preview image may be the above-mentioned Figure 2 Preview image B shown in Figure (b) .
[0072] As an example, the first camera may be a telephoto camera of the electronic device. Exemplarily, the first camera may be the camera A described in the above application scenario.
[0073] In some embodiments, the electronic device can set not only the first zoom ratio but also the second zoom ratio. When the zoom ratio of the first camera is greater than or equal to the first ratio threshold and less than or equal to the second ratio threshold, the electronic device can perform moon detection on the first preview image captured by the first camera. When the zoom ratio of the first camera is less than the first ratio threshold or greater than the second ratio threshold, the electronic device may not display the second preview image, that is, the electronic device uses one camera for image capture.
[0074] It should be noted that the first magnification threshold and the second magnification threshold can be pre-set according to the requirements, for example, the first magnification threshold can be 10 times (or written as 10X), 15 times, 20 times or 30 times, etc. The second magnification threshold can be 30 times or 40 times, etc., and the second magnification threshold is greater than the first magnification threshold.
[0075] In some embodiments, the zoom magnification of the first camera can be manually adjusted by a user to any zoom magnification greater than or equal to the first magnification threshold, or can be automatically adjusted by the electronic device to any zoom magnification greater than or equal to the first magnification threshold.
[0076] Exemplarily, when the electronic device switches to certain shooting modes, the zoom ratio of the first camera is automatically increased. For example, when the electronic device switches to the full moon shooting mode, in order to obtain a clear moon image, the electronic device can adjust the zoom ratio of the first camera to a first ratio that is greater than or equal to a first ratio threshold.
[0077] In some embodiments, the electronic device can detect the moon in the first preview image captured by the first camera in a variety of ways. Exemplarily, a neural network model can be set in the electronic device, and the neural network model can perform object recognition, so that the electronic device can recognize each object in the first preview image through the set neural network model, and detect whether there is a moon by recognizing each object. Alternatively, the electronic device can have an AI (artificial intelligence) recognition function, so that the electronic device can recognize each object in the first preview image through the AI recognition function to detect whether there is a moon in the first preview image, and the embodiments of the present application do not impose specific restrictions on this.
[0078] Step 402: When there is a moon in the first preview image, display the second preview image captured by the second camera of the electronic device in the first preview image in a picture-in-picture manner.
[0079] It should be noted that both the second preview image and the first preview image include the moon, and the image acquisition range displayed in the second preview image is larger than the image acquisition range displayed in the first preview image. The second camera and the first camera acquire images of the same shooting scene.
[0080] As an example, when there is a moon in the first preview image, the electronic device can simultaneously capture images of the same shooting scene through the first camera and the second camera. When the second camera is used to capture images and obtain a second preview image, the second preview image can be displayed in the first preview image in a picture-in-picture manner. Figure 2 The application scenario shown in Figure (c).
[0081] It should be noted that the second camera may be a main camera of the electronic device, and the second camera may be the camera B described in the above scenario.
[0082] Step 403: Update the first preview image to a third preview image.
[0083] It should be noted that the exposure of the third preview image is smaller than that of the first preview image, and the clarity of objects other than the moon in the second preview image is greater than that of objects other than the moon in the third preview image.
[0084] As an example, the operation of updating the first preview image to the third preview image may include: reducing the exposure degree and / or exposure duration of the first preview image to obtain the third preview image.
[0085] When the first camera of the electronic device captures the first preview image, the brightness of the moon is relatively high, resulting in a blurry display of the moon region in the captured first preview image. Generally, an image with a lower exposure and / or a shorter exposure time will be clearer when displaying an image region with stronger light. Therefore, in order to obtain a clear moon image, the electronic device can obtain a third preview image by reducing the exposure and / or exposure time of the first preview image.
[0086] For ease of understanding, the present application provides a grayscale value statistical diagram of image pixels. Figure 5 , Figure 5 Figure (a) in FIG. 1 is a statistical diagram of the grayscale values of pixels in the third preview image. Figure 5 As can be seen from Figure (a) in the figure, the number of grayscale values of the pixels in the third preview image is evenly distributed and the number is small. The grayscale value distribution of the pixels is usually the grayscale value distribution of the pixels in the moon area.
[0087] Since the moon is brighter in the first preview image, while the light of other objects is weaker, after reducing the exposure and / or exposure time of the first preview image, the clarity of the moon in the third preview image is very high, but other objects may not be imaged or may be blurred. When the electronic device captures the second preview image, the automatic exposure (AE) algorithm converges, that is, the second preview image is exposed normally, and the electronic device does not reduce the exposure and / or exposure time of the second preview image.
[0088] For example, see Figure 5 , Figure 5 Figure (b) in FIG. 1 is a statistical diagram of the grayscale values of pixels in the second preview image. Figure 5As shown in Figure (b), the grayscale values of the pixels in the second preview image are distributed more concentratedly.
[0089] Since images with a larger exposure and / or a longer exposure time are usually clearer when displaying image areas with weaker light, the moon displayed in the second preview image is blurry, but the clarity of objects other than the moon in the second preview image is higher, that is, the clarity of objects other than the moon in the second preview image is greater than the clarity of objects other than the moon in the third preview image.
[0090] It should be noted that, when there is a moon in the first preview image, the embodiment of the present application does not specifically limit the execution order of step 402 and step 403. That is, when there is a moon in the first preview image, the electronic device may first execute the operation of step 402 and then execute the operation of step 403, or may first execute the operation of step 403 and then execute the operation of step 402, or may also execute the operations of step 402 and step 403 at the same time.
[0091] As an example, when the first preview image is updated to the third preview image, the second preview image is displayed on the third preview image in a picture-in-picture manner.
[0092] As can be seen from the above, the electronic device can automatically enlarge the zoom ratio of the first camera after entering certain shooting modes, or the user can manually adjust the zoom ratio of the first camera. In the case where the zoom ratio of the first camera is manually enlarged and adjusted by the user, if there is a moon in the first preview image, the electronic device can enter the moon-gazing shooting mode. In the case where the electronic device is in the moon-gazing shooting mode, the electronic device can perform the operations of step 402 and step 403.
[0093] In some embodiments, when the electronic device enters the moon-gazing shooting mode, a prompt message may be used in the shooting interface to remind the user of the current shooting mode. The prompt message may be in the form of at least one of text, pattern, control, etc.
[0094] It is worth noting that when the presence of the moon is detected in the first preview image, the second preview image is displayed in the first preview image in a picture-in-picture manner, so that after the first preview image is updated to the third preview image, if the imaging effect of other objects in the third 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 his or her own needs, thereby improving user shooting convenience and user stickiness.
[0095] Step 404: In response to the shooting operation, the third preview image is processed based on the second preview image to obtain a target image.
[0096] If the user is satisfied with the currently captured image, the user can trigger a shooting operation. The shooting operation can be an operation in which the user can click a shooting control in a photo mode, or an operation in which the user can click a recording control in a recording mode, etc. In this way, when the electronic device receives a shooting operation, in order to obtain a clear image of the moon and clear images of other objects other than the moon, the electronic device can process the third preview image based on the second preview image in response to the shooting operation to obtain a target image in which all objects have high clarity.
[0097] As an example, the electronic device processes the third preview image based on the second preview image in response to a shooting operation to obtain an operation of a target image, including: determining, in response to the shooting operation, target mapping parameters based on exposure parameters of the second preview image, wherein the target mapping parameters are used to adjust the exposure parameters of the third preview image; updating the exposure parameters of the third preview image according to the target mapping parameters; and fusing the third preview image with the updated third preview image to obtain the target image.
[0098] In some embodiments, the exposure parameters include an exposure value and an exposure duration. Thus, the electronic device determines the target mapping parameters according to the exposure parameters of the second preview image in response to the shooting operation, including: in response to the shooting operation, obtaining an S frame (also called a short frame) corresponding to the second preview image according to the exposure parameters of the second preview image, where the S frame is a preview image captured by the second camera before the second preview image is captured, and the exposure value of the S frame is less than the exposure value of the second preview image, and the exposure duration of the S frame is less than the exposure duration of the second preview image; fusing the S frame with the second preview image to obtain a fourth image; and determining the exposure parameters of the fourth image as the target exposure parameters.
[0099] As can be seen from the above, the exposure of the third preview image is not only less than that of the first preview image, but also less than that of the second preview image. In this way, if the third preview image is directly processed according to the exposure parameters of the second preview image, the brightness of the moon displayed in the second preview image will affect the clarity of the moon displayed in the updated third preview image, that is, a halo is likely to appear in the moon area in the updated third preview image, resulting in a decrease in the clarity of the moon in the target image after the updated third preview image is fused with the third preview image. Therefore, in order to avoid the second preview image from having an adverse effect on the clarity of the moon displayed in the target image, the electronic device can determine the S frame corresponding to the second preview image according to the exposure parameters of the second preview image.
[0100] It is worth noting that since the exposure of the S frame is less than the exposure of the second preview image, after the S frame is fused with the second preview image to obtain the fourth image, the clarity of the moon area in the fourth image is improved, and at the same time, the clarity of other objects except the moon is not affected.
[0101] In some embodiments, the electronic device can not only obtain the S frame corresponding to the second preview image, but also obtain the L frame (also called long frame) corresponding to the second preview image, wherein the L frame is a preview image captured after the second camera captures the second preview image, the exposure value of the L frame is greater than the exposure value of the second preview image, and the exposure duration of the L frame is greater than the exposure duration of the second preview image; thereafter, the S frame, the second preview image and the L frame can be fused to obtain a fifth image; and the exposure parameters of the fifth image are determined as the target exposure parameters.
[0102] It is worth noting that by determining the L frame of the second preview image and fusing the L frame, S frame and the second preview image, the image signal-to-noise ratio of the fifth image is improved, the noise in the fifth image is reduced, and the clarity of the target image is improved.
[0103] In some embodiments, the electronic device fuses the third preview image with the updated third preview image to obtain the target image, and the operation includes: determining a first focus position of the moon in the third preview image, and a second focus position of the moon in the updated third preview image; when the first focus position is inconsistent with the second focus position, adjusting the focus position of the moon in the updated third preview image according to a deviation value between the first focus position and the second focus position; and fusing the third preview image with the adjusted focus position and the third preview image to obtain the target image.
[0104] In order to avoid the moon from having a double image in the fused image, the electronic device can determine the first focus position and the second focus position respectively. When the first focus position is the same as the second focus position, the electronic device can directly fuse the updated third preview image with the third preview image to obtain the target image. When the first focus position is different from the second focus position, the position of the moon in the updated third preview image is first adjusted, and then the image fusion is performed to obtain the target image.
[0105] It is worth noting that by adjusting the display position of the moon, the problem of ghosting of the moon in the fused image is avoided, thereby improving the clarity of the target image.
[0106] For example, see Figure 6In response to the shooting operation, the electronic device may obtain a third preview image in raw format (raw format is a photo format or an image format), a second preview image in raw format, and an S frame and an L frame in RGB format (RGB format is a photo format or an image format) corresponding to the second preview image. The electronic device may fuse the second preview image, the S frame and the L frame, and map the exposure parameters of the fused image to the third preview image to obtain an updated third preview image; convert the updated third preview image and the original third preview image into images in RGB format respectively; detect the position of the moon to obtain a first focus position and a second focus position; when the first focus position is different from the second focus position, adjust the position of the moon in the updated third preview image so that the focus position of the moon in the updated third preview image is the first focus position. Fuse the updated third preview image with the original third preview image.
[0107] That is, in response to the shooting operation, the electronic device can obtain two data streams, one of which is the data stream X of the third preview image, and the electronic device can process it according to the normal image signal processing (ISP) pipeline. The other data stream Y can include the third preview image, the second preview image, and the S frame and L frame corresponding to the second preview image. The electronic device can perform exposure parameter mapping, moon position adjustment and other processing on the other data stream Y in turn, and then fuse it with the third preview image in the data stream X, and complete the subsequent processing flow. For example, the target image obtained after fusion is subjected to dynamic range correction (DRC) processing.
[0108] In some embodiments, when performing image fusion, the electronic device may fuse different images using the Laplace pyramid algorithm, so that the edges of the fused images have a smooth transition. That is, the electronic device may use the Laplace pyramid algorithm to fuse the S frame with the second preset image, and the electronic device may use the Laplace pyramid algorithm to fuse the S frame, the L frame with the second preset image, and the electronic device may use the Laplace pyramid algorithm to fuse the third preview image with the updated third preview image. Of course, the electronic device may also implement image fusion through other fusion algorithms, and the embodiments of the present application do not impose specific restrictions on this.
[0109] In some embodiments, when the electronic device uses the Laplace pyramid algorithm to fuse the third preview image with the updated third preview image, it can also obtain a mask image (mask image) corresponding to the third preview image. The mask image can be a black and white image containing a moon pattern. The mask image can assist in completing the fusion of the third preview image with the updated third preview image. The embodiments of the present application do not impose specific restrictions on this.
[0110] In the embodiment of the present application, since the exposure of the third preview image is lower than that of the first preview image, a clear image of the moon can be obtained in the third preview image; and since the clarity of objects other than the moon in the second preview image is higher than the clarity of objects other than the moon in the third preview image, the third preview image is processed by the second preview image, and the target image obtained is an image with high clarity including the moon and other objects, thereby improving the imaging clarity of other background objects in the same viewfinder as the moon, and improving the image shooting effect.
[0111] Since the distance between the other objects captured by the electronic device through the second camera and the electronic device is relatively close, if the above Figure 4 In the embodiment shown, the third preview image is processed based on the second preview image, and there is a certain probability that other objects in the fused target image may not be clearly imaged. Therefore, in order to ensure the clarity of each object in the target image, the electronic device can also select different methods to obtain the target image according to the distance between other objects captured by the second camera and the electronic device.
[0112] Based on this, the present application embodiment provides another possible implementation method, please refer to Figure 7 As an example but not a limitation, the method is described by taking application in an electronic device as an example. The method may include part or all of the following contents:
[0113] The operations of step 701 to step 703 may refer to the operations of step 401 to step 403 described above, and will not be described in detail in the embodiment of the present application.
[0114] Step 704: Focus on objects other than the moon within the image acquisition range of the second camera.
[0115] It should be noted that the electronic device can automatically focus on objects other than the moon, or when receiving a focus operation, focus on the object indicated by the focus operation. For example, the user can click on the position of other objects in the second preview image, and in response to the user's click operation, the electronic device can focus on the object corresponding to the click position.
[0116] As an example, when the electronic device focuses on an object other than the moon within the image acquisition range of the second camera, it can also display the position of the focus frame in the second preview image, where the focus frame is used to indicate the imaging position of the currently focused object.
[0117] In some embodiments, the electronic device can focus on objects other than the moon within the image acquisition range of the second camera through a set distance sensor or a motor corresponding to the second camera.
[0118] It should be noted that the embodiment of the present application does not impose any specific restrictions on the order of executing step 703 and step 704, that is, the electronic device may execute the operation of step 704 after executing the operation of step 703, or may execute the operation of step 703 after executing the operation of step 704, or may execute the operations of step 703 and step 704 at the same time.
[0119] Step 705: After focusing is completed, determine the focus distance of the second camera.
[0120] As an example, the electronic device is provided with a motor corresponding to the second camera, so that the electronic device can determine the focus distance by the indication code value (code value) of the current corresponding to the motor stroke. Alternatively, the electronic device can measure the distance between other objects and the electronic device by a distance measurement sensor according to the time of flight (TOF) technology; and determine the measured distance as the focus distance.
[0121] It is worth noting that, through the focusing distance of the second camera, the distance between other objects other than the moon within the image acquisition range of the second camera and the electronic device can be accurately determined, so that the subsequent method of determining the target image has data support.
[0122] Step 706: In response to the shooting operation, the third preview image is processed based on the second preview image according to the focus distance to obtain a target image.
[0123] In some embodiments, the exposure parameters include an exposure value and an exposure duration. Thus, the electronic device, in response to a shooting operation, processes the third preview image based on the second preview image according to the focus distance to obtain an operation of a target image, including: in response to the shooting operation, obtaining an S frame corresponding to the second preview image according to the exposure parameters of the second preview image, the S frame being a preview image captured by the second camera before the second preview image is captured, and the exposure value of the S frame is less than the exposure value of the second preview image, and the exposure duration of the S frame is less than the exposure duration of the second preview image; when the focus distance is greater than a distance threshold, updating the third preview image based on the S frame and the second preview image, and merging the updated third preview image with the third preview image to obtain a target image; when the focus distance is less than or equal to the distance threshold, merging the S frame, the second preview image, and the third preview image to obtain a target image.
[0124] It should be noted that the distance threshold can be pre-set according to needs, for example, the distance threshold can be 3 meters or 3.5 meters.
[0125] It is worth noting that the electronic device can select different methods to determine the target image according to different focusing distances, so that the operation of determining the target image is more targeted.
[0126] In one possible manner, when the focus distance is greater than a distance threshold, the electronic device updates the third preview image based on the S frame and the second preview image, and fuses the updated third preview image with the third preview image to obtain the target image. The operation includes: when the focus distance is greater than the distance threshold, fusing the S frame with the second preview image to obtain the first image; updating the exposure parameters of the third preview image according to the exposure parameters of the first image; and fusing the updated third preview image with the third preview image to obtain the target image.
[0127] As an example, the operation of the electronic device updating the exposure parameter of the third preview image according to the exposure parameter of the first image may include: re-exposing the third preview image according to the exposure parameter of the first image.
[0128] It is worth noting that, since the exposure of the S frame is less than the exposure of the second preview image, after the S frame is fused with the second preview image to obtain the first image, the clarity of the moon area in the first image is improved, and at the same time, the clarity of other objects except the moon is not affected. In this way, the exposure parameters of the third preview image are updated by the exposure parameters of the first image, so that the clarity of other objects in the updated third preview image is improved, thereby ensuring the clarity of each object in the target image.
[0129] As an example, the electronic device can not only obtain the S frame corresponding to the second preview image, but also obtain the L frame corresponding to the second preview image according to the exposure parameters of the second preview image, where the L frame is a preview image captured after the second camera captures the second preview image, and the exposure value of the L frame is greater than the exposure value of the second preview image, and the exposure duration of the L frame is greater than the exposure duration of the second preview image; in this way, the electronic device can fuse the S frame, the second preview image and the L frame to obtain the second image; update the exposure parameters of the third preview image according to the exposure parameters of the second image; and fuse the updated third preview image with the third preview image to obtain the target image.
[0130] It should be noted that the operation of the electronic device fusing the updated third preview image with the third preview image to obtain the target image can refer to the operation of the electronic device fusing the updated third preview image with the third preview image to obtain the target image in the above step 404, and the embodiments of the present application will not describe them one by one.
[0131] It is worth noting that by acquiring the L frame of the second preview image and fusing the L frame, the S frame and the second preview image, the image signal-to-noise ratio of the second image is improved, the noise in the second image is reduced, and the clarity of the target image is improved.
[0132] In another possible embodiment, when the focus distance is less than or equal to the distance threshold, the electronic device fuses the S frame, the second preview image and the third preview image to obtain the target image, including: when the focus distance is less than or equal to the distance threshold, fusing the S frame with the second preview image to obtain the third image; fusing the third preview image with the third image to obtain the target image.
[0133] It is worth noting that by fusing the S frame, the second preview image and the third preview image, when objects other than the moon are close to the electronic device, a target image with a clear moon and other clear objects can also be obtained, that is, the imaging clarity of the target image is improved.
[0134] In some embodiments, since the electronic device can also obtain the L frame of the second preview image according to the exposure parameters of the second preview image, when the focus distance is less than or equal to the distance threshold, the electronic device can also fuse the S frame, the second preview image and the L frame to obtain the second image, and directly fuse the second image with the third preview image to obtain the target image.
[0135] It should be noted that the electronic device can also use the Laplacian pyramid algorithm to fuse the third preview image with the second image, and the electronic device can use the Laplacian pyramid algorithm to fuse the third preview image with the third image. Of course, the electronic device can also use other methods to perform image fusion, and the embodiments of the present application do not specifically limit this.
[0136] As an example, when the focus distance is less than or equal to the distance threshold, Figure 6 In the data stream Y shown in FIG. 1 , the electronic device obtains the second preview image and the S frame and L frame in the raw format corresponding to the second preview image. The data stream Y does not include the third preview image. Figure 6 In the embodiment, the processing operation of the electronic device on one data stream Y does not include the operation of updating the exposure parameters of the third preview image.
[0137] In the embodiment of the present application, since the exposure of the third preview image is less than that of the first preview image, a clear moon image can be obtained in the third preview image; and since the clarity of other objects except the moon in the second preview image is greater than the clarity of other objects except the moon in the third preview image, the target image obtained by processing the third preview image through the second preview image is an image with high clarity including the moon and other objects, thereby improving the imaging clarity of other background objects in the same viewfinder as the moon, and improving the image shooting effect. In addition, the electronic device can select different methods to determine the target image according to different focusing distances, so that the operation of determining the target image is more targeted.
[0138] In the embodiment of the present application, the electronic device can not only Figure 4 and Figure 7 The updated third preview image and the original third preview image are merged in the manner provided in the embodiment, and can also be merged in other manners. For example, the display size of the moon is adjusted during the fusion process to improve the coordination between the moon and other objects in the target image.
[0139] Based on this, the present application embodiment provides another possible implementation method, please refer to Figure 8 As an example but not a limitation, the method is described by taking application in an electronic device as an example. The method may include part or all of the following contents:
[0140] The operations of step 801 to step 803 may refer to the operations of step 401 to step 403 described above, and will not be described in detail in the embodiment of the present application.
[0141] Step 804: When there is a moon in the first preview image, display a moon adjustment control in the shooting interface.
[0142] As an example, the moon adjustment control is used to adjust the display size of the moon in the target image. The moon adjustment control can be composed of at least one of a pattern, text, or number. For example, the application scenario of step 804 can refer to the above Figure 3 The application scenario shown.
[0143] It should be noted that the embodiment of the present application does not impose any specific restrictions on the order of executing step 804 and step 802, that is, the electronic device may execute the operation of step 802 after executing the operation of step 804, or may execute the operation of step 804 after executing the operation of step 802, or may execute the operations of step 802 and step 804 at the same time.
[0144] Step 805: In response to a user operation on the moon adjustment control, storing the target value selected by the user operation.
[0145] It should be noted that the target value is used to indicate the display size of the moon in the target image.
[0146] In order to improve the coordination between the moon in the target image and other objects in the current shooting scene, users can adjust the display size of the moon in the target image through the moon adjustment control.
[0147] In one possible case, in response to the user operation on the moon adjustment control, the electronic device does not change the display size of the moon in the third preview image when storing the target value selected by the user operation. That is, after the user adjusts the display size of the moon in the target image through the moon adjustment control, before the electronic device displays the target image, the user cannot see the change in the display size of the moon.
[0148] In another possible case, in response to the user operation on the moon adjustment control, the electronic device can adjust the display size of the moon in the third preview image to the size indicated by the target value while storing the new target value selected by the user operation. In the image acquisition stage, the embodiment of the present application is described by taking the example of not changing the display size of the moon in the third preview image.
[0149] It is worth noting that the display size of the moon in the target image is adjusted through the moon adjustment control, thereby improving the coordination between the moon and other objects in the target image and improving the interactivity with the user.
[0150] Step 806: In response to the shooting operation, the third preview image is processed based on the second preview image to obtain a target image.
[0151] It should be noted that, in response to the shooting operation, the electronic device processes the third preview image based on the second preview image to obtain the target image, which can refer to the above step 404. That is, in response to the shooting operation, the electronic device can determine the target mapping parameter based on the exposure parameter of the second preview image, and the target mapping parameter is used to adjust the exposure parameter of the third preview image; update the exposure parameter of the third preview image according to the target mapping parameter; and fuse the third preview image with the updated third preview image to obtain the target image.
[0152] Alternatively, the electronic device may also refer to the operation of step 706 above, and before referring to step 706, the electronic device may perform the operations of steps 704 and 705 to determine the focus distance of the second camera. In this way, in response to the shooting operation, the electronic device may obtain the S frame corresponding to the second preview image according to the exposure parameter of the second preview image, where the S frame is a preview image captured by the second camera before the second preview image is captured, and the exposure value of the S frame is less than the exposure value of the second preview image, and the exposure duration of the S frame is less than the exposure duration of the second preview image; when the focus distance is greater than the distance threshold, the third preview image is updated based on the S frame and the second preview image, and the updated third preview image is fused with the third preview image to obtain the target image; when the focus distance is less than or equal to the distance threshold, the S frame, the second preview image and the third preview image are fused to obtain the target image.
[0153] Since the user may have adjusted the display size of the moon in the target image, during the process of fusing other images with the third preview image, the electronic device may also adjust the display size of the moon in the third preview image during the fusion process, thereby adjusting the display size of the moon in the target image.
[0154] In some embodiments, the electronic device fuses the updated third preview image with the third preview image to obtain the target image, including: determining a first focus position of the moon in the third preview image, and a second focus position of the moon in the updated third preview image; when the first focus position is inconsistent with the second focus position, adjusting the focus position of the moon in the updated third preview image according to a deviation value between the first focus position and the second focus position; and fusing the third preview image with the focus position adjusted according to a target value to obtain the target image.
[0155] As an example, the electronic device fuses the third preview image after the focus position is adjusted with the third preview image according to the target value to obtain the target image, and the operation includes: when the target value is a preset value, fusing the third preview image after the focus position is adjusted with the third preview image to obtain the target image; when the target value is the target value, adjusting the display size of the moon in the third preview image to the size indicated by the target value, and fusing the third preview image after the display size of the moon is adjusted with the third preview image after the focus position is adjusted to obtain the target image.
[0156] Since the user may not adjust the display size of the moon in the target image through the moon adjustment control, in this case, the electronic device may not adjust the display size of the moon during the image fusion stage.
[0157] It should be noted that the preset value can be set in advance according to needs. Normally, the preset value is 1. When the preset value is 1, the display size of the moon captured by the first camera is the display size of the moon in the target image, that is, there is no need to adjust the display size of the moon.
[0158] In order to ensure the accuracy of the moon display position and avoid ghosting in the moon area after fusion, the electronic device can adjust the display size of the moon in the third preview image according to the target value after adjusting the focus position of the moon. Figure 6 After determining the first focus position of the moon, the electronic device can adjust the display size of the moon in the third preview image according to the target value, and then fuse the third preview image after the moon display size is adjusted with the third preview image after the focus position is adjusted.
[0159] It should be noted that the electronic device may use the Laplace pyramid algorithm to fuse the third preview image after the moon display size is adjusted and the third preview image after the focus position is adjusted.
[0160] It is worth noting that the moon display size is adjusted after the focus position of the moon is adjusted, thereby reducing the possibility of moon ghosting in the target image and improving the display clarity and display effect of the target image.
[0161] In the embodiment of the present application, since the exposure of the third preview image is less than that of the first preview image, a clear moon image can be obtained in the third preview image; and since the clarity of objects other than the moon in the second preview image is greater than the clarity of objects other than the moon in the third preview image, the target image obtained by processing the third preview image through the second preview image is an image with high clarity including the moon and other objects, thereby improving the imaging clarity of other background objects in the same viewfinder as the moon, and improving the image shooting effect. In addition, the electronic device can select different methods to determine the target image according to different focusing distances, so that the operation of determining the target image is more targeted. In addition, the display size of the moon in the target image is adjusted through the moon adjustment control, thereby improving the coordination between the moon and other objects in the target image, and at the same time improving the interactivity with the user.
[0162] After explaining the image processing method provided in the embodiment of the present application in detail, the electronic device involved in the embodiment of the present application is explained.
[0163] As an example, the method can be applied to an electronic device with multiple cameras, and the multiple cameras include a telephoto camera and a main camera. As an example and not a limitation, the electronic device can be, but is not limited to, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a vehicle-mounted device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a mobile phone, a smart watch, a smart camera, etc., and the embodiments of the present application are not limited to this.
[0164] Fig. 9 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig. 9The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0165] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0166] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0167] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0168] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0169] 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.
[0170] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0171] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0172] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0173] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is an integer greater than 1.
[0174] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0175] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0176] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is an integer greater than 1.
[0177] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0178] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in various coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0179] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0180] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0181] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created by the electronic device 100 during use (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0182] The electronic device 100 can implement audio functions, such as music playback, recording, etc., through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D and the application processor.
[0183] The pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a device including at least two parallel plates with conductive materials. When force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation is applied to the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than a pressure threshold is applied to the above Figure 2 When a touch operation with a strength greater than or equal to the pressure threshold acts on the above Figure 2 When the image is viewed in the control, instructions for displaying the image are executed.
[0184] The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the user presses the above Figure 2 In the shooting control shown, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
[0185] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, in the shooting scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing. For example, the distance sensor 180F can be used to focus on objects other than the moon within the image acquisition range of the second camera, and after the focus is completed, the focus distance of the second camera is determined.
[0186] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0187] The touch sensor 180K is also called a "touch panel". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0188] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. Touch operations acting on 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 support customization. Exemplarily, the motor can also realize the determination of object focus and focus distance.
[0189] Next, the software system of the electronic device 100 will be described.
[0190] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software system of the electronic device 100.
[0191] Fig.10 1 is a block diagram of a software system of an electronic device 100 provided in an embodiment of the present application. Fig.10 The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime) and the system layer, and the kernel layer.
[0192] The application layer can include a series of application packages. Fig.10 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
[0193] The application framework layer provides application programming interface (API) and programming framework for the applications in the application layer. The application framework layer includes some predefined functions. Fig.10 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc. The window manager is used to manage window programs. The window manager can obtain the size of the display screen, determine whether there is a status bar, lock the screen, capture the screen, etc. The content provider is used to store and obtain data and make these data accessible to applications. These data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build the display interface of the application, and the display interface can be composed of one or more views, for example, including a view for displaying a text message notification icon, including a view for displaying text, and including a view for displaying pictures. The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, etc. The notification manager enables the application to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of an icon or scroll bar text, such as a notification of an application running in the background. The notification manager can also be a notification that appears on the screen in the form of a dialog window, such as a text message in the status bar, a reminder sound, an electronic device vibrating, an indicator light flashing, etc.
[0194] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system. The core library consists of two parts: one is the function that the Java language needs to call, and the other is the Android core library. The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0195] The system library can include multiple functional modules, such as: surface manager, media library, 3D graphics processing library (such as: OpenGL ES), 2D graphics engine (such as: SGL), etc. The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.
[0196] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
[0197] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.
[0198] When the 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, timestamp of the touch operation, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the raw input event. For example, if the touch operation is a single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer, starts the camera application, and then calls the kernel layer to start the camera driver to capture static images or videos through the camera 193.
[0199] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of 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, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (such as: coaxial cable, optical fiber, data subscriber line (Digital Subscriber Line, DSL)) or wireless (such as: infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access, or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a digital versatile disc (DVD)), or a semiconductor medium (such as a solid state disk (SSD)).
[0200] The above are optional embodiments provided for the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the technical scope disclosed in the present application shall be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: Applied in an electronic device, the method comprises: During image acquisition by a first camera of the electronic device, if a zoom ratio of the first camera is greater than or equal to a first ratio threshold, performing moon detection on a first preview image acquired by the first camera; When the moon exists in the first preview image, displaying a second preview image captured by the second camera of the electronic device in the first preview image in a picture-in-picture manner, wherein both the second preview image and the first preview image include the moon; updating the first preview image to a third preview image, wherein the exposure of the third preview image is lower than that of the first preview image, and the clarity of objects other than the moon in the second preview image is higher than the clarity of objects other than the moon in the third preview image; In response to a photographing operation, the third preview image is processed based on the second preview image to obtain a target image.
2. The method according to claim 1, characterized in that Before the step of processing the third preview image based on the second preview image to obtain the target image in response to the shooting operation, the method further comprises: Focusing on objects other than the moon within the image acquisition range of the second camera; After focusing is completed, determining a focus distance of the second camera; The step of processing the third preview image based on the second preview image in response to the shooting operation to obtain a target image includes: In response to the shooting operation, the third preview image is processed based on the second preview image according to the focus distance to obtain the target image.
3. The method according to claim 2, characterized in that The step of processing the third preview image based on the second preview image in response to the shooting operation according to the focus distance to obtain the target image includes: In response to the shooting operation, acquiring an S frame corresponding to the second preview image according to the exposure parameter of the second preview image, where the S frame is a preview image captured by the second camera before the second preview image is captured, and an exposure value of the S frame is smaller than an exposure value of the second preview image, and an exposure duration of the S frame is smaller than an exposure duration of the second preview image; When the focus distance is greater than a distance threshold, based on the S frame and the second preview image, the third preview image is updated, and the updated third preview image is fused with the third preview image to obtain the target image; When the focus distance is less than or equal to the distance threshold, the S frame, the second preview image and the third preview image are fused to obtain the target image.
4. The method according to claim 3, characterized in that When the focus distance is greater than a distance threshold, the third preview image is updated based on the S frame and the second preview image, and the updated third preview image is merged with the third preview image to obtain the target image, including: When the focus distance is greater than the distance threshold, fusing the S frame with the second preview image to obtain a first image; updating the exposure parameter of the third preview image according to the exposure parameter of the first image; The updated third preview image is merged with the third preview image to obtain the target image.
5. The method according to claim 3, characterized in that When the focus distance is greater than the distance threshold, the third preview image is updated based on the S frame and the second preview image, and the updated third preview image is merged with the third preview image to obtain the target image, the method further includes: According to the exposure parameter of the second preview image, acquiring L frames corresponding to the second preview image, where the L frames are preview images captured after the second camera captures the second preview image, and an exposure value of the L frames is greater than an exposure value of the second preview image, and an exposure duration of the L frames is greater than an exposure duration of the second preview image; When the focus distance is greater than a distance threshold, the third preview image is updated based on the S frame and the second preview image, and the updated third preview image is merged with the third preview image to obtain the target image, including: Merging the S frame, the second preview image and the L frame to obtain a second image; updating the exposure parameter of the third preview image according to the exposure parameter of the second image; The updated third preview image is merged with the third preview image to obtain the target image.
6. The method according to any one of claims 3 to 5, characterized in that The step of fusing the updated third preview image with the third preview image to obtain the target image includes: Determining a first focus position of the moon in the third preview image, and a second focus position of the moon in the updated third preview image; When the first focus position is inconsistent with the second focus position, adjusting the focus position of the moon in the updated third preview image according to a deviation value between the first focus position and the second focus position; According to the target value, the third preview image after the focus position is adjusted is fused with the third preview image to obtain the target image, and the target value is used to indicate the display size of the moon in the target image.
7. The method according to claim 6, characterized in that The step of fusing the third preview image after the focus position is adjusted with the third preview image according to the target value to obtain the target image includes: When the target value is a preset value, fusing the third preview image after the focus position is adjusted with the third preview image to obtain the target image; When the target value is the target value, the display size of the moon in the third preview image is adjusted to the size indicated by the target value, and the third preview image after the moon display size is adjusted and the third preview image after the focus position is adjusted are fused to obtain the target image, and the target value is determined in response to the user operation of adjusting the display size of the moon received before the shooting operation.
8. The method according to any one of claims 6 or 7, characterized in that In the process of collecting images through the first camera of the electronic device, if the zoom ratio of the first camera is greater than or equal to the first ratio threshold, after performing moon detection on the first preview image collected by the first camera, the method further includes: In the case where the moon exists in the first preview image, displaying a moon adjustment control in the shooting interface, wherein the moon adjustment control is used to adjust the display size of the moon in the target image; In response to a user operation on the moon adjustment control, a target value selected by the user operation is stored, where the target value is used to indicate a display size of the moon in the target image.
9. The method according to claim 3, characterized in that When the focus distance is less than or equal to the distance threshold, fusing the S frame, the second preview image and the third preview image to obtain the target image, including: When the focus distance is less than or equal to the distance threshold, fusing the S frame with the second preview image to obtain a third image; The third preview image is fused with the third image to obtain the target image.
10. An electronic device, characterized in that: The structure of the electronic device includes a processor and a memory; The memory is used to store a program that supports the electronic device to execute the method according to any one of claims 1 to 9.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Method and device for displaying camera preview pictures as well as terminal
CN104333701A
Preview image collecting method and device, and electronic equipment
CN108737739A
Moon shooting method and electronic device
CN109951633A
Moon image shooting method, device and computer readable storage medium
CN113347364A
Shooting method and electronic equipment
CN113709354A