Method for switching camera and electronic device

By obtaining distance information from camera module parameters, the problem of automatic switching between different cameras in electronic devices without relying on laser sensors is solved, achieving image stability and smoothness, and improving the user's shooting experience.

CN118138876BActive 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
2022-04-29
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

How can we achieve automatic switching between different cameras in electronic devices without relying on laser sensors to improve the user's shooting experience?

Method used

By acquiring parameters (such as code values) from the camera module, the distance information between the electronic device and the subject is determined, and based on this information, it is determined whether to switch cameras to ensure that the image does not change during the switching process. Multi-camera fusion technology is used to improve image quality.

Benefits of technology

It enables automatic switching between different cameras in electronic devices without relying on laser sensors, ensuring the stability and smoothness of the displayed image and improving the shooting experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118138876B_ABST
    Figure CN118138876B_ABST
Patent Text Reader

Abstract

The application relates to the terminal field and provides a camera switching method and an electronic device, which are applied to an electronic device. The electronic device comprises a camera module, the camera module comprises a first camera and a second camera, the method comprises the following steps: starting a camera application program; displaying a first image, the first image being obtained by collecting an image by taking the first camera as a main camera; determining that a first parameter and a second parameter satisfy a first preset condition, the first parameter being used for indicating distance information between the electronic device and a target object, the first parameter being a parameter from the camera module, and the second parameter being used for indicating a zoom ratio of the electronic device; and displaying a second image, the second image being obtained by collecting an image by taking the second camera as the main camera. According to the technical scheme of the application, automatic switching of different cameras in the electronic device can be realized without relying on a laser sensor, and the shooting experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the Chinese Patent Application No. 202210468924.9 filed on April 29, 2022, entitled "Method for Switching Camera and Electronic Device", with the State Intellectual Property Office of P.R.C. TECHNICAL FIELD

[0002] The present application relates to the field of terminals, in particular, to a method for switching camera and an electronic device. BACKGROUND

[0003] When the electronic device is shooting, in order to collect a clear image, it often needs to automatically switch the camera; for example, when the electronic device shoots a distant scene, it can switch to a long-focus camera; when the electronic device shoots a close-range scene, it can switch to an ultra-wide-angle camera.

[0004] At present, the distance information between the electronic device and the shooting object is usually determined based on the laser sensor in the electronic device; through the distance information between the electronic device and the shooting object, different cameras in the electronic device can be automatically switched; for example, when the electronic device enters the camera application, the default camera that can be turned on is the wide-angle camera; when the laser sensor in the electronic device detects that the distance between the electronic device and the shooting object is close, the electronic device can switch the camera from the wide-angle camera to the ultra-wide-angle camera, so as to collect a clear image; however, the current method for switching the camera depends on the laser sensor in the electronic device; if the electronic device does not include the laser sensor, the automatic switching between different cameras in the electronic device cannot be realized.

[0005] Therefore, without relying on the laser sensor, how to automatically switch different cameras in the electronic device becomes a problem to be solved. SUMMARY

[0006] The present application provides a method for switching camera and an electronic device, which can realize the automatic switching of different cameras in the electronic device without relying on the laser sensor, and improve the shooting experience of the user.

[0007] In a first aspect, a method for switching camera is provided, applied to an electronic device, the electronic device comprising a camera module, the camera module comprising a first camera and a second camera, the method comprising:

[0008] starting a camera application;

[0009] displaying a first image, the first image being obtained by the first camera as a main camera for collecting an image;

[0010] The first parameter is used to indicate distance information between the electronic device and a target object, the first parameter is a parameter from the camera module, the target object is a photographed object in the first image, and the second parameter is used to indicate a zoom ratio of the electronic device.

[0011] The second image is an image collected by the second camera as a main camera.

[0012] In the embodiments of the present application, since the electronic device can not include a laser sensor, the distance information between the electronic device and the photographed object cannot be obtained through the laser sensor; the distance information between the electronic device and the photographed object can be obtained by obtaining the first parameter (for example, the code value) of the camera module in the electronic device; whether the camera of the electronic device is switched can be determined based on the distance information between the electronic device and the photographed object; for example, if the distance between the electronic device and the photographed object is close, the electronic device can use the ultra-wide-angle camera as the main camera. In addition, in the embodiments of the present application, the second parameter of the electronic device can be obtained, and it is determined that the second parameter meets the first preset condition; when the first parameter and the second parameter meet the first preset condition, the problem of picture jumping during the camera switching process of the electronic device can be avoided; therefore, through the embodiments of the present application, the electronic device can realize automatic switching of different cameras without relying on the laser sensor; and during the switching process of different cameras, the stability of the display picture can be ensured, that is, the display picture is smooth and smooth.

[0013] In a possible implementation, the user can indicate the electronic device to start the camera application by clicking the icon of the "camera" application; or when the electronic device is in a locked state, the user can indicate the electronic device to start the camera application by sliding rightward on the display screen of the electronic device. Alternatively, when the electronic device is in a locked state, the icon of the camera application is included on the lock screen, and the user indicates the electronic device to start the camera application by clicking the icon of the camera application. Alternatively, when the electronic device is running other applications, the application has the permission to call the camera application; the user can indicate the electronic device to start the camera application by clicking the corresponding control. For example, when the electronic device is running an instant messaging application, the user can indicate the electronic device to start the camera application by selecting the control of the camera function, and the like.

[0014] In a possible implementation, when the electronic device is photographing, the main subject in the photographing scene can be determined first, which is the photographed object; the distance between the electronic device and the photographed object can refer to the distance between the electronic device and the focus of the photographed object after the electronic device completes focusing.

[0015] It should be understood that starting the camera application can refer to running the camera application.

[0016] It should also be understood that multiple cameras can be included in the electronic device; for example, a main camera and an auxiliary camera can be included in the multiple cameras; when the electronic device collects an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera; during the processing, part of the image information collected by the auxiliary camera can be extracted to compensate for the image collected by the main camera, to realize fusion of the images collected by the two cameras, and to obtain a displayed image after processing, to achieve functions such as improving the shooting quality, background blurring, optical zoom, and the like.

[0017] In a possible implementation, when the electronic device collects an image, it is in a single-camera mode, that is, the electronic device opens one camera to collect an image, and the camera is a main camera.

[0018] In a possible implementation, when the electronic device collects an image, it is in a single-camera mode, that is, the electronic device opens one camera to collect an image, and the camera is a main camera.

[0019] Exemplarily, when the electronic device collects an image, it is in a dual-camera mode, that is, the electronic device opens two cameras to collect an image; one of the cameras is a main camera, and the other is an auxiliary camera; when collecting an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera; during the processing, part of the image information collected by the auxiliary camera can be extracted to compensate for the image collected by the main camera, to realize fusion of the images collected by the two cameras, and to obtain a displayed image after processing, to achieve functions such as improving the shooting quality, background blurring, optical zoom, and the like.

[0020] In a possible implementation, when the electronic device collects an image, it is in a multi-camera mode, for example, in a triple-camera mode; when the electronic device collects an image, it can open three cameras; the three cameras include one main camera and two auxiliary cameras; when collecting an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera; during the processing, part of the image information collected by the two auxiliary cameras can be extracted to compensate for the image collected by the main camera, to realize fusion of the images collected by the three cameras, and to obtain a displayed image after processing, to achieve functions such as improving the shooting quality, background blurring, optical zoom, and the like.

[0021] With reference to the first aspect, in some implementations of the first aspect, the determining that the first parameter and the second parameter satisfy the first preset condition comprises:

[0022] determining that the first parameter is greater than a first preset threshold, and that the second parameter satisfies a second preset range, wherein the first preset threshold is used to indicate distance information between the camera module and a sensor in the electronic device, and the second preset range is used to indicate a zoom range of the camera module.

[0023] With reference to the first aspect, in some implementations of the first aspect, the method further includes:

[0024] obtaining a first distance range of the first camera, the first distance range being used to indicate an effective distance range in which the first camera is capable of focusing;

[0025] obtaining the first preset threshold based on the first distance range.

[0026] It should be understood that the effective distance range in which the first camera is capable of focusing can mean that the first camera is capable of accurate focusing within the effective distance range. If the distance between the electronic device and the shooting object is greater than the effective distance range, or less than the effective distance range, the electronic device can not be able to accurately focus, so that the clarity of the image captured by the first camera is reduced.

[0027] In a possible implementation, the first distance range of the first camera is greater than 10 cm, that is, when the distance between the electronic device and the shooting object is greater than 10 cm, the first camera is capable of accurate focusing on the shooting object.

[0028] In the embodiments of the present application, the first preset threshold can be determined based on the effective distance range in which the first camera is capable of accurate focusing, so that when the electronic device identifies that the distance between the electronic device and the shooting object is close or far, the electronic device can automatically switch to the second camera as the main camera, thereby ensuring the image quality of the captured image.

[0029] With reference to the first aspect, in some implementations of the first aspect, a starting point of the first distance range is a first numerical value, and the first preset threshold is greater than or equal to the first numerical value.

[0030] In a possible implementation, the first distance range is greater than 10 cm, that is, the starting point of the first distance range is 10 cm; and the first preset threshold can be greater than or equal to 10 cm.

[0031] With reference to the first aspect, in some implementations of the first aspect, the method further includes:

[0032] obtaining a zoom range of the first camera;

[0033] obtaining the second preset range based on the zoom range.

[0034] In the embodiments of the present application, the second preset range can be determined based on the variable magnification range of the first camera, so as to ensure the smoothness of the captured image and avoid the problem of image jump.

[0035] With reference to the first aspect, in some implementations of the first aspect, the second preset range belongs to a subset of the variable magnification range.

[0036] In a possible implementation, when the variable magnification range of the first camera is [1, 3.5), the second preset range can be a subset of [1, 3.5); for example, the second preset range can be [1, 2); or the second preset range can be [1, 2.5), and the like.

[0037] With reference to the first aspect, in some implementations of the first aspect, the first parameter is a parameter of the camera module.

[0038] In a possible implementation, the first parameter can be a distance parameter of the camera module, and the distance parameter can be used to represent the distance information between the lens and the sensor in the electronic device; for example, the greater the distance parameter, the greater the distance between the lens and the sensor, that is, the closer the distance between the electronic device and the shooting object; the smaller the distance parameter, the smaller the distance between the lens and the sensor, that is, the farther the distance between the electronic device and the shooting object. It should be understood that the distance parameter can be referred to as a "code value"; or the distance parameter can also be referred to as a lens position.

[0039] In the embodiments of the present application, the distance information between the electronic device and the shooting object can be determined based on the first parameter of the camera module; through the embodiments of the present application, the electronic device can realize automatic switching of different cameras without relying on a laser sensor, and improve the user's shooting experience.

[0040] With reference to the first aspect, in some implementations of the first aspect, the second parameter is a variable magnification of the electronic device.

[0041] In a possible implementation, the second preset range can be determined based on the variable magnification M corresponding to the first camera and the variable magnification N; the range corresponding to the second preset range can be located between [M, N).

[0042] In the embodiments of the present application, the second parameter satisfying the second preset range can ensure that the switching process of different cameras in the electronic device avoids the problem of picture jump; so as to ensure that the display picture is still smooth and smooth.

[0043] In a possible implementation, the method further comprises:

[0044] determining that the first parameter is less than a second preset threshold value;

[0045] displaying a third image, the third image being obtained by the first camera as a main camera.

[0046] In a possible implementation, the second preset threshold value can be determined based on the first preset threshold value, and the second preset threshold value is greater than the first preset threshold value; or, the second preset threshold value is the same as the first preset threshold value.

[0047] In the embodiments of the present application, in a close distance shooting scenario, the electronic device can switch from using the first camera as a main camera (for example, a wide-angle camera) to using the second camera (for example, an ultra-wide-angle camera) as a main camera; when the electronic device exits the close distance shooting scenario, the electronic device can also switch from using the second camera (for example, an ultra-wide-angle camera) as a main camera to using the first camera (for example, a wide-angle camera) as a main camera based on the first parameter and the second parameter.

[0048] In the embodiments of the present application, in a long distance shooting scenario, the electronic device can switch from using the first camera as a main camera (for example, a wide-angle camera) to using the second camera (for example, a telephoto camera) as a main camera; when the electronic device exits the long distance shooting scenario, the electronic device can also switch from using the second camera (for example, a telephoto camera) as a main camera to using the first camera (for example, a wide-angle camera) as a main camera based on the first parameter and the second parameter.

[0049] With reference to the first aspect, in some implementations of the first aspect, the displaying the second image comprises:

[0050] displaying the second image in a first display interface of the electronic device, the first display interface further comprising a first icon, the first icon being used to indicate the super macro mode.

[0051] With reference to the first aspect, in some implementations of the first aspect, the first icon comprises a first control, and the method further comprises:

[0052] detecting a first operation on the first control;

[0053] in response to the first operation, the electronic device exits the super macro mode.

[0054] With reference to the first aspect, in some implementations of the first aspect, the electronic device is located at the same position when displaying the first image and displaying the second image.

[0055] In the embodiments of the present application, the position of the electronic device can remain unchanged during the shooting process, the focusing object of the electronic device can be moved from a long-range shooting object to a short-range shooting object, the electronic device can automatically identify the distance between the electronic device and the shooting object, and automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the collected image.

[0056] With reference to the first aspect, in some implementations of the first aspect, the first camera includes a wide-angle camera.

[0057] With reference to the first aspect, in some implementations of the first aspect, the second camera includes an ultra-wide-angle camera or a long-focus camera.

[0058] The second aspect provides an electronic device, including a module / unit for executing the method of the first aspect or any one of the switching cameras in the first aspect.

[0059] The third aspect provides an electronic device, including one or more processors, a memory and a camera module; the memory and the one or more processors are coupled, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors invoke the computer instructions to make the electronic device execute:

[0060] starting a camera application;

[0061] displaying a first image, the first image being an image collected by the first camera as a main camera;

[0062] determining that a first parameter and a second parameter satisfy a first preset condition, the first parameter being used to indicate distance information between the electronic device and a target object, the target object being a shooting object in the first image, and the second parameter being used to indicate a zoom ratio of the electronic device;

