A photographing method and an electronic device

By changing the camera's orientation and stitching together multiple frames without changing the electronic device's position, the problem of presenting more scenery in high-resolution images was solved, achieving a combination of a wider field of view and greater clarity.

CN115914860BActive Publication Date: 2026-03-27HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-17
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

How to maintain high resolution while presenting more of the scene in an image taken from the same viewpoint, especially the scene captured by a wide-angle camera that cannot be covered when using a telephoto camera.

Method used

By automatically changing the orientation of the camera while keeping the electronic device in the same position, multiple frames of images to be stitched are captured and stitched together into a single target image, resulting in a target image with the same high resolution as the images to be stitched together and an expanded field of view.

Benefits of technology

It achieves the ability to present more scenery without reducing image resolution, by using a camera with a small field of view to capture a wider range of scenery, and ensuring image clarity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914860B_ABST
    Figure CN115914860B_ABST
Patent Text Reader

Abstract

A photographing method and an electronic device. The photographing method provided in the embodiments of the present application can automatically change the orientation of a camera when the position of the electronic device remains unchanged, photograph N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into one target image, so that the target image has the image resolution of the to-be-stitched images and presents more scenes (photographed objects) than any to-be-stitched image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of terminal and communication, and particularly relates to a photographing method and an electronic device. BACKGROUND

[0002] With the development of science and technology, the photographing function of electronic devices such as mobile phones is gradually improved. One electronic device can have multiple cameras, such as a wide-angle camera and a long-focus camera. At the same view point (the distance to the photographed object is unchanged), the image resolution of the image photographed by the long-focus camera is higher than that of the image photographed by the wide-angle camera, but the scene presented is less.

[0003] How to make the image photographed at the same view point have the resolution of the image photographed by the long-focus camera, while presenting even more scenes in the image photographed by the wide-angle camera, so that the image can remain clear while presenting more scenes is a direction worthy of research. SUMMARY

[0004] The present application provides a photographing method and an electronic device. In the case that the position of the electronic device remains unchanged, the direction of the camera can be automatically changed, N frames of to-be-stitched images are photographed, and then the N frames of to-be-stitched images are stitched into a first image, so that the first image has the image resolution of the to-be-stitched images and presents more scenes (photographed objects) than any to-be-stitched image.

[0005] In a first aspect, the present application provides a photographing method applied to an electronic device including a first camera and a second camera, the field angles of the first camera and the second camera are different, and the method includes: the electronic device starts a camera; a preview interface is displayed, the preview interface includes a first control and a second control; a preview image is acquired by using the first camera; the preview image is displayed in the preview interface; at a first time, a first operation on the first control is detected; in response to the first operation, a first image acquired by the first camera is photographed, and the first image is saved, the interface of the second control corresponds to the first image; the first image is the preview image displayed in the preview interface at the first time; in response to the first operation, the direction of the second camera is changed, N frames of to-be-stitched images are acquired by using the second camera, N is an integer greater than 2; the N frames of to-be-stitched images are stitched to obtain a target image, the image content in the target image is the same as that in the first image; and the target image is saved.

[0006] In the above embodiment, the electronic device can automatically change the orientation of the camera, capture N frames of to-be-stitched images when the position is unchanged, stitch the N frames of to-be-stitched images into one target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, that is, more scenes (photographed objects) are presented than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes by using a camera with a small field of view, so that more scenes can be presented in the image, and the image resolution is not reduced, so that the image is clear.

[0007] With reference to the first aspect, in an implementation manner, after the target image is saved, the method further includes: detecting, by the electronic device, a second operation on the second control; and displaying, by the electronic device, the target image in response to the second operation.

[0008] In the above embodiment, at this time, the first image is still displayed in the interface of the second control, but when the user clicks the first image, the target image is displayed.

[0009] With reference to the first aspect, in an implementation manner, before the orientation of the second camera is changed, the method further includes: determining, by the electronic device, whether a shooting scene is moving; wherein the shooting scene is moving refers to that a photographed object is moving relative to the electronic device or the electronic device is moving; and the shooting scene is not moving refers to that the photographed object is not moving relative to the electronic device and the electronic device is not moving; when it is determined that the shooting scene is not moving, moving, by the electronic device, the motor to change the orientation of the second camera; and when it is determined that the shooting scene is moving, processing, by the electronic device, the first image to obtain the target image.

[0010] In the above embodiment, in order to improve the imaging quality of the target image, before the motor is moved, it is necessary to determine whether the shooting scene is moving. If it is determined that the shooting scene is moving, the scheme of processing the N frames of to-be-stitched images to obtain the target image is exited. In this way, it can be ensured that the same scene will not appear multiple times in the target image.

[0011] With reference to the first aspect, in an implementation manner, the method further includes: when it is determined that the shooting scene is moving, stopping, by the electronic device, the motor after the motor is moved to the initial position.

[0012] In the above embodiment, the initial position can be the center of the second camera. Restoring the second camera to the initial position facilitates the acquisition of the N frames of to-be-stitched images next time.

[0013] With reference to the first aspect, in an implementation form, at the second time, the electronic device determines whether the shooting scene is moving, specifically including: the electronic device determines a first detection result corresponding to the second time and a second detection result; the first detection result is used to describe whether the photographed object at the second time is moving relative to the electronic device; the second detection result is used to describe whether the electronic device at the second time is moving; in a case where it is determined that the photographed object at the second time is not moving relative to the electronic device and the electronic device at the first time is not moving, it is determined that the shooting scene at the second time is not moving; in a case where it is determined that the photographed object at the second time is moving relative to the electronic device or the electronic device at the first time is moving, it is determined that the shooting scene at the second time is moving.

[0014] In the above embodiment, the electronic device can determine whether the shooting scene is moving by acquiring the first detection result and the second detection result in real time, and the first detection result and the second detection result can be acquired when needed. The efficiency of acquiring N frames of to-be-processed images can be improved.

[0015] With reference to the first aspect, in an implementation form, the electronic device determines the first detection result corresponding to the second time and the second detection result, specifically including: the electronic device detects whether there is a moving object in the shooting scene by using a first preview image and a first preview image, to obtain the first detection result; the first preview image is a preview image acquired by using a first camera at the second time; the first preview image is a preview image that is X frames different in acquisition time from the first preview image; X is an integer greater than or equal to 1; the second detection result is obtained by determining whether the electronic device is moving by using attitude data at the second time; the attitude data is used to describe the moving attitude of the electronic device.

[0016] In the above embodiment, whether the scene in the current shooting scene is moving relative to the electronic device can be calculated by using two preview images. Whether the current electronic device is moving can be determined by acquiring the attitude data in real time.

[0017] With reference to the first aspect, in an implementation form, after the electronic device determines that the shooting scene at the first time is not moving, before the first movement of the motor, the method further includes: the electronic device determines the number N of to-be-stitched images by using the field of view angle of the first camera and the field of view angle of the second camera.

[0018] With reference to the first aspect, in an implementation form, the N frames of to-be-stitched images are stitched to obtain a target image, specifically including: the electronic device stitches the N frames of to-be-stitched images to obtain a second image; and the second image is cropped to obtain the target image.

[0019] In the above embodiment, the target image can be acquired by stitching the N frames of to-be-stitched images and then cropping.

[0020] In a second aspect, the present application provides a photographing method applied to an electronic device including a first camera, the method comprising: starting a camera by the electronic device; displaying a preview interface, the preview interface including a first preview frame, a second preview frame and a first control; detecting a first operation on the first control; in response to the first operation, changing an orientation of the first camera, acquiring N frames of to-be-stitched images by the first camera, N being an integer greater than 2; stitching the N frames of to-be-stitched images to obtain a target image; displaying the Nth frame of to-be-stitched image in the first preview frame; and displaying the target image in the second preview frame.

[0021] In the above embodiment, the electronic device can automatically change the orientation of the camera while the position of the electronic device remains unchanged, acquire N frames of to-be-stitched images, and stitch the N frames of to-be-stitched images into a target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, i.e., presents more scenes (photographed objects) than any to-be-stitched image. In this way, the electronic device can use a camera with a small field of view to capture a larger range of scenes, so that more scenes can be presented in the image, while the image resolution is not reduced, so that the image is clear. At the same time, the electronic device can display the target image in the second preview frame, so that the user can be visualized during photographing.

[0022] In combination with the second aspect, in an implementation, the motor is moved N times to change the orientation of the first camera, and before the N frames of to-be-stitched images are acquired by the first camera, the method further comprises: moving the motor W-1 times to change the orientation of the first camera, acquiring W-1 frames of to-be-stitched images in the N frames of to-be-stitched images by the first camera, W being an integer greater than or equal to 2 and less than or equal to N; processing the W-1 frames of to-be-stitched images to obtain a third image; displaying the third image in the second preview frame; moving the motor to change the orientation of the first camera, acquiring a next frame of to-be-stitched image by the first camera; displaying the next frame of to-be-stitched image in the first preview frame; stitching the third image and the next frame of to-be-stitched image to obtain a fourth image; and displaying the fourth image in the second preview frame.

[0023] In the above embodiment, the electronic device displays the image obtained by stitching the acquired multiple frames of to-be-processed images in the second preview frame, so that the intermediate image before the target image is obtained can be visualized.

[0024] In combination with the second aspect, in an implementation, the fourth image is obtained by stitching the third image and the next frame of to-be-stitched image, specifically comprising: the electronic device stitches the third image and the next frame of to-be-stitched image to obtain a fifth image; and the fifth image is cropped to obtain the fourth image.

[0025] In combination with the second aspect, in an implementation, the electronic device stitches the third image and the next frame of image to be stitched to obtain a fifth image, specifically including:

