Photographing mode switching method and related apparatus
AssigneeHonor Device Co., Ltd.
InventorJianxian Wang
Life of this patent
Estimating the term…
Abstract
This application provides a photographing mode switching method and a related apparatus. When detecting an operation of switching from a first photographing mode to a second photographing mode, an electronic device may obtain preview data in the first photographing mode from a memory by invoking a GPU, and downsample the preview data to a specified image size, to obtain a downsampled image of a specified data type; and perform blurring processing on the downsampled image of the specified data type returned by the GPU, to obtain a blurred image, and display the blurred image in a preview box in a coverage manner.
Claims20
A photographing mode switching method, applied to an electronic device having a camera, wherein the method comprises:
- displaying a first preview interface, wherein the first preview interface comprises a preview box, the preview box displays a preview picture captured by the camera of the electronic device in a first photographing mode, and resolution of the preview picture captured by the camera of the electronic device in the first photographing mode is first resolution;
- receiving a first operation of switching from the first photographing mode to a second photographing mode, wherein the first photographing mode is different from the second photographing mode;
- in response to the first operation, obtaining a memory address of a display control module at an application framework layer on the electronic device, wherein a memory region corresponding to the memory address of the display control module stores preview data in the first photographing mode, and the preview data in the first photographing mode is used to display, in the preview box, the preview picture captured in the first photographing mode;
- invoking a graphics processing unit GPU to obtain a raw image that is stored in the memory region corresponding to the memory address of the display control module;
- downsampling the raw image to specified resolution by using the GPU to obtain a downsampled image of a specified type, wherein the specified resolution is less than the first resolution;
- performing blurring processing on the downsampled image of the specified type to obtain a blurred image;
- displaying the blurred image in the preview box in a coverage manner;
- and
- cancelling display of the blurred image in the preview box when a preview picture captured by the camera of the electronic device in the second photographing mode is obtained, and displaying, in the preview box, the preview picture captured by the camera of the electronic device in the second photographing mode.
An electronic device, comprising a camera, one or more processors, and one or more storages, wherein the camera and the one or more storages are coupled to the one or more processors, the one or more storages are configured to store computer program code, the computer program code comprises computer instructions, and when the electronic device executes the computer instructions, the electronic device performs the following operations:
- displaying a first preview interface, wherein the first preview interface comprises a preview box, the preview box displays a preview picture captured by the camera of the electronic device in a first photographing mode, and resolution of the preview picture captured by the camera of the electronic device in the first photographing mode is first resolution;
- receiving a first operation of switching from the first photographing mode to a second photographing mode, wherein the first photographing mode is different from the second photographing mode;
- in response to the first operation, obtaining a memory address of a display control module at an application framework layer on the electronic device, wherein a memory region corresponding to the memory address of the display control module stores preview data in the first photographing mode, and the preview data in the first photographing mode is used to display, in the preview box, the preview picture captured in the first photographing mode;
- invoking a graphics processing unit GPU to obtain a raw image that is stored in the memory region corresponding to the memory address of the display control module;
- downsampling the raw image to specified resolution by using the GPU to obtain a downsampled image of a specified type, wherein the specified resolution is less than the first resolution;
- performing blurring processing on the downsampled image of the specified type to obtain a blurred image;
- displaying the blurred image in the preview box in a coverage manner;
- and
- cancelling display of the blurred image in the preview box when a preview picture captured by the camera of the electronic device in the second photographing mode is obtained, and displaying, in the preview box, the preview picture captured by the camera of the electronic device in the second photographing mode.
A non-transitory computer-readable storage medium, comprising instructions, wherein when the instructions are run on an electronic device, the electronic device performs the following operations:
- displaying a first preview interface, wherein the first preview interface comprises a preview box, the preview box displays a preview picture captured by a camera of the electronic device in a first photographing mode, and resolution of the preview picture captured by the camera of the electronic device in the first photographing mode is first resolution;
- receiving a first operation of switching from the first photographing mode to a second photographing mode, wherein the first photographing mode is different from the second photographing mode;
- in response to the first operation, obtaining a memory address of a display control module at an application framework layer on the electronic device, wherein a memory region corresponding to the memory address of the display control module stores preview data in the first photographing mode, and the preview data in the first photographing mode is used to display, in the preview box, the preview picture captured in the first photographing mode;
- invoking a graphics processing unit GPU to obtain a raw image that is stored in the memory region corresponding to the memory address of the display control module;
- downsampling the raw image to specified resolution by using the GPU to obtain a downsampled image of a specified type, wherein the specified resolution is less than the first resolution;
- performing blurring processing on the downsampled image of the specified type to obtain a blurred image;
- displaying the blurred image in the preview box in a coverage manner;
- and cancelling display of the blurred image in the preview box when a preview picture captured by the camera of the electronic device in the second photographing mode is obtained, and displaying, in the preview box, the preview picture captured by the camera of the electronic device in the second photographing mode.
Dependencies are inferred from the claim text.