[0063] displaying a second image, the second image being an image collected by the second camera as a main camera.

[0064] With reference to the third aspect, in some implementations of the third aspect, the one or more processors invoke the computer instructions to make the electronic device execute:

[0065] determining that the first parameter is greater than a first preset threshold and the second parameter satisfies a second preset range, wherein the first preset threshold is used to indicate distance information between the camera module and a sensor in the electronic device, and the second preset range is used to indicate a zoom range of the camera module.

[0066] With reference to the third aspect, in some implementations of the third aspect, the one or more processors invoke the computer instructions to cause the electronic device to perform:

[0067] obtain a first distance range of the first camera, the first distance range being used to represent an effective distance range for focusing by the first camera;

[0068] obtain the first preset threshold based on the first distance range.

[0069] With reference to the third aspect, in some implementations of the third aspect, the one or more processors invoke the computer instructions to cause the electronic device to perform:

[0070] obtain a zoom ratio range of the first camera;

[0071] obtain the second preset range based on the zoom ratio range.

[0072] With reference to the third aspect, in some implementations of the third aspect, a starting point of the first distance range is a first numerical value, and the first preset threshold is greater than or equal to the first numerical value.

[0073] With reference to the third aspect, in some implementations of the third aspect, the second preset range belongs to a subset of the zoom ratio range.

[0074] With reference to the third aspect, in some implementations of the third aspect, the first parameter is a parameter from the first camera.

[0075] With reference to the third aspect, in some implementations of the third aspect, the second parameter is a zoom ratio of the electronic device.

[0076] With reference to the third aspect, in some implementations of the third aspect, the one or more processors invoke the computer instructions to cause the electronic device to perform:

[0077] display the second image on a first display interface of the electronic device, the first icon including a first control, and the first display interface further including a first icon, the first icon being used to indicate a super macro mode.

[0078] With reference to the third aspect, in some implementations of the third aspect, the one or more processors invoke the computer instructions to cause the electronic device to perform:

[0079] detect a first operation on the first control;

[0080] in response to the first operation, the electronic device exits the super macro mode.

[0081] With reference to the third aspect, in some implementations of the third aspect, the first camera includes a wide-angle camera, and the second camera includes an ultra-wide-angle camera or a telephoto camera.

[0082] With reference to the third aspect, in some implementations of the third aspect, the electronic device is located at the same position when displaying the first image and when displaying the second image.

[0083] A fourth aspect provides an electronic device, including one or more processors, a memory; the memory is coupled to the one or more processors, the memory is configured to store computer program codes, the computer program codes include computer instructions, and the one or more processors are configured to invoke the computer instructions to enable the electronic device to execute the first aspect or any of the methods in the first aspect.

[0084] A fifth aspect provides a chip system applied to an electronic device, the chip system including one or more processors, and the processors are configured to invoke computer instructions to enable the electronic device to execute the first aspect or any of the methods in the first aspect.

[0085] A sixth aspect provides a computer readable storage medium, the computer readable storage medium storing computer program codes, and when the computer program codes are run by an electronic device, the electronic device is enabled to execute the first aspect or any of the methods in the first aspect.

[0086] A seventh aspect provides a computer program product, the computer program product including computer program codes, and when the computer program codes are run by an electronic device, the electronic device is enabled to execute the first aspect or any of the methods in the first aspect.

[0087] In the embodiments of the present application, since the laser sensor can not be included in the electronic device, the distance information between the electronic device and the shooting object cannot be obtained through the laser sensor; the distance information between the electronic device and the shooting object can be obtained by obtaining the first parameter (for example, the code value) of the camera module in the electronic device; whether to switch the camera of the electronic device can be determined based on the distance information between the electronic device and the shooting object; for example, if the distance between the electronic device and the shooting object is close, the electronic device can take the ultra-wide-angle camera as the main camera. In addition, in the embodiments of the present application, the second parameter of the electronic device can be obtained, and it is determined that the second parameter satisfies the first preset condition; when the first parameter and the second parameter satisfy the first preset condition, the problem of picture jumping during the camera switching process of the electronic device can be avoided; therefore, through the embodiments of the present application, the electronic device can realize the automatic switching of different cameras without relying on the laser sensor; and during the switching process of different cameras, the stability of the display picture can be ensured, that is, the display picture is smooth and smooth. BRIEF DESCRIPTION OF DRAWINGS

[0088] Figure 1 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0089] Figure 2 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0090] Figure 3 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0091] Figure 4 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0092] Figure 5 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0093] Figure 6 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0094] Figure 7 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0095] Figure 8 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0096] Figure 9 FIG. 1 is a schematic diagram of a hardware system suitable for the electronic device of the present application;

[0097] Figure 10 is a schematic view of another graphical user interface provided by an embodiment of the present application;

[0098] Figure 11 is a schematic view of another graphical user interface provided by an embodiment of the present application;

[0099] Figure 12 is a schematic view of another graphical user interface provided by an embodiment of the present application;

[0100] Figure 13 is a schematic view of an application scenario provided by an embodiment of the present application;

[0101] Figure 14 is a side view of an application scenario provided by an embodiment of the present application;

[0102] Figure 15 is a schematic flowchart of another method for switching camera provided by an embodiment of the present application;

[0103] Figure 16 is a schematic view of a preview interface of a camera application provided by an embodiment of the present application;

[0104] Figure 17 is a schematic view of a preview interface of a camera application provided by an embodiment of the present application;

[0105] Figure 18 is a schematic view of a structure of an electronic device provided by an embodiment of the present application;

[0106] Figure 19 is a schematic view of a structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

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

[0108] In order to facilitate the understanding of the embodiments of the present application, first, the related concepts involved in the embodiments of the present application are briefly described.

[0109] 1、Field of view (FOV)

[0110] The field of view angle is also referred to as field of view in optical engineering, and the size of the field of view angle determines the field of view range of the optical instrument; the field of view angle of the electronic device is used to indicate the maximum angle that the camera can shoot in the process of shooting the shooting object.

[0111] It should be understood that the field of view angle can also be referred to as "field of view range", "field of view range", "field of view area", etc.

[0112] 2, distance parameter

[0113] The distance parameter can be used to represent the distance information between the lens and the sensor in the electronic device; for example, the larger the distance parameter, the greater the distance between the lens and the sensor, that is, it can represent that the distance between the electronic device and the shooting object is closer; the smaller the distance parameter, the smaller the distance between the lens and the sensor, that is, it can represent that the distance between the electronic device and the shooting object is farther. It should be understood that the distance parameter can be referred to as "code value"; alternatively, the distance parameter can also be referred to as lens position.

[0114] 3, zoom

[0115] The zoom is used to represent the zoom size of the electronic device when shooting.

[0116] 4, main camera and auxiliary camera

[0117] The electronic device can include multiple cameras; for example, the multiple cameras can include a main camera and an auxiliary camera; when the electronic device collects an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera; during processing, part of the image information collected by the auxiliary camera can be extracted to compensate for the image collected by the main camera, so as to realize the fusion of the images collected by the two cameras, and after processing, the displayed image is obtained, so as to improve the shooting quality, background blurring, optical zoom and other functions.

[0118] Exemplarily, if the electronic device collects an image in a single camera mode, that is, the electronic device starts one camera to collect an image, and the camera is the main camera.

[0119] Exemplarily, if the electronic device is in a dual-camera mode when collecting an image, i.e., the electronic device opens two cameras to collect an image; one of the cameras is a main camera, and the other is an auxiliary camera; when collecting the image, the image collected by the main camera is usually taken as a reference, and the image collected by the main camera is processed; during the processing, part of the image information collected by the auxiliary camera can be extracted to compensate for the image collected by the main camera, so as to realize the fusion of the images collected by the two cameras, and obtain the displayed image after processing, so as to improve the shooting quality, background blurring, optical zoom, and the like.

[0120] In one example, the dual cameras in the electronic device can be a wide-angle camera and a long-focus camera; the wide-angle camera can be taken as a main camera, and the long-focus camera can be taken as an auxiliary camera; the image collected by the wide-angle camera is taken as a reference, and during the processing of the image collected by the wide-angle camera, the image information of a distant shooting object collected by the long-focus camera can be extracted to realize the fusion of the images collected by the wide-angle camera and the long-focus camera, and the long-focus camera can supplement the detailed information of the distant shooting object; and the displayed image is obtained after processing, so that the electronic device has a longer optical zoom when shooting.

[0121] Exemplarily, the dual-camera mode in the electronic device can also include a wide-angle camera and a super-wide-angle camera, a color camera and a black-and-white camera, a color camera and a depth camera, and the like.

[0122] Exemplarily, if the electronic device is in a multi-camera mode when collecting an image, for example, the electronic device is in a triple-camera mode when collecting an image, then three cameras can be opened when the electronic device collects an image; the three cameras include one main camera and two auxiliary cameras; when collecting the image, the image collected by the main camera is usually taken as a reference, and the image collected by the main camera is processed; during the processing, part of the image information collected by the two auxiliary cameras can be extracted to compensate for the image collected by the main camera, so as to realize the fusion of the images collected by the three cameras, and obtain the displayed image after processing, so as to improve the shooting quality, background blurring, optical zoom, and the like.

[0123] For example, the multi-camera mode in the electronic device can include a wide-angle camera, a black-and-white camera, and a near-infrared camera; the wide-angle camera can be a main camera, and the black-and-white camera and the near-infrared camera can be auxiliary cameras; the main image frame can be obtained through the wide-angle camera, the detailed information of the image of the dark area of the shooting object can be supplemented through the black-and-white camera, and the detailed information of the distant view of the shooting object can be supplemented through the near-infrared camera.

[0124] It should be understood that the above are examples illustrating the single-camera mode, dual-camera mode, and multi-camera mode of electronic devices; this application does not limit the type of camera in the single-camera mode, dual-camera mode, or multi-camera mode.

[0125] 5. Super Macro Mode

[0126] Super Macro mode refers to a shooting mode in which the electronic device automatically switches to the ultra-wide-angle camera as the main camera when the zoom level is between 1x (1×) and 2x (2×).

[0127] For example, in a shooting scenario where the electronic device is shooting from far to near; for instance, if the position of the electronic device remains unchanged, the zoom center of the electronic device at the first moment is the first shooting object; and at the second moment the zoom center of the electronic device is the second shooting object, with the first shooting object being farther away from the electronic device and the second shooting object being closer to the electronic device; then when the electronic device is shooting the second shooting object, the electronic device can automatically use the ultra-wide-angle camera as the main camera and enter the super macro mode to increase the field of view when the electronic device is shooting.

[0128] Alternatively, "in a close-up shooting scenario" can also refer to an electronic device shooting the same subject, where the electronic device moves and the distance between the electronic device and the subject gradually decreases.

[0129] For example, such as Figure 5 As shown in (a), the same shooting scene includes a first shooting object 260 and a second shooting object 270. The distance between the first shooting object and the electronic device is d1, and the distance between the second shooting object and the electronic device is d2, where d2 is less than d1. Figure 6 This is a side view of the shooting scene. During the shooting process, the electronic device remains in a fixed position; the electronic device activates the camera application, and at the first moment, the electronic device focuses on the first subject 260. The electronic device can display the display interface 280; at this time, the zoom ratio of the electronic device is 1× (which can be understood as any value between 1× and 2×, or other values, not limited in this embodiment); Figure 5 As shown in (b) in the second moment, the electronic device maintains 1× (which can be understood as any value between 1× and 2×, or other values, which are not limited in this application embodiment) and changes the shooting object; for example, the electronic device focuses on the second shooting object 270. At this time, the electronic device recognizes that the distance between the second shooting object 270 and the electronic device is relatively close, and the electronic device can enter the super macro mode and automatically switch to the ultra-wide-angle camera as the main camera for focusing, and display the display interface 290.

[0130] It should be understood that the super macro shooting mode of electronic devices cannot be entered by the user; this shooting mode is usually automatically switched into by the electronic device.

[0131] 6. Super Long View Mode

[0132] Super Long View mode refers to a shooting mode in which electronic devices automatically use the telephoto camera as the main camera to capture images.

[0133] For example, in a shooting scenario where the electronic device is shooting from near to far; for instance, with the electronic device's position remaining unchanged, at the first moment the zoom center of the electronic device is the first shooting object; at the second moment the zoom center of the electronic device is the third shooting object, the first shooting object is closer to the electronic device, and the third shooting object is closer to the electronic device; when the electronic device is shooting the third shooting object, the electronic device can automatically use the telephoto camera as the main camera and enter the super long-range mode to increase the detail information of the distant shooting object.

[0134] For example, such as Figure 13 As shown in (a), the same shooting scene includes a first shooting object 260 and a third shooting object 281. The distance between the first shooting object and the electronic device 100 is d3, and the distance between the third shooting object and the electronic device 100 is d4. d3 is less than d4. Figure 14 This is a side view of the shooting scene. The electronic device 100 includes a camera module 272. During shooting, the electronic device 100 remains in a fixed position. The electronic device 100 activates the camera application and focuses on the first subject 260 at the first moment. The electronic device 100 can display the display interface 282. At this time, the zoom ratio of the electronic device 100 is a single zoom ratio. Figure 13 As shown in (b), at the second moment, the electronic device 100 changes the subject of the shot; for example, the electronic device 100 focuses on the third subject 281. At this time, the electronic device 100 recognizes that the distance between the third subject 281 and the electronic device 100 is far. The electronic device 100 can enter the super telephoto mode, that is, the electronic device 100 can automatically switch to the super telephoto camera as the main camera for focusing and display the display interface 291.

[0135] 7. Timer

[0136] A timer is a device that uses specific principles to measure time.

[0137] The method and electronic device for switching cameras in the embodiments of this application will now be described with reference to the accompanying drawings.

[0138] Figure 1A hardware system suitable for use with the application is shown.

[0139] The electronic device 100 can be a mobile phone, a smart television, a tablet computer, a wearable electronic device, a vehicle-mounted electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, and the like. The embodiments of the present application do not make any limitation on the specific type of the electronic device 100.