[0026] The electronic device determines all feature points of the third image and the next frame of image to be stitched; the feature points are points where image gray values change sharply or pixel points with relatively large curvature on image edges in the third image and the next frame of image to be stitched, used to calculate an affine transformation matrix of the next frame of image to be stitched, the affine transformation matrix being used to perform a linear transformation and a translation once on the next frame of image to be stitched and transform to a vector space where the third image is located; from the all feature points, M pairs of feature points that are most similar are determined; M is an integer greater than or equal to 3; the affine transformation matrix of the next frame of image to be stitched is calculated according to the M pairs of feature points; the first image to be stitched is obtained by performing affine transformation on the next frame of image to be stitched according to the affine transformation matrix; the first image to be stitched and the third image are fused to obtain the fifth image.

[0027] In the above embodiment, two frames of images are stitched by using image stitching technology.

[0028] In a third aspect, the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code comprising computer instructions, a first camera and a second camera, the one or more processors invoking the computer instructions to cause the electronic device to perform: starting a camera; displaying a preview interface, the preview interface comprising a first control and a second control; acquiring a preview image by using the first camera; displaying the preview image in the preview interface; detecting a first operation on the first control at a first time; in response to the first operation, capturing a first image acquired by the first camera, saving the first image, and the interface of the second control corresponding to the first image; the first image being the preview image displayed in the preview interface at the first time; in response to the first operation, changing the orientation of the second camera, moving the motor, and acquiring a plurality of frames of image to be stitched by using the second camera to obtain N frames of image to be stitched, N being an integer greater than 2; stitching the N frames of image to be stitched to obtain a target image, the image content in the target image being the same as the image content in the first image; saving the target image.

[0029] In the above embodiment, the electronic device can automatically change the orientation of the camera, capture N frames of to-be-stitched images when the position is unchanged, and then stitch the N frames of to-be-stitched images into one target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, that is, more scenes (photographed objects) are presented than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes by using a camera with a small field of view, so that more scenes can be presented in the image, and the image resolution is not reduced, so that the image is clear.

[0030] In combination with the third aspect, in an implementation, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: detecting a second operation on the second control; and in response to the second operation, displaying the target image.

[0031] In the above embodiment, at this time, the first image is still displayed in the interface of the second control, but when the user clicks the first image, the target image is displayed.

[0032] In combination with the third aspect, in an implementation, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: determining whether the shooting scene is moving; wherein the shooting scene is moving refers to that the photographed object is moving relative to the electronic device or the electronic device is moving; and the shooting scene is not moving refers to that the photographed object is not moving relative to the electronic device and the electronic device is not moving; when it is determined that the shooting scene is not moving, the electronic device moves the motor to change the orientation of the second camera; and when it is determined that the shooting scene is moving, the first image is processed to obtain a target image.

[0033] In the above embodiment, in order to improve the imaging quality of the target image, it is necessary to determine whether the shooting scene is moving before moving the motor. If it is determined that the shooting scene is moving, the scheme of processing the N frames of to-be-stitched images to obtain the target image is exited. In this way, it can be ensured that the same scene will not appear multiple times in the target image.

[0034] In combination with the third aspect, in an implementation, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: when it is determined that the shooting scene is moving, stopping moving the motor after moving the motor to the initial position.

[0035] In the above embodiment, the initial position can be the center of the second camera. Restoring the second camera to the initial position facilitates the next acquisition of the N frames of to-be-stitched images.

[0036] In combination with the third aspect, in an implementation, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: determining a first detection result and a second detection result corresponding to a second time; the first detection result is used to describe whether the photographed object is moving relative to the electronic device at the second time; the second detection result is used to describe whether the electronic device is moving at the second time; in a case where it is determined that the photographed object is not moving relative to the electronic device at the second time and the electronic device is not moving at the first time, it is determined that the photographed scene is not moving at the second time; in a case where it is determined that the photographed object is moving relative to the electronic device at the second time or the electronic device is moving at the first time, it is determined that the photographed scene is moving at the second time.

[0037] In the above embodiment, the electronic device can determine whether the photographed scene is moving by acquiring the first detection result and the second detection result in real time, and the first detection result and the second detection result can be acquired when needed. The efficiency of acquiring the N frames of to-be-stitched images can be improved.

[0038] In combination with the third aspect, in an implementation, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: determining whether there is a moving object in the photographed scene by using the first preview image and the first preview image, to obtain a first detection result; the first preview image is a preview image acquired by using a first camera at a second time; the first preview image is a preview image that is X frames away from the first preview image in acquisition time; X is an integer greater than or equal to 1; determining whether the electronic device is moving by using attitude data at the second time, to obtain a second detection result; the attitude data is used to describe the moving attitude of the electronic device.

[0039] In the above embodiment, whether the scene is moving relative to the electronic device in the current photographed scene can be calculated by using two frames of preview images. Whether the electronic device is moving in real time can be determined by acquiring the attitude data.

[0040] In combination with the third aspect, in an implementation, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: determining the number N of to-be-stitched images by using the field of view angle of the first camera and the field of view angle of the second camera.

[0041] In combination with the third aspect, in an implementation, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: the electronic device stitching the N frames of to-be-stitched images to obtain a second image; and cropping the second image to obtain the target image.

[0042] In the above embodiment, the target image can be acquired by stitching the N frames of to-be-stitched images and then cropping.

[0043] With reference to the third aspect, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: starting a camera; displaying a preview interface, the preview interface comprising a first preview frame, a second preview frame, and a first control; detecting a first operation on the first control; in response to the first operation, changing an orientation of the first camera, moving the motor, and obtaining a plurality of frames of to-be-stitched images using the first camera to obtain N frames of to-be-stitched images, N being an integer greater than 1; stitching the N frames of to-be-stitched images to obtain a target image; displaying the Nth frame of to-be-stitched image in the first preview frame; and displaying the target image in the second preview frame.

[0044] In the above embodiments, the electronic device can automatically change the orientation of the camera while the position remains unchanged, capture N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into a target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, i.e., presents more scenes (photographed objects) than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes using a camera with a small field of view, so that more scenes can be presented in the image, while the image resolution is not reduced, so that the image is clear. At the same time, the electronic device can display the target image in the second preview frame, so that it can visualize the user during the shooting process.

[0045] With reference to the third aspect, in an implementation, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: moving the motor W-1 to change the orientation of the first camera, obtaining W-1 frames of to-be-stitched images from the N frames of to-be-stitched images using the first camera, W being an integer greater than or equal to 2 and less than or equal to N; processing the W-1 frames of to-be-stitched images to obtain a third image; displaying the third image in the second preview frame; moving the motor to change the orientation of the first camera, and obtaining a next frame of to-be-stitched image using the first camera; displaying the next frame of to-be-stitched image in the first preview frame; stitching the third image and the next frame of to-be-stitched image to obtain a fourth image; and displaying the fourth image in the second preview frame.

[0046] In the above embodiments, the electronic device displays the image obtained by stitching the plurality of frames of to-be-processed images in the second preview frame, so that the intermediate image before the target image is obtained can be visualized.

[0047] With reference to the third aspect, in an implementation, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: stitching the third image and the next frame of to-be-stitched image to obtain a fifth image; and cropping the fifth image to obtain the fourth image.

[0048] In combination with the third aspect, in an implementation, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: determining all feature points of the third image and the next frame to-be-stitched image; the feature points being points where image gray values change sharply or pixel points with relatively large curvature on image edges in the third image and the next frame to-be-stitched image, used to calculate an affine transformation matrix of the next frame to-be-stitched image, the affine transformation matrix being used to perform a linear transformation once and a translation to the vector space where the third image is located; determining M pairs of feature points that are most similar from the all feature points; the M being an integer greater than or equal to 3; calculating the affine transformation matrix of the next frame to-be-stitched image according to the M pairs of feature points; performing affine transformation on the next frame to-be-stitched image according to the affine transformation matrix to obtain a first to-be-stitched image; and fusing the first to-be-stitched image and the third image to obtain the fifth image.

[0049] In the above embodiment, two frames of images are stitched by using the image stitching technology.

[0050] In the fourth aspect, the embodiments of the present application provide an electronic device, which comprises one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes comprising computer instructions, a first camera and a second camera; the one or more processors invoke the computer instructions to cause the electronic device to perform the method described in the first aspect or any implementation of the first aspect.

[0051] In the above embodiment, the electronic device can automatically change the orientation of the camera while the position of the electronic device remains unchanged, capture N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into a target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, that is, more scenes (photographed objects) are presented than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes by using a camera with a small field of view, so that more scenes can be presented in the image, and the image resolution is not reduced, so that the image is clear.

[0052] In the fifth aspect, the embodiments of the present application provide a chip system, which is applied to an electronic device, and the chip system comprises one or more processors, and the processor is configured to invoke computer instructions to cause the electronic device to perform the method described in the first aspect or any implementation of the first aspect.

[0053] In the above embodiments, the electronic device can automatically change the orientation of the camera, capture N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into one target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, that is, presents more scenes (photographed objects) than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes by using a camera with a small field of view, so that more scenes can be presented in the image, and the image resolution is not reduced, so that the image is clear.

[0054] In a sixth aspect, an embodiment of the present application provides a computer program product containing instructions, characterized by causing an electronic device to perform the method described in the first aspect or any one of the implementation manners of the first aspect when the computer program product is run on the electronic device.

[0055] In the above embodiments, the electronic device can automatically change the orientation of the camera, capture N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into one target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, that is, presents more scenes (photographed objects) than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes by using a camera with a small field of view, so that more scenes can be presented in the image, and the image resolution is not reduced, so that the image is clear.

