Image processing method and device
By combining the advantages of front camera and rear camera on the mobile phone to perform image segmentation and fusion processing, the problem of traditional Selfie imaging is solved, and the Selfie experience and imaging effect are improved.
Patent Information
- Application Number
- CN202311724932.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-14
- Publication Date
- 2025-06-17
AI Technical Summary
When taking selfies in traditional mobile phones, due to the limited view range of the front camera and the low imaging quality, the user's selfie experience and photo effects are poor.
By acquiring images captured by the front camera and the rear camera, image segmentation and fusion processing are performed, and the target image is generated by combining the front camera portrait imaging effect and the rear camera wide-angle view range.
It improves the quality of self-portrait imaging, enriches user self-portrait composition, improves user experience, and generates richer image information and better imaging effects.
Smart Images

Figure CN120163714A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computational photography technology, and particularly to an image processing method and apparatus. Background Art
[0002] Selfie is one of the most common shooting scenarios of mobile phone cameras. Currently, almost all mobile phone selfies are achieved by using the front camera of the mobile phone, which requires the user to hold the mobile phone and stretch the arm for shooting. However, in the traditional selfie scenario, the viewing range of the front camera is limited and the imaging quality is low, resulting in a poor user selfie experience and photo effect. Summary of the Invention
[0003] To improve the user's selfie effect and image quality, embodiments of the present disclosure provide an image processing method, apparatus, electronic device, and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides an image processing method applied to an electronic device. The method includes:
[0005] Obtain a first image collected by a front camera of the electronic device and a second image collected by a rear camera of the electronic device, where the first image includes a preset object;
[0006] Perform image segmentation on the preset object in the first image to obtain a segmented image of the preset object;
[0007] Perform fusion processing on the segmented image and the second image to obtain a target image.
[0008] In some embodiments, the obtaining a first image collected by a front camera of the electronic device and a second image collected by a rear camera of the electronic device includes:
[0009] In response to detecting a first shooting instruction of the electronic device in a preset camera mode, collect the first image by using the front camera called in the preset camera mode, and collect the second image by using the rear camera called in the preset camera mode.
[0010] In some embodiments, the obtaining a first image collected by a front camera of the electronic device and a second image collected by a rear camera of the electronic device includes:
[0011] In response to detecting that the electronic device turns on the preset camera mode, call the front camera to work, and in the case of detecting a second shooting instruction, collect the first image by using the front camera;
[0012] The rear camera is called to work, and in the case where a third photographing instruction is detected, the second image is collected by the rear camera.
[0013] In some embodiments, the fusing the segmented image and the second image to obtain a target image includes:
[0014] Obtaining a first field of view angle of the front camera that collects the first image, and a second field of view angle of the rear camera that collects the second image;
[0015] Determining an image scaling ratio based on the first field of view angle and the second field of view angle;
[0016] Adjusting the size of the segmented image based on the image scaling ratio, and fusing the adjusted segmented image on top of the second image to obtain the target image.
[0017] In some embodiments, the image processing method according to the present disclosure further includes:
[0018] In response to the electronic device turning on the preset camera mode, the front camera and the rear camera are called to work simultaneously;
[0019] Collecting a first preview image through the front camera, and collecting a second preview image through the rear camera, wherein the first preview image includes the preset object;
[0020] Displaying the first preview image and the second preview image on the preview interface of the electronic device.
[0021] In some embodiments, the displaying the first preview image and the second preview image on the preview interface of the electronic device includes:
[0022] Displaying the first preview image and the second preview image side by side on the preview interface;
[0023] Or,
[0024] Displaying the first preview image and the second preview image in layers on the preview interface.
[0025] In some embodiments, the image processing method according to the present disclosure further includes:
[0026] In response to the electronic device turning on the preset camera mode, the front camera and the rear camera are called to work simultaneously;
[0027] Collecting a first preview image through the front camera, and collecting a second preview image through the rear camera, wherein the first preview image includes the preset object;
[0028] Perform image segmentation on the preset object in the first preview image to obtain a preview segmentation image of the preset object;
[0029] Perform fusion processing on the preview segmentation image and the second preview image to obtain a target preview image, and display the target preview image on the preview interface of the electronic device.
[0030] In some embodiments, the obtaining of the first image captured by the front camera of the electronic device and the second image captured by the rear camera of the electronic device includes:
[0031] In response to the electronic device turning on a preset camera mode, detect a user operation instruction;
[0032] Determine a target front camera from at least one front camera and a target rear camera from at least one rear camera according to the user operation instruction, and determine the camera parameters of the target front camera and the target rear camera;
[0033] Based on the camera parameters, use the target front camera to capture the first image and use the target rear camera to capture the second image.
[0034] In some embodiments, the performing of fusion processing on the segmentation image and the second image to obtain a target image includes:
[0035] Display an operation option interface on the electronic device, where the operation option interface includes a manual editing option and an automatic editing option;
[0036] In response to detecting that the user selects the manual editing option, display the segmentation image and the second image on the electronic device;
[0037] Obtain an editing instruction for the user to adjust the size and / or position of the segmentation image, and fuse the segmentation image and the second image according to the editing instruction to obtain the target image.
[0038] In a second aspect, an embodiment of the present disclosure provides an image processing apparatus applied to an electronic device, where the apparatus includes:
[0039] An image acquisition module configured to obtain a first image captured by the front camera of the electronic device and a second image captured by the rear camera of the electronic device, where the first image includes a preset object;
[0040] An image segmentation module configured to perform image segmentation on the preset object in the first image to obtain a segmentation image of the preset object;
[0041] An image fusion module, configured to perform a fusion process on the segmented image and the second image to obtain a target image.
[0042] In some embodiments, the image acquisition module is configured to:
[0043] In response to detecting a first photographing instruction of the electronic device in a preset camera mode, collect the first image through a front camera called in the preset camera mode, and collect the second image through a rear camera called in the preset camera mode.
[0044] In some embodiments, the image acquisition module is configured to:
[0045] In response to detecting that the electronic device turns on the preset camera mode, call the front camera to work, and in the case of detecting a second photographing instruction, collect the first image through the front camera;
[0046] Call the rear camera to work, and in the case of detecting a third photographing instruction, collect the second image through the rear camera.
[0047] In some embodiments, the image fusion module is configured to:
[0048] Obtain a first field of view angle of the front camera that collects the first image and a second field of view angle of the rear camera that collects the second image;
[0049] Determine an image scaling ratio based on the first field of view angle and the second field of view angle;
[0050] Adjust the size of the segmented image based on the image scaling ratio, and fuse the adjusted segmented image on top of the second image to obtain the target image.
[0051] In some embodiments, the image acquisition module is configured to:
[0052] In response to the electronic device turning on the preset camera mode, call the front camera and the rear camera to work simultaneously;
[0053] Collect a first preview image through the front camera and a second preview image through the rear camera, wherein the first preview image includes the preset object;
[0054] Display the first preview image and the second preview image on the preview interface of the electronic device.
[0055] In some embodiments, the image acquisition module is configured to:
[0056] The first preview image and the second preview image are displayed side by side on the preview interface;
[0057] Or,
[0058] The first preview image and the second preview image are displayed in layers on the preview interface.
[0059] In some embodiments, the image acquisition module is configured to:
[0060] In response to the electronic device turning on the preset camera mode, simultaneously call the front camera and the rear camera to work;
[0061] Acquire a first preview image through the front camera and a second preview image through the rear camera, wherein the first preview image includes the preset object;
[0062] Perform image segmentation on the preset object in the first preview image to obtain a preview segmentation image of the preset object;
[0063] Perform fusion processing on the preview segmentation image and the second preview image to obtain a target preview image, and display the target preview image on the preview interface of the electronic device.
[0064] In some embodiments, the image acquisition module is configured to:
[0065] In response to the electronic device turning on the preset camera mode, detect a user operation instruction;
[0066] Determine a target front camera from at least one front camera and a target rear camera from at least one rear camera according to the user operation instruction, and determine the camera parameters of the target front camera and the target rear camera;
[0067] Based on the camera parameters, use the target front camera to acquire the first image and use the target rear camera to acquire the second image.
[0068] In some embodiments, the image fusion module is configured to:
[0069] Display an operation option interface on the electronic device, where the operation option interface includes a manual editing option and an automatic editing option;
[0070] In response to detecting that the user selects the manual editing option, display the segmentation image and the second image on the electronic device;
[0071] Obtain an editing instruction for the user to adjust the size and / or position of the segmentation image, and fuse the segmentation image and the second image according to the editing instruction to obtain the target image.
[0072] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0073] at least one front camera and at least one rear camera;
[0074] a processor; and
[0075] a memory storing computer instructions for causing the processor to execute the method according to any embodiment of the first aspect.
[0076] In a fourth aspect, an embodiment of the present disclosure provides a storage medium storing computer instructions for causing a computer to execute the method according to any embodiment of the first aspect.
[0077] The image processing method according to the embodiment of the present disclosure includes obtaining a first image collected by a front camera and a second image collected by a rear camera, performing image segmentation on the first image to obtain a segmented image of a preset object, and performing fusion processing on the segmented image and the second image to obtain a target image. In the embodiment of the present disclosure, the first image is collected by the front camera, the second image is collected by the rear camera, and the preset object of the first image is fused with the second image to obtain the target image, combining the advantages of the front camera and the rear camera to improve the self - portrait imaging quality and the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0078] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0079] Figure 1 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure.
[0080] Figure 2 is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0081] Figure 3 is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0082] Figure 4 is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0083] Figure 5 is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0084] Figure 6 It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0085] Figure 7 It is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0086] Figure 8a It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0087] Figure 8b It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0088] Figure 8c It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0089] Figure 9 It is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0090] Figure 10 It is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0091] Figure 11 It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0092] Figure 12 It is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0093] Figure 13 It is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0094] Figure 14 It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0095] Figure 15 It is a schematic diagram of the principle of an image processing method according to some embodiments of the present disclosure.
[0096] Figure 16 It is a flowchart of an image processing method according to some embodiments of the present disclosure.
[0097] Figure 17 It is a structural block diagram of an image processing apparatus according to some embodiments of the present disclosure.
[0098] Figure 18 It is a structural block diagram of an electronic device according to some embodiments of the present disclosure. Specific embodiments
[0099] The technical solutions of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts belong to the scope of protection of the present disclosure. In addition, the technical features involved in different embodiments of the present disclosure described below can be combined with each other as long as they do not conflict with each other.
[0100] Selfie is one of the most common scenarios when users take pictures with their mobile phones. Currently, almost all mobile phone selfies are taken using the front-facing camera on the front of the mobile phone. When taking a selfie, the user needs to hold the mobile phone and stretch it out for shooting.
[0101] Without using auxiliary tools such as selfie sticks and tripods, the distance between the camera and the portrait is relatively fixed, resulting in a limited viewing range of the front-facing camera. Especially when taking landscape photos, users often expect to include themselves and a larger range of scenery in the photo. Even if the user repeatedly adjusts their posture, it is difficult to cover more scenery in the photo, resulting in a poor selfie experience.
[0102] To enhance the user's selfie experience, some mobile phones add multiple cameras with different focal lengths to the front-facing camera, so that users can achieve front-facing wide-angle shooting and increase the selfie viewing range. However, adding additional cameras means an increase in cost, and additional holes also need to be added to the front screen of the mobile phone, reducing the screen display area ratio.
[0103] Moreover, in the related art, the pixels of the front-facing camera are generally inferior to those of the rear-facing camera, and the front-facing camera pays more attention to optimizing the portrait effect. Therefore, the portrait effect captured by the front-facing camera is better, but the scenery often has a poor effect.
[0104] Based on the above defects in the related art, the embodiments of the present disclosure provide an image processing method, device, electronic device, and storage medium, aiming to combine the rear-facing camera and the front-facing camera to enrich the user's selfie composition and improve the selfie effect and imaging quality.
[0105] In the embodiments of the present disclosure, the image processing method and device can be applied to an electronic device. The present disclosure does not limit the type of the electronic device, and it can be any suitable device type, such as a smart phone, a tablet computer, etc.
[0106] In the embodiments of the present disclosure, the electronic device includes at least one front-facing camera and at least one rear-facing camera. The front-facing camera refers to the camera provided on the front of the electronic device, and the rear-facing camera refers to the camera provided on the back of the electronic device.
[0107] For example Figure 1 taking the shown smart phone as an example, asFigure 1 As shown in (a), generally one or two front cameras 110 are provided on the front of the mobile phone 100. To achieve a full-screen display on the front of the mobile phone, the front camera 110 is generally disposed on the mobile phone screen through a hole. As Figure 1 As shown in (b), generally one to four rear cameras 120 are provided on the back of the mobile phone 100, and the rear cameras 120 are generally centrally disposed in the lens module in the upper half of the mobile phone.
[0108] Combined with the mobile phone usage scenario, the front camera 110 and the rear camera 120 are different in shooting scenarios and imaging algorithms. For example, the front camera 110 is mainly used for scenarios such as video calls and selfies, and more for shooting close-range portraits. Therefore, in related technologies, the algorithms for the front camera 110 mainly focus on optimizing the effect of half-body portraits, so the front camera 110 generally has a better portrait shooting effect.
[0109] The rear camera 120 is mainly used for other shooting scenarios except the above scenarios. The pixels of the rear camera 120 are generally higher than those of the front camera 110, and multiple rear cameras 120 can cover various focal lengths. Therefore, the rear camera 120 can have a larger viewing range and more diverse composition methods, so the rear camera 120 has a better imaging effect in landscape shooting, full-body portraits, etc.
[0110] For the selfie scenario, for example, when the user is traveling, if the user expects to take a picture of himself / herself together with the distant scenery, the user needs to stretch out his / her arm, adjust the posture and position, and use the front camera 110 to take a picture of his / her own portrait and the background scenery.
[0111] During this process, due to the limited length of the user's arm, the proportion of the selfie portrait is relatively fixed, resulting in a limited viewing range of the front camera 110. Even if the user repeatedly adjusts the posture and angle, it is difficult to cover more background. In addition, since the pixels of the front camera 110 are generally not as high as those of the rear camera 120, and the front camera 110 pays more attention to portrait optimization, the background details collected by the front camera 110 are also less, resulting in a poor imaging effect.
[0112] In the embodiment of the present disclosure, the advantages of the front camera 110 and the rear camera 120 are fully considered. In the user's selfie scenario, the front camera 110 can be used to collect a portrait image, and the rear camera 120 can be used to collect a background image. Then, through image fusion technology, the front camera portrait and the rear camera background are fused to obtain a final selfie image, so as to combine the advantages of the better portrait shooting effect of the front camera 110 and the wider viewing range and higher imaging effect of the rear camera 120, and obtain a selfie image with richer image information and better imaging effect.
[0113] As Figure 2As shown, in some embodiments, the image processing method of the present disclosure example includes:
[0114] S210. Obtain a first image collected by a front camera of the electronic device and a second image collected by a rear camera of the electronic device.
[0115] In the embodiments of the present disclosure, the electronic device may be as Figure 1 shown. It includes at least one front camera 110 and at least one rear camera 120. The front camera 110 and the rear camera 120 are respectively disposed on the front and back sides of the electronic device, so that the shooting directions and ranges of the two are different.
[0116] Different from the traditional self - shooting method, in the embodiments of the present disclosure, when the user uses the electronic device to take a self - portrait, not only the front camera 110 is needed to collect the portrait, but at the same time, the rear camera 120 is also needed to collect the background image.
[0117] In some embodiments, in the case of detecting a single shooting instruction of the user, the front camera and the rear camera can be called simultaneously to collect one image each. The image collected by the front camera is the first image, and the image collected by the rear camera is the second image.
[0118] In other embodiments, the first image and the second image can also be collected by two shootings respectively. For example, in the case of detecting the user's first shooting instruction, the front camera is called to collect the first image, and then in the case of detecting the user's second shooting instruction, the rear camera is called to collect the second image.
[0119] In the following embodiments of the present disclosure, the above - mentioned two image collection methods are respectively described and will not be elaborated here for the time being.
[0120] In some embodiments, some electronic devices include multiple front cameras and multiple rear cameras. Thus, when collecting images, according to the user operation instruction or the system default instruction, a target front camera can be selected from multiple front cameras, and a target rear camera can be selected from multiple rear cameras, and the target front camera is called to collect the first image, and the target rear camera is called to collect the second image. The following embodiments of the present disclosure describe this process.
[0121] In the embodiments of the present disclosure, the first image collected by the front camera includes a preset object. The preset object may be, for example, a portrait. When the user holds the electronic device and uses the front camera to take a picture, the collected first image includes the user's own portrait, and the portrait on the first image is the preset object described in the present disclosure.
[0122] For example Figure 3In an example scenario, the first image captured by the front camera is a self-portrait image including a portrait, and the second image captured by the rear camera is a background image.
[0123] S220. Perform image segmentation on a preset object in the first image to obtain a segmented image of the preset object.
[0124] In the embodiments of the present disclosure, as can be seen from the foregoing, the first image includes a preset object, so that the preset object in the first image can be segmented by image segmentation technology to obtain a segmented image including only the preset image.
[0125] There are many related technologies for image segmentation, such as portrait matting algorithms, foreground-background segmentation algorithms, etc. Those skilled in the art can understand and fully implement them with reference to the related technologies, and the present disclosure will not elaborate on the specific algorithm principles.
[0126] For example, in an example, an image segmentation model based on a deep neural network (DNN, Deep Neural Network) can be pre-trained. By inputting the first image into the image segmentation model, the segmented image output by the model can be obtained.
[0127] In an example, the first image captured by the front camera is as Figure 4 shown. The first image includes a preset object 101 and a background 102, and the preset object 101 is a portrait. By performing portrait segmentation on the first image, the image segmentation of the foreground portrait and the background can be realized, and the background image after removing the portrait and the segmented image including the portrait can be obtained respectively.
[0128] S230. Perform fusion processing on the segmented image and the second image to obtain a target image.
[0129] As can be seen from the foregoing, the second image is an image captured by the rear camera of the electronic device, and the second image can be, for example, a landscape image. In the embodiments of the present disclosure, the segmented image including the preset object obtained by the foregoing image segmentation can be fused with the second image to obtain a target image. That is, the target image includes the preset object in the first image and the background image in the second image.
[0130] For example, in an example, the second image is as Figure 5 shown, and the segmented image is as Figure 4 shown. Combining Figure 5 it can be seen that after fusing the segmented image and the second image, the preset object included in the segmented image can be superimposed on the landscape image of the second image to obtain the final target image.
[0131] In some embodiments, the fusion ratio and position of the preset object of the segmented image on the second image can be determined according to the field of view angle ratio of the front camera and the rear camera, or can be set independently by the user. The following will separately describe this in the present disclosure.
[0132] It is worth noting that the beneficial effects of the image processing method according to the embodiments of the present disclosure in the user's self - shooting scenario include but are not limited to the following aspects:
[0133] 1) Combining Figure 4 , Figure 5 As can be seen from the example, due to factors such as the fixed focal length of the front camera and the limitation of the user's arm length, the proportion of the portrait on the first image collected by the front camera is relatively fixed, and the portrait occupies a relatively large proportion of the picture. Therefore, when the user takes a self - portrait with the scenery, the background information that can be included in the self - portrait image is less.
[0134] In the embodiments of the present disclosure, since the second image is collected by the rear camera, the rear camera can include multiple different focal lengths, and the object distance of the rear camera can be infinite, so the viewing range is wider and can cover more scene information.
[0135] Therefore, after fusing the segmented image and the second image, the target image can include more scene information, improving the self - portrait image effect. Moreover, the increase in the viewing range will greatly enrich the user's self - portrait composition. The user can adopt more poses and angles to capture the portrait, enriching the user's self - portrait experience.
[0136] 2) In the related art, the pixels of the rear camera of the electronic device are generally higher than those of the front camera. Therefore, using the second image collected by the rear camera as the self - portrait background can obtain more background details and imaging effects. At the same time, combining the good portrait imaging effect of the front camera, the advantages of the front camera and the rear camera are combined to obtain better imaging quality.
[0137] 3) In the embodiments of the present disclosure, since the first image and the second image are the front - and rear - shot images collected in the same environmental scene, the first image and the second image have the same or approximate environmental effects, which can reflect the user's situation in this scene. Therefore, the fused target image has a more natural and smooth transition effect and better imaging quality compared with traditional post - production P - pictures.
[0138] 4) In the embodiments of the present disclosure, in a scenario such as traveling, the user can take self - portrait photos containing more scenery without using auxiliary tools such as selfie sticks and tripods, nor relying on others to take pictures, which greatly facilitates the user's self - portrait operation.
[0139] As described above, in the embodiments of the present disclosure, the front camera is used to collect the first image, the rear camera is used to collect the second image, and after the first image is segmented, the preset object included in the first image is fused with the second image to obtain the target image, which can effectively enrich the user's self - shooting experience, improve the quality of self - shooting images, and enable the user to obtain a more natural, content - rich and detailed self - shooting image.
[0140] In some embodiments, the image processing method of the present disclosure example can be used as a camera mode of an electronic device. It can be understood that taking a smart phone as an example, the camera application of a smart phone generally includes multiple camera modes, such as night scene, portrait, macro, etc. Similarly, the image processing method of the embodiments of the present disclosure can also be used as a camera mode of the camera application, such as the "self - shooting synthesis" mode. The user can enable this function by clicking on the "self - shooting synthesis" mode in the camera application.
[0141] For example Figure 6 shows an example diagram of the display interface of the mobile phone camera application in the related art. When the user opens the camera application, multiple camera modes will be displayed on the display interface, such as "video recording", "night scene", "standard", "self - shooting synthesis", etc. When the user clicks and selects "self - shooting synthesis", it means that the user needs to start this camera mode, and then the image processing method described in the embodiments of the present disclosure can be entered.
[0142] It should be noted that after the "self - shooting synthesis" camera mode is enabled, the methods of using the front camera and the rear camera to collect the first image and the second image can include the following two types:
[0143] 1) The user clicks the capture button once, and the front camera and the rear camera capture images simultaneously;
[0144] 2) The user can click the capture button twice separately to capture the first image and the second image respectively.
[0145] The following will separately describe the above two shooting methods.
[0146] As Figure 7 shown, in some embodiments, the image processing method of the present disclosure example includes:
[0147] S710. In response to the electronic device enabling the preset camera mode, the front camera and the rear camera are simultaneously called to work.
[0148] In the embodiments of the present disclosure, the preset camera mode is the aforementioned "self - shooting synthesis" mode. When the user clicks "self - shooting synthesis" on the Figure 6 shown display interface, it means that the user wants to enter this camera mode, and thus the electronic device enables the "self - shooting synthesis" camera mode.
[0149] In some embodiments, when entering the camera mode, the electronic device can simultaneously activate the front camera and the rear camera to work, that is, the front camera and the rear camera work simultaneously.
[0150] It can be understood that some electronic devices include multiple front cameras and multiple rear cameras. Thus, when entering the "selfie composition" camera mode, a default front camera can be activated from the multiple front cameras to work. Similarly, a default rear camera can be activated from the multiple rear cameras to work. During the photographing process, the user can also independently select to switch between the front camera and the rear camera, which will be described below in this disclosure.
[0151] S720. Collect a first preview image through the front camera and collect a second preview image through the rear camera.
[0152] When the front camera and the rear camera are simultaneously activated to work, the front camera can capture an image in front of the electronic device, and this image is the first preview image. At the same time, the rear camera can capture an image on the back of the electronic device, and this image is the second preview image.
[0153] It can be understood that since the user has not clicked the capture button at this time, it is in the photographing preview stage at this time, that is, the first preview image captured by the front camera and the second preview image captured by the rear camera need to be displayed on the preview interface of the camera application, so that the user can observe the imaging effect through the preview interface.
[0154] S730. Display the first preview image and the second preview image on the preview interface of the electronic device.
[0155] It can be understood that in a conventional shooting scenario, generally only one camera is activated to work at the same time, so the preview interface only needs to display the preview image of this one camera. In the embodiments of this disclosure, since the front camera and the rear camera are activated to work simultaneously, the preview images of these two cameras need to be displayed on the preview interface at the same time.
[0156] In some embodiments, the preview interface can be divided into two parts, so that the first preview image and the second preview image are displayed side by side on the preview interface. For example Figure 8a In the example, the entire preview interface can be divided into two parts, the upper and lower parts, which are the first area and the second area respectively. Thus, the first preview image can be displayed in the first area, and the second preview image can be displayed in the second area, that is, the first preview image and the second preview image are displayed side by side on the preview interface.
[0157] Of course, those skilled in the art can understand that the way of dividing the preview interface is not limited to Figure 8a as shown, and it can also be any other form suitable for implementation, and this disclosure does not limit this.
[0158] In some other embodiments, the first preview image and the second preview image can be displayed in layers on the preview interface. For example, the first preview image is displayed in the lower layer, and the second preview image is displayed in a floating window above the first preview image.
[0159] For example Figure 8b In the example, the preview interface of the camera application includes a third area in the upper layer and a fourth area in the lower layer. The third area floats above the fourth area in the form of a floating window, so that the first preview image can be displayed in the third area and the second preview image can be displayed in the fourth area, realizing the layered display of the first preview image and the second preview image.
[0160] Of course, those skilled in the art can understand that the layering method of the preview interface is not limited to Figure 8b shown, and it can also be any other form suitable for implementation. For example, the user can manually drag the position of the third area, and the present disclosure does not limit this.
[0161] In the above Figure 8a and Figure 8b two embodiments, the user can preview the shooting effects of the front camera and the rear camera through the preview interface at the same time, so that the user can adjust the appropriate shooting posture, angle, etc. by observing the preview effect, improving the user's shooting experience.
[0162] However, in Figure 8a and Figure 8b the embodiments, the preview effects of the front camera and the rear camera are displayed independently, and the user cannot preview the effect after fusion processing. Therefore, in some embodiments, the fused image effect can be further displayed on the preview interface, which will be described below in combination with Figure 9 for illustration.
[0163] As Figure 9 shown, in some embodiments, the image processing method of the present disclosure example includes:
[0164] S910. In response to the electronic device turning on the preset camera mode, simultaneously call the front camera and the rear camera to work.
[0165] S920. Collect the first preview image through the front camera and collect the second preview image through the rear camera.
[0166] In the embodiments of the present disclosure, the method processes of S910 to S920 can refer to the foregoing S710 to S720, and the present disclosure will not elaborate on this.
[0167] S930. Perform image segmentation on the preset object on the first preview image to obtain a preview segmentation image of the preset object.
[0168] S940. Perform a fusion process on the preview segmented image and the second preview image to obtain a target preview image, and display the target preview image on the preview interface of the electronic device.
[0169] In the embodiments of the present disclosure, after the first preview image is captured by the front camera and the second preview image is captured by the rear camera, the preview images can be fused to obtain a target preview image, so as to display the target preview image on the preview interface, enabling the user to directly observe the image effect after synthesis on the preview interface.
[0170] Specifically, an image segmentation can be performed on a preset object in the first preview image captured by the front camera to obtain a preview segmented image including the preset object. The process of image segmentation can fully refer to the foregoing Figure 4 embodiments, and the present disclosure will not elaborate on this.
[0171] After obtaining the preview segmented image, the preview segmented image including the preset object can be fused onto the second preview image captured by the rear camera to obtain the fused target preview image. The process of image fusion can fully refer to the foregoing Figure 5 embodiments, and the present disclosure will not elaborate on this.
[0172] For example Figure 8c In the example, after obtaining the target preview image through the above process, the target preview image can be displayed on the preview interface. Combining Figure 8c It can be seen that the portrait captured by the front camera and the background captured by the rear camera are synthetically displayed on the preview interface. Although the user has not clicked the capture button to take a photo, the imaging effect can already be accurately understood through the preview interface. Thus, the user can adjust the posing and angle, etc., and take a photo after achieving a satisfactory shooting effect.
[0173] In contrast Figures 8a - 8c in the embodiments, Figure 8a and Figure 8b in the preview interface of taking a photo, the images captured by the front camera and the rear camera are independently displayed respectively. The user can preview the imaging effects of the front camera and the rear camera respectively. And since there is no need to perform operations such as image fusion, the computing resources consumed are very small. In Figure 8c the embodiments, the fused image can be displayed and previewed in the preview interface of taking a photo, so that the user can very intuitively see the shooting effect, greatly facilitating the user's self - shooting experience.
[0174] In addition, in Figures 8a - 8cIn an embodiment, since the front camera and the rear camera work simultaneously in the "selfie composition" mode, after the user adjusts the pose and angle according to the preview interface, the user only needs to click the capture button once. Thus, when the electronic device detects the first capture instruction for the user to click the capture button, it can simultaneously capture the first image using the front camera and capture the second image using the rear camera. In other words, the user only needs one capture action to simultaneously complete the capture of the first image and the second image.
[0175] In some other embodiments, as described above, in the "selfie composition" mode, the first image and the second image can also be captured separately through two capture operations. The following will be described in conjunction with Figure 10 this.
[0176] As Figure 10 shown, in some embodiments, the image processing method of the present disclosure includes:
[0177] S1010. In response to detecting that the electronic device turns on a preset camera mode, call the front camera to work, and in the case of detecting a second capture instruction, capture the first image through the front camera.
[0178] S1020. Call the rear camera to work, and in the case of detecting a third capture instruction, capture the second image through the rear camera.
[0179] In the embodiments of the present disclosure, the preset camera mode is the aforementioned "selfie composition" mode. In the case of detecting the activation of this camera mode, the first image and the second image can be captured sequentially.
[0180] For example Figure 11 in the example, when it is detected that the electronic device turns on the "selfie composition" mode, the electronic device can first call the front camera to work. For example Figure 11 as shown in (a) below, at this time, the preview interface displays the preview image of the front camera. After the user clicks the capture button for the first time, the electronic device detects the second capture instruction for the user to click the capture button, and then captures the first image through the front camera.
[0181] After the first image is captured, the electronic device automatically calls the rear camera to work, that is, automatically flips the camera. For example Figure 11 as shown in (b) below, at this time, the preview interface displays the preview image of the rear camera. After the user clicks the capture button for the second time, the electronic device detects the third capture instruction for the user to click the capture button, and then captures the second image through the rear camera.
[0182] After the first image and the second image are captured through the method of any of the above embodiments, the target image can be obtained by using the aforementioned image segmentation and fusion process.
[0183] It is worth noting that in the process of fusing the segmented image of the preset object with the second image, the field of view (FoV) of the front camera is generally different from that of the rear camera, so the image ratios of the two images are also different. If the preset object on the first image is directly fused with the second image, the portrait ratio will often be unbalanced, resulting in poor imaging effects. Therefore, in some embodiments of the present disclosure, the image ratio can be automatically adjusted during image fusion. Figure 12 Provide explanation.
[0184] like Figure 12 As shown, in some embodiments, the image processing method of the present disclosure example includes:
[0185] S1210: Acquire a first field of view angle of a front camera that captures a first image, and a second field of view angle of a rear camera that captures a second image.
[0186] The field of view angle FoV is an optical characteristic of a camera. The size of the field of view angle determines the field of view of the camera. The field of view angle parameters of each camera included in the electronic device are all known parameters. In the embodiment of the present disclosure, the first field of view angle FoV 1 of the front camera that captures the first image and the second field of view angle FoV 2 of the rear camera that captures the second image can be obtained.
[0187] S1220. Determine an image scaling ratio based on the first field of view angle and the second field of view angle.
[0188] In the embodiment of the present disclosure, after determining the first field of view angle FoV 1 and the second field of view angle FoV 2, the image scaling ratio of the front camera and the rear camera can be determined, which can be expressed as FoV 1 / FoV 2.
[0189] S1230 , adjusting the size of the segmented image based on the image scaling ratio, and fusing the adjusted segmented image onto an upper layer of the second image to obtain a target image.
[0190] Combination Figure 5 In the embodiment, when the segmented image of the preset object is fused with the second image, in order to ensure the correct proportion of the portrait, the size of the segmented image needs to be adjusted in combination with the image scaling ratio FoV 1 / FoV 2 to obtain the scaled segmented image. Then, the adjusted segmented image is fused with the second image to obtain the target image.
[0191] It is worth noting that when the segmented image and the second image are fused, the position of the segmented image on the second image can be preset. For example, the segmented image can be set to be close to the lower edge of the second image and located in the center of the image by default.Figure 5 In the example target image, the portrait is located at the lower edge and the center position of the image.
[0192] As can be seen from the above, in the embodiments of the present disclosure, when fusing the segmented image and the second image, the image scaling ratio is determined based on the field of view angles of the front camera and the rear camera, and the segmented image is scaled and adjusted before being fused into the second image, so that the portrait ratio in the target image is more coordinated and the imaging effect is improved.
[0193] In the above embodiments, after the first image and the second image are collected, the electronic device can automatically execute the above method process to implement image segmentation of the first image and image fusion of the segmented image and the second image. In some other embodiments, the position and image ratio of the preset object can also be manually adjusted by the user. The following will be described in conjunction with Figure 13 for illustration.
[0194] As Figure 13 shown, in some embodiments, the image processing method of the present disclosure example includes:
[0195] S1310. Display an operation option interface on the electronic device.
[0196] S1320. In response to detecting that the user selects the manual editing option, display the segmented image and the second image on the electronic device.
[0197] S1330. Obtain an editing instruction for the user to adjust the size and / or position of the segmented image, and fuse the segmented image and the second image according to the editing instruction to obtain a target image.
[0198] In the embodiments of the present disclosure, after the first image and the second image are collected, the electronic device can provide "automatic editing option" and "manual editing option" for the user to select.
[0199] For example Figure 14 In the example, after the first image and the second image are collected, an operation option interface is output on the display interface of the electronic device, and the operation option interface includes "automatic editing" and "manual editing".
[0200] If the user selects "automatic editing", after the electronic device detects the instruction that the user selects "automatic editing", it can perform image segmentation and fusion processing on the first image and the second image according to the method process of any of the foregoing embodiments to obtain a target image. Those skilled in the art can understand and fully implement it with reference to the foregoing, and the present disclosure will not be elaborated herein.
[0201] If the user selects "Manual Editing", the electronic device detects the instruction that the user selects "Manual Editing", indicating that the user expects to adjust the target image by himself / herself. Thus, the segmented image and the second image can be displayed on the electronic device for the user to manually edit.
[0202] For example Figure 15 As shown, the electronic device can display the segmented image and the second image, and there is an editable instruction box on the segmented image, so that the user can adjust the size and / or position of the segmented image by dragging the instruction box. For example Figure 15 In the example, the user can click the cross arrow in the middle of the segmented image and then drag it to adjust the position of the segmented image; the user can click the edge or diagonal of the instruction box and then drag it to adjust the size of the segmented image.
[0203] After the user adjusts the size and / or position of the segmented image, the user can click the "OK" button below. Thus, the electronic device can obtain the editing instruction for adjusting the segmented image, and perform a fusion process on the segmented image and the second image based on the editing instruction to obtain the target image.
[0204] As can be seen from the above, in the embodiments of the present disclosure, the user can manually adjust the position and proportion of the portrait, thus enriching the user's self - shooting operation and improving the user experience.
[0205] In the above - mentioned embodiments of the present disclosure, during the photographing process of the electronic device, the user can freely switch the camera or adjust the camera parameters. The following will be combined with Figure 16 for illustration.
[0206] As Figure 16 shown, in some embodiments, the image - processing method of the present disclosure example includes:
[0207] S1610. In response to the electronic device turning on the preset camera mode, detect the user operation instruction.
[0208] S1620. Determine the target front - facing camera from at least one front - facing camera, determine the target rear - facing camera from at least one rear - facing camera according to the user operation instruction, and determine the camera parameters of the target front - facing camera and the target rear - facing camera.
[0209] S1630. Collect the first image by using the target front - facing camera based on the camera parameters, and collect the second image by using the target rear - facing camera.
[0210] Combined with the foregoing Figure 6 shown, the user can turn on this camera mode by clicking the "Self - shooting Synthesis" option on the photographing interface. After entering this camera mode, the user can enter the photographing preview interface according to the method process of any of the foregoing embodiments, and the present disclosure will not elaborate on this.
[0211] In the photo preview interface, the user can freely select the focal length. For example, Figure 8a as shown in Figure 8a , the user can select the focal length through the options of "1X", "3X", and "10X" in the interface. It can be understood that during the focal length switching process, it is often necessary to switch to different cameras. Therefore, the camera can be switched by switching the focal length. Thus, the desired target front camera can be selected from one or more front cameras, and the desired target rear camera can be selected from one or more rear cameras. Similarly, the user can also adjust the camera parameters, which may include, for example, exposure time, white balance, flash, etc., and the present disclosure does not limit this.
[0212] After determining the target front camera, the target rear camera, and the corresponding camera parameters, when it is detected that the user clicks the capture button, the first image can be captured through the target front camera according to the camera parameters set by the user, and the second image can be captured by using the target rear camera. The subsequent method process is not described in detail herein by the present disclosure.
[0213] As can be seen from the above, in the embodiment of the present disclosure, the first image is captured by the front camera, the second image is captured by the rear camera, and the preset object of the first image is fused with the second image to obtain the target image, combining the advantages of the front camera and the rear camera to improve the self - portrait imaging quality and the user experience.
[0214] In some embodiments, the present disclosure provides an image processing apparatus, which can be applied to the aforementioned electronic device, such as Figure 17 as shown in Figure 17 . The apparatus according to the example of the present disclosure includes:
[0215] An image acquisition module 10, configured to obtain a first image captured by the front camera of the electronic device and a second image captured by the rear camera of the electronic device, where the first image includes a preset object;
[0216] An image segmentation module 20, configured to perform image segmentation on the preset object on the first image to obtain a segmented image of the preset object;
[0217] An image fusion module 30, configured to perform a fusion process on the segmented image and the second image to obtain a target image.
[0218] In some embodiments, the image acquisition module 10 is configured to:
[0219] In response to detecting a first capture instruction of the electronic device in a preset camera mode, capture the first image through the front camera called in the preset camera mode, and capture the second image through the rear camera called in the preset camera mode.
[0220] In some embodiments, the image acquisition module 10 is configured to:
[0221] In response to detecting that the electronic device turns on the preset camera mode, call the front camera to work, and in the case of detecting a second photographing instruction, collect the first image through the front camera;
[0222] Call the rear camera to work, and in the case of detecting a third photographing instruction, collect the second image through the rear camera.
[0223] In some embodiments, the image fusion module 30 is configured to:
[0224] Obtain a first field of view angle of the front camera that collects the first image and a second field of view angle of the rear camera that collects the second image;
[0225] Determine an image scaling ratio based on the first field of view angle and the second field of view angle;
[0226] Adjust the size of the segmented image based on the image scaling ratio, and fuse the adjusted segmented image on the upper layer of the second image to obtain the target image.
[0227] In some embodiments, the image acquisition module 10 is configured to:
[0228] In response to the electronic device turning on the preset camera mode, call the front camera and the rear camera to work simultaneously;
[0229] Collect a first preview image through the front camera and a second preview image through the rear camera, wherein the first preview image includes the preset object;
[0230] Display the first preview image and the second preview image on the preview interface of the electronic device.
[0231] In some embodiments, the image acquisition module 10 is configured to:
[0232] Display the first preview image and the second preview image side by side on the preview interface;
[0233] Or,
[0234] Display the first preview image and the second preview image in layers on the preview interface.
[0235] In some embodiments, the image acquisition module 10 is configured to:
[0236] In response to the electronic device turning on the preset camera mode, call the front camera and the rear camera to work simultaneously;
[0237] Collect a first preview image through the front camera and collect a second preview image through the rear camera, where the first preview image includes the preset object;
[0238] Perform image segmentation on the preset object in the first preview image to obtain a preview segmentation image of the preset object;
[0239] Perform a fusion process on the preview segmentation image and the second preview image to obtain a target preview image, and display the target preview image on the preview interface of the electronic device.
[0240] In some embodiments, the image acquisition module 10 is configured to:
[0241] Respond to the electronic device turning on a preset camera mode and detect a user operation instruction;
[0242] Determine a target front camera from at least one front camera, determine a target rear camera from at least one rear camera according to the user operation instruction, and determine the camera parameters of the target front camera and the target rear camera;
[0243] Based on the camera parameters, use the target front camera to collect the first image and use the target rear camera to collect the second image.
[0244] In some embodiments, the image fusion module 30 is configured to:
[0245] Display an operation option interface on the electronic device, where the operation option interface includes a manual editing option and an automatic editing option;
[0246] Respond to detecting that the user selects the manual editing option, and display the segmentation image and the second image on the electronic device;
[0247] Obtain an editing instruction for the user to adjust the size and / or position of the segmentation image, and fuse the segmentation image and the second image according to the editing instruction to obtain the target image.
[0248] In some embodiments, the present disclosure provides an electronic device, including:
[0249] At least one front camera and at least one rear camera;
[0250] A processor; and
[0251] A memory storing computer instructions for causing the processor to execute the method according to any of the foregoing embodiments.
[0252] In some embodiments, the present disclosure provides a storage medium storing computer instructions for causing a computer to execute the method described in any of the foregoing embodiments.
[0253] Figure 18 FIG. shows a block diagram of an electronic device in some embodiments of the present disclosure. The following will describe the electronic device of some embodiments of the present disclosure in conjunction with Figure 18 FIG.
[0254] Referring to Figure 18 , the electronic device 1800 may include one or more of the following components: a processing component 1802, a memory 1804, a power supply component 1806, a multimedia component 1808, an audio component 1810, an input / output (I / O) interface 1812, a sensor component 1816, and a communication component 1818.
[0255] The processing component 1802 generally controls the overall operation of the electronic device 1800, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 1802 may include one or more processors 1820 to execute instructions. In addition, the processing component 1802 may include one or more modules to facilitate the interaction between the processing component 1802 and other components. For example, the processing component 1802 may include a multimedia module to facilitate the interaction between the multimedia component 1808 and the processing component 1802. Also, the processing component 1802 may read executable instructions from the memory to implement functions related to the electronic device.
[0256] The memory 1804 is configured to store various types of data to support the operation of the electronic device 1800. Examples of such data include instructions for any application or method operating on the electronic device 1800, contact data, phone book data, messages, pictures, videos, etc. The memory 1804 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.
[0257] The power supply component 1806 provides power to various components of the electronic device 1800. The power supply component 1806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 1800.
[0258] The multimedia component 1808 includes a display screen that provides an output interface between the electronic device 1800 and the user. In some embodiments, the multimedia component 1808 includes a front camera and / or a rear camera. When the electronic device 1800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have a focal length and optical zoom capabilities.
[0259] The audio component 1810 is configured to output and / or input audio signals. For example, the audio component 1810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 1800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 1804 or transmitted via the communication component 1818. In some embodiments, the audio component 1810 further includes a speaker for outputting audio signals.
[0260] The I / O interface 1812 provides an interface between the processing component 1802 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0261] The sensor component 1816 includes one or more sensors for providing a status assessment of various aspects of the electronic device 1800. For example, the sensor component 1816 can detect the on / off state of the electronic device 1800, the relative positioning of components, such as the display and the keypad of the electronic device 1800. The sensor component 1816 can also detect a change in the position of the electronic device 1800 or a component of the electronic device 1800, the presence or absence of user contact with the electronic device 1800, the orientation or acceleration / deceleration of the electronic device 1800, and the temperature change of the electronic device 1800. The sensor component 1816 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 1816 can also include a light sensor, such as a CMOS or a CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 1816 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0262] The communication component 1818 is configured to facilitate communication between the electronic device 1800 and other devices in a wired or wireless manner. The electronic device 1800 may access a communication standard-based wireless network, such as Wi-Fi, 2G, 3G, 4G, 5G, or 6G, or a combination thereof. In an exemplary embodiment, the communication component 1818 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1818 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0263] In an exemplary embodiment, the electronic device 1800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components.
[0264] Obviously, the above-described embodiments are merely examples for clear illustration and are not limitations on the embodiments. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to exhaustively list all the embodiments here. And the obvious changes or modifications derived therefrom are still within the protection scope of the present disclosure.
Claims
1. An image processing method, characterized in that, Applied to an electronic device, the method includes: Obtaining a first image captured by a front camera of the electronic device and a second image captured by a rear camera of the electronic device, where the first image includes a preset object; Performing image segmentation on the preset object in the first image to obtain a segmented image of the preset object; Performing fusion processing on the segmented image and the second image to obtain a target image.
2. The method according to claim 1, characterized in that, The obtaining of the first image captured by the front camera of the electronic device and the second image captured by the rear camera of the electronic device includes: In response to detecting a first photographing instruction of the electronic device in a preset camera mode, capturing the first image by the front camera called in the preset camera mode and capturing the second image by the rear camera called in the preset camera mode.
3. The method according to claim 1, characterized in that, The obtaining of the first image captured by the front camera of the electronic device and the second image captured by the rear camera of the electronic device includes: In response to detecting that the electronic device turns on the preset camera mode, calling the front camera to work, and in the case of detecting a second photographing instruction, capturing the first image by the front camera; Calling the rear camera to work, and in the case of detecting a third photographing instruction, capturing the second image by the rear camera.
4. The method according to claim 1, characterized in that, The performing of the fusion processing on the segmented image and the second image to obtain a target image includes: Obtaining a first field of view angle of the front camera that captures the first image and a second field of view angle of the rear camera that captures the second image; Determining an image scaling ratio based on the first field of view angle and the second field of view angle; Adjusting the size of the segmented image based on the image scaling ratio and fusing the adjusted segmented image on top of the second image to obtain the target image.
5. The method according to claim 2, characterized in that, It further includes: In response to the electronic device turning on the preset camera mode, simultaneously calling the front camera and the rear camera to work; Capturing a first preview image by the front camera and capturing a second preview image by the rear camera, where the first preview image includes the preset object; Displaying the first preview image and the second preview image on a preview interface of the electronic device.
6. The method according to claim 5, characterized in that, The displaying of the first preview image and the second preview image on the preview interface of the electronic device includes: Displaying the first preview image and the second preview image side by side on the preview interface; Or, Displaying the first preview image and the second preview image in layers on the preview interface.
7. The method according to claim 2, characterized in that, It further includes: In response to the electronic device turning on the preset camera mode, simultaneously calling the front camera and the rear camera to work; Capturing a first preview image by the front camera and capturing a second preview image by the rear camera, where the first preview image includes the preset object; Performing image segmentation on the preset object in the first preview image to obtain a preview segmented image of the preset object; Fuse the preview segmentation image and the second preview image to obtain a target preview image, and display the target preview image on the preview interface of the electronic device.
8. The method according to claim 1, characterized in that, The obtaining of the first image captured by the front camera of the electronic device and the second image captured by the rear camera of the electronic device includes: In response to the electronic device turning on a preset camera mode, detect a user operation instruction; Determine a target front camera from at least one front camera and a target rear camera from at least one rear camera according to the user operation instruction, and determine the camera parameters of the target front camera and the target rear camera; Based on the camera parameters, use the target front camera to capture the first image and use the target rear camera to capture the second image.
9. The method according to claim 1, characterized in that, The fusing the segmentation image and the second image to obtain a target image includes: Display an operation option interface on the electronic device, the operation option interface including a manual editing option and an automatic editing option; In response to detecting that the user selects the manual editing option, display the segmentation image and the second image on the electronic device; Obtain an editing instruction for the user to adjust the size and / or position of the segmentation image, and fuse the segmentation image and the second image according to the editing instruction to obtain the target image.
10. An image processing apparatus, characterized in that, Applied to an electronic device, the apparatus includes: An image acquisition module configured to obtain a first image captured by the front camera of the electronic device and a second image captured by the rear camera of the electronic device, the first image including a preset object; An image segmentation module configured to perform image segmentation on the preset object in the first image to obtain a segmentation image of the preset object; An image fusion module configured to perform a fusion process on the segmentation image and the second image to obtain a target image.
11. An electronic device, characterized in that, Includes: At least one front camera and at least one rear camera; A processor; And A memory storing computer instructions for causing the processor to execute the method according to any one of claims 1 to 9.
12. A storage medium, characterized in that, Stores computer instructions for causing a computer to execute the method according to any one of claims 1 to 9.