[0140] The electronic device 100 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 headset interface 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.

[0141] It should be noted that, Figure 1 The structures shown do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 1 The structures shown do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 1 The structures shown do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 1 The structures shown do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than those shown, or the electronic device 100 can include a combination of some of the components shown, or the electronic device 100 can include sub-components of some of the components shown. Figure 1 The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0142] The processor 110 can include one or more processing units. For example, the processor 110 can include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, a neural-network processing unit (NPU). Among them, different processing units can be independent devices or integrated devices. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.

[0143] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can save instructions or data that the processor 110 has just used or repeatedly uses. If the processor 110 needs to use the instructions or data again, it can directly call from the memory. Avoiding repeated access reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0144] Exemplarily, the processor 110 can be configured to execute the method for switching cameras according to the embodiments of the present application; for example, starting a camera application; displaying a first image, the first image being obtained by collecting images by a first camera as a main camera; determining that a first parameter and a second parameter meet a first preset condition, the first parameter being used to indicate distance information between the electronic device and a target object, the first parameter being a parameter from the camera module, the target object being a photographed object in the first image, the second parameter being used to indicate a zoom ratio of the electronic device; displaying a second image, the second image being obtained by collecting images by a second camera as a main camera.

[0145] Figure 1 The connection relationship between the modules shown is only illustrative and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Alternatively, the modules of the electronic device 100 can also adopt a combination of the above-mentioned various connection modes.

[0146] The wireless communication function of the electronic device 100 can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.

[0147] Antenna 1 and antenna 2 are used for transmitting and receiving electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization of antennas. For example: antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, antennas can be used in combination with a tuning switch.

[0148] Electronic device 100 can realize display functions through GPU, display screen 194 and application processor. GPU is a microprocessor for image processing, connected to display screen 194 and application processor. GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 can include one or more GPUs that execute program instructions to generate or change display information.

[0149] Display screen 194 can be used to display images or videos.

[0150] Exemplarily, in the embodiments of the present application, display screen 194 can be used to display a second image.

[0151] Electronic device 100 can realize a shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor, etc.

[0152] ISP is used to process data fed back by camera 193. For example, when taking a photo, the shutter is opened, light passes through the camera and is transmitted to the camera photosensitive element, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing to convert it into an image visible to the naked eye. ISP can optimize the noise, brightness and color of the image through algorithms, and ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, ISP can be provided in camera 193.

[0153] The camera 193 (also known as a lens) is used to capture still images or videos. It can be activated via application commands to enable photo-taking, such as capturing images of any scene. The camera may include components such as an imaging lens, filters, and an image sensor. Light emitted or reflected by an object enters the imaging lens, passes through the filter, and is finally focused onto the image sensor. The imaging lens is primarily used to focus and image the light emitted or reflected by all objects within the shooting field of view (also known as the scene to be captured, the target scene, or the scene image the user expects to capture). The filter is primarily used to filter out excess light waves (such as infrared light waves other than visible light). The image sensor can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The image sensor is primarily used to perform photoelectric conversion on the received light signal, converting it 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 standard RGB, YUV, and other image signal formats.

[0154] In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0155] The camera 193 can be located in front of the electronic device 100 or on the back of the electronic device 100. The specific number and arrangement of the cameras can be set according to the requirements, and this application does not impose any restrictions.

[0156] For example, the electronic device 100 includes a front-facing camera and a rear-facing camera. For instance, either the front-facing camera or the rear-facing camera may include one or more cameras. Taking an electronic device 100 having four rear-facing cameras as an example, when the electronic device 100 activates all four rear-facing cameras for shooting, the camera switching method provided in this application embodiment can be used.

[0157] Alternatively, the camera can be mounted on an external accessory of the electronic device 100, which is rotatably connected to the frame of the phone. The angle formed between the external accessory and the display screen 194 of the electronic device 100 can be any angle between 0 and 360 degrees. For example, when the electronic device 100 takes a selfie, the external accessory rotates the camera to face the user. Of course, when the phone has multiple cameras, only some cameras can be mounted on the external accessory, while the remaining cameras are mounted on the main body of the electronic device 100. This application embodiment does not impose any restrictions on this.

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

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

[0160] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, the y-axis, and the z-axis) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the electronic device 100 shaking, and calculates the distance that the lens module needs to compensate according to the angle, so that the lens offsets the shaking of the electronic device 100 through reverse motion, achieving anti-shake. The gyroscope sensor 180B can also be used in scenarios such as navigation and motion sensing games.

[0161] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally the x-axis, the y-axis, and the z-axis). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100, as an input parameter for horizontal-vertical screen switching and pedometer applications.

[0162] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance by infrared or laser. In some embodiments, for example in a shooting scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.

[0163] The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed brightness of the ambient light. The ambient light sensor 180L can also be used to automatically adjust the white balance when shooting. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touch.

[0164] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize functions such as unlocking, accessing application locks, taking photos, and answering incoming calls.

[0165] Touch sensor 180K, also known as a touch device, can be disposed on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a touch screen. Touch sensor 180K is used to detect touch operations applied to or near it. Touch sensor 180K can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 194. In other embodiments, touch sensor 180K may also be disposed on the surface of electronic device 100, and in a different location from display screen 194.

[0166] The hardware system of electronic device 100 has been described in detail above. The software system of electronic device 100 will be introduced below.

[0167] Figure 2 This is a schematic diagram of the software system of the electronic device provided in the embodiments of this application.

[0168] like Figure 2 As shown, the system architecture may include an application layer 210, an application framework layer 220, a hardware abstraction layer 230, a driver layer 240, and a hardware layer 250.

[0169] Application layer 210 may include applications such as camera application, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0170] The application framework layer 220 provides application programming interfaces (APIs) and programming frameworks for applications in the application layer; the application framework layer may include some predefined functions.

[0171] For example, the application framework layer 220 may include a camera access interface; the camera access interface may include camera management and camera devices. Specifically, camera management can be used to provide an access interface for managing cameras; camera devices can be used to provide an interface for accessing cameras.

[0172] The hardware abstraction layer 230 is used to abstract hardware. For example, the hardware abstraction layer can encompass the camera abstraction layer and other hardware device abstraction layers; the camera hardware abstraction layer can call camera algorithms.

[0173] For example, the hardware abstraction layer 230 includes a camera hardware abstraction layer and a camera algorithm; the camera algorithm may include software algorithms for image processing.

[0174] For example, the camera algorithm library may include the algorithm corresponding to the camera switching method provided in the embodiments of this application.

[0175] Exemplarily, the algorithms in the camera algorithms can refer to not depending on specific hardware implementation; for example, code that can usually run in a CPU, etc.

[0176] The driver layer 240 is configured to provide drivers for different hardware devices. For example, the driver layer can include a camera driver.

[0177] The hardware layer 250 is located at the bottom of the operating system; as Figure 2 shown, the hardware layer 250 can include camera 1, camera 2, camera 3, etc. Among them, camera 1, camera 2, camera 3 can correspond to multiple cameras on the electronic device.

[0178] For ease of understanding, the following takes the electronic device 100 as a mobile phone with the above-mentioned software and hardware structure as an example, and first describes the cameras and interfaces on the electronic device 100 to which the switching camera method provided by the embodiments of the present application is applicable in detail.

[0179] The electronic device to which the switching camera method provided by the embodiments of the present application is applicable has at least multiple cameras 193, for example, has three kinds of cameras 193; the three kinds of cameras are respectively a main camera (for example, a wide-angle camera), an ultra-wide-angle camera and a long-focus camera; the three kinds of cameras can be used to shoot the same scene to be shot.

[0180] Optionally, the electronic device 100 can also have other cameras 193, and the number of types of cameras 193 and the number of each type of camera 193 can be set as needed, which is not limited by the embodiments of the present application.

[0181] Exemplarily, as Figure 3 shown, the electronic device 100 can have three cameras 193 as an example; the arrangement mode of the three cameras can be as shown in (a) of Figure 3 , or as shown in (b) of Figure 3 ; for example, the three cameras 193 can be a main camera 1931 (for example, a wide-angle camera), an ultra-wide-angle camera 1932 and a long-focus camera 1933.

[0182] It should be understood that the above is only an example of two arrangement modes, and other arrangement modes can also be used; the specific arrangement mode can be designed and changed as needed, which is not limited by the embodiments of the present application.

[0183] It should be noted that, when the three cameras are shooting, the field of view angle range corresponding to the main camera 1931 is usually greater than the field of view angle range corresponding to the telephoto camera 1933; the field of view angle range corresponding to the ultra-wide-angle camera 1932 is greater than the field of view angle range corresponding to the main camera 1931; there can be an overlap between the field of view angle of the ultra-wide-angle camera 1932 and the field of view angle of the main camera 1931; that is, the ultra-wide-angle camera 1932 can shoot the scene content and the scene content around it that the main camera 1931 shoots.

[0184] It should be understood that the field of view angle range corresponding to the telephoto camera 1933 is smaller than the field of view angle range corresponding to the main camera 1931, and there can be an overlap between the field of view angle of the main camera 1931 and the field of view angle of the telephoto camera 1933; that is, the main camera 1931 can shoot the scene content and the scene content around it that the telephoto camera 1933 shoots. There can be an overlap between the field of view angle of the ultra-wide-angle camera 1932 and the field of view angle of the telephoto camera 1933; that is, the ultra-wide-angle camera 1932 can shoot the scene content and the scene content around it that the telephoto camera 1933 shoots.

[0185] Among them, the ultra-wide-angle camera 1932 is suitable for shooting close-up scenes because of its small focusing distance; and as its name implies, the ultra-wide-angle camera 1932 is suitable for shooting scenes with a large field of view angle; the main camera 1931 is more suitable for shooting portraits because of its high definition, and the telephoto camera 1933 is more suitable for shooting close-up scenes.

[0186] Exemplarily, as shown in Figure 4 , the zoom ratio of the ultra-wide-angle camera can be less than M times the zoom ratio; the zoom ratio of the wide-angle camera, that is, the main camera, can be in the range of [M, N); and the zoom ratio of the telephoto camera can be greater than or equal to N times the zoom ratio.

[0187] For example, M can be 1 and N can be 3.5; the zoom ratio of the ultra-wide-angle camera is less than 1 times the zoom ratio (1x); the zoom ratio of the wide-angle camera is in the range of 1 times the zoom ratio to 3.5 times the zoom ratio [1x~3.5x); and the zoom ratio of the telephoto camera is greater than or equal to 3.5 times the zoom ratio.

[0188] It should be understood that, in the process of shooting by the electronic device, the greater the zoom ratio, the smaller the corresponding field of view angle.

[0189] Currently, an electronic device usually determines distance information between the electronic device and a shooting object based on a laser sensor in the electronic device; different cameras in the electronic device can be automatically switched through the distance information between the electronic device and the shooting object; for example, when the electronic device enters a camera application, a camera used for shooting can be a wide-angle camera by default; when the laser sensor in the electronic device detects that the distance between the electronic device and the shooting object is close, the electronic device can switch the camera from the wide-angle camera to the ultra-wide-angle camera, so as to collect a clear image; however, the current camera switching method depends on the laser sensor in the electronic device; if the electronic device does not include the laser sensor, the automatic switching between different cameras in the electronic device cannot be realized.

[0190] Therefore, the embodiment of the present application provides a method for switching cameras, without depending on the laser sensor of the electronic device, the electronic device can acquire a first parameter (for example, a code value) and a second parameter; when the first parameter and the second parameter meet a first preset condition, the electronic device can automatically switch different cameras, thereby improving the shooting experience and image quality of the user; for example, in a close-range shooting scene, the electronic device can automatically switch to an ultra-wide-angle camera as a main camera, so that the field of view of the electronic device becomes larger; because the field of view of the electronic device becomes larger, the image information of the shooting object collected by the electronic device increases, thereby improving the clarity of the image; for a long-distance shooting scene, the electronic device can automatically switch to a long-focus camera as a main camera, so that the electronic device can obtain more image detail information.

[0191] The application scenarios of the method for switching cameras provided by the embodiment of the present application will be described below. Figure 5 The application scenarios of the method for switching cameras provided by the embodiment of the present application will be described below.

[0192] The method for switching cameras in the embodiment of the present application can be applied to a shooting scene (for example, single-scene shooting, double-scene shooting, etc.), a preview scene, a video recording scene, or a video call scene, etc.; through the method for switching cameras in the embodiment of the present application, the automatic switching between different cameras in the electronic device can be realized based on the acquired lens position and zoom value without depending on the laser sensor in the electronic device, thereby improving the shooting experience and image quality of the user.

[0193] Exemplarily, the preview scene includes but is not limited to the following scenes:

[0194] Shooting preview, aperture preview, night scene preview, portrait preview, video recording preview, or professional preview, etc.

[0195] It should be understood that the preview scene can refer to a scene in which the electronic device collects an image before a button indicating shooting is clicked in a certain shooting mode.

[0196] In one example, after the electronic device enters the camera application, the default photographing camera mode can be started; in the photographing camera mode, the electronic device can enter the default photographing mode, which can refer to a photographing mode in which the wide-angle camera is used as the main camera and the zoom ratio is single zoom ratio (1x); the default photographing mode is a non-super macro mode, in which the distance parameter (for example, the code value) and the zoom ratio (for example, the zoom value) of the electronic device can be obtained, and in the case that the distance parameter meets the first preset threshold and the zoom ratio meets the second preset range, the electronic device can switch to the ultra-wide-angle camera to capture images.

[0197] Exemplarily, the method for switching cameras in the embodiments of the present application can also be applied to a video call scenario, which can include but is not limited to the following scenarios:

[0198] video call, video conference application, long and short video application, video live broadcast application, video online course application, portrait intelligent lens operation application scenario, system camera video recording function to record video, video monitoring, or intelligent cat eye and other portrait shooting scenarios.

[0199] It should be understood that the above is an example of the application scenario, and does not limit the application scenario of the present application in any way.