[0056] In a seventh aspect, an embodiment of the present application provides a computer-readable storage medium, including instructions, characterized by causing an electronic device to perform the method described in the first aspect or any one of the implementation manners of the first aspect when the instructions are run on the electronic device.

[0057] In the above embodiments, the electronic device can automatically change the orientation of the camera, capture N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into one target image, so that the target image has the image resolution of the to-be-stitched images and a larger field of view, that is, presents more scenes (photographed objects) than any to-be-stitched image. In this way, the electronic device can capture a larger range of scenes by using a camera with a small field of view, so that more scenes can be presented in the image, and the image resolution is not reduced, so that the image is clear. BRIEF DESCRIPTION OF DRAWINGS

[0058] Figures la-c A set of example diagrams showing a scene photographed by a wide-angle camera is shown;

[0059] Figure 2a 、 Figure 2b A set of schematic diagrams showing an electronic device using a long-focus camera to replace a wide-angle camera to photograph an image is shown;

[0060] Figures 3a-d For the scene 1, a set of schematic diagrams for acquiring N frames of to-be-stitched images in the case that the shooting scene is not moving;

[0061] Figure 4 For the shooting method involved in the scene 1, a schematic flowchart is shown in FIG. 3;

[0062] Figure 5 For the electronic device to obtain the first to-be-stitched image, a schematic flowchart is shown in FIG. 4;

[0063] Figures 6a-h For the electronic device involved in the scene 2 to acquire the target image, a set of schematic diagrams is shown in FIG. 5;

[0064] Figure 7 For the shooting method involved in the scene 2, a schematic flowchart is shown in FIG. 6;

[0065] Figures 8a-g For the electronic device involved in the scene 3 to acquire the target image, a set of schematic diagrams is shown in FIG. 7;

[0066] Figure 9 FIG. 8 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;

[0067] Figure 10 FIG. 9 is a system structure schematic diagram of the electronic device of the embodiment of the present application. DETAILED DESCRIPTION

[0068] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and the appended claims of the present application, the singular forms "a," "an" and "the" are intended to include both singular and plural forms, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0069] Hereinafter, the terms "first" and "second" are only for the purpose of description, and cannot be understood as implying or suggesting relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, the meaning of "a plurality of" is two or more, unless otherwise specified.

[0070] The term "user interface" (UI) in the embodiments of the present application is a medium interface for interaction and information exchange between an application program or operating system and a user, which realizes conversion between internal forms of information and forms acceptable by the user. The user interface is source code written in a specific computer language such as Java, extensible markup language (XML), and the like. The interface source code is parsed and rendered on an electronic device, and finally presented as content recognizable by the user. A commonly used form of the user interface is a graphic user interface (GUI), which refers to a user interface displayed in a graphical manner and related to computer operation. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, Widgets, and the like displayed in the display screen of the electronic device.

[0071] In one scheme, in order to capture more scenes (photographed objects), the electronic device can use the first lens to capture. The first lens can be a wide-angle camera or an ultra-wide-angle camera.

[0072] As Figures la-c A set of example diagrams for capturing a scene by using a wide-angle camera are shown.

[0073] As Figure la The user interface 10 is a main interface of the electronic device. In response to a user operation (for example, a click operation) on the camera application 101, the electronic device can start a capturing function and enter a preview mode.

[0074] As Figure lb shown, it is assumed that the electronic device is in the first position, and for the scene in the area 101, the electronic device cannot capture by using the telephoto camera, but can capture by using the wide-angle camera with a larger field of view (larger than the telephoto camera). At this time, the corresponding zoom ratio can be a 3x zoom ratio. The user interface 11 is a preview interface, at this time, an image is obtained by using the wide-angle camera. In response to a user operation (for example, a click operation) on the capturing control 111, the electronic device can capture the image A displayed in the preview frame 112. The electronic device can display Figure lc the user interface 12 shown in FIG. 12.

[0075] In the user interface 12, a replay control 121 can be displayed, and the thumbnail of the image A is displayed in the replay control. In response to a user operation (for example, a click operation) on the replay control 121, the electronic device can display Figure lc the user interface 13 shown in FIG. 13.

[0076] In the user interface 13, an image B can be displayed, which can be the image A or an image obtained after processing the image A. The image B has a lower image resolution, resulting in the image B being unclear. For example, a portion of the image B can be displayed in the region 102, and the portion of the image B can appear unclear when enlarged by X times, as shown in the image in the region 103.

[0077] In this way, although the wide-angle camera has a larger field of view and can capture more scenes, the image captured by the wide-angle camera has a lower image resolution and can appear unclear.

[0078] In the embodiments of the present application, the electronic device can remain unchanged at the first position and capture the scene in the region 101 using the second lens. The first lens is the wide-angle camera, and the second lens is the long-focus camera. At this time, the image resolution is the image resolution of the image captured by the long-focus camera, which is higher than the image resolution of the image A and relatively clearer.

[0079] Figure 2a 、 Figure 2b A set of schematic diagrams in which the electronic device captures an image using the long-focus camera instead of the wide-angle camera is shown.

[0080] Referring to the foregoing Figure lb In the schematic diagram shown, the electronic device remains unchanged at the first position and, in response to a user operation (e.g., a click operation) on the shooting control 111, the electronic device can move the motor four times according to a preset trajectory to change the orientation of the long-focus camera, so that the long-focus camera can capture the scene in the region 201 first, and then capture the scenes in the regions 202, 203, and 204 in turn. Four frames of to-be-stitched images are obtained, and then the electronic device can stitch the four frames of to-be-stitched images to obtain an image C.

[0081] The image displayed in the user interface 21 shown in Figure 2b The image displayed in the user interface 21 shown in

[0082] The image C has the same image content as the image B displayed in the user interface 13.

[0083] The image content is the same means that the image C and the scene displayed in the image B are the same. For example, the image B and the image C both include the scene 101, the scene 102, the scene 103, and the scene 104. Alternatively, the image content being the same can mean that all pixels in the image B and the image C are the same, or the percentage of the same pixels, when the percentage is greater than a preset value, the image content is considered to be the same. For example, the preset value is 70%, 80%, or 90%, etc.

[0084] It can be understood that if the first lens involved in the foregoing is an ultra-wide-angle camera, the second lens can be a wide-angle camera.

[0085] In this way, the electronic device can use the camera with a small field of view to capture a larger range of scenes, so that more scenes can be presented in the image, and at the same time, the image resolution of the image is not reduced, so that the image is clear.

[0086] The shooting method involved in the embodiments of the present application can automatically change the orientation of the camera while the position of the electronic device remains unchanged, capture N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into a first image, so that the first image has the image resolution of the to-be-stitched images and a larger field of view, that is, more scenes (photographed objects) are presented than any to-be-stitched image.

[0087] The following describes three scenes to which the shooting method is applicable and the detailed process of the shooting method involved in each scene:

[0088] Scene 1: A second camera with a smaller field of view is used to replace a first camera with a larger field of view to obtain a target image.

[0089] Specifically, when the electronic device uses the first lens to shoot an image, the electronic device can move the motor N times according to a preset trajectory while the position remains unchanged. Each time the motor (the motor of the second camera) is moved, the orientation of the second camera changes, so that the scene that can be captured by the second camera changes. In this way, the second camera can obtain N frames of to-be-stitched images, and then stitch the N frames of to-be-stitched images into a first image. In this process, before each time the motor is moved, the electronic device detects whether the current shooting scene is moving. If it is moving, the process is exited, and then a frame of image obtained from the first camera is selected as the first image. Then the first image is processed to generate a target image. In the process, the first camera can be a wide-angle camera, and the second camera can be a long-focus camera. The first camera can also be an ultra-wide-angle camera, and the second camera can be a wide-angle camera.

[0090] The following will be described in detail taking the first camera as a wide-angle camera and the second camera as a long-focus camera as an example.

[0091] In this way, the electronic device can use the long-focus camera to obtain the target image instead of the wide-angle camera, so that the target image has the image resolution of the image captured by the long-focus camera, and has the field of view of the image captured by the wide-angle camera.

[0092] The user interface involved in the process can refer to the user interfaces 11 shown in the foregoing Figure lb , Figure lc the user interface 12 shown in the foregoing Figure 2b , and the user interface 21 shown in the foregoing

[0093] . Figure lb The schematic diagram of capturing a scene by using the wide-angle camera is shown in the foregoing Figure 2b . It is assumed that at this time, the electronic device starts the photographing function, and obtains a preview image by using the first camera at a 3x zoom ratio. In response to the operation of the user on the photographing control, the electronic device can continue to obtain a preview image by using the wide-angle camera and display the preview image in the user interface. Meanwhile, in the case where the photographing scene does not move, N frames of to-be-stitched images are obtained by using the second camera, and then the N frames of to-be-stitched images are stitched and processed to obtain a target image and save the target image. An exemplary user interface in which the electronic device displays the target image can be as shown in the user interface 21 shown in the foregoing .

[0094] Figures 3a-d For the case where the photographing scene does not move in the scene 1, a set of schematic diagrams of obtaining N frames of to-be-stitched images is shown in the foregoing

[0095] As shown in the foregoing Figure 3a , it is assumed that at this time, the electronic device determines N to be 4 according to the field of view of the wide-angle camera and the field of view of the long-focus camera, and then changes the orientation of the second camera by moving the motor 4 times according to the preset track to obtain 4 frames of to-be-stitched images. This makes it possible to first capture the scene in the region 301, and then capture the scenes in the regions 302, 303, and 304 in sequence to obtain the 4 frames of to-be-stitched images. When the orientation of the second camera is changed during the continuous movement of the motor twice, the scene captured by the second camera twice can have an overlapping region, so that there is an overlapping region between the two frames of to-be-stitched images when the two frames of to-be-stitched images are captured in sequence. For example, the region 305 is an overlapping region when the electronic device captures the regions 301 and 302.