[0200] In one example, as shown in (a) of FIG. 2, the same shooting scene includes a first shooting object 260 and a second shooting object 270, the distance between the first shooting object 260 and the electronic device 100 is d1, and the distance between the second shooting object and the electronic device is d2, d2 is less than d1; Figure 5 is a side view of the shooting scene, the electronic device 100 includes a camera module 272; during the shooting process, the electronic device 100 keeps the position unchanged; the electronic device 100 starts the camera application, and at the first time, the electronic device 100 focuses on the first shooting object 260, and the electronic device 100 can display a display interface 280; at this time, the zoom ratio of the electronic device 100 is single zoom ratio; as shown in (b) of FIG. 2, at the second time, the electronic device 100 keeps the single zoom ratio and changes the shooting subject; for example, the electronic device 100 focuses on the second shooting object 270, and at this time, the electronic device 100 identifies that the distance between the second shooting object 270 and the electronic device 100 is close, and the electronic device 100 can enter the super macro mode and automatically switch to the ultra-wide-angle camera as the main camera to focus, and display a display interface 290. Figure 6 Figure 5

[0201] ​​It should be noted that, assuming that at the first moment, when the electronic device 100 focuses on the first subject 260, the wide-angle camera in the electronic device 100 acts as the main camera; and if at the second moment, the electronic device 100 does not activate the super macro mode, that is, when the electronic device 100 focuses on the second subject 270, the wide-angle camera still acts as the main camera, then the display interface of the electronic device 100 will look like this. Figure 10 As shown in (b) of the figure; because the distance between the second subject 270 and the electronic device 100 is relatively close, the position of the second subject 270 may be outside the effective focusing range of the wide-angle camera, resulting in low clarity of the captured preview image; through the camera switching method provided in this application embodiment, when the electronic device 100 detects that the distance to the second subject 270 is relatively close, the electronic device 100 can automatically enter the super macro mode, that is, the electronic device can automatically use the ultra-wide-angle camera as the main camera without user operation, and display as shown in the figure. Figure 5 The display interface 290 is shown in (b) of the diagram.

[0202] The camera switching method provided in this application embodiment allows the electronic device to automatically switch the main camera image (e.g., from a wide-angle camera as the main camera to an ultra-wide-angle camera as the main camera) without relying on the laser sensor in the electronic device, thereby increasing the field of view of the electronic device. As the field of view of the electronic device increases, the image information of the subject captured by the electronic device increases, thereby improving the image clarity.

[0203] The following is combined Figures 7 to 17 The method for switching cameras provided in the embodiments of this application will be described in detail.

[0204] Figure 7 This is a schematic flowchart of a camera switching method provided in an embodiment of this application. The method can be... Figure 1 The electronic device shown executes the method 300, which includes steps S310 to S340. Steps S310 to S340 are described in detail below.

[0205] It should be understood that in the embodiments of this application, the electronic device includes a camera module, which includes a first camera and a second camera; wherein the first camera and the second camera are cameras of different types.

[0206] Step S310: Launch the camera application.

[0207] For example, a user can instruct an electronic device to launch the camera application by clicking the icon of the "Camera" application; for example, Figure 9 As shown in (a) in the text, or,Figure 10 As shown in (a) in the text; or, Figure 11 As shown in (a) in the figure.

[0208] For example, when an electronic device is locked, a user can instruct the device to launch the camera application by swiping right on the screen. Alternatively, if the device is locked and the lock screen includes a camera application icon, the user can instruct the device to launch the camera application by tapping the icon. Or, if the device is running another application with permission to access the camera application, the user can instruct the device to launch the camera application by tapping the corresponding control. For instance, if the device is running an instant messaging application, the user can instruct the device to launch the camera application by selecting a control that enables camera functionality.

[0209] It should be understood that the above is an example of how to open a camera application; the camera application can also be opened by voice commands or other methods; this application does not limit this in any way.

[0210] It should also be understood that launching the camera application can mean running the camera application.

[0211] Step S320: Display the first image.

[0212] The first image is obtained by the first camera as the main camera.

[0213] It should be understood that electronic devices may include multiple cameras; for example, multiple cameras may include a main camera and an auxiliary camera; when an electronic device captures images, the image captured by the main camera is usually used as a reference and processed; during the processing, some image information captured by the auxiliary camera can be extracted to compensate for the image captured by the main camera, thereby achieving the fusion of the images captured by the two cameras and obtaining the displayed image after processing, so as to improve shooting quality, background blur, optical zoom and other functions.

[0214] For example, the main camera can refer to the main camera when the electronic device is in single-camera mode, or the main camera when the electronic device is in dual-camera mode, or the main camera when the electronic device is in multi-camera mode.

[0215] It should be understood that this application does not limit the type of camera in the single-camera mode, dual-camera mode or multi-camera mode of electronic devices.

[0216] In one example, displaying the first image can be as follows: Figure 11The first image can be displayed as a preview image shown in (b) in FIG. 1A, or the first image can be displayed as a preview image shown in (b) in FIG. 1B. Figure 12 The first image can be displayed as a preview image shown in (b) in FIG. 1A, or the first image can be displayed as a preview image shown in (b) in FIG. 1B.

[0217] In step S330, it is determined that the first parameter and the second parameter satisfy a first preset condition.

[0218] The first parameter can be used to indicate distance information between the electronic device and the target object, the first parameter is a parameter from the camera module, and the target object is a photographed object in the first image, which can also be referred to as a photographed subject. The second parameter is used to indicate a zoom ratio of the electronic device.

[0219] For example, when the electronic device is photographing, the photographed scene can include a photographed subject area and a background area. The photographed subject in the photographed scene can be determined first. The photographed subject is the photographed object in the photographed scene. The photographed subject can be determined by using the prior art or by being clicked on the screen by the user. The present application is not limited in this regard. The distance between the electronic device and the photographed object can refer to the distance between the electronic device and the focus point of the photographed object after the electronic device completes focusing.

[0220] Optionally, the first parameter can be a parameter of the camera module.

[0221] For example, the first parameter can be a distance parameter of the camera module. For example, the first parameter can be a distance parameter of the first camera.

[0222] It should be understood that the distance parameter can be used to represent the distance information between the lens and the sensor in the electronic device. For example, the larger the distance parameter, the greater the distance between the lens and the sensor, i.e., the closer the distance between the electronic device and the photographed object. The smaller the distance parameter, the smaller the distance between the lens and the sensor, i.e., the farther the distance between the electronic device and the photographed object. It should be understood that the distance parameter can be referred to as a "code value". Alternatively, the distance parameter can also be referred to as a lens position.

[0223] Optionally, the first parameter can also be a distance parameter of the second camera.

[0224] For example, in an embodiment of the present application, the code value can represent the current size. The current size can reflect the magnetic field size, so as to determine the distance parameter between the electronic device and the photographed object. That is, by obtaining the current size of the camera module, the current value can be mapped to any one value between 0 and 1024, so as to represent the distance information between the electronic device and the photographed object.

[0225] Optionally, the second parameter can be a zoom ratio of the electronic device, i.e., a zoom value.

[0226] Exemplarily, the determining that the first parameter and the second parameter satisfy the first preset condition comprises:

[0227] The first parameter is greater than a first preset threshold, and the second parameter satisfies a second preset range, wherein the first preset threshold is used to indicate distance information between the camera module and a sensor in the electronic device, and the second preset range is used to indicate a zoom range of the camera module.

[0228] Exemplarily, assuming that the first preset threshold is 0.15 mA, and the second preset range is 1x-2x; if the obtained first parameter is 0.2 mA, and the obtained second parameter is 1.2x, it indicates that the first parameter and the second parameter satisfy the first preset condition.

[0229] Exemplarily, the second preset range is determined based on a zoom ratio corresponding to the first camera.

[0230] For example, as shown in Figure 4 The second preset range can be determined based on a zoom ratio M corresponding to the wide-angle camera and a zoom ratio N; the range corresponding to the second preset range can be located between [M, N).

[0231] In one example, the main camera is a wide-angle camera, and if the zoom ratio corresponding to the wide-angle camera is 1x to 3.5x, the second preset range can refer to 1x-2x.

[0232] In one example, the main camera is a wide-angle camera, and if the zoom ratio corresponding to the wide-angle camera is 0.8x to 3.5x, the second preset range can refer to 0.8x-1.5x.

[0233] Optionally, the specific implementation steps can refer to steps S404 to S406 shown in the following Figure 8

[0234] In the embodiments of the present application, since the electronic device can not include a laser sensor, the electronic device cannot obtain the distance information between the electronic device and the shooting object through the laser sensor; therefore, the distance parameter of the camera module can be obtained to determine the distance information between the electronic device and the shooting object; and the automatic switching of different types of cameras in the electronic device is realized based on the distance information, thereby meeting the shooting needs of the user and improving the shooting experience of the user.

[0235] ​In addition, the second parameter is acquired to avoid a problem of display picture jumping in the process of switching the camera of the electronic device; therefore, in a case where the first parameter and the second parameter satisfy the first preset condition, it can be ensured that the displayed picture is still smooth and fluent in the process of switching the camera.

[0236] Optionally, a first distance range of the first camera is acquired, the first distance range being used to represent an effective distance range in which the first camera focuses; and the first preset threshold is obtained based on the first distance range.

[0237] It should be understood that the effective distance range in which the first camera focuses can mean that the first camera can accurately focus within the effective distance range; if greater than or less than the effective distance range, the electronic device can not accurately focus, so that the clarity of the image collected by the first camera is reduced.

[0238] Exemplarily, the first distance range of the first camera is greater than 10 cm, that is, when the distance between the electronic device and the shooting object is greater than 10 cm, the first camera can accurately focus on the shooting object.

[0239] In the embodiments of the present application, the first preset threshold can be determined based on the effective distance range in which the first camera can accurately focus, so that when the electronic device identifies that the distance between the electronic device and the shooting object is close or far, the electronic device can automatically switch to the second camera as the main camera, thereby ensuring the image quality of the collected image.

[0240] Optionally, a starting point of the first distance range is a first value, and the first preset threshold is greater than or equal to the first value.

[0241] For example, the first distance range is greater than 10 cm, that is, the starting point of the first distance range is 10 cm; and the first preset threshold can be greater than or equal to 10 cm.

[0242] Optionally, a zoom range of the first camera is acquired; and the second preset range is obtained based on the zoom range.

[0243] In the embodiments of the present application, the second preset range can be determined based on the zoom range of the first camera, thereby ensuring the smoothness of the collected image and avoiding the problem of image jumping.

[0244] Optionally, the second preset range belongs to a subset of the zoom range.

[0245] For example, if the zoom range of the first camera is [1, 3.5), then the second preset range can be a subset of [1, 3.5); for example, the second preset range can be [1, 2); or, the second preset range can be [1, 2.5), etc.

[0246] Optionally, before determining that the first parameter and the second parameter satisfy the first preset condition, the method further includes:

[0247] Obtain the current shooting mode of the electronic device;

[0248] Acquire the first and second parameters when the shooting mode is not Super Macro mode.

[0249] It should be understood that Super Macro mode refers to a shooting mode in which the electronic device automatically switches to the ultra-wide-angle camera as the main camera when the zoom level is between 1x (1×) and 2x (2×).

[0250] For example, in scenarios where electronic devices are shooting at close range, the distance between the electronic device and the subject is relatively short; through the embodiments of this application, the electronic device can automatically use the ultra-wide-angle camera as the main camera and enter the super macro mode to increase the field of view when the electronic device is shooting.

[0251] like Figure 5 As shown in (a), the same shooting scene includes a first shooting object 260 and a second shooting object 270. The distance between the first shooting object and the electronic device is d1, and the distance between the second shooting object and the electronic device is d2, where d2 is less than d1. Figure 6 This is a side view of the shooting scene. During the shooting process, the electronic device remains in a fixed position; the electronic device activates the camera application, and at the first moment, it focuses on the first subject 260. The electronic device can display the display interface 280; at this time, the zoom ratio of the electronic device is a single zoom ratio; such as Figure 5 As shown in (b), at the second moment, the electronic device maintains a single zoom magnification and changes the subject being photographed; for example, the electronic device focuses on the second subject 270. At this time, the electronic device recognizes that the distance between the second subject 270 and the electronic device is relatively close, and the electronic device can enter the super macro mode and automatically switch to the ultra-wide-angle camera as the main camera for focusing, and display the display interface 290.

[0252] It should be understood that the super macro shooting mode of electronic devices cannot be entered by the user; this shooting mode is usually automatically switched into by the electronic device.

[0253] Step S340: Display the second image.

[0254] The second image is an image collected by the second camera as a main camera.

[0255] It should be understood that multiple cameras can be included in the electronic device; for example, the multiple cameras can include a main camera and an auxiliary camera. When the electronic device collects an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera. During the processing, part of the image information collected by the auxiliary camera can be extracted to compensate for the image collected by the main camera, to realize fusion of the images collected by the two cameras, and to obtain a displayed image after processing, to achieve functions such as improving the shooting quality, background blurring, and optical zoom.

[0256] For example, if the electronic device collects an image in a single-camera mode, that is, the electronic device starts one camera to collect an image, the camera is a main camera.

[0257] For example, if the electronic device collects an image in a dual-camera mode, that is, the electronic device starts two cameras to collect an image; one camera is a main camera, and the other camera is an auxiliary camera. When collecting an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera. During the processing, part of the image information collected by the auxiliary camera can be extracted to compensate for the image collected by the main camera, to realize fusion of the images collected by the two cameras, and to obtain a displayed image after processing, to achieve functions such as improving the shooting quality, background blurring, and optical zoom.

[0258] For example, if the electronic device collects an image in a multi-camera mode, for example, in a triple-camera mode, the electronic device can start three cameras to collect an image. The three cameras include a main camera and two auxiliary cameras. When collecting an image, the image collected by the main camera is usually taken as a reference to process the image collected by the main camera. During the processing, part of the image information collected by the two auxiliary cameras can be extracted to compensate for the image collected by the main camera, to realize fusion of the images collected by the three cameras, and to obtain a displayed image after processing, to achieve functions such as improving the shooting quality, background blurring, and optical zoom.