[0096] The first frame of to-be-stitched image and the second frame of to-be-stitched image obtained by the electronic device are taken as examples for explanation:

[0097] As shown in the foregoing Figure 3bAs shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera.

[0098] As shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera. Figure 3c As shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera. Figure 3c As shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera.

[0099] The process of the electronic device obtaining the third frame of the image to be stitched and the fourth frame of the image to be stitched can refer to the foregoing description of the process of the electronic device obtaining the first frame of the image to be stitched and the second frame of the image to be stitched, which will not be described herein again. Figures 3a-c As shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera.

[0100] Figure 3d As shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera.

[0101] Then, the electronic device can stitch the four frames of the image to be processed into a first image by using the overlapping regions in the four frames of the image to be processed, and then process the first image to obtain a target image, and the target image can be displayed. The image displayed in the user interface 21 shown in the foregoing Figure 2b As shown, it is assumed that the initial orientation of the second camera can make it capture the scene in region 306. The first movement of the motor changes the orientation of the second camera so that it can capture the scene in region 301, obtaining a first frame of the image to be stitched. Then, the second movement of the motor changes the orientation of the second camera.

[0102] The process of the electronic device obtaining the target image by using the photographing method in the embodiments of the present application will be described in detail below in combination with the foregoing description of scenario 1.

[0103] Figure 4 An illustrative flowchart of the photographing method involved in scenario 1.

[0104] The process of the electronic device obtaining the target image by using the photographing method in the embodiments of the present application in scenario 1 can refer to the description of steps S111-S116 below.

[0105] S101. The electronic device starts the photographing function and enters the preview mode.

[0106] In some embodiments, an example user interface in which the electronic device starts the photographing function can refer to the foregoing description of the user interface in which the electronic device starts the photographing function.​Figure la In the description of the user interface 10 in FIG. 1, in response to the operation (e.g., a click operation) of the user on the camera application, the electronic device can start the photographing function and enter the preview mode. In the initial state of entering the preview mode, the electronic device defaults to use the 1x zoom ratio to photograph the scene, at which time the electronic device can use the wide-angle camera to capture the image. The user can set the zoom ratio when the electronic device captures the image, for example, set the zoom ratio from the 1x zoom ratio to the 3x zoom ratio, and the like.

[0107] At different zoom ratios, the electronic device can use different cameras to capture images and display. For example, when the zoom ratio is greater than 3.5x zoom ratio, the electronic device uses the telephoto camera. When the zoom ratio is less than 1.0x zoom ratio, the ultra-wide-angle camera is used, and the wide-angle camera can be used in other cases. It should be understood that the effect of the zoom ratio on the camera used to capture the image has different configurations in different electronic devices, which will not be illustrated here.

[0108] S102. The electronic device continuously captures images through the first camera to obtain an image sequence;

[0109] This step S102 is continuously performed. The electronic device captures images using the first camera, and two or more images can constitute an image sequence. The electronic device can display the captured images, that is, after preprocessing the captured images, the electronic device sends the images to the display screen for preview. An exemplary user interface involved in the preview can be the user interface 11 shown in FIG. 1. Figure lb

[0110] Specifically, the light signal reflected by the photographed object is transmitted to the image sensor of the first camera through the first camera, the image sensor converts the light signal into an electrical signal, and the image sensor transmits the electrical signal to the ISP, and the ISP converts the electrical signal into a corresponding image.

[0111] S103. The electronic device continuously captures attitude data;

[0112] This step S103 is continuously performed. The attitude data is used to describe the motion attitude of the electronic device, which can be the angular velocity of the electronic device around three axes (i.e., x, y, and z axes), or the angle of shaking of the electronic device. It can also be the magnitude of acceleration in each direction (generally three axes) or other data, which is not limited by the embodiments of the present application.

[0113] In some embodiments, the electronic device can obtain the angular velocity around the three axes and the shaking angle through the gyroscope sensor. The acceleration in each direction is obtained through the acceleration sensor.

[0114] ​S104. The electronic device continuously uses the first image and the second image in the image sequence to detect whether there is a moving object in the shooting scene, and obtains a first detection result;

[0115] This step S104 is performed continuously. The first detection result is used to describe whether the object being photographed is moving relative to the electronic device in the current environment.

[0116] The electronic device acquires a first preview image and a second preview image from the image sequence involved in step S102. The first and second preview images are two frames acquired at different times, with X being an integer greater than or equal to 1. The value of X is related to the processing power of the electronic device. For example, when X = 1, the first and second preview images are two consecutively acquired frames by the electronic device, with the first preview image being the frame acquired latest.

[0117] In some embodiments, the electronic device can detect whether the object being photographed is moving relative to the electronic device in the current environment based on a first preview image and a second preview image. In this process, the electronic device can use optical flow to calculate the temporal changes of pixels in the first and second preview images and the correlation between the two frames to determine the correspondence between the first and second preview images, calculate the displacement of the object being photographed in the two frames, and determine whether the object is moving based on this displacement.

[0118] It should be understood that, in addition to optical flow, electronic devices can also determine whether the object being photographed is moving relative to the electronic device through other methods, and this application embodiment does not limit this.

[0119] S105. The electronic device continuously uses attitude data to determine whether the device is moving, and obtains a second detection result;

[0120] This step S104 is performed continuously. The electronic device uses the attitude data involved in step S104 to determine whether the device is moving.

[0121] Specifically, taking the angle of the electronic device's vibration as an example, when the angle is greater than the first preset threshold, it is determined that the electronic device is moving.

[0122] It should be understood that when the attitude data is in other forms, the method for determining whether the electronic device is moving is similar, and will not be elaborated here.

[0123] S106. In response to the first operation at the first moment, the electronic device determines the first detection result and the second detection result corresponding to the first moment;

[0124] The first operation is an operation of triggering the electronic device to capture an image. The first operation can be an operation (e.g., a click operation) on the capture control 111 in the user interface 11 shown in FIG. 1A. Figure lb The first time point is a time point when the first operation is detected.

[0125] The steps S104 and S105 are continuously performed. When the first operation is detected, the electronic device can obtain the first detection result and the second detection result as the first detection result and the second detection result corresponding to the first time point.

[0126] S107. The electronic device determines whether the current capturing scene is moving according to the first detection result and the second detection result corresponding to the first time point.

[0127] In a case where the first detection result is that the object being captured is moving relative to the electronic device in the current environment or the second detection result is that the electronic device is moving, the electronic device can determine that the current capturing scene is moving. Then, the steps S115 and S116 are performed.

[0128] In a case where the first detection result is that the object being captured is not moving relative to the electronic device in the current environment and the second detection result is that the electronic device is not moving, the electronic device can determine that the current capturing scene is not moving. Then, the steps S108-S113 and S116 are performed.

[0129] S108. The electronic device determines the number N of images to be stitched according to the field of view of the first camera and the field of view of the second camera.

[0130] The electronic device can calculate the field of view of the first camera at the first time point according to the zoom ratio at the first time point. The field of view of the second camera is pre-set before the electronic device is manufactured. Then, the electronic device can determine the number N of images to be stitched by searching the first information table according to the field of view of the first camera at the first time point and the field of view of the second camera.

[0131] The first information table is used to store the correspondence between the number N of images to be stitched and the field of view of the first camera and the field of view of the second camera.

[0132] The electronic device determines the minimum N value in the N values satisfying the first preset condition in the first information table as the number N of images to be stitched. The first preset condition is that the field of view of the second camera corresponding to the N value is less than the field of view of the first camera at the first time point, and the field of view of the first camera corresponding to the N value is greater than the field of view of the first camera at the first time point.

[0133] Table 1 is an example of the first information table.

[0134]

[0135] Table 1

[0136] In Table 1, a < b < c < d. The value range of a is 25-30, for example, 27. The value range of b is 45-50, for example, 46. The value range of c is 60-65, for example, 64. The value range of d is 75-80, for example, 78. At this time, when the field of view of the first camera at the first time is 50, the N values satisfying the first preset condition are 9 and 16, and the electronic device can determine that the N of the image to be spliced at this time is 9.

[0137] It should be understood that Table 1 is only an exemplary schematic of the first information table, and in actual application, the first information table can also have other expression manners. It can also be an array, a matrix, a database, etc., and the embodiments of the present application do not limit this.

[0138] If the corresponding N value is not found, steps S115 and S116 are performed.

[0139] S109. The electronic device moves the motor to change the orientation of the second camera, and obtains the first frame of image to be spliced by the second camera;

[0140] The electronic device moves the position of the motor from the initial position to the first position, and moving the motor can change the orientation of the second camera and change the shooting range of the second camera, so that the scene shot by the second camera changes. The scene corresponding to the first frame of image to be spliced obtained by the electronic device can be as shown in the foregoing Figure 3b . The initial position of the motor can be located at the center, for example, the shooting range of the second camera when the motor is at the center is the area 306 in the foregoing Figure 3b , and the shooting range of the second camera after the motor is moved for the first time is the area 301.

[0141] The electronic device can rotate the motor N times according to the preset track, and then obtain the N frames of image to be processed. Before rotating the motor each time, it is detected whether the current shooting scene is moving. If it is moving, the process is exited, and then a frame of image is selected from the images obtained by the first camera as the first image. The description of the process can be referred to the description of steps S110-S114 below.