[0259] Optionally, when the electronic device displays the first image and the second image, the electronic device is located at the same position.

[0260] In the embodiments of the present application, the position of the electronic device during the shooting process can remain unchanged, the focusing object of the electronic device can be moved from a long shot shooting object to a close shot shooting object, the electronic device can automatically identify the distance between the electronic device and the shooting object, and automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the collected image.

[0261] In a possible implementation, the position of the electronic device when the electronic device displays the first image and displays the second image can also be different; for example, for the same shooting object, the electronic device is in a shooting process from far to close or from close to far; the first image and the second image are displayed.

[0262] Optionally, after displaying the second image, the electronic device can update the shooting mode of the electronic device to a super macro mode.

[0263] Optionally, after displaying the second image, the method further includes:

[0264] The first parameter is less than a second preset threshold, and the second preset threshold can be obtained based on the first preset threshold;

[0265] The third image is an image collected by the first camera as the main camera.

[0266] For example, in a close distance shooting scenario of the electronic device, the electronic device can switch from using the first camera (for example, a wide-angle camera) as the main camera to using the second camera (for example, a super wide-angle camera) as the main camera; when the electronic device exits the close distance shooting scenario, the electronic device can also switch from using the second camera (for example, a super wide-angle camera) as the main camera to using the first camera (for example, a wide-angle camera) as the main camera based on the first parameter and the second parameter.

[0267] For example, in a long distance shooting scenario of the electronic device, the electronic device can switch from using the first camera (for example, a wide-angle camera) as the main camera to using the second camera (for example, a long-focus camera) as the main camera; when the electronic device exits the long distance shooting scenario, the electronic device can also switch from using the second camera (for example, a long-focus camera) as the main camera to using the first camera (for example, a wide-angle camera) as the main camera based on the first parameter and the second parameter.

[0268] In one example, the second preset threshold is greater than the first preset threshold; or, the second preset threshold is equal to the first preset threshold.

[0269] It should be understood that the above examples illustrate the switching between wide-angle and ultra-wide-angle cameras, as well as between wide-angle and telephoto cameras; this application does not limit the type of camera.

[0270] Optionally, a second image may be displayed on a first display interface of the electronic device. The first display interface also includes a first icon used to indicate the super macro mode. For example, the first icon may refer to... Figure 9 506 shown.

[0271] Optionally, the first icon may include a first control, and the electronic device detects a first operation on the first control; in response to the first operation, the electronic device may exit the target shooting mode.

[0272] For example, the first display interface may refer to, for instance, Figure 9 The first control in the display interface 505 shown in (d) can refer to the first icon 506 of the super macro mode; or, the first display interface can refer to, for example, the first control in the display interface 505 shown in (d). Figure 10 The first icon in the display interface 512 shown in (f) can refer to the icon 513 used for the super macro mode; or, the first display interface can refer to, for example, the icon 513 used for the super macro mode. Figure 11 The first control in the display interface 518 shown in (d) can be the icon 519 of the super macro mode; or, the first display interface can be such as Figure 12 The first control shown in (h) of the display interface 527 may refer to the icon 528 of the super macro mode.

[0273] For example, the first operation could refer to turning off the super macro mode; for instance, as... Figure 9 As shown in (d), the first icon can refer to icon 506, the first control can refer to the "×" in icon 506, and the first operation can refer to clicking the "×" in "Super Macro ×", so that the electronic device can turn off the Super Macro mode; optionally, after turning off the Super Macro mode, the electronic device can no longer push the Super Macro mode in the preview display interface.

[0274] In the embodiments of the present application, since the laser sensor is not included in the electronic device, the distance information between the electronic device and the shooting object cannot be obtained through the laser sensor; the distance information between the electronic device and the shooting object can be obtained by obtaining the distance parameter (for example, the code value) of the camera module in the electronic device; whether to switch the camera of the electronic device can be determined based on the distance information between the electronic device and the shooting object; for example, if the distance between the electronic device and the shooting object is close, the electronic device can take the ultra-wide-angle camera as the main camera. In addition, in the embodiments of the present application, the second parameter of the electronic device can be obtained, and it is determined that the second parameter satisfies the first preset condition; when the first parameter and the second parameter satisfy the first preset condition, the problem of picture jumping during the camera switching process of the electronic device can be avoided; therefore, through the embodiments of the present application, the electronic device can realize the automatic switching of different cameras without relying on the laser sensor; and during the switching process of different cameras, it can be ensured that the displayed picture is still smooth and smooth.

[0275] Figure 8 is a schematic flowchart of the method for switching the camera provided by the embodiments of the present application. The method can be executed by the electronic device shown in Figure 1 ; the method 400 includes steps S401 to S414, which will be described in detail below.

[0276] It should be understood that steps S401 to S414 are described by taking the switching between the wide-angle camera and the ultra-wide-angle camera as an example; steps S401 to S414 can also be applied to the switching between other types of cameras, and the type of camera is not limited in the present application.

[0277] Step S401, starting the camera application.

[0278] For example, the user can click the icon of the "camera" application to instruct the electronic device to start the camera application, as shown in (a) of FIG. 1, as shown in (a) of FIG. 2, as shown in (a) of FIG. 3, as shown in (a) of FIG. 4 or as shown in (a) of FIG. 5. Figure 9 Figure 10 Figure 11 Figure 12 ​​​Alternatively, when the electronic device is in the lock screen state, the user can indicate the electronic device to open the camera application by a gesture of swiping right on the display screen of the electronic device. Alternatively, when the electronic device is in the lock screen state, the lock screen interface includes an icon of the camera application, and the user indicates the electronic device to open the camera application by clicking the icon of the camera application. Alternatively, when the electronic device is running another application, the application has the permission to call the camera application, and the user indicates the electronic device to open the camera application by clicking a corresponding control. For example, when the electronic device is running an instant messaging application, the user can indicate the electronic device to open the camera application by selecting a control of the camera function.

[0279] It should be understood that the above is an example of the operation of opening the camera application, and the electronic device can be indicated to open the camera application by voice or other operations; the present application does not limit the indication of the electronic device to open the camera application.

[0280] In step S402, the shooting mode of the electronic device is obtained.

[0281] For example, the shooting mode of the electronic device is obtained, which means that the current shooting mode of the electronic device is obtained. The distance between the electronic device and the shooting object can be different, and the shooting mode of the electronic device can be different.

[0282] It should be understood that the shooting mode of the electronic device can include the information of the currently opened camera type and / or zoom ratio of the electronic device.

[0283] For example, as shown in (b) of FIG. 1, after the electronic device opens the camera application, the electronic device can enter the default camera mode, i.e., the photographing camera mode. In the photographing camera mode, the default shooting mode of the electronic device can be that the single zoom ratio and the wide-angle camera are used as the main camera. Figure 9

[0284] Optionally, the camera mode of the camera application can also include the aperture camera mode.

[0285] It should be understood that, as shown in (b) of FIG. 1, Figure 9 ​As shown in (b), Night Scene Camera Mode, Portrait Camera Mode, Quick Camera Mode, Video Camera Mode, or more camera modes can refer to a camera mode in the camera application; Shooting Mode refers to the current shooting mode of the electronic device in any camera mode; for example, the type of camera and / or zoom ratio currently activated by the electronic device in any camera mode. Step S403: Determine whether the electronic device is in Super Macro Mode; if the electronic device is in Super Macro Mode, proceed to step S410; if the electronic device is not in Super Macro Mode, proceed to step S404.

[0286] For example, the display interface of the super macro mode can be as follows: Figure 10 As shown in (c) below; or, as follows Figure 11 As shown in (d) in the text; or, as in the following... Figure 12 As shown in (c) above; or, as follows: Figure 13 As shown in (b) of the diagram.

[0287] For example, such as Figure 9 The display interface shown in (a) is the desktop 501 of the electronic device; when the electronic device detects that the user clicks the camera application icon 502 on the desktop 501, it can display as follows: Figure 9 Another display interface shown in (b) is shown in the image; Figure 9 As shown in (b), after the electronic device enters the camera application, it can display the display interface 503 and start the shooting mode by default. In the shooting mode, the electronic device can enter the default shooting mode, which can be a shooting mode that uses the wide-angle camera as the main camera and the zoom ratio is a single zoom ratio (1×). The default shooting mode can be a non-super macro mode.

[0288] For example, in addition to the snapshot camera mode, the camera modes in an electronic device may also include a night scene camera mode, a portrait camera mode, a video camera mode, or more camera modes. Optionally, the camera modes may also include an aperture camera mode.

[0289] In the embodiments of this application, the super macro mode refers to a shooting mode in which the electronic device automatically switches to the ultra-wide-angle camera as the main camera when the zoom ratio is between 1x (1×) and 2x (2×).

[0290] For example, in scenarios where electronic devices are shooting at close range, the distance between the electronic device and the subject is relatively short; through the embodiments of this application, the electronic device can automatically use the ultra-wide-angle camera as the main camera and enter the super macro mode to increase the field of view when the electronic device is shooting.

[0291] likeFigure 5 As shown in (a) of FIG. 6, the first shooting object 260 and the second shooting object 270 are included in the same shooting scene, the distance between the first shooting object and the electronic device is d1, and the distance between the second shooting object and the electronic device is d2, d2 is less than d1; Figure 6 As shown in (b) of FIG. 6, the electronic device keeps the zoom ratio as the single zoom ratio and changes the shooting object at the second time. For example, the electronic device focuses on the second shooting object 270, and the electronic device can recognize that the distance between the second shooting object 270 and the electronic device is relatively close. The electronic device can enter the super macro shooting mode and automatically switch the ultra-wide-angle camera to the main camera to focus. The electronic device can display the display interface 290. Figure 5 As shown in (b) of FIG. 6, the electronic device keeps the zoom ratio as the single zoom ratio and changes the shooting object at the second time. For example, the electronic device focuses on the second shooting object 270, and the electronic device can recognize that the distance between the second shooting object 270 and the electronic device is relatively close. The electronic device can enter the super macro shooting mode and automatically switch the ultra-wide-angle camera to the main camera to focus. The electronic device can display the display interface 290.

[0292] It should be understood that the super macro shooting mode of the electronic device cannot be entered by the user selecting the shooting mode. The shooting mode is usually automatically switched by the electronic device.

[0293] In step S404, the code value (an example of the first parameter) is obtained.

[0294] Optionally, the code value of the main camera in the electronic device can be obtained.

[0295] In the embodiments of the present application, since the laser sensor is not included in the electronic device, the distance information between the electronic device and the shooting object cannot be obtained by the laser sensor. The distance information between the electronic device and the shooting object can be obtained by obtaining the distance parameter (for example, the code value) of the camera module in the electronic device. Based on the distance information between the electronic device and the shooting object, it can be determined whether to switch the camera of the electronic device. For example, if the distance between the electronic device and the shooting object is relatively close, the electronic device can use the ultra-wide-angle camera as the main camera.

[0296] It should be understood that the code value of the main camera can be used to represent the distance information between the lens and the sensor in the electronic device. For example, the larger the code value, the greater the distance between the lens and the sensor, that is, the closer the distance between the electronic device and the shooting object. The smaller the code value, the smaller the distance between the lens and the sensor, that is, the farther the distance between the electronic device and the shooting object. It should be understood that the code value can also be referred to as the lens position.

[0297] Exemplarily, when the electronic device is photographing, a subject in a photographing scene can be determined first, and the subject is a photographing object; the distance between the electronic device and the photographing object can refer to a distance between the electronic device and a focus point of the photographing object after the electronic device completes focusing.

[0298] Optionally, when the electronic device is a dual-camera electronic device or a multi-camera electronic device, the code value of the auxiliary camera can also be acquired.

[0299] In step S405, the zoom ratio is acquired, that is, the zoom value (an example of the second parameter) is acquired.

[0300] Exemplarily, the zoom ratio of the current photographing mode of the electronic device can be acquired.

[0301] Optionally, in the embodiments of the present application, step S404 can be performed first, and then step S405 can be performed; or step S405 can be performed first, and then step S404 can be performed; the present application does not limit the order of step S404 and step S405.

[0302] In step S406, it is determined whether the code value meets the first preset threshold and whether the zoom value meets the second preset range (an example of the first preset condition); if the code value meets the first preset threshold and the zoom value meets the second preset range, step S407 is performed; if the code value does not meet the first preset threshold and / or the zoom value does not meet the second preset range, step S402 is performed.

[0303] In the embodiments of the present application, the zoom ratio of the current photographing mode can be acquired, and it is determined whether the zoom ratio meets the second preset range; by determining whether the zoom ratio meets the second preset range, the problem of picture jumping in the subsequent camera switching process of the electronic device can be avoided; therefore, before the electronic device switches the camera, it can be determined whether the zoom ratio of the current photographing mode meets the second preset range, so as to ensure that the displayed picture is still smooth and fluent during the camera switching process.

[0304] Exemplarily, determining whether the code value meets the first preset threshold can refer to determining whether the code value is greater than the first preset threshold; that is, it is determined whether the current electronic device is close to the photographing object.

[0305] It should be understood that the smaller the code value is, the farther the distance between the electronic device and the photographing object is; the larger the code value is, the closer the distance between the electronic device and the photographing object is.

[0306] Exemplarily, the second preset range can refer to a range size of the zoom ratio; determining whether the zoom value meets the second preset range can refer to determining whether the zoom ratio of the current shooting mode is within the second preset range.

[0307] In one example, the main camera is a wide-angle camera, and if the zoom ratio corresponding to the wide-angle camera is 1 times zoom ratio (1x) to 3.5 times zoom ratio (3.5x), the second preset range can refer to 1x-2x.

[0308] In one example, the main camera is a wide-angle camera, and if the zoom ratio corresponding to the wide-angle camera is 0.8 times zoom ratio (0.8x) to 3.5 times zoom ratio (3.5x), the second preset range can refer to 0.8x-1.5x.

[0309] It should be understood that, as shown in Figure 4 The second preset range can be determined based on the zoom ratio M corresponding to the wide-angle camera and the zoom ratio N; the range corresponding to the second preset range can be between [M, N).

[0310] For example, assuming that the first preset threshold is 0.15 mA, and the second preset range is 1x-2x; in a case where the current shooting mode of the electronic device is a non-super macro mode, if the code value collected by the main camera is 0.2 mA, and the zoom value of the current shooting mode is 1.2x, the code value is greater than the first preset threshold, and the zoom value is within the range corresponding to the second preset range; in other words, the current code value meets the first preset threshold and the zoom value meets the second preset range; if one of the code value collected by the main camera or the zoom value does not meet the preset threshold, the method returns to step S402.

[0311] In the embodiments of the present application, the code value can represent the current size; the current size can reflect the magnetic field size, so as to determine the distance parameter between the electronic device and the shooting object; that is, by obtaining the current size of the camera module, the current value can be mapped to any one value between 0-1024, so as to represent the distance information between the electronic device and the shooting object.

[0312] It should be understood that the above is an example of the first preset threshold and the second preset range, and the size of the first preset threshold and the size of the second preset range are not limited in the present application.

[0313] Step S407, taking the ultra-wide-angle camera as the main camera.

[0314] Exemplarily, the electronic device can switch from the wide-angle camera as the main camera to the ultra-wide-angle camera as the main camera in a case where no operation of the user is detected; in other words, the electronic device can automatically use the ultra-wide-angle camera as the main camera in a case where no operation is detected.

[0315] It should be understood that multiple cameras can be included in the electronic device; for example, the multiple cameras can include a main camera and an auxiliary camera; when the electronic device captures an image, the image captured by the main camera is usually taken as a reference to process the image captured by the main camera; during the processing, part of the image information captured by the auxiliary camera can be extracted to compensate for the image captured by the main camera, so as to realize fusion of the images captured by the two cameras, and obtain a displayed image after processing, so as to achieve functions such as improving the shooting quality, background blurring, optical zoom, etc. Exemplarily, if the electronic device is in a single-camera mode when capturing an image, that is, the electronic device opens one camera to capture an image, the camera is the main camera.

[0316] Exemplarily, if the electronic device is in a dual-camera mode when capturing an image, that is, the electronic device opens two cameras to capture an image; one of the cameras is the main camera, and the other is the auxiliary camera; when capturing an image, the image captured by the main camera is usually taken as a reference to process the image captured by the main camera; during the processing, part of the image information captured by the auxiliary camera can be extracted to compensate for the image captured by the main camera, so as to realize fusion of the images captured by the two cameras, and obtain a displayed image after processing, so as to achieve functions such as improving the shooting quality, background blurring, optical zoom, etc.

[0317] Exemplarily, if the electronic device is in a multi-camera mode when capturing an image, for example, the electronic device is in a triple-camera mode when capturing an image, the electronic device can open three cameras when capturing an image; the three cameras include one main camera and two auxiliary cameras; when capturing an image, the image captured by the main camera is usually taken as a reference to process the image captured by the main camera; during the processing, part of the image information captured by the two auxiliary cameras can be extracted to compensate for the image captured by the main camera, so as to realize fusion of the images captured by the three cameras, and obtain a displayed image after processing, so as to achieve functions such as improving the shooting quality, background blurring, optical zoom, etc.

[0318] Case 1

[0319] If the electronic device is in a single-camera mode, the electronic device can close the wide-angle camera; open the ultra-wide-angle camera, and use the ultra-wide-angle camera as the main camera.

[0320] Case 2

[0321] If the electronic device is a multi-camera mode (for example, including a dual-camera mode or a triple-camera mode), the electronic device can take the ultra-wide-angle camera as the main camera, and all or part of the auxiliary cameras can be turned on.

[0322] Optionally, in the embodiments of the present application, when the electronic device detects that the code value is greater than the first preset threshold value, and the current zoom value is in the second preset range, the electronic device can adjust the zoom value; take the ultra-wide-angle camera as the main camera, and turn on the super macro mode; at this time, the zoom value displayed in the display interface of the electronic device can be 1x, and the actual zoom value can be obtained by adjusting the unit scale of the zoom indication axis of the camera application; for example, if the unit scale of the zoom axis is 0.01x, the actual zoom value at this time can be 0.99x; if the unit scale of the zoom axis is 0.02x, the actual zoom value at this time can be 0.98x.

[0323] It should be understood that the unit scale of the zoom indication axis can refer to the smallest unit of zoom; for example, if the unit scale of the zoom axis is 0.02x, the zooming process from 1x to 1.1x can include: 1x-1.02x-1.04x-1.06x-1.08x-1.1x.

[0324] Step S408, updating the shooting mode of the electronic device to the super macro mode.

[0325] For example, the different shooting modes in the electronic device can correspond to different labels, and updating the shooting mode of the electronic device to the super macro mode can mean updating the label corresponding to the non-super macro mode to the label corresponding to the super macro mode.

[0326] For example, the label corresponding to the non-super macro mode is flag=1, and the label corresponding to the super macro mode is flag=0, after the electronic device switches to the ultra-wide-angle camera as the main camera, the label corresponding to the shooting mode can be updated to flag=0.

[0327] For example, updating the shooting mode of the electronic device to the super macro mode can mean updating the shooting mode of the electronic device from the non-super macro mode to the super macro mode.

[0328] Optionally, a control indicating the super macro mode can be displayed in the display interface of the electronic device; for example, as shown in (d) of FIG. 5, the super macro control 506 can be displayed in the display interface 505; or, as shown in (f) of FIG. 5, the icon 513 indicating the super macro mode can be displayed in the display interface 515; or, as shown in (d) of FIG. 6, the super macro control 606 can be displayed in the display interface 605. Figure 9 Figure 10 Figure 11 ​​As shown in (d) of FIG. 5B, the interface 518 can display a control 518 indicating the super macro mode; or as shown in (h) of FIG. 5B, the interface 527 can display an icon 528 indicating the super macro mode. Figure 12 As shown in (d) of FIG. 5B, the interface 518 can display a control 518 indicating the super macro mode; or as shown in (h) of FIG. 5B, the interface 527 can display an icon 528 indicating the super macro mode. Step S409, the next judgment process is entered; that is, returning to execute step S402 and step S403, and executing the corresponding subsequent steps according to the result of step S403.

[0329] Exemplarily, after updating the shooting mode of the electronic device to the super macro mode, it can be regarded as the end of a judgment process, and the next judgment process can be continued, that is, steps S402 to S403 are continuously executed, and the corresponding subsequent steps are executed according to the result of step S403.

[0330] In one example, the electronic device can continue to execute the multiple judgment processes; that is, after updating the shooting mode to the super macro mode, steps S402 and S403 are continuously executed, and the corresponding subsequent steps are executed according to the result of step S403; for example, if the shooting mode is in the super macro mode, steps S410 to S414 are executed.

[0331] In one example, when the preset time is reached, the electronic device can continue to execute the next judgment process; for example, the electronic device can include a timer, and when the timer reaches the preset time (for example, 30S), the electronic device can continue to execute steps S402 to S403, and execute the corresponding subsequent steps according to the result of step S403.

[0332] Step S410, in the case that the electronic device is in the super macro mode, the code value of the camera module is acquired.

[0333] Optionally, the electronic device can acquire the code value of the main camera. For example, when the wide-angle camera is the main camera, the electronic device can acquire the code value of the wide-angle camera.

[0334] In one example, if the electronic device collects images in single camera mode, in the case of being in the super macro mode, the ultra-wide-angle camera is used as the main camera; at this time, the wide-angle camera can be turned on and the code value of the wide-angle camera is acquired.

[0335] In one example, if the electronic device collects images in dual camera mode, in the case of being in the super macro mode, the code value of the wide-angle camera can be directly acquired.

[0336] It should be understood that the above is exemplified by acquiring the code value of the wide-angle camera in the super macro mode; the code value of other types of main cameras can also be acquired, which is not limited in the present application.

[0337] In the embodiments of the present application, since the laser sensor is not included in the electronic device, the distance information between the electronic device and the shooting object cannot be acquired through the laser sensor; the distance information between the electronic device and the shooting object can be acquired by acquiring the code value of the main camera; whether to switch the camera of the electronic device can be determined based on the distance information between the electronic device and the shooting object; for example, if the distance between the electronic device and the shooting object is close, the electronic device can switch from using the wide-angle camera as the main camera to using the ultra-wide-angle camera as the main camera.

[0338] In step S411, it is determined whether the code value meets a third preset threshold (an example of a second preset condition); if the code value is less than or equal to the third preset threshold, step S413 is performed; if the code value is greater than the third preset threshold, step S402 is performed.

[0339] In the embodiments of the present application, the third preset threshold can be greater than the first preset threshold in step S406; the first preset threshold is used to determine whether the distance between the electronic device and the shooting object is close; if the distance between the electronic device and the shooting object is close and the zoom value meets the second preset range, in order to make the field of view of the electronic device larger, more image information of the shooting object can be acquired, the electronic device can switch from the main camera to the ultra-wide-angle camera; the third preset threshold is used to determine whether the distance between the electronic device and the shooting object is far; if the distance between the electronic device and the shooting object is far, in order to improve the clarity of the acquired image or acquire more image detail information, the electronic device can use the wide-angle camera as the main camera.

[0340] For example, the third preset threshold can be 0.8 mA; if the code value of the main camera acquired is greater than 0.8 mA, the code value meets the third threshold; if the code value of the main camera acquired is less than or equal to 0.8 mA, the code value does not meet the third threshold.

[0341] In the embodiments of the present application, the code value can represent the current size; the current size can reflect the magnetic field size, so as to determine the distance parameter between the electronic device and the shooting object; that is, by acquiring the current size of the camera module, the current value can be mapped to any value between 0 and 1024, so as to represent the distance information between the electronic device and the shooting object.

[0342] It should be understood that the above is an example of the third preset threshold, and the size of the third preset threshold is not limited in the present application.

[0343] In step S412, the wide-angle camera is used as the main camera.

[0344] In the embodiments of the present application, the electronic device taking the wide-angle camera as the main camera can refer to that the electronic device can take the ultra-wide-angle camera as the main camera based on the code value of the camera module when no operation of the user is detected; in other words, the electronic device can automatically take the wide-angle camera as the main camera to capture images without detecting any operation.

[0345] In step S413, the shooting mode is updated to the non-super macro mode.

[0346] For example, different shooting modes in the electronic device can correspond to different labels, and updating the shooting mode of the electronic device to the super macro mode can refer to updating the label corresponding to the super macro mode to the label corresponding to the non-super macro mode.

[0347] For example, the label corresponding to the super macro mode is flag=0, and the label corresponding to the non-super macro mode is flag=1. After the electronic device takes the wide-angle camera as the main camera, the label corresponding to the shooting mode can be updated to flag=1.

[0348] For example, updating the shooting mode of the electronic device to the super macro mode can refer to updating the shooting mode of the electronic device from the super macro mode to the non-super macro mode.

[0349] In step S414, the next judgment process is entered.

[0350] For example, after updating the shooting mode of the electronic device to the non-super macro mode, it can be regarded as the end of one judgment process, and the next judgment process can be continued, that is, steps S402 to S403 are continued to be executed, and the corresponding subsequent steps are executed according to the result of step S403.

[0351] In one example, the electronic device can continue to execute the multiple judgment processes in a loop; that is, after updating the shooting mode to the non-super macro mode, steps S402 and S403 are continued to be executed, and the corresponding subsequent steps are executed according to the result of step S403; for example, if the shooting mode is in the non-super macro mode, steps S410 to S414 are executed.

[0352] In one example, when the preset time is reached, the electronic device can continue to execute the next judgment process; for example, the electronic device can include a timer, and when the timer reaches the preset time (for example, 30S), the electronic device can continue to execute steps S402 to S403, and the corresponding subsequent steps are executed according to the result of step S403.

[0353] It should be understood that the above steps S401 to S414 are described using the switching between a wide-angle camera and an ultra-wide-angle camera as an example; steps S401 to S414 can also be applied to switching between other types of cameras, and this application does not limit the type of camera.

[0354] For example, the algorithm for switching cameras through steps S401 to S414 is described in detail below; in conjunction with Figures 9 to 12 An example diagram of the interface for an electronic device performing the camera switching method according to an embodiment of this application is described.

[0355] In one example, such as Figure 9 As shown, Figure 9 The display interface shown in (a) can be the desktop 501 of the electronic device; when the electronic device detects that the user clicks the camera application icon 502 on the desktop 501, it can display as shown in (a). Figure 9 Another display interface shown in (b) is shown in the image; Figure 9 The display interface 503 shown in (b) can be the display interface of a camera application, and the display interface 503 may include a smart control 504; after the electronic device detects an operation on the smart control 504, it executes the camera switching method provided in this application embodiment, such as... Figure 9 As shown in (c); for example, when the electronic device is in non-super macro mode, based on the distance parameters and zoom ratio of the acquired camera module; if the distance parameters and zoom ratio meet the first preset condition, the electronic device switches to use the ultra-wide-angle camera as the main camera, that is, the electronic device enters super macro mode, and displays as shown in (c). Figure 9 The display interface 505 shown in (d) may include a control 506 indicating the shooting mode. The current shooting mode is super macro mode, as shown in the figure. Figure 9 As shown in (d); if the user clicks on the "×" in "Super Macro ×", the electronic device can turn off the Super Macro mode; optionally, after turning off the Super Macro mode, the electronic device may no longer push the Super Macro mode in the preview display interface.

[0356] For example, combined Figure 9 (c) and Figure 9 As can be seen from (c), the field of view of the electronic device in super macro mode is greater than that of the electronic device in non-super macro mode, that is... Figure 10 The field of view shown in (d) is greater than Figure 10 The field of view is shown in (c).

[0357] Optionally, after the electronic device detects an instruction to take a picture, the currently active camera is used as the camera for capturing images; such asFigure 9 As shown in (d), when the electronic device is in super macro mode, the electronic device uses the ultra-wide-angle camera as the main camera to capture images.