[0142] Steps S110-S114 are loop steps. In the case that the current shooting scene is not moving, steps S110-S114 can be looped N-1 times until N frames of image to be spliced are obtained.

[0143] S110. At the next moment, the electronic device determines whether the current shooting scene is moving;

[0144] The electronic device determines whether the current shooting scene is moving according to the first detection result and the second detection result corresponding to the next moment. The process involved in this step S110 is similar to the description of the foregoing step S107, and the foregoing description of the step S107 can be referred to, and details are not described herein again.

[0145] In the case that the current shooting scene is moving, the electronic device exits the loop and performs steps S114-S116.

[0146] In the case that the current shooting scene is not moving, the electronic device performs steps S111 and S112.

[0147] S111. The electronic device moves the motor to change the orientation of the second camera, and acquires a next frame of the image to be stitched by the second camera;

[0148] The process involved in this step S111 is similar to the description of the foregoing step S109, and the foregoing description of the step S109 can be referred to, and details are not described herein again.

[0149] After the electronic device moves the motor to acquire the first frame of the image to be stitched, the orientation of the second camera is changed when the motor is moved twice in succession, so that the second camera can capture the scene twice with an overlapping area, so that the two frames of the image to be stitched have an overlapping area when the two frames of the image to be stitched are captured in succession. The area of the overlapping area can be 15%-25% of the image, for example, 20%.

[0150] S112. The electronic device determines whether N frames of the image to be stitched are acquired;

[0151] When the image to be stitched acquired by the electronic device is less than N frames, steps S110-S112 are continuously performed.

[0152] When the image to be stitched acquired by the electronic device is equal to N frames, steps S113 and S116 are performed.

[0153] S113. The electronic device stitches the N frames of the image to be stitched to obtain a first image;

[0154] The electronic device can stitch the N frames of the image to be stitched to obtain the first image by using an image stitching technology.

[0155] Specifically, in some embodiments, the electronic device stitches the N frames of the image to be stitched, which is a loop process, and two frames of images are continuously stitched to obtain the first image.

[0156] The electronic device can select two images from the N frames of images to be spliced, one of which is taken as a first image to be spliced and the other is taken as a second image to be spliced, splice the first image to be spliced and the second image to be spliced to obtain a first spliced image, and take the first spliced image as an updated first image to be spliced, and then select one image from the N frames of images to be spliced as an updated second image to be spliced, and splice the updated first image to be spliced and the updated second image to be spliced to obtain an updated first image to be spliced. The above process is repeatedly cycled until the N frames of images are spliced to obtain the first image.

[0157] Figure 5 An illustrative flowchart for the electronic device to obtain the first image to be spliced.

[0158] The process of updating the first image to be spliced through one cycle can be referred to the description of steps S201-S205 below.

[0159] S201. The electronic device determines feature points of the first image to be spliced and the second image to be spliced.

[0160] The feature points are points where the image gray value changes sharply or pixel points with large curvature on the image edge in the first image to be spliced and the second image to be spliced, which have significant features and can reflect the essential characteristics of the image. The electronic device can calculate the feature points in the first image to be spliced and the second image to be spliced by using a scale-invariant feature transform (SIFT) algorithm or a speeded up robust feature (SURF) algorithm.

[0161] S202. The electronic device matches the feature points of the first image to be spliced and the second image to be spliced, and screens out M pairs of most similar feature points therefrom.

[0162] The value of M is a positive integer greater than or equal to 3, for example, M can be 3. The matching of the feature points is the matching of the images. The electronic device can calculate the Euclidean distance between the feature points of the first image to be spliced and the second image to be spliced by using a K-neighbor algorithm. The smaller the Euclidean distance between any feature point of the second image to be spliced and any feature point of the first image to be spliced, the more similar the two feature points are.

[0163] In some embodiments, the electronic device can determine 3 pairs of feature points with the smallest Euclidean distance.

[0164] In other embodiments, the electronic device can set a second preset threshold, and stop calculating when 3 pairs of feature points with a Euclidean distance less than the second preset threshold are obtained, and take the 3 pairs of feature points as the 3 pairs of most similar feature points.

[0165] It should be understood that, in addition to calculating the Euclidean distance between the feature points of the first image to be stitched and the second image to be stitched by the K-neighbor algorithm, there can be other ways to determine the M pairs of most similar feature points, which are not limited in the embodiments of the present application.

[0166] S203. The electronic device calculates an affine transformation matrix of the second image to be stitched using the M pairs of feature points;

[0167] The affine transformation matrix is used to perform a linear transformation on the second image to be stitched and add a translation, so as to transform the second image to be stitched to the vector space where the first image to be stitched is located.

[0168] S204. The electronic device performs affine transformation on the second image to be stitched according to the image affine transformation matrix to obtain a third image to be stitched, and performs Laplace fusion on the third image to be stitched and the first image to be stitched to obtain a first stitched image.

[0169] The electronic device performs affine transformation on the second image to be stitched using the affine transformation matrix to obtain a third image to be stitched. The third image to be stitched is located in the same vector space as the first image to be stitched. Then the electronic device performs Laplace fusion on the third image to be stitched and the first image to be stitched to obtain a first stitched image. The first stitched image obtained by the fusion is used as an updated first image to be stitched.

[0170] It should be understood that, in addition to the Laplace fusion algorithm, the electronic device can also use other ways to fuse the first image to be stitched and the third image to be stitched. The embodiments of the present application are not limited in this regard.

[0171] It should be understood that, in addition to the above stitching method, in some other embodiments, there are other ways to stitch the N frames of images, for example, the N frames of images are divided into two groups, and the above-mentioned methods are used to stitch them respectively to obtain two frames of images, and then the two frames of images are stitched to obtain a first image. The embodiments of the present application do not limit the way the electronic device stitches to obtain the first image.

[0172] S114. The electronic device restores the motor of the second camera to the initial position;

[0173] In some embodiments, the initial position of the motor can be the center of the second camera.

[0174] S115. The electronic device determines the image corresponding to the first time from the image sequence as the first image;

[0175] The electronic device pre-processes the image captured by the first camera at the first time from the image sequence obtained by the first camera to obtain a first image.

[0176] In S116, the electronic device processes the first image to obtain a target image.

[0177] The target image has the same image content as the first image obtained by processing the preview image obtained by the first camera at the first time.

[0178] The same image content means that the target image and the scene displayed in the first image are the same. That is, the first image includes scene 1, scene 2, and scene 3, and the target image should also include scene 1, scene 2, and scene 3.

[0179] For example, the first image can be the image in the user interface 13 shown in the foregoing Figure lc The target image can be the image in the user interface 21 shown in the foregoing Figure 2b At this time, the target image and the first image both include scene 101, scene 102, scene 103, and scene 104.

[0180] Optionally, the same image content can also mean that all pixels in the target image and the first image are the same, or the percentage of the same pixels, and when the percentage is greater than a preset value, the image content is considered to be the same. For example, the preset value is 70%, 80%, or 90%, etc.

[0181] If the first image is obtained by splicing the foregoing N frames of images to be processed, the electronic device can crop the first image to obtain a second image. When cropping, the aspect ratio of the image is 4:3.

[0182] In some embodiments, the electronic device can take the second image as the target image.

[0183] In another embodiment, the electronic device can perform some post-processing on the second image to obtain the target image. For example, brightness compensation, etc.

[0184] If the first image is the image corresponding to the first time determined from the image sequence, the electronic device can take the first image as the target image. Or perform some post-processing to generate the target image.

[0185] It should be understood that the above steps S101-S116 are described in detail taking the first camera as a wide-angle camera and the second camera as a long-focus camera as an example. When the first camera can also be an ultra-wide-angle camera and the second camera is a wide-angle camera, the process of obtaining the target image is similar to steps S101-S116, and reference can be made to the foregoing description of steps S101-S116, which will not be described here.

[0186] However, it should be noted that the first information table can be referred to as a second information table with changes in the content of the first information table. The second information table can refer to the description of Table 2 below.

[0187] Table 2 is another example of a second information table.

[0188]

[0189] Table 2

[0190] In Table 1, a < b < c < d. The value range of a is 60-80, for example, 77. The value range of b is 100-115, for example, 110. The value range of c is 115-130, for example, 128. The value range of d is 130-140, for example, 139. At this time, when the field of view of the first camera at the first time is 115, the N value satisfying the first preset condition is 9 and 16, and the electronic device can determine that the N of the image to be spliced at this time is 9.

[0191] Scene 2: The electronic device can move the motor (the motor of the third camera) according to the preset trajectory while keeping the position unchanged, so that the orientation of the third camera can move horizontally and vertically, so that the third camera can capture N frames of images to be spliced, and each frame of image to be spliced is spliced with the last frame of image to be spliced to obtain a target image. In this way, the shooting range of the electronic device can be expanded horizontally and vertically, and the problem of image blur caused by excessive shaking of the electronic device when the user moves the electronic device too fast to change the orientation of the third camera to obtain the image to be spliced is avoided. The third camera can be the first camera or the second camera described above, or other cameras, and the embodiments of the present application do not limit this.

[0192] Figures 6a-h A set of schematic diagrams for the electronic device involved in scene 2 to obtain a target image.

[0193] The above process can be referred to as wide-angle splicing. An example of an exemplary user interface of the electronic device starting the shooting function and entering the wide-angle splicing can be as shown in Figure 6a .

[0194] As shown in Figure 6aAs shown, after the electronic device activates the shooting function, it can display user interface 60. In response to user operations on more controls 601 (such as click operations), the electronic device can display more settings. User interface 61 is then displayed.

[0195] The user interface 61 may include more settings, and in response to user actions (such as clicks) on the wide-angle splicing control 611, the electronic device can enter wide-angle splicing mode. Display as follows: Figure 6b The user interface shown.

[0196] User interface 62 is a settings interface when the electronic device enters wide-angle stitching mode. The user can set the field of view when the electronic device acquires the target image in area 611. Assuming the user sets the field of view to 90 degrees, the electronic device can use its horizontal and vertical movement motors to change the orientation of the third camera. The horizontal movement motor allows it to capture the scene corresponding to a 90-degree field of view. The vertical movement motor allows the electronic device to capture more of the scene corresponding to the vertical direction. Figure 6b The area 622 shown represents the current shooting range of the electronic device. In response to a user's operation on the shooting control 621 (e.g., a click), the electronic device can acquire N frames to be stitched together. Here, N is a positive integer greater than or equal to 2, typically a square of a positive integer, and the value of N is determined by the field of view set by the user and the field of view of the third camera. For example, N = 4.

[0197] like Figure 6c As shown, the electronic device can move the motor four times along a preset trajectory, changing the orientation of the third camera to acquire four frames of images to be stitched together. This allows it to first capture the scene in area 601, and then sequentially capture the scene in areas 602, 603, and 604. When the orientation of the third camera is changed during two consecutive motor movements, the scenes captured by the third camera in the two instances overlap, resulting in an overlapping area between the two consecutive frames to be stitched together. For example, area 605 is the overlapping area when the electronic device captures scenes from areas 601 and 602.

[0198] like Figure 6d As shown, the electronic device's moving motor enables the third camera to capture the scene in area 631, obtaining a first frame of the image to be stitched together, which serves as the third image. In the user interface 63, area 632 can be referred to as the first preview frame, and area 633 can be referred to as the second preview frame. The first preview frame is used to display the image to be stitched together acquired by the electronic device. The second preview frame is used to display the latest third image (the stitched image) from the electronic device. At this time, the electronic device can simultaneously display the third image in both the first and second preview frames.

[0199] Then, as Figure 6e As shown, the electronic device moves a motor to cause the third camera to move laterally, capturing images of the scene in area 641 to obtain a second frame of image to be stitched together. The electronic device then stitches this second frame of image to be stitched together with the aforementioned third image, updating the third image to obtain the latest third image. The electronic device then displays the second frame of image to be stitched together in a first preview frame in user interface 64, and displays the updated third image in a second preview frame.

[0200] Then, as Figure 6f As shown, the electronic device continues to move the motor, causing the third camera to move vertically, so that it can capture the scene in area 651 to obtain the third frame of the image to be stitched, and update the third image.

[0201] Then, as Figure 6g As shown, the electronic device continues to move the motor, causing the third camera to move laterally, so that it can capture the scene in area 661, obtain the fourth frame of the image to be stitched, and obtain the updated third image.

[0202] The descriptions of user interfaces 65 and 66 can be found in the preceding description of user interface 64. They will not be repeated here.

[0203] After the electronic device stitches the images N-1 times consecutively, it obtains the latest third image. Then it stops capturing the image. The result is displayed as follows: Figure 6h The user interface 67 is shown. In response to a user's action on the echo control 671 (e.g., a click), the electronic device can display, as shown... Figure 6h The user interface 68 shown in the image.

[0204] The user interface 68 can display a fourth image, which can be the latest third image or a processed version of the latest third image.

[0205] Figure 7 This is a schematic flowchart illustrating the shooting method involved in Scene 2.

[0206] In scenario 2, the process of acquiring a target image using the shooting method in the embodiments of this application can be referred to the following description of steps S301-S307.

[0207] S301. The electronic device has entered wide-angle splicing mode;

[0208] An exemplary user interface for an electronic device to enter wide-angle splicing mode can be referred to the aforementioned... Figures 6a-c The description is omitted here.

[0209] S302. In response to the first operation, the electronic device calculates the number N of the stitching images obtained by the set field of view and the field of view of the third camera;

[0210] The set field of view refers to the field of view set by the user through the electronic device, and the related content can be referred to the foregoing Figure 6b .

[0211] The step S302 involves a process similar to the foregoing step S108, and the embodiments of the present application will not be described here.

[0212] S303. The electronic device moves the motor to change the field of view of the third camera, obtains a third image through the third camera, and displays the third image in the first preview frame and the second preview frame;

[0213] The schematic diagram involved in the step S303 can be referred to the foregoing description of Figure 6d . At this time, the third image is equivalent to the first frame of the stitching image.

[0214] The process of the electronic device obtaining the latest third image is a loop process, and the electronic device stitches each frame of the stitching image obtained with the third image to obtain the updated third image. The loop process is repeated N-1 times, and the loop process can be referred to the description of the steps S304-S306 below. The schematic diagram involved in the process can be referred to the foregoing description of Figures 6e-g .

[0215] S304. The electronic device moves the motor again to change the field of view of the third camera, obtains a frame of the stitching image through the third camera, and displays the frame of the stitching image in the first preview frame;

[0216] S305. The electronic device stitches the latest third image with the frame of the stitching image, updates the third image, and displays the updated third image in the second preview frame;

[0217] The process of the electronic device stitching the latest third image with the frame of the stitching image to update the third image is similar to the process of stitching two frames of the stitching image in the foregoing step S113, and can be referred to the foregoing description of the step S113, which will not be described here.

[0218] S306. The electronic device determines whether the stitching is performed N-1 times;

[0219] In the case of determining that the stitching is performed N-1 times, the step S107 is performed,

[0220] In the case of determining that the stitching is not performed N-1 times, the steps S304-S306 are continuously performed.

[0221] S307. The electronic device saves the latest third image.

[0222] In some embodiments, the electronic device can process the latest third image to obtain a target image.

[0223] In some other embodiments, the electronic device can take the latest third image as the target image.

[0224] Scenario 3: In the wide-angle splicing involved in the aforementioned scenario 2, the electronic device moves the motor according to a preset trajectory, so that the orientation of the third camera can be moved horizontally / vertically, so that the third camera can capture N frames of to-be-spliced images, and each time a frame of to-be-spliced image is obtained, it is spliced with the last frame of to-be-spliced image to obtain a target image. In this way, the shooting range of the electronic device can be expanded horizontally / vertically, and at the same time, the problem of image blur caused by excessive shaking of the electronic device when the user moves the electronic device too fast to change the orientation of the third camera to obtain to-be-spliced images is avoided. The third camera can be the first camera or the second camera involved in the foregoing, or it can be another camera, and the embodiments of the present application do not limit this.

[0225] Taking the horizontal movement of the motor as an example, the process of vertical movement of the motor is similar, which will not be repeated here.

[0226] Figures 8a-g A set of schematic diagrams for the electronic device to obtain a target image involved in scenario 3.

[0227] The process in which the electronic device enters the wide-angle splicing mode can refer to the description in the foregoing Figures 6a-b .

[0228] As shown in Figure 8a , the user interface 80 is a setting interface when the electronic device enters the wide-angle splicing mode, and it is assumed that at this time, the user sets the field of view angle when obtaining a target image to be 120. Then the electronic device can move the motor horizontally to change the orientation of the third camera. The horizontal movement of the motor makes it can obtain the corresponding scene when the field of view angle is 120. Figure 8a The area 811 shown in is the current shooting range of the electronic device. In response to the operation (such as a click operation) of the user on the shooting control 811, the electronic device can obtain N frames of to-be-spliced images. The area 812 in the user interface 80 is a first preview frame, and the area 813 is a second preview frame. Wherein, N is a positive integer greater than or equal to 2, and is usually a power of a certain positive integer and the value of N is determined by the field of view angle currently set by the user and the field of view angle of the third camera. At this time, take N as 4 for example.

[0229] Figure 8bAs shown, the electronic device can move the motor four times along a preset trajectory, changing the orientation of the third camera to acquire four frames of images to be stitched together. This allows it to first capture the scene in region 801, and then sequentially capture the scene in regions 802, 803, and 804. When the orientation of the third camera is changed during two consecutive motor movements, the scenes captured by the third camera in the two instances overlap, resulting in an overlapping area between the two consecutive frames to be stitched together. For example, region 805 is the overlapping area when the electronic device captures scenes from regions 801 and 802.

[0230] like Figure 8c As shown, the electronic device moves a motor, enabling the third camera to capture images of the scene in area 821, obtaining a first frame of the image to be stitched together, which serves as the third image. The third image is simultaneously displayed in both the first and second preview frames of the user interface 81.

[0231] Then, as Figure 8d As shown, the electronic device moves a motor to cause the third camera to move laterally, capturing images of the scene in area 831 to obtain a second frame of the image to be stitched together. The electronic device then stitches this second frame with the aforementioned third image, updating the third image to obtain the latest third image. The electronic device then displays the second frame in the first preview frame of the user interface 82 and the updated third image in the second preview frame.

[0232] Then, as Figure 8e As shown, the electronic device continues to move the motor, causing the third camera to move laterally, so that it can capture the scene in area 841 to obtain the third frame of the image to be stitched, and update the third image.

[0233] Then, as Figure 8f As shown, the electronic device continues to move the motor, causing the third camera to move laterally, so that it can capture the scene in area 851, obtain the fourth frame of the image to be stitched, and obtain the updated third image.

[0234] The descriptions of user interfaces 83 and 84 can be found in the preceding description of user interface 82. They will not be repeated here.

[0235] After the electronic device stitches the images N-1 times consecutively, it obtains the latest third image. Then it stops capturing the image. The result is displayed as follows: Figure 8g The user interface 85 is shown. In response to a user's action on the echo control 851 (e.g., a click), the electronic device can display, as shown... Figure 8g The user interface 86 shown in the image.