[0358] It should be understood that, such as Figure 9 The display interface shown in (d) can display a zoom ratio of 1× when the electronic device is in super macro mode, using the ultra-wide-angle camera as the main camera to capture images; at this time, the actual zoom value of the camera application can be 0.99×, or 0.98×, or other zoom ratio values ​​less than 1×.

[0359] Optionally, the actual zoom value of the camera application can be obtained by adjusting the unit scale of the zoom indicator axis of the camera application; for example, if the unit scale of the zoom axis is 0.01×, then the actual zoom value can be 0.99×; if the unit scale of the zoom axis is 0.02×, then the actual zoom value can be 0.98×.

[0360] Optionally, Figure 9 The control 506 indicating the super macro mode may not be displayed in the display interface shown in (d); this application does not impose any limitations on this.

[0361] In one example, such as Figure 10 As shown, Figure 10 The display interface shown in (a) can be the desktop 507 of the electronic device; when the electronic device detects that the user clicks the camera application icon 508 on the desktop 507, it can display as follows: Figure 10 Another display interface shown in (b) is shown in the image; Figure 10 The display interface 509 shown in (b) can be the display interface of a camera application, and the display interface 509 may include a setting control 510; the electronic device detects an operation on the setting control 510, such as... Figure 10 As shown in (c); after the electronic device detects an operation on the setting control 510, a setting display interface can be displayed, which includes a control 511 indicating that automatic camera switching is enabled, such as... Figure 10 As shown in (d) in the figure; the electronic device detects the operation on control 511 and executes the camera switching method provided in the embodiments of this application, such as Figure 10 As shown in (e); for example, when the electronic device is in non-super macro mode, based on the distance parameters and zoom ratio of the acquired camera module; if the distance parameters and zoom ratio meet the first preset condition, the electronic device switches to use the ultra-wide-angle camera as the main camera, that is, the electronic device enters super macro mode, and displays as shown in (e); Figure 10The display interface 512 shown in (f) may include an icon 513 indicating the shooting mode, where the current shooting mode is Super Macro mode. If the user clicks the "×" in "Super Macro ×", the electronic device can turn off the Super Macro mode. Optionally, after turning off the Super Macro mode, the electronic device may no longer push the Super Macro mode in the preview display interface. Optionally, Figure 10 The relevant descriptions in [the document] also apply to [other applications]. Figure 9 This will not be elaborated upon here.

[0362] In one example, super macro can be enabled via a separate control in the camera application's display interface, such as... Figure 10 As shown; Figure 11 The display interface shown in (a) can be the desktop 514 of the electronic device; when the electronic device detects that the user clicks the camera application icon 515 on the desktop 514, it can display as shown in (a). Figure 11 Another display interface 516 is shown in (b) above; Figure 11 The display interface 516 shown in (b) can be the display interface of a camera application, and the display interface 516 may include controls 517; such as Figure 11 As shown in (c), after the electronic device detects the operation on the setting control 517, it executes the camera switching method provided in this application embodiment; for example, if the electronic device is in non-super macro mode, it obtains the distance parameters and zoom ratio of the camera module; if it determines that the distance parameters and zoom ratio meet the first preset condition, the electronic device switches to use the ultra-wide-angle camera as the main camera, that is, the electronic device enters super macro mode, and displays as shown in (c). Figure 11 The display interface 518 shown in (d) may include an icon 519 indicating the shooting mode, where the current shooting mode is Super Macro mode. If the user clicks the "×" in "Super Macro ×", the electronic device can turn off the Super Macro mode. Optionally, after turning off the Super Macro mode, the electronic device may no longer push the Super Macro mode in the preview display interface. Figure 11 The relevant descriptions in [the document] also apply to [other applications]. Figure 9 This will not be elaborated upon here.

[0363] It should be understood that Figure 11 and Figure 11 The difference in the displayed interface is that, Figure 9 The automatic camera switching is turned on / off via the smart control 504; Figure 9 The camera is automatically switched on / off via a control that is independent of the smart control.

[0364] In one example, such as Figure 11As shown, the user can indicate to turn on the automatic switching of the camera in the setting display interface of the electronic device, so that the electronic device executes the method for switching the camera provided in the embodiments of the present application.

[0365] Exemplarily, Figure 12 The display interface shown in (a) can be a desktop 520 of the electronic device; after the electronic device detects that the user clicks the icon 521 of the setting on the desktop 520, a display interface as shown in (b) can be displayed. Figure 12 Another display interface shown in (b); Figure 12 The display interface shown in (b) can be a setting display interface, which can include options such as wireless network, Bluetooth or camera; as shown in (c). Figure 12 As shown in (c), the electronic device detects the click on the camera option to enter the setting interface of the camera, and displays a display interface as shown in (d). Figure 12 As shown in (d), the camera setting interface can include a control 522 for automatically switching the camera; as shown in (e). Figure 12 As shown in (e), after the electronic device detects the operation on the control 522, the method for switching the camera provided in the embodiments of the present application can be executed; as shown in (f). Figure 12 As shown in (f), the electronic device detects that the user clicks the icon 525 of the camera application on the desktop 520 to enter the camera application; after entering the camera application, another display interface 526 as shown in (g) can be displayed, and at this time the electronic device can be in a non-super macro mode; the electronic device can determine the distance parameter and the zoom ratio based on the obtained distance parameter and the zoom ratio of the camera module; if the distance parameter and the zoom ratio meet the first preset condition, the electronic device switches the ultra-wide-angle camera as the main camera, that is, the electronic device enters the super macro mode, and displays a display interface as shown in (h). Figure 12 As shown in (h), the display interface 527 can include an icon 528 indicating the shooting mode, and the current shooting mode is the super macro mode; if it is detected that the user clicks the "x" in "super macro x", the electronic device can close the super macro mode; optionally, after closing the super macro mode, the electronic device can no longer push the super macro mode in the preview display interface. Figure 12 Optionally,

[0366] The related description in (a) is also applicable to (b), which will not be repeated here. Figure 12 Figure 9 Optionally, after the electronic device enters the display interface of the camera application, a display interface as shown in (h) can also be directly displayed; that is, the electronic device can directly go from the display interface as shown in (f) to the display interface as shown in (h).

[0367] Optionally, after the electronic device enters the display interface of the camera application, a display interface as shown in (h) can also be directly displayed; that is, the electronic device can directly go from the display interface as shown in (f) to the display interface as shown in (h). Figure 12 Figure 12 Figure 12 ​​​​

[0368] Optionally, Figure 12 The method shown in steps S401 to S414 can also be applied to switching between the wide-angle camera and the long-focus camera; or, switching between other types of cameras.

[0369] For example, as shown in (a) of FIG. 12, the same shooting scene includes a first shooting object 260 and a third shooting object 281, the distance between the first shooting object and the electronic device 100 is d3, the distance between the third shooting object and the electronic device 100 is d4, and d3 is less than d4; Figure 8 As shown in (a) of FIG. 12, the electronic device 100 includes a camera module 272; during the shooting process, the electronic device 100 keeps the position unchanged; the electronic device 100 opens the camera application, and at a first time, the electronic device 100 focuses on the first shooting object 260, and the electronic device 100 can display a display interface 282; at this time, the zoom ratio of the electronic device 100 is a single zoom ratio; as shown in (b) of FIG. 12, at a second time, the electronic device 100 changes the shooting object; for example, the electronic device 100 focuses on the third shooting object 281, and at this time, the electronic device 100 identifies that the distance between the third shooting object 281 and the electronic device 100 is far, and the electronic device 100 can enter a super-telephoto mode, that is, the electronic device 100 can automatically switch to the super-long-focus camera as the main camera to focus, and display a display interface 291. Figure 13 Figure 14 For example, for switching between the wide-angle camera and the long-focus camera, the above As shown in step S403 of FIG. 11, “whether in a super-macro mode” can be changed to “whether in a super-telephoto mode”, and the display interface of the super-telephoto mode can be as shown in (b) of FIG. 12; in step S406, “whether the code value meets the first preset threshold value and whether the zoom value meets the second preset range” can be changed to “whether the code value meets the fourth preset threshold value and whether the zoom value meets the fifth preset range”; in step S407, “using the super-wide-angle camera as the main camera” is changed to “using the long-focus camera as the main camera”; in step S408, “updating the shooting mode to the super-macro mode” is changed to “updating the shooting mode to the super-telephoto mode”; and in step S411, “whether the code value meets the third preset threshold value” is changed to “whether the code value meets the sixth preset threshold value”.

[0370] Figure 13 Figure 8

[0371] ​​​Among them, the Super Distance View mode refers to a shooting mode in which the electronic device automatically switches to use the telephoto camera as the main camera to capture images; the fourth preset threshold is used to determine whether the distance between the electronic device and the subject is too far. When the distance between the electronic device and the subject is less than or equal to the fourth threshold, it indicates that the distance between the electronic device and the subject is too far; the fourth preset threshold may not be equal to the first preset threshold; similarly, the fifth preset range is not equal to the second preset range. The fifth preset threshold is determined based on the zoom ratio corresponding to the telephoto camera, such as... Figure 16 As shown, the range corresponding to the fifth preset threshold can be between [N, K), where K can refer to the maximum zoom ratio corresponding to the telephoto camera. Furthermore, the third preset threshold and the sixth preset threshold are not equal. Based on the acquired code value and the sixth preset threshold, it can be determined whether to use the telephoto camera as the main camera; for example, if the code value is greater than the sixth preset threshold, the electronic device can switch from using the telephoto camera as the main camera to using the wide-angle camera as the main camera to capture images.

[0372] It should be understood that the super macro mode is suitable for close-up shooting; the super long-range mode is suitable for long-range shooting; based on the camera switching method of the embodiments of this application, the electronic device can automatically switch between different cameras based on the acquired code value and zoom value, that is, without any operation by the user, the electronic device can switch between multiple different cameras based on the distance between the electronic device and the shooting object.

[0373] In the embodiments of this application, without relying on the laser sensor in the electronic device, the electronic device can automatically switch between different cameras based on the code value and zoom value acquired by the main camera, thereby improving the user's shooting experience and image quality. For example, in close-up shooting scenarios, the electronic device can automatically switch from using the wide-angle camera as the main camera to using the ultra-wide-angle camera as the main camera, thus increasing the field of view of the electronic device. Since the field of view of the electronic device increases, the image information of the subject acquired by the electronic device increases, thereby improving the image clarity. In long-distance shooting scenarios, the electronic device can automatically switch from using the wide-angle camera as the main camera to using the telephoto camera as the main camera, thereby enabling the electronic device to acquire more image detail information.

[0374] In one example, to ensure the stability of image acquisition by the electronic device, the device can make a judgment based on multiple frames of images before switching cameras; for example, it can determine whether at least two consecutive frames meet a preset threshold; if at least two consecutive frames meet the preset threshold, the electronic device switches cameras; such as... Figure 4 As shown.

[0375] Figure 13 is a schematic flowchart of a method for switching camera provided by an embodiment of the present application. The method can be executed by the electronic device shown in Figure 15 ; the method 600 comprises steps S601 to S616, which are described in detail as follows.

[0376] It should be understood that steps S601 to S616 are described by taking switching between the wide-angle camera and the ultra-wide-angle camera as an example; steps S601 to S616 can also be applicable to switching between other types of cameras, and the type of the camera is not limited in the present application.

[0377] Step S601, starting the camera application.

[0378] Step S602, obtaining the shooting mode of the electronic device.

[0379] Step S603, determining whether the mode of the electronic device is in the super macro mode; if the shooting mode of the electronic device is in the super macro mode, executing step S611; if the shooting mode of the electronic device is not in the super macro mode, executing step S604.

[0380] Step S604, obtaining the camera module distance parameter (for example, the code value).

[0381] Step S605, obtaining the zoom ratio (for example, the zoom value).

[0382] Optionally, in an embodiment of the present application, step S604 can be executed first, and then step S605 can be executed; or, step S605 can be executed first, and then step S604 can be executed; the present application does not make any limitation on the sequence of steps S604 and S605.

[0383] Step S606, determining whether the code value meets the first preset threshold and whether the zoom value meets the second preset range; if the code value meets the first preset threshold and the zoom value meets the second preset range, executing step S607; if the code value does not meet the first preset threshold and / or the zoom value does not meet the second preset range, executing step S602.

[0384] Step S607, determining whether the two consecutive frames of images meet the first preset threshold and the second preset range; if the two consecutive frames of images meet the first preset threshold and the second preset range, executing step S608; if the two consecutive frames of images do not meet the first preset threshold and the second preset range, returning to execute step S602.

[0385] Exemplarily, the two continuous frames of images can be a first frame of image and a second frame of image, the electronic device collects the first frame of image in the non-super macro mode, and obtains the code value of the main camera lens being greater than the first preset threshold value, which indicates that the distance between the electronic device and the photographed object is relatively close. In addition, the size of the zoom value is within the zoom range corresponding to the second preset range. Similarly, the electronic device collects the second frame of image in the non-super macro mode, and obtains the code value of the main camera lens. If the code value is greater than the first preset threshold value, it indicates that the distance between the electronic device and the photographed object is relatively close. In addition, the size of the zoom value is within the second preset range. At this time, the code value of the first frame of image and the code value of the second frame of image are both greater than the first preset threshold value, and the zoom ratio of the first frame of image and the zoom ratio of the second frame of image are both within the second preset range, that is, the two continuous frames of images meet the first preset threshold value and the second preset range.

[0386] Step S608: taking the ultra-wide-angle camera lens as the main camera lens.

[0387] Step S609: updating the shooting mode to the super macro mode.

[0388] Step S610: entering the next judgment process, that is, returning to execute steps S602 and S603, and executing the corresponding subsequent steps according to the result of step S603.

[0389] Step S611: obtaining the distance parameter (for example, the code value) of the camera lens module.

[0390] Step S612: judging whether the code value meets the third preset threshold value. If the code value meets the third preset threshold value, step S613 is executed. If the code value does not meet the third preset threshold value, step S602 is returned to execute.