[0236] The fourth image displayed in the user interface 86 can be the latest third image, or an image obtained by processing the latest third image.

[0237] It should be understood that the detailed process of the photographing method involved in scenario 3 is the same as that of scenario 2 described above, and reference can be made to the foregoing description of steps S301-S307, which will not be repeated here.

[0238] In the embodiments of the present application, Figure lb The photographing control 111 in the user interface 11 shown in FIG. 1 can also be referred to as a first control, and the operation on the first control can be referred to as a first operation. Figure 6b The photographing control 621 in the user interface 62 shown in FIG. 6 can also be referred to as a first control, and the operation on the first control can be referred to as a first operation. Figure lc The echo control 121 in the user interface 12 shown in FIG. 1 can also be referred to as a second control, and the operation on the second control can be referred to as a second operation. The first spliced image can also be referred to as a second image. The updated third image can also be referred to as a fifth image.

[0239] Next, an example electronic device provided by the embodiments of the present application will be introduced.

[0240] Figure 9 FIG. 1 is a structural schematic diagram of an electronic device provided by the embodiments of the present application.

[0241] The embodiments will be described below with the electronic device as an example. It should be understood that the electronic device can have more or fewer components than those shown in the figure, can combine two or more components, or can have a different component configuration. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0242] The electronic device can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric 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.

[0243] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0244] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (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 can be independent devices, or can be integrated in one or more processors.

[0245] The controller can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching instructions and executing instructions.

[0246] The processor 110 can also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or is using repeatedly. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0247] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, and / or a universal serial bus (USB) interface, etc.

[0248] It can be understood that the interface connection relationship between the modules shown in the embodiments of the present application is only illustrative and does not constitute a structural limitation on the electronic device. In some other embodiments of the present application, the electronic device can also use different interface connection methods or a combination of multiple interface connection methods in the above embodiments.

[0249] The electronic device can realize the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.

[0250] 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), etc. In some embodiments, the electronic device can include 1 or N display screens 194, and N is a positive integer greater than 1.

[0251] The electronic device can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.

[0252] ISP is used to process the data feedback from the camera 193. For example, when taking a photo, the shutter is opened, 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 the ISP for processing and conversion into a visible image. ISP can also optimize 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 provided in the camera 193.

[0253] The camera 193 is used to capture still images or videos. Objects generate optical images through lenses and project them onto photosensitive elements. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to the ISP for conversion 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 a standard RGB, YUV, or other format image signal. In some embodiments, the electronic device can include one or N cameras 193, where N is a positive integer greater than 1. The camera includes a motor that moves to change the orientation of the camera, allowing the camera to capture different scenes.

[0254] The digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.

[0255] The video codec is used to compress or decompress digital video. The electronic device can support one or more video codecs. In this way, the electronic device can play or record videos in multiple encoding formats, such as moving picture experts group (MPEG) 1, MPEG 2, MPEG 3, MPEG 4, etc.

[0256] NPU is a neural-network (NN) computing processor that learns from biological neural network structures, such as the transmission mode between human brain neurons, to quickly process input information and continuously self-learn. Through NPU, the electronic device can achieve intelligent cognition applications, such as image recognition, face recognition, voice recognition, and text understanding.

[0257] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to extend the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos are stored in the external memory card.

[0258] The internal memory 121 can be used to store computer executable program code, which includes instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area.

[0259] The electronic device can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor, etc. For example, music playing, recording, etc.

[0260] The audio module 170 is used to convert digital audio information into analog audio signals for output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals.

[0261] The speaker 170A, also known as a "loudspeaker", is used to convert audio electrical signals into sound signals. The electronic device can listen to music or listen to hands-free calls through the speaker 170A.

[0262] The receiver 170B, also known as a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device answers a call or a voice message, the receiver 170B can be held close to the ear to listen to the voice.

[0263] The microphone 170C, also known as a "microphone", "sound transducer", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak into the microphone 170C by holding the mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device can be provided with at least one microphone 170C.

[0264] The earphone interface 170D is used to connect a wired earphone. The earphone interface 170D can be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0265] The pressure sensor 180A is configured to sense a pressure signal and convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194. The pressure sensor 180A can be of various types, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, etc.

[0266] The gyroscope sensor 180B can be configured to determine a motion posture of the electronic device. In some embodiments, the gyroscope sensor 180B can be configured to determine an angular velocity of the electronic device around three axes (i.e., x, y and z axes). The gyroscope sensor 180B can be configured to implement anti-shake. For example, when a shutter is pressed, the gyroscope sensor 180B detects an angle of shaking of the electronic device, calculates a distance that needs to be compensated by a lens module according to the angle, and causes the lens to implement anti-shake by performing a reverse movement to offset the shaking of the electronic device. The gyroscope sensor 180B can also be configured to implement navigation and motion sensing game scenarios.

[0267] The fingerprint sensor 180H is configured to collect a fingerprint. The electronic device can implement fingerprint unlocking, access to an application lock, fingerprint photographing, fingerprint answering a call, etc. by using characteristics of the collected fingerprint.

[0268] The temperature sensor 180J is configured to detect a temperature. In some embodiments, the electronic device can implement a temperature processing strategy by using the temperature detected by the temperature sensor 180J.

[0269] The touch sensor 180K, also referred to as a touch panel. The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 together form a touch screen, also referred to as a touch panel.

[0270] In the embodiments of the present application, the processor 110 can invoke computer instructions stored in the internal memory 121 to cause the electronic device to perform the photographing method in the embodiments of the present application.

[0271] Figure 10 The system structure of the electronic device in the embodiments of the present application is shown in FIG. 1.

[0272] The system structure of the electronic device is described below.

[0273] The layered architecture divides the system into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the system is divided into five layers, from top to bottom, an application program layer, an application program framework layer, a hardware abstraction layer, a kernel layer and a hardware layer.

[0274] The application program layer can include a series of application program packages.

[0275] The application program packages can include a camera, a gallery, etc.

[0276] The application framework layer provides an application programming interface (API) and a programming framework for the applications of the application layer. The application framework layer includes some pre-defined functions.

[0277] In some embodiments, the application framework layer can include a camera access interface, wherein the camera access interface can include camera management and camera devices. The camera access interface is used to provide an application programming interface and a programming framework for camera applications.

[0278] The hardware abstraction layer is an interface layer between the application framework layer and the kernel layer, and provides a virtual hardware platform for the operating system.

[0279] In the embodiments of the present application, the hardware abstraction layer can include a camera hardware abstraction layer and a camera algorithm library.

[0280] The camera hardware abstraction layer can provide virtual hardware of a camera device 1 (first camera) and a camera device 2 (second camera). It can also obtain pose data and transmit it to the camera algorithm library. The camera hardware abstraction layer can also be used to calculate the number N of images to be stitched and obtain information from the camera algorithm library.

[0281] The camera algorithm library can include an algorithm module and a motion detection module.

[0282] The algorithm module includes a plurality of algorithms for processing images, which can be used to implement the stitching of N frames of images to be stitched and other processing.

[0283] The motion detection module can be used to calculate whether the current shooting scene of the electronic device is moving.

[0284] The kernel layer is a layer between hardware and software. The kernel layer includes drivers of various hardware.

[0285] In some embodiments, the kernel layer can include camera device drivers, digital signal processor drivers, and image processor drivers.

[0286] The camera device driver is used to drive the sensor of the camera to collect images and drive the image signal processor to pre-process the images.

[0287] The digital signal processor driver is used to drive the digital signal processor to process images.

[0288] The image processor driver is used to drive the image processor to process images.

[0289] The following describes the method in the embodiments of the present application in combination with the above hardware structure and system structure:

[0290] 1. The electronic device starts the shooting function, enters the preview mode, and acquires an image.

[0291] This step 1 is continuously performed. In some embodiments, in response to a user operation (e.g., a click operation) on the camera application, the camera application calls a camera access interface of an application framework layer, starts the camera application, and then sends an instruction to start the camera application by calling a camera device 1 (a first camera) in a camera hardware abstraction layer, which sends the instruction to a camera device driver in a kernel layer. The camera device driver can start a sensor (a sensor 1) of the first camera of the camera, acquire a to-be-processed image through the sensor 1, and transmit the to-be-processed image to an image signal processor for preprocessing to obtain a preview image (at least two frames of preview images constitute an image sequence), and then transmit the preview image to the camera hardware abstraction layer through the camera device driver, which can display the preview image.

[0292] 2. The electronic device continuously acquires attitude data.

[0293] This step 2 is continuously performed.

[0294] The camera hardware abstraction layer can acquire the attitude data and transmit the attitude data to a camera algorithm library.

[0295] 3. The electronic device calculates a first detection result and a second detection result.

[0296] This step 3 is continuously performed.

[0297] For the first detection result: According to the foregoing description of step 1, the hardware abstraction layer can acquire two continuous preview images. The hardware abstraction layer transmits the two continuous preview images (a first image and a second image in the image sequence) to the camera algorithm library, which uses a running detection module to obtain the first detection result according to the two continuous preview images by using related computer instructions.

[0298] For the second detection result: The running detection module in the camera algorithm library can use the attitude data to obtain the second detection result by using related computer instructions.

[0299] 4. In response to a first operation at a first time, the electronic device determines whether a current shooting scene is moving.

[0300] In some embodiments, in response to a user operation (e.g., a click operation) on a shooting control in the camera application, the camera application calls a camera access interface of an application framework layer, and then acquires, from the camera algorithm library, a result of whether a current moving scene corresponding to the first time is moving by calling a camera hardware abstraction layer. It is assumed that there is no movement here.