[0391] Step S613: judging whether the two continuous frames of images meet the third preset threshold value. If the two continuous frames of images meet the third preset threshold value, step S614 is executed. If the two continuous frames of images do not meet the third preset threshold value, step S602 is returned to execute.

[0392] Exemplarily, the two continuous frames of images can be a first frame of image and a second frame of image, the electronic device collects the first frame of image in the super macro mode, and can obtain the code value of the wide-angle camera lens, which is greater than or equal to the third preset threshold value. The electronic device collects the second frame of image in the super macro mode, and can obtain the code value of the wide-angle camera lens, and judge whether the code value is less than or equal to the third preset threshold value. At this time, the code values of the two continuous frames of images are both less than or equal to the third threshold value, that is, the two continuous frames of images meet the third preset threshold value.

[0393] Step S614: taking the wide-angle camera lens as the main camera lens.

[0394] Step S615, update the shooting mode to the non-super macro mode.

[0395] Step S616, enter the next judgment process.

[0396] It should be noted that the above steps S601 to S616 are applicable to the relevant description in Figure 1 , which will not be repeated here.

[0397] It should be understood that the above steps S601 to S617 are described by taking the switching between the wide-angle camera and the ultra-wide-angle camera as an example; similarly, the above method of switching the camera can also be applied to the switching between the wide-angle camera and the long-focus camera, or the switching between other types of cameras.

[0398] In the embodiments of the present application, without relying on the laser sensor in the electronic device, the electronic device can realize the automatic switching of different cameras in the electronic device based on the obtained distance parameter and zoom ratio collected by the main camera, improve the user's shooting experience and image quality; for example, in the scene of close-range shooting, the electronic device can automatically switch from using the wide-angle camera as the main camera to using the ultra-wide-angle camera as the main camera, so that the field of view angle of the electronic device becomes larger; since the field of view angle of the electronic device becomes larger, the image information of the shooting object collected by the electronic device increases, thereby improving the clarity of the image; for the scene of long-distance shooting, the electronic device can automatically switch from using the wide-angle camera as the main camera to using the long-focus camera as the main camera, so that the electronic device obtains more image detail information. In addition, through the embodiments of the present application, it can be judged whether at least two consecutive images meet a preset threshold; if at least two consecutive images meet the preset threshold, the electronic device can switch the camera; thereby ensuring the stability of the image collected by the electronic device.

[0399] Figure 8 The schematic diagram of the preview interface of the camera application provided by the embodiments of the present application.

[0400] Exemplarily, for the scene of close-range shooting of the electronic device, Figure 16 (a) in (a) is a preview image collected by using the wide-angle camera as the main camera; Figure 16 (b) in (b) is a preview image collected by the electronic device in the super macro mode, i.e. a preview image collected by the electronic device using the ultra-wide-angle camera as the main camera; combining (a) in Figure 16 and (b) in Figure 16 , it can be seen that in the scene of close-range shooting, when the electronic device collects the image by using the ultra-wide-angle camera as the main camera, the clarity of the image and the field of view angle of the electronic device are both improved.

[0401] Figure 16 This is a schematic diagram of a preview interface of a camera application provided in an embodiment of this application.

[0402] For example, in scenarios where electronic devices are shooting from a distance, Figure 17 (a) shows a preview image captured using a wide-angle camera as the main camera; Figure 17 Image (b) shows a preview image captured by the electronic device in Super View mode, i.e., a preview image captured by the electronic device using the telephoto camera as the main camera; combined with Figure 17 The preview image shown in (a) is the same as Figure 17 As can be seen from the preview image shown in (b), in long-distance shooting scenarios, the image details are enhanced when the electronic device captures the image using the telephoto camera as the main camera.

[0403] It should be understood that the above examples are provided to help those skilled in the art understand the embodiments of this application, and are not intended to limit the embodiments of this application to the specific values ​​or scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of this application.

[0404] The above text combined Figure 17 The method for switching cameras provided in the embodiments of this application has been described in detail; the following will be combined with Figures 1 to 17 The apparatus embodiments of this application are described in detail below. It should be understood that the apparatus in the embodiments of this application can perform the various methods described in the foregoing embodiments of this application, that is, the specific working processes of the various products described below can be referred to the corresponding processes in the foregoing method embodiments.

[0405] Figures 18 to 19 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 700 includes a processing module 710, a display module 720, a first camera, and a second camera.

[0406] The processing module 710 is configured to start a camera application; the display module 720 is configured to display a first image, the first image being an image collected by the first camera as a main camera; the processing module 710 is further configured to determine that a first parameter and a second parameter satisfy a first preset condition, the first parameter being used to indicate distance information between the electronic device and a target object, the first parameter being a parameter from the camera module, the target object being a photographed object in the first image, the second parameter being used to indicate a zoom ratio of the electronic device; and the display module 720 is further configured to display a second image, the second image being an image collected by the second camera as a main camera.

[0407] Optionally, as an embodiment, the processing module 710 is specifically configured to:

[0408] determine that the first parameter is greater than a first preset threshold, and the second parameter satisfies a second preset range, wherein the first preset threshold is used to indicate distance information between the camera module and a sensor in the electronic device, and the second preset range is used to indicate a zoom range of the camera module.

[0409] Optionally, as an embodiment, the processing module 710 is specifically configured to:

[0410] obtain a first distance range of the first camera, the first distance range being used to represent an effective distance range of the first camera for focusing;

[0411] obtain the first preset threshold based on the first distance range.

[0412] Optionally, as an embodiment, the processing module 710 is specifically configured to:

[0413] obtain a zoom ratio range of the first camera;

[0414] obtain the second preset range based on the zoom ratio range.

[0415] Optionally, as an embodiment, a starting point of the first distance range is a first numerical value, and the first preset threshold is greater than or equal to the first numerical value.

[0416] Optionally, as an embodiment, the second preset range belongs to a subset of the zoom ratio range.

[0417] Optionally, as an embodiment, the first parameter is a parameter from the first camera.

[0418] Optionally, as an embodiment, the second parameter is the zoom ratio of the electronic device.

[0419] Optionally, as an embodiment, the processing module 710 is specific for:

[0420] displaying the second image on the first display interface of the electronic device, the first display interface further comprising a first icon, the first icon being used for indicating the super macro mode.

[0421] Optionally, as an embodiment, the first icon comprises a first control, and the processing module 710 is further specific for:

[0422] detecting a first operation on the first control;

[0423] in response to the first operation, the electronic device exits the super macro mode.

[0424] Optionally, as an embodiment, the first camera comprises a wide-angle camera, and / or the second camera comprises an ultra-wide-angle camera or a long-focus camera.

[0425] Optionally, as an embodiment, the electronic device is in the same position when displaying the first image and displaying the second image.

[0426] It should be noted that the electronic device 700 is embodied in the form of functional modules. The term “module” herein can be implemented in the form of software and / or hardware, and no specific limitation is made.

[0427] For example, the “module” can be a software program, a hardware circuit or a combination of both, which realizes the above functions. The hardware circuit can include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combination logic circuit and / or other suitable components supporting the described functions.

[0428] Therefore, the units of the examples described in the embodiments of the present application can be realized in the form of electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software mode depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0429] Figure 18 A structural schematic diagram of an electronic device provided by the present application is shown. Figure 19 Figure 19The dashed line in the figure indicates that the unit or the module is optional; the electronic device 800 can be used to implement the methods described in the above method embodiments.

[0430] The electronic device 800 includes one or more processors 801 that can support the electronic device 800 to implement the method of switching cameras in the method embodiments. The processor 801 can be a general-purpose processor or a special-purpose processor. For example, the processor 801 can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices such as discrete gates or transistor logic devices, or discrete hardware components.

[0431] The processor 801 can be used to control the electronic device 800, execute software programs, and process data of the software programs. The electronic device 800 can further include a communication unit 805 to implement input (reception) and output (transmission) of signals.

[0432] For example, the electronic device 800 can be a chip, the communication unit 805 can be an input and / or output circuit of the chip, or the communication unit 805 can be a communication interface of the chip, and the chip can be a component of a terminal device or other electronic device.

[0433] For another example, the electronic device 800 can be a terminal device, and the communication unit 805 can be a transceiver of the terminal device, or the communication unit 805 can be a transceiver circuit of the terminal device.

[0434] The electronic device 800 can include one or more memories 802 having programs 804 stored thereon, and the programs 804 can be run by the processor 801 to generate instructions 803, so that the processor 801 executes the method of switching cameras described in the above method embodiments according to the instructions 803.

[0435] Optionally, the memory 802 can also store data.

[0436] Optionally, the processor 801 can also read the data stored in the memory 802, and the data can be stored in the same storage address as the program 804, or the data can be stored in a different storage address from the program 804.

[0437] The processor 801 and the memory 802 can be separately arranged, or can be integrated together, for example, integrated on a system on chip (SOC) of the terminal device.

[0438] Exemplarily, the memory 802 can be used to store a related program 804 of the method for switching cameras provided in the embodiments of the present application, and the processor 801 can be used to call the related program 804 of the method for switching cameras stored in the memory 802 when executing the method for switching cameras, and execute the method for switching cameras of the embodiments of the present application; for example, starting a camera application; displaying a first image, the first image being obtained by collecting an image by taking the first camera as a main camera; determining that a first parameter and a second parameter meet a first preset condition, the first parameter being used to indicate distance information between the electronic device and a target object, the first parameter being a parameter from the camera module, the target object being a photographed object in the first image, and the second parameter being used to indicate a zoom ratio of the electronic device; displaying a second image, the second image being obtained by collecting an image by taking the second camera as a main camera.

[0439] The present application also provides a computer program product, which, when executed by the processor 801, implements the method for switching cameras of any method embodiment in the present application.

[0440] The computer program product can be stored in the memory 802, for example, is a program 804, which is finally converted into an executable target file that can be executed by the processor 801 after processing processes such as preprocessing, compiling, assembling and linking.

[0441] The present application also provides a computer readable storage medium, which stores a computer program, and the computer program, when executed by a computer, implements the method for switching cameras described in any method embodiment of the present application. The computer program can be a high-level language program or an executable target program.

[0442] The computer readable storage medium is, for example, the memory 802. The memory 802 can be a volatile memory or a nonvolatile memory, or the memory 802 can include both volatile and nonvolatile memory. The nonvolatile memory can be a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as the external cache. By way of example, and not limitation, many forms of RAM are available, for example, a static RAM (SRAM), a dynamic RAM (DRAM), a synchronous DRAM (SDRAM), a double data rate SDRAM (DDR SDRAM), an enhanced SDRAM (ESDRAM), a synchlink DRAM (SLDRAM), and a direct rambus RAM (DR RAM).

[0443] Those skilled in the art can clearly understand that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0444] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, device and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.

[0445] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other manners. For example, the embodiments of the electronic device described above are merely schematic, and the division of the modules is merely a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.

[0446] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.

[0447] In addition, each functional unit in the embodiments of the present application can be integrated in one processing unit, or each unit can exist physically as a separate unit, or two or more units can be integrated in one unit.

[0448] It should be understood that, in various embodiments of the present application, the size of the serial number of each process does not mean the execution order, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0449] In addition, the term "and / or" in the present application is merely a description of the association relationship of the associated objects, and can represent three relationships, for example, A and / or B, which can represent three cases of A alone, A and B together, and B alone. In addition, the character " / " in the present application generally represents an "or" relationship between the front and rear associated objects.

[0450] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0451] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims. In summary, the above is only a preferred embodiment of the technical solutions of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for switching a camera, the method comprising: The method is applied to an electronic device including a camera module, the camera module including a first camera and a second camera, and the method includes: starting a camera application; displaying a first image, the first image being an image collected by the first camera as a main camera; obtaining a code value of the first camera; when the code value of the first camera is greater than a first preset threshold and a zoom value meets a second preset range, switching the main camera from the first camera to the second camera, wherein the zoom value is used to indicate a zoom ratio of the first camera, the second preset range is determined based on a zoom ratio range of the first camera, the first preset threshold is obtained based on a first distance range of the first camera, and the first distance range is used to represent an effective distance range for focusing of the first camera; displaying a second image, the second image being an image collected by the second camera as the main camera.

2. The method of claim 1, wherein, The code value of the first camera corresponds to a distance between a lens of the first camera and an image sensor of the first camera.

3. The method of claim 1, wherein, After the second image is displayed, the method further includes: obtaining a code value of the second camera; when the code value of the second camera is less than a second preset threshold, switching the main camera from the second camera to the first camera; displaying a third image, the third image being an image collected by the first camera as the main camera.

4. The method of any one of claims 1 to 3, wherein, The first camera is a wide-angle camera, and the second camera is an ultra-wide-angle camera.

5. The method of any one of claims 1 to 3, wherein, A starting point of the first distance range is a first numerical value, and the first preset threshold is greater than or equal to the first numerical value.

6. The method of any one of claims 1 to 3, wherein, Further including: obtaining a zoom ratio range of the first camera; based on the zoom ratio range, obtaining the second preset range.

7. The method of claim 6, wherein, The second preset range belongs to a subset of the zoom ratio range.

8. The method of any one of claims 1 to 3, wherein, The displaying of the second image includes: displaying the second image on a first display interface of the electronic device, and the first display interface further includes a first icon, the first icon being used to indicate a super macro mode.

9. The method of claim 8, wherein, The first icon includes a first control, and the method further includes: detecting a first operation on the first control; in response to the first operation, the electronic device exits the super macro mode.

10. The method of any one of claims 1 to 3, wherein, When the first image is displayed and the second image is displayed, the electronic device is located at the same position.

11. An electronic device, comprising: including: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program codes, the computer program codes include computer instructions, and the one or more processors invoke the computer instructions to enable the electronic device to perform the method in any one of claims 1 to 10.

12. A chip system, characterized by The chip system is applied to an electronic device, and the chip system comprises one or more processors configured to invoke computer instructions to cause the electronic device to perform the method of any one of claims 1-10.

13. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor performs the method of any one of claims 1-10.

Citation Information

Patent Citations

  • Image capturing method and electronic equipment

    CN110248081A

  • Opening method, electronic equipment and computer storage medium

    CN112804450A