[0301] 5. The electronic device calculates the number N of images to be stitched;

[0302] In some embodiments, the camera hardware abstraction layer can look up the first information table or the second information table according to the field of view of the first camera and the field of view of the second camera. The first information table or the second information table can be placed in a memory in the camera hardware abstraction layer. Or the camera hardware abstraction layer can record the storage address of the first information table or the second information table, and obtain the first information table or the second information table according to the storage address.

[0303] 6. The electronic device obtains N frames of images to be stitched;

[0304] The camera hardware abstraction layer obtains the motor rotation trajectory and sends instructions to the camera device driver in the kernel layer to generate N frames of images to be stitched. The camera device driver can start the sensor of the second camera (sensor 2) to obtain N frames of images to be processed through the sensor 2. Each frame of the image to be stitched is transmitted to the image signal processor for preprocessing, and then the frame of the image to be stitched is transmitted to the camera hardware abstraction layer through the camera device driver. During this process, the camera hardware abstraction layer determines whether the current shooting scene is moving in real time. It is assumed here that there is no movement.

[0305] 7. The electronic device stitches the N frames of images to be stitched to obtain a first image;

[0306] The hardware abstraction layer can transmit the N frames of images to be stitched to the camera algorithm library, and the algorithm module in the camera algorithm library stitches the N frames of images to be processed to obtain a first image.

[0307] 8. The electronic device processes the first image to obtain a target image.

[0308] The algorithm module in the camera algorithm library processes the first image, for example, cropping, to obtain a target image and sends it to the camera hardware abstraction layer.

[0309] If the current shooting scene moves in step 6, the hardware abstraction layer sends instructions to restore the motor to the initial position through the camera device driver to the sensor 2. At the same time, the instruction to select the image corresponding to the first time from the images obtained by the sensor 1 is sent through the camera device driver to the image signal processor, and the image signal processor sends the image corresponding to the first time obtained by the sensor 1 as the first image through the camera device driver to the hardware abstraction layer.

[0310] The above-described embodiments merely serve to illustrate the technical solutions of the present application, rather than limit the present application; even though the present application has been described in detail with reference to the foregoing embodiments, those ordinarily skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or equivalently replace some of the technical features thereof; and these modifications or replacements do not cause the essence of the corresponding technical solutions to depart from the scope of the technical solutions of the embodiments of the present application.

[0311] In the above-described embodiments, the term "when" can be interpreted as meaning "if" or "after" or "in response to determining" or "in response to detecting" according to the context. Similarly, the phrase "upon determining" or "if detecting (the stated condition or event)" can be interpreted as meaning "if determining" or "in response to determining" or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)" according to the context.

[0312] In the above-described embodiments, all or some of the flowcharts or functional modules can be realized in the form of a software program. The software program is stored in a volatile or non-volatile storage medium (for example, a RAM, a floppy disk, a USB flash disk, a ROM, or a DVD), and contains a number of instructions capable of being executed by one or more computer processors. The above-described embodiments can be realized by means of computer programs or pieces of program code that are executed on one or more computers or computer processors. The program code can be stored in a computer-readable medium, such as a floppy disk, a USB flash disk, a ROM, or a DVD, and can be read and executed by one or more computers or computer processors. The program code can also be transmitted via a data network, such as the Internet, a local area network, or a wide area network, between one or more computers or computer processors.

[0313] Those ordinarily skilled in the art can understand that all or some of the flowcharts in the above-described embodiments can be implemented by a computer program instructing relevant hardware, and the program can be stored in a computer-readable storage medium and can include the flowcharts of the above-described embodiments when executed. The aforementioned storage medium includes a ROM or a random access memory (RAM), a magnetic disk or an optical disk, and various media capable of storing program codes.

Claims

1. A shooting method, characterized in that, Applied to an electronic device including a first camera and a second camera, wherein the field of view of the first camera is greater than the field of view of the second camera, the method includes: The electronic device activates the camera; Display a preview interface, which includes a first control and a second control; Use the first camera to acquire a preview image; The preview image is displayed on the preview interface; At the first moment, the first image captured by the first camera is displayed in the preview interface, and the first operation on the first control is detected; In response to the first operation, the number of times the second camera moves, N, is obtained, and the orientation of the second camera is changed by a moving motor according to a preset trajectory with the number of times N moves, so as to obtain N frames of images to be stitched together, where N is an integer greater than 2; wherein, N is determined based on the field of view of the first camera at the first moment and the field of view of the second camera; the field of view of the first camera at the first moment is determined based on the zoom ratio of the first camera at the first moment; The N frames of images to be stitched together are stitched together to obtain a target image. The image content in the target image is the same as the image content in the first image, and the image clarity of the target image is greater than that of the first image. Save the target image.

2. The method according to claim 1, characterized in that, After saving the target image, the method further includes: The electronic device detects a second operation on the second control; In response to the second operation, the target image is displayed.

3. The method according to claim 1 or 2, characterized in that, Before changing the orientation of the second camera, the method further includes: The electronic device determines whether the shooting scene is moving; wherein, shooting scene movement means that the object being shot is moving relative to the electronic device or that the electronic device is moving; shooting scene no movement means that the object being shot is not moving relative to the electronic device and that the electronic device is not moving. When it is determined that there is no movement in the shooting scene, the electronic device moves the motor to change the orientation of the second camera; When the motion of the shooting scene is determined, the first image is processed to obtain the target image.

4. The method according to claim 3, characterized in that, The method further includes: When determining the movement of the shooting scene, the electronic device moves the motor to the initial position and then stops moving the motor.

5. The method according to claim 3 or 4, characterized in that, At the second moment, the electronic device determines whether the shooting scene is in motion, specifically including: The electronic device determines a first detection result and a second detection result corresponding to the second moment; the first detection result is used to describe whether the photographed object moves relative to the electronic device at the second moment; the second detection result is used to describe whether the electronic device moves at the second moment. If it is determined that the object being photographed at the second moment is not moving relative to the electronic device and the electronic device is not moving at the first moment, then it is determined that the shooting scene at the second moment is not moving. If it is determined that the object being photographed is moving relative to the electronic device at the second moment or that the electronic device is moving at the first moment, then the motion of the shooting scene at the second moment is determined.

6. The method according to claim 5, characterized in that, The electronic device determines the first detection result and the second detection result corresponding to the second time moment, specifically including: The electronic device uses a first preview image and a second preview image to detect whether there are moving objects in the shooting scene and obtains a first detection result; the first preview image is the preview image acquired by the first camera at the second time; the second preview image is a preview image that differs from the first preview image in acquisition time by X frames; where X is an integer greater than or equal to 1. The attitude data at the second moment is used to determine whether the device is moving, and a second detection result is obtained; the attitude data is used to describe the motion attitude of the electronic device.

7. The method according to any one of claims 1-6, characterized in that, The N frames of images to be stitched together are stitched together to obtain the target image, specifically including: The electronic device stitches together the N frames of images to be stitched together to obtain a second image; The second image is cropped to obtain the target image.

8. A shooting method, characterized in that, Applied to an electronic device including a third camera, the method includes: The electronic device activates the camera; Display a preview interface, which includes a first preview box, a second preview box, and a first control; A first operation on the first control was detected; In response to the first operation, the number of times the third camera moves, N, is obtained, and the orientation of the third camera is changed by a moving motor according to a preset trajectory with the number of times the third camera moves, N, in order to obtain a target image; wherein, N is determined based on the field of view angle set by the user and the field of view angle of the third camera; The process of moving the motor to change the orientation of the third camera according to a preset trajectory and moving it a number of times N to obtain a target image includes: When the w-th moving motor changes the orientation of the third camera, the w-th frame to be stitched is displayed in the first preview frame, and the third image is displayed in the second preview frame. The third image is obtained by stitching the w-th frame to be stitched and the fourth image displayed in the second preview frame when the moving motor changes the orientation of the third camera for the (w-1)th time. The process includes: performing an affine transformation on the w-th frame to be stitched, stitching the image obtained after the affine transformation with the fourth image to obtain a fifth image, and cropping the fifth image to obtain the third image. Wherein, w is greater than or equal to 1 and less than or equal to N. When w equals 1, the first frame to be stitched is the same as the fourth image displayed in the second preview frame.

9. The method according to claim 8, characterized in that, Performing an affine transformation on the w-th frame of the image to be stitched together specifically includes: The electronic device determines all feature points of the fourth image and the w-th frame to be stitched together; the feature points are points in the fourth image and the w-th frame to be stitched together where the image grayscale value changes drastically or pixels with large curvature on the image edge, and are used to calculate the affine transformation matrix of the w-th frame to be stitched together. The affine transformation matrix is ​​used to perform a linear transformation on the w-th frame to be stitched together and then add a translation to transform it to the vector space where the fourth image is located. From all the feature points, determine the M pairs of feature points that are most similar; where M is an integer greater than or equal to 3; Calculate the affine transformation matrix of the w-th frame of the image to be stitched based on the M pairs of feature points; The w-th frame of the image to be stitched is subjected to an affine transformation based on the affine transformation matrix.

10. An electronic device, characterized in that, The electronic device includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when executed by the one or more processors, cause the electronic device to perform the method as described in any one of claims 1-9.

11. A chip system applied to an electronic device, the chip system comprising one or more processors, the processors being configured to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1-9.

12. A computer program product containing instructions, characterized in that, When the computer program product is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1-9.

13. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Shooting method, electronic equipment and storage medium

    CN111107269A

  • Image acquisition method and device, electronic equipment and computer readable storage medium

    CN112087580A