WO2024087804A1 - 切换摄像头的方法与电子设备 - Google Patents

切换摄像头的方法与电子设备 Download PDF

Info

Publication number
WO2024087804A1
WO2024087804A1 PCT/CN2023/112634 CN2023112634W WO2024087804A1 WO 2024087804 A1 WO2024087804 A1 WO 2024087804A1 CN 2023112634 W CN2023112634 W CN 2023112634W WO 2024087804 A1 WO2024087804 A1 WO 2024087804A1
Authority
WO
WIPO (PCT)
Prior art keywords
electronic device
camera
distance
image
shooting
Prior art date
Application number
PCT/CN2023/112634
Other languages
English (en)
French (fr)
Inventor
田春霖
王文博
王永华
朱世宇
郗东苗
朱聪超
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2024087804A1 publication Critical patent/WO2024087804A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72448User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions
    • H04M1/72454User interfaces specially adapted for cordless or mobile telephones with means for adapting the functionality of the device according to specific conditions according to context-related or environment-related conditions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/62Control of parameters via user interfaces
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/63Control of cameras or camera modules by using electronic viewfinders
    • H04N23/631Graphical user interfaces [GUI] specially adapted for controlling image capture or setting capture parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/667Camera operation mode switching, e.g. between still and video, sport and normal or high- and low-resolution modes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/69Control of means for changing angle of the field of view, e.g. optical zoom objectives or electronic zooming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/90Arrangement of cameras or camera modules, e.g. multiple cameras in TV studios or sports stadiums
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M2250/00Details of telephonic subscriber devices
    • H04M2250/52Details of telephonic subscriber devices including functional features of a camera

Definitions

  • the present application relates to the field of terminals, and in particular, to a method for switching cameras and an electronic device.
  • the electronic device can automatically switch between different cameras based on the parameters of the wide-angle camera; for example, when the electronic device can recognize that the distance between the electronic device and the object being photographed is close based on the parameters of the wide-angle camera, it can automatically switch to use the ultra-wide-angle camera as the main camera and enter the super macro mode; however, when the distance between the electronic device and the object being photographed is close, the distance between the electronic device and the object being photographed is less than the effective distance for the wide-angle camera to focus, resulting in a reduction in the accuracy of the wide-angle camera's parameters, which may cause the electronic device to automatically exit when shooting in super macro mode, resulting in poor stability in the super macro mode.
  • the present application provides a method for switching cameras and an electronic device, which can improve the stability of shooting modes (for example, super macro mode) in the electronic device and improve the user's shooting experience.
  • shooting modes for example, super macro mode
  • a method for switching cameras is provided, which is applied to an electronic device, wherein the electronic device includes a camera module, the camera module includes a first camera and a second camera, and the method includes:
  • first distance and a second distance satisfy a first preset condition, wherein the first distance and the second distance are used to indicate an object distance between the electronic device and a photographed object, the first distance is an object distance obtained based on parameters of the first camera, and the second distance is an object distance obtained based on parameters of the second camera;
  • a second image is displayed, where the second image is obtained by capturing an image with the second camera acting as a main camera.
  • the electronic device when the first distance and the second distance meet the first preset condition, switches to use the second camera as the main camera to display the second image; since the first distance is the object distance obtained according to the parameters of the first camera, and the second distance is the object distance obtained according to the parameters of the second camera; therefore, in an embodiment of the present application,
  • the determination on whether to switch the camera will be made based on dual restriction conditions; compared with the existing scheme in which whether to switch the camera is determined only based on the parameters of the second camera, the method for switching the camera provided in the embodiment of the present application is more accurate, that is, the shooting mode in the electronic device is more stable.
  • the first distance and the second distance satisfy a first preset condition, including:
  • the first distance is greater than a first preset threshold and the second distance is greater than a second preset threshold, wherein the first preset threshold is different from the second preset threshold.
  • the first preset threshold is a preset threshold obtained based on a first distance range, and the first distance range is used to represent an effective distance range for focusing of the first camera.
  • the second preset threshold is a preset threshold obtained based on a second distance range, and the second distance range is used to represent an effective distance range for focusing of the second camera.
  • the method further includes:
  • determining whether a brightness parameter of a shooting scene in which the electronic device is located is less than or equal to a first brightness threshold
  • the second image is displayed.
  • the electronic device may further determine whether to exit the super macro mode based on the brightness parameters of the shooting scene; because when the shooting scene in which the electronic device is located is dark, the accuracy of the parameters collected by the first camera and the parameters collected by the second camera is low; because the accuracy of the parameters collected by the first camera and the parameters collected by the second camera is low, the accuracy of the first distance and the second distance is low; at this time, the electronic device can directly exit the super macro mode.
  • the first brightness threshold is a preset threshold obtained based on a first brightness range, and the first brightness range is used to represent an effective brightness range for focusing of the first camera.
  • the zoom ratio when the electronic device displays the first image is a first zoom ratio
  • the current zoom ratio of the electronic device is a second zoom ratio
  • the second image is displayed.
  • the zoom magnification of the electronic device when the first distance and/or the second distance does not satisfy a preset condition and the brightness parameter of the shooting scene in which the electronic device is located is greater than a first brightness threshold, it can be determined whether the zoom magnification of the electronic device has changed; if the zoom magnification of the electronic device has changed, the electronic device exits the super macro mode; for example, if the zoom magnification of the electronic device has changed, it may be that the user has adjusted the zoom magnification of the electronic device; at this time, the electronic device exits the super macro mode.
  • displaying the first image includes:
  • the first image is displayed.
  • the shooting scene of the electronic device can be Whether the electronic device enters the super macro mode is determined based on the brightness of the scene and the second distance; compared with determining whether the electronic device enters the super macro mode based on the second distance, the accuracy of entering the super macro mode in the embodiment of the present application is higher.
  • the second brightness threshold is a preset threshold obtained based on a second brightness range, and the second brightness range is used to represent an effective brightness range for focusing of the second camera.
  • the method when the first camera includes an open-loop motor, the method further includes:
  • the first distance is obtained.
  • displaying the first image includes:
  • the electronic device When the electronic device is in a super macro mode, the first image is displayed.
  • displaying the first image includes:
  • the first image is displayed on a first display interface of the electronic device, and the first display interface also includes a first icon, and the first icon is used to indicate the super macro mode.
  • the first icon includes a first control, and further includes:
  • the electronic device In response to the first operation, the electronic device exits the super macro mode.
  • displaying the second image includes:
  • the second image is displayed.
  • the first camera includes an ultra-wide-angle camera or a telephoto camera, and/or the second camera includes a wide-angle camera.
  • the first camera is an ultra-wide-angle camera
  • the second camera is a wide-angle camera
  • the ultra-wide-angle camera is used as the main camera, and the electronic device displays a first image
  • the electronic device exits the super macro mode the wide-angle camera is used as the main camera, and the electronic device displays a second image.
  • the first camera is a telephoto camera and the second camera is a wide-angle camera; when the electronic device is in a super telephoto mode, the telephoto camera is used as the main camera, and the electronic device displays a first image; when the electronic device exits the super telephoto mode, the wide-angle camera is used as the main camera, and the electronic device displays a second image.
  • the electronic device is located at the same position when displaying the first image and when displaying the second image.
  • the position of the electronic device may remain unchanged during the shooting process. If the focus object of the electronic device moves from a distant shooting object to a close-up shooting object, the electronic device may automatically identify the distance between the electronic device and the shooting object and enter the super macro mode. If the focus object of the electronic device moves from a close-up shooting object to a distant shooting object, the electronic device may automatically identify the distance between the electronic device and the shooting object and exit the super macro mode. The electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image. quantity.
  • the first image includes a first photographed object
  • the second image includes a second photographed object
  • the first photographed object and the second photographed object are located at the same position
  • the distance between the first photographed object and the electronic device is a third distance
  • the distance between the second photographed object and the electronic device is a fourth distance
  • the third distance is smaller than the fourth distance
  • the position of the electronic device may change during the shooting process; for example, the electronic device may be moved to shoot different subjects (for example, a first subject and a second subject); when the focus object of the electronic device moves from a close-up subject to a distant subject, the electronic device may automatically identify the distance between the electronic device and the subject and exit the super macro mode; the electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • the electronic device may be moved to shoot different subjects (for example, a first subject and a second subject); when the focus object of the electronic device moves from a close-up subject to a distant subject, the electronic device may automatically identify the distance between the electronic device and the subject and exit the super macro mode; the electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • the first image and the second image include a third photographic object, and when the first image and the second image are displayed, the third photographic object is located at the same position; when the first image is acquired, the distance between the third photographic object and the electronic device is a fifth distance; when the second image is acquired, the distance between the third photographic object and the electronic device is a sixth distance, and the fifth distance is smaller than the sixth distance.
  • the position of the electronic device may change during the shooting process; for example, the electronic device may move to shoot the same subject (for example, a third subject); when the focus object of the electronic device moves from a close-up subject to a distant subject, the electronic device may automatically identify the distance between the electronic device and the subject and exit the super macro mode; the electronic device may automatically switch between different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • an electronic device comprising a module/unit for executing the first aspect or any one of the methods for switching cameras in the first aspect.
  • an electronic device comprising one or more processors, a memory and a camera module, the camera module comprising a first camera and a second camera;
  • the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code comprises a computer instruction, and the one or more processors call the computer instruction to enable the electronic device to execute:
  • first distance and a second distance satisfy a first preset condition, wherein the first distance and the second distance are used to indicate an object distance between the electronic device and a photographed object, the first distance is an object distance obtained based on parameters of the first camera, and the second distance is an object distance obtained based on parameters of the second camera;
  • a second image is displayed, where the second image is obtained by capturing an image with the second camera acting as a main camera.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the first distance is greater than a first preset threshold and the second distance is greater than a second preset threshold, wherein the first preset threshold is different from the second preset threshold.
  • the first preset threshold is a preset threshold obtained based on a first distance range
  • the first distance range is used to represent an effective distance range for the first camera to focus. Surround.
  • the second preset threshold is a preset threshold obtained based on a second distance range, and the second distance range is used to represent an effective distance range for focusing of the second camera.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • determining whether a brightness parameter of a shooting scene in which the electronic device is located is less than or equal to a first brightness threshold
  • the second image is displayed.
  • the first brightness threshold is a preset threshold obtained based on a first brightness range, and the first brightness range is used to represent an effective brightness range for focusing of the first camera.
  • a zoom ratio when the electronic device displays the first image is a first zoom ratio
  • a current zoom ratio of the electronic device is a second zoom ratio
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the second image is displayed.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the first image is displayed.
  • the second brightness threshold is a preset threshold obtained based on a second brightness range, and the second brightness range is used to represent an effective brightness range for focusing of the second camera.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the first distance is obtained.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the electronic device When the electronic device is in a super macro mode, the first image is displayed.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the first image is displayed on a first display interface of the electronic device, and the first display interface also includes a first icon, and the first icon is used to indicate the super macro mode.
  • the first icon includes a first control.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the electronic device In response to the first operation, the electronic device exits the super macro mode.
  • the one or more processors call the computer instructions to cause the electronic device to execute:
  • the second image is displayed.
  • the first camera includes an ultra-wide-angle camera or a telephoto camera
  • the second camera includes a wide-angle camera
  • the electronic device is located at the same position when displaying the first image and when displaying the second image.
  • the first image includes a first photographed object
  • the second image includes a second photographed object
  • the first photographed object and the second photographed object are located at the same position
  • the distance between the first photographed object and the electronic device is a third distance
  • the distance between the second photographed object and the electronic device is a fourth distance
  • the third distance is smaller than the fourth distance
  • the first image and the second image include a third photographic object, and when the first image and the second image are displayed, the third photographic object is located at the same position; when the first image is captured, the distance between the third photographic object and the electronic device is a fifth distance; when the second image is captured, the distance between the third photographic object and the electronic device is a sixth distance, and the fifth distance is smaller than the sixth distance.
  • an electronic device comprising 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 code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the first aspect or any one of the methods in the first aspect.
  • a chip system which is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the first aspect or any one of the methods in the first aspect.
  • a computer-readable storage medium stores a computer program code.
  • the computer program code is executed by an electronic device, the electronic device executes the first aspect or any one of the methods in the first aspect.
  • a computer program product comprising: a computer program code, when the computer program code is executed by an electronic device, the electronic device executes the first aspect or any one of the methods in the first aspect.
  • the electronic device when the first distance and the second distance meet the first preset condition, switches to using the second camera as the main camera; since the first distance is the object distance obtained according to the parameters of the first camera, and the second distance is the object distance obtained according to the parameters of the second camera; therefore, in an embodiment of the present application, when judging whether to switch to the second camera as the main camera, it is determined whether to switch the camera based on dual restrictions; compared with the existing solution in which whether to switch the camera is determined only based on the parameters of the second camera, the method for switching cameras provided in the embodiment of the present application is more stable.
  • FIG1 is a schematic diagram of a shooting scene applicable to the super macro mode of the present application.
  • FIG2 is a side view of a shooting scene suitable for the super macro mode of the present application.
  • FIG3 is a schematic diagram of another shooting scene applicable to the super macro mode of the present application.
  • FIG4 is a schematic diagram of another shooting scene applicable to the super macro mode of the present application.
  • FIG5 is a schematic diagram of a shooting scene applicable to the super long-range mode of the present application.
  • FIG6 is a side view of a shooting scene suitable for the super telephoto mode of the present application.
  • FIG7 is a schematic diagram of another shooting scene applicable to the super macro mode of the present application.
  • FIG8 is a schematic diagram of another shooting scene applicable to the super macro mode of the present application.
  • FIG9 is a schematic diagram of a hardware system of an electronic device applicable to the present application.
  • FIG10 is a schematic diagram of a software system of an electronic device applicable to the present application.
  • FIG11 is a schematic diagram of an arrangement of multiple cameras on an electronic device provided in an embodiment of the present application.
  • FIG12 is a schematic diagram of zoom ratios corresponding to different types of cameras provided in an embodiment of the present application.
  • FIG13 is a schematic diagram of a graphical user interface for automatically exiting the super macro mode
  • FIG14 is a schematic flow chart of a method for switching cameras provided in an embodiment of the present application.
  • FIG15 is a schematic flowchart of another method for switching cameras provided in an embodiment of the present application.
  • FIG16 is a schematic diagram of a functional relationship provided in an embodiment of the present application.
  • FIG17 is a schematic diagram of a camera in different positions according to an embodiment of the present application.
  • FIG18 is a schematic diagram of posture differences based on different positions of a camera provided in an embodiment of the present application.
  • FIG19 is a schematic flow chart of another method for switching cameras provided in an embodiment of the present application.
  • FIG20 is a schematic diagram of a graphical user interface provided in an embodiment of the present application.
  • FIG21 is a schematic diagram of another graphical user interface provided in an embodiment of the present application.
  • FIG22 is a schematic diagram of another graphical user interface provided in an embodiment of the present application.
  • FIG23 is a schematic diagram of another graphical user interface provided in an embodiment of the present application.
  • FIG24 is a schematic diagram of another graphical user interface provided in an embodiment of the present application.
  • FIG25 is a schematic diagram of a preview interface of a camera application provided in an embodiment of the present application.
  • FIG26 is a schematic diagram of a preview interface of a camera application provided in an embodiment of the present application.
  • FIG27 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • FIG. 28 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • first, second, etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features.
  • a feature defined as “first” or “second” may explicitly or implicitly include one or more of the features.
  • “multiple” means two or more.
  • the field of view angle is also called the field of view in optical engineering.
  • the size of the field of view angle determines the field of view of the optical instrument; electronic equipment
  • the field of view angle is used to indicate the maximum angle that the camera can capture when the electronic device is shooting the object.
  • field of view angle can also be referred to as "field of view range”, “field of view range”, “field of view area” and the like.
  • 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 is, the larger the distance between the lens and the sensor is, that is, the closer the distance between the electronic device and the photographed object is; the smaller the distance parameter is, the smaller the distance between the lens and the sensor is, that is, the farther the distance between the electronic device and the photographed object is.
  • the distance parameter can be called a "code value"; or, the distance parameter can also be called a lens position.
  • OTP is a type of memory in MCU, which is used to indicate one-time programming. It usually adopts a fuse structure, and the programming process is an irreversible destructive activity.
  • the OTP data is data stored in the device of the camera; the OTP data will not change with the change of the shooting scene or the shooting object.
  • the OTP data includes a mapping relationship between the code value of the camera and the object distance; the object distance refers to the object distance between the electronic device and the photographed object; the code value is used to indicate the moving distance of the motor output when the camera in the electronic device focuses.
  • the zoom ratio is used to indicate the zoom level of an electronic device when taking photos.
  • An electronic device may include multiple cameras; for example, the multiple cameras may include a main camera and an auxiliary camera; when the electronic device captures images, the image captured by the main camera is usually used 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 the fusion of the images captured by the two cameras and obtain the displayed image after processing, so as to achieve functions such as improving shooting quality, background blur, and optical zoom.
  • the electronic device is in single-camera mode when capturing images, that is, the electronic device turns on one camera to capture images, the camera is the main camera.
  • the electronic device is in dual-camera mode when capturing images, that is, the electronic device turns on two cameras to capture images; one camera is the main camera and the other camera is the auxiliary camera; when capturing images, the image captured by the main camera is usually used 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 the fusion of the images captured by the two cameras and obtain the displayed image after processing, so as to improve the shooting quality, background blur, optical zoom and other functions.
  • the dual cameras in an electronic device may be a wide-angle camera and a telephoto camera; wherein the wide-angle camera may be used as a main camera, and the telephoto camera may be used as an auxiliary camera; the image captured by the wide-angle camera is used as a reference, and in the process of processing the image captured by the wide-angle camera, the image information of the distant object captured by the telephoto camera can be extracted, so that the images captured by the wide-angle camera and the telephoto camera can be fused, and the detail information of the distant object can be supplemented by the telephoto camera; and the displayed image is obtained after processing, so that the electronic device has a farther optical zoom when shooting.
  • the dual-camera mode in the electronic device may also include: a wide-angle camera and an ultra-wide-angle camera, a color camera and a black-and-white camera, a color camera and a depth camera, etc.
  • the electronic device is in multi-camera mode when capturing images, for example, the electronic device is in triple-camera mode when capturing images, then three cameras can be turned on when the electronic device captures images; the three cameras include a main camera and two auxiliary cameras; when capturing images, the image captured by the main camera is usually used 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 the fusion of the images captured by the three cameras and obtain the displayed image after processing, so as to improve the shooting quality, background blur, optical zoom and other functions.
  • the multi-camera mode in an electronic device may include a wide-angle camera, a black-and-white camera, and a near-infrared camera; wherein the wide-angle camera can be the main camera, and the black-and-white camera and the near-infrared camera can be auxiliary cameras.
  • the wide-angle camera can be used to obtain the main image
  • the black-and-white camera can be used to supplement the detailed image information of the dark light area of the object
  • the near-infrared camera can be used to supplement the detailed information of the distant view of the object.
  • 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 for shooting when the zoom ratio of the electronic device is between 1x (1 ⁇ ) and 2x (2 ⁇ ).
  • the electronic device is in a shooting scene from far to near; for example, when the position of the electronic device remains unchanged, the zoom center of the electronic device at the first moment is the first shooting object; at the second moment, the zoom center of the electronic device is the second shooting object, the first shooting object is farther away from the electronic device, and the second shooting object is closer to the electronic device; 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 of the electronic device when shooting.
  • 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, the distance between the second shooting object and the electronic device is d2, and d2 is less than d1;
  • FIG. 1 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, the distance between the second shooting object and the electronic device is d2, and d2 is less than d1;
  • the electronic device 100 includes a camera module 272; during the shooting process, the electronic device maintains a constant position; the electronic device turns on a camera application, and at a first moment the electronic device focuses on the first shooting object 260, and the electronic device can display a display interface 280; at this time, the zoom ratio of the electronic device is 1 ⁇ (understandable , it can also be any value between 1 ⁇ and 2 ⁇ , or other values, which are not limited in the embodiments of the present application); as shown in (b) in Figure 1, at the second moment, the electronic device maintains 1 ⁇ (it can be understood that it can also be any value between 1 ⁇ and 2 ⁇ , or other values, which are not limited in the embodiments of the present application) and changes the photographic object; for example, the electronic device focuses on the second photographic object 270.
  • the zoom ratio of the electronic device is 1 ⁇ (understandable , it can also be any value between 1 ⁇ and 2 ⁇ , or other values, which are not limited in the embodiments of the present application); as shown in (b) in Figure
  • the electronic device recognizes that the distance between the second photographic 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.
  • the shooting scene of the electronic device from far to near may also refer to the electronic device shooting the same object, the electronic device moves, and the distance between the electronic device and the object gradually decreases.
  • the electronic device 100 is in a shooting scene from far to near; for example, when the position of the shooting object remains unchanged, the electronic device 100 moves during the shooting process; the distance between the shooting object and the electronic device 100 is from far to near, and the electronic device 100 can recognize based on the parameters of the camera module that the distance between the electronic device and the shooting object is close, and the electronic device can automatically use the ultra-wide-angle camera as the main camera and enter the super macro mode to increase the distance between the shooting object and the electronic device 100.
  • the position of the second photographic object 270 remains unchanged during the shooting process; at the first moment, the electronic device 100 is located at the first position for shooting, and the distance between the electronic device and the second photographic object 270 is d2; as shown in (b) in FIG. 3 , the electronic device 100 moves from the first position to the second position for shooting; at this time, the distance between the electronic device 100 and the second photographic object 270 is d3, and d3 is less than d2; the electronic device 100 recognizes that the distance between the second photographic object 270 and the electronic device 100 is relatively close, and the electronic device 100 can automatically use the ultra-wide-angle camera as the main camera and enter the super macro mode to increase the field of view of the electronic device when shooting.
  • the electronic device is in a shooting scene from far to near; for example, when the position of the electronic device remains unchanged, the shooting object of the electronic device is a moving shooting object; the distance between the moving shooting object and the electronic device 100 is from far to near, and the electronic device 100 can automatically switch to the shooting mode of the ultra-wide-angle camera as the main camera when it recognizes that the distance between the electronic device and the shooting object is close based on the parameters of the camera module.
  • the electronic device 100 when the position of the electronic device remains unchanged, at a first moment, the third photographic object 283 is located at a first position, and the electronic device 100 photographs the third photographic object 283; as shown in (b) in FIG. 4 , at a second moment, the electronic device 100 recognizes that the third photographic object 283 has moved to a second position based on the parameters of the shooting module, and when the electronic device 100 recognizes that the distance between the third photographic object 283 and the electronic device 100 is relatively close, the electronic device 100 can automatically use the ultra-wide-angle camera as the main camera and enter the super macro mode to increase the field of view of the electronic device when shooting.
  • Super telephoto mode refers to a shooting mode in which an electronic device automatically uses the telephoto camera as the main camera to capture images.
  • the electronic device is in a shooting scene from near to far; for example, when the position of the electronic device remains unchanged, the zoom center of the electronic device at the first moment is the first shooting object; at the second moment, the zoom center of the electronic device is the fourth shooting object, the first shooting object is closer to the electronic device, and the fourth 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 telephoto mode to increase the detail information of the telephoto object.
  • the same shooting scene includes a first shooting object 260 and a fourth shooting object 281, the distance between the first shooting object 260 and the electronic device 100 is d3, the distance between the fourth shooting object 281 and the electronic device 100 is d4, and d3 is less than d4;
  • FIG. 1 the same shooting scene includes a first shooting object 260 and a fourth shooting object 281, the distance between the first shooting object 260 and the electronic device 100 is d3, the distance between the fourth shooting object 281 and the electronic device 100 is d4, and d3 is less than d4;
  • the electronic device 100 includes a camera module 272; during the shooting process, the electronic device 100 maintains an unchanged position; the electronic device 100 turns on the camera application, and at the first moment the electronic device 100 focuses on the first shooting object 260 , 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; as shown in (b) of Figure 5, at the second moment, the electronic device 100 changes the shooting object; for example, the electronic device 100 focuses on the fourth shooting object 281.
  • the electronic device 100 recognizes that the distance between the fourth shooting object 281 and the electronic device 100 is far, and 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 to focus, and display the display interface 291.
  • the electronic device 100 is in a shooting scene from near to far; for example, when the position of the shooting object remains unchanged, the electronic device 100 moves during the shooting process; the distance between the shooting object and the electronic device 100 is from near to far, the electronic device 100 can identify based on the parameters of the camera module that the distance between the electronic device and the shooting object is far, the electronic device can automatically use the telephoto camera as the main camera and enter the super telephoto mode to increase the detail information of the telephoto object.
  • the position of the second photographic object 270 remains unchanged during the shooting process; at the first moment, the electronic device 100 is located at the second position for shooting, and the distance between the electronic device 100 and the second photographic object 270 is d3; as shown in (b) of FIG.
  • the electronic device 100 moves from the second position to the first position for shooting; at this time, the distance between the electronic device 100 and the second photographic object 270 is d2, and d2 is greater than d3; the electronic device 100 recognizes that the distance between the second photographic object 270 and the electronic device 100 is far, and the electronic device can automatically use the telephoto camera as the main camera and enter the super telephoto mode to increase the detail information of the telephoto object.
  • the electronic device is in a shooting scene from near to far; for example, when the position of the electronic device remains unchanged, the shooting object of the electronic device is a moving shooting object; the distance between the moving shooting object and the electronic device 100 is from near to far, the electronic device 100 can identify that the distance between the electronic device and the shooting object is far based on the parameters of the camera module, and the electronic device can automatically use the telephoto camera as the main camera and enter the super telephoto mode to increase the detail information of the telephoto object.
  • the third subject 283 when the position of the electronic device remains unchanged, at a first moment, the third subject 283 is located at the second position, and the electronic device 100 photographs the third subject 283; as shown in (b) in FIG. 8 , at a second moment, the third subject 283 moves to the first position, and the electronic device 100 recognizes that the distance between the third subject 283 and the electronic device 100 is far, and the electronic device can automatically use the telephoto camera as the main camera and enter the super telephoto mode to increase the detail information of the telephoto subject.
  • the shooting device (for example, camera) on the electronic device usually uses an autofocus system for focusing.
  • the autofocus system is mainly composed of a lens, a motor, a motor driver chip and a photosensitive chip.
  • the lens and the photosensitive chip are the main components of imaging
  • the motor and the motor driver chip are the main components of autofocus.
  • the distance between the lens and the photosensitive chip is also called the focal length.
  • the position of the photographed object from the camera is different, and the corresponding imaging position is different. It is necessary to adjust the distance (focal length) between the lens and the photosensitive chip so that a clear image can be obtained on the photosensitive chip.
  • the autofocus system usually adjusts the focal length by moving the lens driven by a motor.
  • An open-loop motor is a motor that drives the lens to move.
  • the distance the lens moves is determined by the input current. There is no feedback signal to correct the distance moved during the movement of the lens.
  • the motor driver chip of the open-loop motor inputs the current value, and the output is the distance the lens moves. The motor driver chip will not adjust the output distance according to the actual distance the lens moves. Therefore, the focus setting using an open-loop motor is usually not very accurate.
  • the closed-loop motor Compared with the open-loop motor, the closed-loop motor adds a Hall chip to the lens, which senses the magnetic flux of the surrounding magnets through the Hall chip, and then calculates the actual position of the lens.
  • the closed-loop motor can input the actual position of the lens as a feedback signal into the motor driver chip, and the motor driver chip adjusts the output moving distance according to the feedback signal.
  • the closed-loop motor can use the actual moving position of the lens as a feedback signal to accurately adjust the position of the lens, with high imaging quality.
  • FIG. 9 shows a hardware system of an electronic device suitable for the present application.
  • the electronic device 100 may be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, etc.
  • the specific type of the electronic device 100 is not limited to the following embodiments. No restrictions.
  • the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
  • the structure shown in FIG9 does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than those shown in FIG9, or the electronic device 100 may include a combination of some of the components shown in FIG9, or the electronic device 100 may include sub-components of some of the components shown in FIG9.
  • the components shown in FIG9 may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU).
  • AP application processor
  • GPU graphics processor
  • ISP image signal processor
  • controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
  • the processor 110 can be used to execute the method of switching cameras in an embodiment of the present application; for example, running a camera application in an electronic device; displaying a first image, where the first image is obtained by the first camera acting as a main camera to capture an image; determining whether the first distance and the second distance meet a first preset condition, where the first distance and the second distance are used to indicate the object distance between the electronic device and the photographed object, the first distance being the object distance obtained based on the parameters of the first camera, and the second distance being the object distance obtained based on the parameters of the second camera; when the first distance and the second distance meet the first preset condition, displaying the second image, where the second image is obtained by the second camera acting as the main camera to capture an image.
  • connection relationship between the modules shown in Fig. 9 is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100.
  • the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.
  • the wireless communication function of the electronic device 100 can be implemented through components such as the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.
  • Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 can be used to cover Single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.
  • antenna 1 can be reused as a diversity antenna for a wireless local area network.
  • the antenna can be used in combination with a tuning switch.
  • the electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor.
  • the GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
  • Display screen 194 may be used to display images or videos.
  • the display screen 194 may be used to display the second image.
  • the electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted to the camera photosensitive element through the camera. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye.
  • the ISP can perform algorithm optimization on the noise, brightness and color of the image. The ISP can also optimize the exposure and color temperature of the shooting scene and other parameters. In some embodiments, the ISP can be set in the camera 193.
  • the camera 193 (also referred to as a lens) is used to capture static images or videos. It can be triggered to start by application instructions to realize the photo function, such as taking pictures of any scene.
  • the camera may include components such as an imaging lens, a filter, and an image sensor. The light emitted or reflected by the object enters the imaging lens, passes through the filter, and finally converges on the image sensor.
  • the imaging lens is mainly used to converge the light emitted or reflected by all objects in the camera angle (also referred to as the scene to be photographed, the target scene, or the scene image that the user expects to shoot) to form an image;
  • the filter is mainly used to filter out the excess light waves in the light (for example, light waves other than visible light, such as infrared);
  • the image sensor may be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor.
  • CMOS complementary metal oxide semiconductor
  • the image sensor is mainly used to perform photoelectric conversion on the received light signal, convert it into an electrical signal, and then transmit the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • the DSP converts the digital image signal into an image signal in a standard RGB, YUV, etc. format.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • the camera 193 can be located on the 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 needs, and this application does not impose any restrictions.
  • the electronic device 100 includes a front camera and a rear camera.
  • the front camera or the rear camera may include one or more cameras.
  • the electronic device 100 has four rear cameras. In this way, when the electronic device 100 starts the four rear cameras for shooting, the method for switching cameras provided in the embodiment of the present application can be used.
  • the camera is arranged on an external accessory of the electronic device 100, and the external accessory is rotatably connected to the frame of the mobile phone, and the angle formed between the external accessory and the display screen 194 of the electronic device 100 is any angle between 0-360 degrees.
  • the external accessory drives the camera to rotate to a position facing the user.
  • the mobile phone has multiple cameras, only some of the cameras can be arranged on the external accessories, and the remaining cameras can be arranged on the electronic device 100 body. The embodiment of the present application does not impose any restrictions on this.
  • Digital signal processors are used to process digital signals. In addition to processing digital image signals, they 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.
  • Video codecs are used to compress or decompress digital videos.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
  • MPEG Moving Picture Experts Group
  • MPEG2 MPEG2, MPEG3, and MPEG4.
  • the gyro sensor 180B can be used to determine the motion posture of the electronic device 100.
  • the angular velocity of the electronic device 100 around three axes i.e., the x-axis, the y-axis, and the z-axis
  • the gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used in scenes such as navigation and somatosensory games.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally the x-axis, y-axis and 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 applications such as horizontal and vertical screen switching and pedometers.
  • the distance sensor 180F is used to measure the distance.
  • the electronic device 100 can measure the distance by infrared or laser. In some embodiments, for example, in a shooting scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • 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 perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
  • 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 calls.
  • the touch sensor 180K is also called a touch control device.
  • the touch sensor 180K can be set on the display screen 194.
  • the touch sensor 180K and the display screen 194 form a touch screen, which is also called a touch control screen.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor 180K can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K can also be set on the surface of the electronic device 100 and set at a different position from the display screen 194.
  • the hardware system of the electronic device 100 is described in detail above, and the software system of the electronic device 100 is introduced below.
  • FIG. 10 is a schematic diagram of a software system of an electronic device provided in an embodiment of the present application.
  • 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 .
  • the application layer 210 may include camera applications, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the application framework layer 220 provides an application programming interface (API) and a programming framework for the applications in the application layer; the application framework layer may include some predefined functions.
  • API application programming interface
  • the application framework layer 220 may include a camera access interface; the camera access interface may include camera management and camera devices. Among them, camera management may be used to provide an access interface for managing cameras; camera devices may be used to provide access interfaces. Ask about the camera interface.
  • the hardware abstraction layer 230 is used to abstract the hardware.
  • the hardware abstraction layer may include a camera abstraction layer and other hardware device abstraction layers.
  • the hardware abstraction layer 230 includes a camera hardware abstraction layer and a camera algorithm.
  • the camera hardware abstraction layer can call the camera algorithm; the camera algorithm can include a software algorithm for image processing.
  • the camera algorithm library may include algorithms corresponding to the method for switching cameras provided in the embodiments of the present application.
  • the algorithm in the camera algorithm may refer to a code that does not rely on specific hardware implementation; for example, a code that can generally be run in a CPU, etc.
  • the driver layer 240 is used to provide drivers for different hardware devices.
  • the driver layer may include a camera driver.
  • the hardware layer 250 is located at the bottom layer of the operating system; as shown in FIG10 , the hardware layer 250 may include camera 1, camera 2, camera 3, etc. Among them, camera 1, camera 2, camera 3 may correspond to multiple cameras on the electronic device.
  • 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 in detail the camera and interface on the electronic device 100 to which the camera switching method provided in the embodiment of the present application is applicable.
  • the electronic device to which the camera switching method provided in the embodiment of the present application is applicable has at least multiple cameras 193, for example, three types of cameras 193; the three types of cameras are respectively a main camera (for example, a wide-angle camera), an ultra-wide-angle camera and a telephoto camera; the three cameras can be used to shoot the same scene to be shot.
  • the three types of cameras are respectively a main camera (for example, a wide-angle camera), an ultra-wide-angle camera and a telephoto camera; the three cameras can be used to shoot the same scene to be shot.
  • the electronic device 100 may also have other cameras 193, and the type of cameras 193 and the number of each camera 193 may be set as needed, and the embodiment of the present application does not impose any limitation on this.
  • the electronic device 100 may have three cameras 193; the arrangement of the three cameras may be as shown in (a) of FIG11 , or as shown in (b) of FIG11 ; for example, the three cameras 193 may be a main camera 1931 (for example, a wide-angle camera), an ultra-wide-angle camera 1932, and a telephoto camera 1933.
  • the three cameras 193 may be a main camera 1931 (for example, a wide-angle camera), an ultra-wide-angle camera 1932, and a telephoto camera 1933.
  • the field of view angle range corresponding to the main camera 1931 is usually larger than that corresponding to the telephoto camera 1933; and the field of view angle range corresponding to the ultra-wide-angle camera 1932 is larger than that corresponding to the main camera 1931; there may be 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 capture the scene content captured by the main camera 1931 and the scene content around it.
  • the field of view of the telephoto camera 1933 is smaller than that of the main camera 1931, and the field of view of the main camera 1931 may overlap with that of the telephoto camera 1933; that is, the main camera 1931 can capture the scene content captured by the telephoto camera 1933 and the surrounding scene content.
  • the field of view of the ultra-wide-angle camera 1932 may overlap with that of the telephoto camera 1933; that is, the ultra-wide-angle camera 1932 can capture the scene content captured by the telephoto camera 1933 and the surrounding scene content.
  • the ultra-wide-angle camera 1932 is suitable for shooting close scenes due to its smaller focusing distance; and, as the name suggests, the ultra-wide-angle camera 1932 is suitable for shooting scenes with a larger field of view; the main camera 1931 is more suitable for shooting portraits due to its higher clarity, and the telephoto camera 1933 is more suitable for shooting distant close-ups.
  • the zoom ratio of the ultra-wide-angle camera may be less than M times the zoom ratio;
  • the zoom ratio of the main camera can range from [M, N); the zoom ratio of the telephoto camera can be greater than or equal to N times the zoom ratio.
  • M can be 1 and N can be 3.5; then the zoom ratio of the ultra-wide-angle camera is less than 1x zoom ratio (1 ⁇ ); the zoom ratio range of the wide-angle camera is 1x zoom ratio to 3.5x zoom ratio [1 ⁇ 3.5 ⁇ ); the zoom ratio of the telephoto camera is greater than or equal to 3.5x zoom ratio.
  • the electronic device can automatically switch between different cameras based on the parameters of the wide-angle camera; for example, the electronic device can identify that when the distance between the electronic device and the photographed object is close based on the parameters of the wide-angle camera, it can automatically switch to use the ultra-wide-angle camera as the main camera and enter the super macro shooting mode; however, when the distance between the electronic device and the photographed object is close, the actual object distance between the electronic device and the photographed object is not within the effective range of the distance acquisition parameters of the wide-angle camera, resulting in reduced accuracy of the parameters of the wide-angle camera; making it easy for the electronic device to automatically exit the super macro shooting mode when shooting in the super macro shooting mode, resulting in poor stability of the super macro shooting mode; for example, based on the wide-angle camera
  • the effective object distance range mapped by the parameters is 8cm ⁇ 5m; if the actual object distance between the electronic device and the photographed object is less than 8cm, the distance between the electronic device and the photographed object
  • an embodiment of the present application provides a method for switching cameras and an electronic device, the method is applied to an electronic device, the electronic device includes a camera module, the camera module includes a first camera (for example, an ultra-wide-angle camera) and a second camera (for example, a wide-angle camera), the method includes: running a camera application in the electronic device; displaying a first image, the first image is obtained by the first camera acting as a main camera to capture an image; determining whether a first distance and a second distance meet a first preset condition, wherein the first distance and the second distance are used to indicate an object distance between the electronic device and a photographed object, the first distance is an object distance obtained based on parameters of the first camera, and the second distance is an object distance obtained based on parameters of the second camera; when the first distance and the second distance meet the first preset condition, displaying a second image, the second image is obtained by the second camera acting as the main camera to capture an image.
  • the first camera for example, an ultra-wide-angle camera
  • the electronic device when the first distance and the second distance meet the first preset condition, switches to using the second camera as the main camera; since the first distance is the object distance obtained according to the parameters of the first camera, and the second distance is the object distance obtained according to the parameters of the second camera; therefore, in an embodiment of the present application, when judging whether to switch to the second camera as the main camera, it is determined whether to switch the camera based on dual restrictions; compared with the existing solution in which whether to switch the camera is determined only based on the parameters of the second camera, the method for switching cameras provided in the embodiment of the present application is more stable.
  • the method for switching cameras in the embodiments of the present application can be applied to photo shooting scenarios (for example, single-view photo shooting, dual-view photo shooting, etc.), preview scenes, video recording scenes, or video call scenes, etc.; through the method for switching cameras in the embodiments of the present application, it is possible to automatically switch different cameras in the electronic device based on the acquired lens position and zoom value without relying on the laser sensor in the electronic device, thereby improving the user's shooting experience and image quality.
  • the preview scenarios include but are not limited to the following scenarios:
  • Photo preview aperture preview, night scene preview, portrait preview, video preview or professional preview, etc.
  • the preview scene may refer to a scene in which the electronic device captures an image before a button indicating shooting is clicked in a certain shooting mode.
  • the default camera mode can be turned on; in the camera mode, the electronic device can enter the default shooting mode, and the default shooting mode can refer to a shooting mode in which the wide-angle camera is used as the main camera and the zoom ratio is a single zoom ratio (1 ⁇ ); the default shooting mode is a non-super macro focal length mode.
  • the distance parameter for example, code value
  • zoom ratio for example, zoom value
  • the method for switching cameras in the embodiment of the present application can also be applied to a scene of recording a video, or a scene of a video call, wherein the scene of a video call can include but is not limited to the following scenes:
  • Fig. 14 is a schematic flow chart of a method for switching cameras provided in an embodiment of the present application. The method can be performed by the electronic device shown in Fig. 14; the method 300 includes steps S310 to S340, and steps S310 to S340 are described in detail below.
  • Step S310 Run the camera application.
  • the user may instruct the electronic device to run the camera application by clicking the icon of the “Camera” application.
  • the user can instruct the electronic device to run the camera application by sliding the gesture to the right on the display screen of the electronic device.
  • the electronic device is in the lock screen state, and the lock screen interface includes an icon of the camera application.
  • the user instructs the electronic device to run the camera application by clicking the icon of the camera application.
  • the application has the permission to call the camera application; the user can instruct the electronic device to run the camera application by clicking the corresponding control.
  • the electronic device is running an instant messaging application, the user can instruct the electronic device to run the camera application by selecting the control of the camera function.
  • running the camera application may refer to launching the camera application.
  • Step S320 display the first image.
  • the first image is obtained by capturing an image with the first camera acting as the main camera.
  • displaying the first image includes: displaying the first image when the electronic device is in a super macro mode.
  • the first image is an image displayed when the electronic device is in a super macro mode; when the electronic device is in the super macro mode, the ultra-wide-angle camera in the electronic device serves as the main camera.
  • 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 for shooting when the zoom ratio is between 1x (1 ⁇ ) and 2x (2 ⁇ ).
  • displaying a first image includes:
  • a first image is displayed on a first display interface of the electronic device.
  • the first display interface also includes a first icon, and the first icon is used to indicate a super macro mode.
  • the first display interface is as shown in (d) of FIG. 20 ; the first icon may be the icon 606 shown in (d) of FIG. 20 .
  • the first icon includes a first control and further includes:
  • a first operation on a first control is detected; in response to the first operation, the electronic device exits the super macro mode.
  • the first operation may refer to turning off the super macro mode; for example, as shown in (d) in Figure 20, the first icon may refer to icon 606, the first control may refer to the “ ⁇ ” in icon 606, and the first operation may refer to clicking the “ ⁇ ” in “Super Macro ⁇ ”, and the electronic device may 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.
  • displaying the first image includes:
  • the first image is displayed.
  • the wide-angle camera in the electronic device serves as the main camera; when the electronic device detects that the brightness parameter of the shooting environment is greater than the second brightness threshold, it indicates that the shooting environment of the electronic device is not a darker shooting scene; if the second distance parameter is less than or equal to the third preset threshold, the distance between the electronic device and the shooting object obtained based on the parameters collected by the wide-angle camera is closer; at this time, the electronic device can enter the super macro mode and display the first image.
  • the electronic device when the electronic device enters the super macro mode, it can be determined whether the electronic device enters the super macro mode based on the brightness of the shooting scene of the electronic device and the second distance; compared with determining whether the electronic device enters the super macro mode based on the first distance, the accuracy of entering the super macro mode in the embodiment of the present application is higher.
  • the second brightness threshold is a preset threshold obtained based on a second brightness range, and the second brightness range is used to represent an effective brightness range for focusing of the second camera.
  • the brightness range for effective focusing of the second camera is [L1, L2], and the second brightness threshold is greater than or equal to L1.
  • Step S330 Determine whether the first distance and the second distance satisfy a first preset condition.
  • the first distance and the second distance are used to indicate the object distance between the electronic device and the photographed object, the first distance is the object distance obtained based on the parameters of the first camera, and the second distance is the object distance obtained based on the parameters of the second camera.
  • the first distance and the second distance satisfy a first preset condition, including:
  • the first distance is greater than a first preset threshold
  • the second distance is greater than a second preset threshold, wherein the first preset threshold is different from the second preset threshold.
  • the electronic device includes a camera module, which includes a first camera and a second camera; the first distance between the electronic device and the subject can be obtained according to the parameters of the first camera; the second distance between the electronic device and the subject can be obtained according to the parameters collected by the second camera.
  • the first distance may be a distance between the electronic device and the photographed object obtained according to a code value collected by the ultra-wide-angle camera.
  • the second distance may be a code value between the electronic device and the photographed object obtained according to a code value collected by a wide-angle camera.
  • the code value is used to represent the moving distance of the motor output when the electronic device camera focuses; the object distance between the electronic device and the photographed object can be mapped according to the code value.
  • the first preset threshold is a preset threshold obtained based on a first distance range, and the first distance range is used to represent an effective distance range for focusing of the first camera.
  • the effective focus distance range of the first camera is [X1, X2], and the first preset threshold is greater than or equal to X1.
  • the second preset threshold is a preset threshold obtained based on a second distance range, and the second distance range is used to represent an effective distance range for focusing of the second camera.
  • the effective focus distance range of the second camera is [X3, X4], and the second preset threshold is greater than or equal to X3.
  • the method further includes:
  • the parameters of the first camera can be compensated; for example, the code value output by the ultra-wide-angle camera can be compensated so that the accuracy of the code value is higher; when the code value accuracy is higher, the first distance between the electronic device and the photographed object is more accurate.
  • Step S340 Display the second image when the first distance and the second distance satisfy a first preset condition.
  • the second image is obtained by capturing an image with the second camera acting as the main camera.
  • the electronic device when the first distance and the second distance meet preset conditions, the electronic device will use the second camera as the main camera to display the second image; since the first distance is the object distance obtained according to the parameters of the first camera, and the second distance is the object distance obtained according to the parameters of the second camera; therefore, in an embodiment of the present application, when judging whether to switch to the second camera as the main camera, it will be determined whether to switch the camera based on dual restrictions; compared with the existing solution in which whether to switch the camera is determined only based on the parameters of the second camera, the method for switching cameras provided in the embodiment of the present application is more stable.
  • the electronic device when the electronic device is in the super macro mode, can use the ultra-wide-angle camera (an example of the first camera) as the main camera to display the first image; when the electronic device determines that the first distance between the electronic device and the photographed object obtained based on the parameters of the ultra-wide-angle camera and the second distance between the electronic device and the photographed object obtained based on the parameters of the wide-angle camera (an example of the second camera) meet preset conditions, the electronic device exits the super macro mode; for example, when the electronic device determines that the distance between the electronic device and the photographed object is far based on the first distance and the second distance, the electronic device exits the super macro mode; if the preset conditions are not met based on the first distance and/or the second distance, the electronic device remains in the super macro mode; in an embodiment of the present application, the electronic device can determine whether to exit the super macro mode based on the parameters of the ultra-wide-angle camera and the parameters of the wide-angle camera, which can avoid, to a certain extent, the errors in the
  • it also includes:
  • the first distance and/or the second distance do not satisfy the first preset condition, determine whether the brightness parameter of the shooting scene in which the electronic device is located is less than or equal to the first brightness threshold; when the brightness parameter is less than or equal to the first brightness threshold, display the second image.
  • the electronic device may further determine whether to exit the super macro mode based on the brightness parameters of the shooting scene; because when the shooting scene in which the electronic device is located is dark, the accuracy of the parameters collected by the first camera and the parameters collected by the second camera is low; because the accuracy of the parameters collected by the first camera and the parameters collected by the second camera is low, the accuracy of the first distance and the second distance is low; at this time, the electronic device can directly exit the super macro mode.
  • the first brightness threshold is a preset threshold obtained based on a first brightness range, and the first brightness range is used to represent an effective brightness range for focusing of the first camera.
  • the first brightness threshold is located in an effective brightness range for focusing of the first camera.
  • the zoom ratio of the electronic device when displaying the first image is a first zoom ratio
  • the current zoom ratio of the electronic device is a second zoom ratio
  • the second zoom ratio is the same as the first zoom ratio; when the second zoom ratio is different from the first zoom ratio, the second image is displayed.
  • the zoom magnification of the electronic device when the first distance and/or the second distance does not satisfy a preset condition and the brightness parameter of the shooting scene in which the electronic device is located is greater than a first brightness threshold, it can be determined whether the zoom magnification of the electronic device has changed; if the zoom magnification of the electronic device has changed, the electronic device exits the super macro mode; for example, if the zoom magnification of the electronic device has changed, it may be that the user has adjusted the zoom magnification of the electronic device; at this time, the electronic device exits the super macro mode.
  • the first camera includes an ultra-wide-angle camera or a telephoto camera
  • the second camera includes a wide-angle camera
  • the first camera is an ultra-wide-angle camera
  • the second camera is a wide-angle camera
  • the ultra-wide-angle camera is used as the main camera, and the electronic device displays a first image
  • the electronic device exits the super macro mode the wide-angle camera is used as the main camera, and the electronic device displays a second image.
  • the first camera is a telephoto camera and the second camera is a wide-angle camera; when the electronic device is in a super telephoto mode, the telephoto camera is used as the main camera, and the electronic device displays a first image; when the electronic device exits the super telephoto mode, the wide-angle camera is used as the main camera, and the electronic device displays a second image.
  • the position of the electronic device is the same.
  • the position of the electronic device may remain unchanged during the shooting process. If the focus object of the electronic device moves from a distant shooting object to a close-up shooting object, the electronic device may automatically identify the distance between the electronic device and the shooting object and enter the super macro mode; if the focus object of the electronic device moves from a close-up shooting object to a distant shooting object, the electronic device may automatically identify the distance between the electronic device and the shooting object and exit the super macro mode; the electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • the first image includes a first photographed object
  • the second image includes a second photographed object
  • the first photographed object The first photographed object and the second photographed object are at the same position
  • the distance between the first photographed object and the electronic device is a third distance
  • the distance between the second photographed object and the electronic device is a fourth distance
  • the third distance is smaller than the fourth distance
  • the position of the electronic device may change during the shooting process; for example, the electronic device may be moved to shoot different subjects (for example, a first subject and a second subject); when the focus object of the electronic device moves from a close-up subject to a distant subject, the electronic device may automatically identify the distance between the electronic device and the subject and exit the super macro mode; the electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • the electronic device may be moved to shoot different subjects (for example, a first subject and a second subject); when the focus object of the electronic device moves from a close-up subject to a distant subject, the electronic device may automatically identify the distance between the electronic device and the subject and exit the super macro mode; the electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • the first image and the second image include a third photographic object, and when the first image and the second image are displayed, the third photographic object is located at the same position; when capturing the first image, the distance between the third photographic object and the electronic device is a fifth distance; when capturing the second image, the distance between the third photographic object and the electronic device is a sixth distance, and the fifth distance is smaller than the sixth distance.
  • the position of the electronic device may change during the shooting process; for example, the electronic device may move to shoot the same subject (for example, a third subject); when the focus object of the electronic device moves from a close-up subject to a distant subject, the electronic device may automatically identify the distance between the electronic device and the subject and exit the super macro mode; the electronic device may automatically switch different types of cameras as the main camera, thereby ensuring the image quality of the captured image.
  • the electronic device when the first distance and the second distance meet the first preset condition, switches to use the second camera as the main camera to display the second image; since the first distance is the object distance obtained according to the parameters of the first camera, and the second distance is the object distance obtained according to the parameters of the second camera; therefore, in an embodiment of the present application, when judging whether to switch to the second camera as the main camera, it is determined whether to switch the camera based on dual restrictions; compared with the existing solution in which whether to switch the camera is judged only based on the parameters of the second camera, the method for switching cameras provided in the embodiment of the present application is more accurate, that is, the shooting mode in the electronic device is more stable.
  • Fig. 15 is a schematic flow chart of a method for switching cameras provided in an embodiment of the present application. The method may be executed by the electronic device shown in Fig. 9; the method 400 includes steps S410 to S444, and steps S410 to S444 are described in detail below.
  • Step S410 Run the camera application.
  • a user can instruct an electronic device to run a camera application by clicking on the icon of the "Camera" application.
  • the electronic device when the electronic device is in a lock screen state, the user can instruct the electronic device to run a camera application by sliding to the right on the display screen of the electronic device.
  • the electronic device is in a lock screen state, and the lock screen interface includes an icon of a camera application, and the user instructs the electronic device to run the camera application by clicking on the icon of the camera application.
  • the application has the permission to call the camera application; the user can instruct the electronic device to run the camera application by clicking on the corresponding control.
  • the electronic device when the electronic device is running an instant messaging application, the user can instruct the electronic device to turn on the camera application by selecting the control of the camera function.
  • Step S420 determining whether the electronic device is in the super macro mode; if the electronic device is in the super macro mode, executing step S430; if the electronic device is not in the super macro mode, executing step S440.
  • the super macro mode may be a shooting mode of an electronic device; the super macro shooting mode refers to When the zoom ratio of the electronic device is between 1x (1 ⁇ ) and 2x (2 ⁇ ), the electronic device automatically switches to a shooting mode in which the ultra-wide-angle camera is used as the main camera for shooting.
  • a label of the current shooting mode of the electronic device may be obtained, and whether the electronic device is in the super macro mode may be determined according to the label of the shooting mode.
  • Step S430 Acquire data from the ultra-wide-angle camera and the wide-angle camera.
  • the ultra-wide-angle camera is used as the main camera for shooting; at this time, the wide-angle camera can also be in operation, but the data collected by the wide-angle camera is not used for display.
  • the data of the ultra-wide-angle camera may include a functional relationship 1 and a code value; wherein the functional relationship 1 is used to represent a mapping relationship between parameter 1 (object distance 2) and parameter 2 (code value collected by the ultra-wide-angle camera).
  • OTP data of the ultra-wide-angle camera can be obtained.
  • the OTP data is data stored in the ultra-wide-angle camera device.
  • the OTP data includes function relationship 1; for example, function relationship 1 is shown in Figure 16; Figure 16 is a schematic diagram of the curve relationship between distance (object distance) and code value.
  • the data of the wide-angle camera may include a functional relationship 2 and a code value; wherein the functional relationship 2 is used to represent a mapping relationship between parameter 3 (object distance 1) and parameter 4 (code value collected by the wide-angle camera).
  • OTP data of the ultra-wide-angle camera may be obtained, where the OTP data of the ultra-wide-angle camera is data stored in the ultra-wide-angle camera device, and the OTP data includes functional relationship 1.
  • OTP data of the wide-angle camera may be acquired, where the OTP data of the wide-angle camera is data stored in a wide-angle camera device, and the OTP data includes functional relationship 1.
  • the code value may include a voice coil motor (VCM) code value.
  • VCM voice coil motor
  • OTP data is a type of memory data, that is, data stored in the device that cannot be changed.
  • Step S431 determine whether the ultra-wide-angle camera includes an open-loop motor; if the ultra-wide-angle camera includes an open-loop motor, execute step S432; if the ultra-wide-angle camera does not include an open-loop motor, execute step S434.
  • the driving chip in the open-loop motor will not adjust the output moving distance according to the actual moving distance of the lens; therefore, the accuracy of the moving distance of the lens output by the open-loop motor is low; when the accuracy of the moving distance of the lens is low, the accuracy of the object distance between the electronic device and the photographed object is also low; in an embodiment of the present application, if the camera includes an open-loop motor, the lens distance output by the open-loop motor can be corrected, that is, step S442 is executed; thereby improving the accuracy of the object distance between the electronic device and the photographed object.
  • Step S432 Compensate the code value of the ultra-wide-angle camera.
  • the lens in the camera is in an upward posture; as shown in (b) of FIG. 17 , the lens in the camera is in a horizontal posture; as shown in (c) of FIG. 17 , the lens in the camera is in a downward posture; for example, for the same object distance between the electronic device and the photographed object, it is reasonable that the distance moved by the lens in (a) of FIG. 17 , (b) of FIG. 17 , and (c) of FIG. 17 is the same; however, due to the effect of gravity, under the same object distance, there is a difference between the horizontal posture of the lens and the upward posture, or the downward posture, as shown in FIG. 18 . Therefore, in the case where the camera includes an open-loop motor, the parameters of the camera can be compensated according to the different postures of the camera.
  • a positive compensation value is superimposed on the lens movement distance output by the camera
  • a negative compensation value is superimposed on the lens movement distance output by the camera
  • the positive compensation value or the negative compensation value can be obtained by pre-calibrating the data of the same camera at different object distances to obtain multiple groups of pre-selected calibration compensation values; in the actual shooting process, the lens movement distance output by the ultra-wide-angle camera, i.e., the code value, can be compensated according to the position of the camera (for example, the camera is facing up or the camera is facing down).
  • the calibration data includes ⁇ 1 and ⁇ 2; wherein ⁇ 1 is used for the difference in lens movement processing when the lens is horizontal and when the lens is in an upward position at the same object distance; ⁇ 2 is used for the difference in lens movement processing when the lens is horizontal and when the lens is in a downward position at the same object distance; if the lens of the electronic device is in an upward position during the current shooting, the code value is compensated by ⁇ 1; if the lens of the electronic device is in a downward position during the current shooting, the code value is compensated by ⁇ 2; wherein ⁇ 1 is a positive number and ⁇ 2 can be a negative number.
  • Step S433 Obtain the object distance 2 between the electronic device and the photographed object according to the code value after compensation processing and the function relationship 1.
  • the parameters of the ultra-wide-angle camera can be compensated; for example, the code value output by the ultra-wide-angle camera can be compensated to increase the accuracy of the code value; when the code value accuracy is higher, the object distance 2 between the electronic device and the photographed object is more accurate.
  • the code value of the ultra-wide-angle camera may be compensated according to the following formula:
  • code 2 represents the code value after compensation processing
  • code 1 represents the code value of the ultra-wide-angle camera
  • cos ⁇ is used to determine the position and posture of the camera
  • x is used to represent the calibration value
  • gx represents the data of the gravity sensor on the x-axis
  • gy represents the data of the gravity sensor on the y-axis
  • gz represents the data of the gravity sensor on the z-axis.
  • x may represent Lens Sag Compensation (lens posture difference compensation);
  • Lens Sag Compensation refers to the difference between the device and the horizontal Code when it is vertically upward and vertically downward; if g z ⁇ 0, use the vertically upward Lens Sag Compensation, that is, use a positive compensation value for compensation; if g z ⁇ 0, use the vertically downward Lens Sag Compensation, that is, use a negative compensation value for compensation.
  • cos ⁇ greater than 0 indicates that the camera is in an upward posture
  • cos ⁇ less than 0 indicates that the camera is in a downward posture
  • Step S434 When the ultra-wide-angle camera does not include an open-loop motor, the object distance 2 between the electronic device and the photographed object is obtained according to the code value and the function relationship 1.
  • the ultra-wide-angle camera includes a closed-loop motor
  • the object distance 2 between the electronic device and the photographed object can be directly obtained based on the code value of the ultra-wide-angle camera and the function relationship 1.
  • the closed-loop motor can input the actual position of the lens as a feedback signal to the motor driver chip, and the motor driver chip adjusts the output moving distance according to the feedback signal.
  • the closed-loop motor can use the actual moving position of the lens as a feedback signal to accurately adjust the position of the lens; therefore, when the ultra-wide-angle camera includes a closed-loop motor, the accuracy of the code value of the ultra-wide-angle camera is higher, and there is no need to compensate the code value of the ultra-wide-angle camera.
  • Step S435 determine whether the object distance 1 meets the first preset threshold, and whether the object distance 2 meets the second preset threshold; if the object distance 1 meets the first preset threshold, and the object distance 2 meets the second preset threshold, execute step S436; if the object distance 1 does not meet the first preset threshold, and/or the object distance 2 does not meet the second preset threshold, execute step S437.
  • the first preset threshold may be a threshold corresponding to a wide-angle camera; and the second preset threshold may be a threshold corresponding to an ultra-wide-angle camera.
  • whether the object distance 1 satisfies a first preset threshold, and whether the object distance 2 satisfies a second preset threshold may mean that the object distance 1 is greater than the first preset threshold, and the object distance 2 is greater than the second preset threshold.
  • exiting the super macro mode may mean switching from the ultra-wide-angle camera as the main camera to other cameras as the main camera.
  • the electronic device may exit the super macro mode; for example, when the object distance 1 is greater than the first preset threshold and the object distance 2 is greater than the second preset threshold, the super macro mode is exited.
  • a first preset threshold value related to the wide-angle camera and a second preset threshold value related to the ultra-wide-angle camera are used for simultaneous judgment, thereby further improving the accuracy of exiting the super macro mode; avoiding the flash back problem of the super macro mode and improving the stability and robustness of the super macro mode.
  • whether to exit the super macro mode can be determined based on a frame of image; for example, for a frame of image, if object distance 1 meets a first preset threshold and object distance 2 meets a second preset threshold, the electronic device switches the camera to exit the super macro mode.
  • the electronic device may make a judgment based on multiple frames of images before switching the camera; for example, it may be judged whether the object distance 1 satisfies a first preset threshold, and the object distance 2 satisfies a second preset threshold for at least two consecutive frames of images; if the object distance 1 satisfies the first preset threshold, and the object distance 2 satisfies the second preset threshold for at least two consecutive frames of images, the electronic device switches the camera to exit the super macro mode.
  • the first preset threshold and the second preset threshold are used to more accurately determine that the object distance between the electronic device and the photographed object is far; when the object distance between the electronic device and the photographed object is far, the electronic device can exit the super macro mode; because in the embodiment of the present application, when exiting the super macro mode, the first preset threshold and the second preset threshold are used as the double thresholds; wherein the first preset threshold is the threshold of the wide-angle camera, and the second preset threshold is the threshold of the ultra-wide-angle camera; the two preset thresholds are used to determine whether to exit In the super macro mode, compared with using a single preset threshold of a wide-angle camera to determine whether to exit the super macro mode, in the embodiments of the present application, the super macro mode has better stability.
  • the electronic device may determine whether to run the super macro mode again according to steps S440 to S444 as shown in FIG. 15 .
  • Step S437 maintaining super macro mode.
  • the electronic device may maintain the super macro mode; for example, when the object distance 1 is less than or equal to the first preset threshold, and/or the object distance 2 is less than or equal to the second preset threshold, the electronic device maintains the super macro mode.
  • maintaining the super macro mode may mean not exiting the super macro mode.
  • Step S440 Acquire data from the wide-angle camera.
  • the data of the wide-angle camera may include a functional relationship 2 and a code value; wherein the functional relationship 2 is used to represent a mapping relationship between parameter 3 (object distance 1) and parameter 4 (code value collected by the wide-angle camera).
  • OTP data of the wide-angle camera may be obtained, where the OTP data of the wide-angle camera is data stored in a wide-angle camera device, and the OTP data includes functional relationship 2.
  • OTP data is a type of memory data, that is, data stored in the device that cannot be changed.
  • Step S441 Obtain the object distance 1 between the electronic device and the photographed object according to the code value of the wide-angle camera and the function relationship 2.
  • the object distance 1 corresponding to the code value can be determined.
  • Step S442 determine whether the object distance 1 meets the third preset threshold; if the object distance 1 meets the third preset threshold, execute step S443; if the object distance 1 does not meet the third preset threshold, execute step S444.
  • the third preset threshold may be 10 centimeters.
  • object distance 1 meeting the third preset threshold may mean that object distance 1 is greater than the third preset threshold
  • object distance 1 not meeting the preset threshold may mean that object distance 1 is less than or equal to the third preset threshold.
  • the electronic device since the electronic device does not include a laser sensor, the distance information between the electronic device and the photographed object cannot be obtained through the laser sensor; by obtaining the code value of the wide-angle camera, the object distance 1 between the electronic device and the photographed object is obtained; based on the object distance 1 between the electronic device and the photographed 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 photographed object is relatively close, the electronic device can use the ultra-wide-angle camera as the main camera.
  • the electronic device when the electronic device determines whether to run the super macro mode, the electronic device may be based on the object distance 1 and the brightness value of the shooting scene; if the object distance 1 is greater than a third preset threshold and the brightness value of the shooting scene is greater than the preset brightness threshold, step S443 may be executed; if the object distance 1 is less than or equal to the third preset threshold, and/or the brightness value of the shooting scene is less than or equal to the preset brightness value, step S444 is executed.
  • the electronic device when determining whether to run the super macro mode, can also determine whether to run the super macro mode according to the brightness value of the shooting scene; in a darker shooting scene, the focus accuracy is low, that is, the accuracy of the code value of the wide-angle camera is low, and it can be determined not to run the super macro mode; thereby improving the accuracy of running the super macro mode.
  • the electronic device when the electronic device determines whether to operate the super macro mode, the electronic device may determine whether to operate the super macro mode according to the object distance 1 and the brightness value of the shooting scene; if the object distance 1 is greater than the third preset threshold value and the shooting scene If the brightness value of the object is greater than the preset brightness threshold, and the current zoom ratio is 1x zoom ratio, step S443 may be executed; if the object distance 1 is less than or equal to the third preset threshold, and/or the brightness value of the shooting scene is less than or equal to the preset brightness value, and/or the current zoom ratio is not 1x zoom ratio, step S444 may be executed. For specific implementation methods, see step S552 shown in FIG. 19.
  • Step S443 running super macro mode.
  • the super macro mode is operated.
  • 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 for shooting when the zoom ratio is between 1x (1 ⁇ ) and 2x (2 ⁇ ).
  • the electronic device when the electronic device does not detect any user operation, 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 other words, the electronic device can automatically use the ultra-wide-angle camera as the main camera without detecting any operation.
  • an electronic device may include multiple cameras; for example, the multiple cameras may include a main camera and an auxiliary camera; when the electronic device captures an image, the image captured by the main camera is usually used 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 achieve the fusion of the images captured by the two cameras, and obtain the displayed image after processing, so as to achieve the functions of improving the shooting quality, background blur, optical zoom, etc.
  • the electronic device is in single-camera mode when capturing images, that is, the electronic device turns on one camera to capture images, the camera is the main camera.
  • the electronic device is in dual-camera mode when capturing images, that is, the electronic device turns on two cameras to capture images; one camera is the main camera and the other camera is the auxiliary camera; when capturing images, the image captured by the main camera is usually used 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 the fusion of the images captured by the two cameras and obtain the displayed image after processing, so as to improve the shooting quality, background blur, optical zoom and other functions.
  • the electronic device is in multi-camera mode when capturing images, for example, the electronic device is in triple-camera mode when capturing images, then three cameras can be turned on when the electronic device captures images; the three cameras include a main camera and two auxiliary cameras; when capturing images, the image captured by the main camera is usually used 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 the fusion of the images captured by the three cameras and obtain the displayed image after processing, so as to improve the shooting quality, background blur, optical zoom and other functions.
  • the electronic device can turn off the wide-angle camera; turn on the ultra-wide-angle camera, and use the ultra-wide-angle camera as the main camera.
  • the electronic device can use the ultra-wide-angle camera as the main camera, and the auxiliary camera can be fully or partially turned on.
  • the electronic device can determine whether to exit the super macro mode according to steps S430 to S437 as shown in FIG. 15 .
  • Step S444 Do not run the super macro mode.
  • not running the super macro mode may include the electronic device continuing to run the current shooting mode and not entering the super macro mode.
  • the electronic device when the object distance 1 satisfies the first preset threshold and the object distance 2 satisfies the second preset threshold, the electronic device switches to using the wide-angle camera as the main camera and exits the super macro mode; since the object distance 2 is the object distance obtained according to the parameters of the ultra-wide-angle camera, and the object distance 1 is the object distance obtained according to the parameters of the wide-angle camera; therefore, in an embodiment of the present application, when judging whether to exit the super macro mode, it is determined whether to switch the camera based on dual restrictions; compared with the existing solution in which whether to switch the camera is determined only based on the parameters of the wide-angle camera, the method for switching cameras provided in the embodiment of the present application is more accurate, that is, the stability of the shooting mode in the electronic device is better.
  • steps S401 to S444 are described by taking the switching between the wide-angle camera and the ultra-wide-angle camera as an example; steps S401 to S444 can also be applied to the switching between other types of cameras, and the present application does not impose any restrictions on the types of cameras.
  • steps S401 to S444 can also be applied to the switching between the wide-angle camera and the telephoto camera, that is, the method shown in FIG. 15 can also be applied to running the super telephoto mode, exiting the super telephoto mode, or maintaining the super telephoto mode, which will not be described in detail here.
  • the "whether in super macro mode” in step S420 shown in FIG. 15 can be changed to "determine whether in super telephoto mode", and the display interface of the super telephoto mode can be as shown in (b) in the subsequent FIG. 25; the "whether the object distance 1 satisfies the sixth preset threshold” in step S442 can be changed to "whether the object distance 1 satisfies the fourth preset threshold”; the "run super macro mode” in step S443 can be changed to "run super telephoto mode”; the "do not run super macro mode” in step S444 can be changed to "do not run super telephoto mode".
  • the super telephoto 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 and the fifth preset threshold are used to determine whether the object distance between the electronic device and the shooting object is close, so as to determine whether to exit the super telephoto mode, or to maintain the super telephoto mode; the fourth preset threshold and the first preset threshold may not be equal; similarly, the fifth preset range and the second preset range are not equal.
  • the third preset threshold and the sixth preset threshold are not equal, and whether to use the telephoto camera as the main camera can be determined based on the object distance 1 and the sixth preset threshold; for example, if the object distance 1 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.
  • the super macro mode is suitable for close-up shooting; the super telephoto mode is suitable for telephoto shooting; the method of switching cameras based on the embodiment of the present application can avoid the problem of the electronic device flashing back in the super macro mode due to the close object distance between the electronic device and the shooting object when the electronic device is in the super macro mode; or avoid the problem of the electronic device flashing back in the super telephoto mode due to the long object distance between the electronic device and the shooting object when the electronic device is in the super telephoto mode; improve the stability of the super macro mode or the super telephoto mode.
  • the brightness value of the shooting scene and/or the current brightness of the electronic device may be used to determine the brightness of the shooting scene.
  • the zoom ratio determines whether to exit the Super Macro mode; thereby further improving the stability of the Super Macro mode.
  • the object distance 1 when the object distance 1 does not meet the first preset threshold, and/or the object distance 2 does not meet the second preset threshold, it can be determined whether to exit the super macro mode based on the brightness value of the shooting scene and the current zoom ratio of the electronic device, as shown in FIG. 19 .
  • Fig. 19 is a schematic flow chart of a method for switching cameras provided in an embodiment of the present application. The method can be performed by the electronic device shown in Fig. 9; the method 500 includes steps S510 to S554, and steps S410 to S554 are described in detail below.
  • Step S510 Run the camera application.
  • Step S520 determining whether the electronic device is in the super macro mode; if the electronic device is in the super macro mode, executing step S530; if the electronic device is not in the super macro mode, executing step S550.
  • Step S530 Acquire data from the ultra-wide-angle camera.
  • Step S531 determine whether the ultra-wide-angle camera includes an open-loop motor; if the ultra-wide-angle camera includes an open-loop motor, execute step S532; if the ultra-wide-angle camera does not include an open-loop motor, execute step S534.
  • Step S533 Obtain the object distance 2 between the electronic device and the photographed object according to the code value after compensation processing and the function relationship 1.
  • Step S534 When the ultra-wide-angle camera does not include an open-loop motor, the object distance 2 between the electronic device and the photographed object is obtained according to the code value and the function relationship 1.
  • Step S535 determine whether the object distance 1 meets the first preset threshold, and whether the object distance 2 meets the second preset threshold; if the object distance 1 meets the first preset threshold, and the object distance 2 meets the second preset threshold, execute step S536; if the object distance 1 does not meet the first preset threshold, and/or the object distance 2 does not meet the second preset threshold, execute step S537.
  • Step 536 exit super macro mode.
  • Step S537 determine whether the brightness parameter is less than or equal to the brightness threshold 1. If the brightness parameter is less than or equal to the brightness threshold 1, execute step 538; if the brightness threshold is greater than the brightness threshold 1, execute step S539.
  • the judgment can be made according to the brightness parameters of the shooting scene in which the electronic device is located; if the brightness value of the shooting scene in which the electronic device is located is low, that is, the brightness parameter of the shooting scene is less than or equal to the brightness threshold 1, since the accuracy of the parameters of the ultra-wide-angle camera and the parameters of the wide-angle camera is low in the shooting scene with lower brightness, the super macro mode can be directly exited.
  • the ultra-wide-angle camera in the electronic device is the main camera
  • the brightness threshold 1 at this time may be the brightness threshold corresponding to the ultra-wide-angle camera.
  • the super macro mode is exited.
  • Step S539 determine whether the zoom ratio has changed; if the zoom ratio has changed, execute step S540; if the zoom ratio has not changed, execute step S541.
  • the zoom magnification is a first zoom magnification; the current zoom magnification of the electronic device is a second zoom magnification; if the second zoom magnification is different from the first zoom magnification, it indicates that the zoom magnification of the electronic device has changed, and step S540 is executed; if the second zoom magnification is the same as the first zoom magnification, it indicates that the zoom magnification of the electronic device has not changed, and step S541 is executed.
  • step S540 is executed; if the electronic device If the operation of adjusting the zoom ratio is not detected, step S541 is executed.
  • the electronic device when the electronic device runs in the super macro mode, it can be determined whether to exit the super macro mode according to the current zoom ratio of the electronic device; thereby further increasing the stability of the super macro mode.
  • Step S540 exit super macro mode.
  • the super macro mode may be exited.
  • the electronic device may exit the super macro mode in response to the user's operation.
  • the zoom ratio for example, the ratio is adjusted to be greater than 1x zoom
  • Step S541 maintaining the super macro mode.
  • Step S550 Acquire data from the wide-angle camera.
  • Step S551 Obtain the object distance 1 between the electronic device and the photographed object according to the code value of the wide-angle camera and the function relationship 2.
  • Step S552 determine whether the brightness parameter meets the brightness threshold 2, whether the zoom ratio is equal to the ratio 1, and whether the object distance 1 meets the third preset threshold; if so, execute step S553; if not, execute step S554.
  • the brightness threshold 2 in step S562 is a brightness threshold related to the wide-angle camera.
  • the brightness parameter satisfying the brightness threshold 2 may mean that the brightness parameter is greater than the brightness threshold 2; and the object distance 1 satisfying the third preset threshold may mean that the object distance 1 is less than or equal to the third preset threshold.
  • the brightness parameter may include an illumination value, or a brightness value.
  • an illuminance value for example, Lux index
  • a brightness threshold value 2 when running in super macro mode, an illuminance value (for example, Lux index) can be obtained through an ultra-wide-angle camera; if the illuminance value is greater than a brightness threshold value 2, it indicates that the shooting environment of the electronic device is a low-light shooting environment.
  • the brightness value of the electronic device may be acquired; if the brightness value is less than a brightness threshold value 2, it indicates that the shooting environment of the electronic device is a night scene shooting environment.
  • Exposure is the exposure time; Aperture is the aperture size; Iso is the sensitivity; Luma is the average value of Y in the image in the XYZ color space.
  • Step S553 Run super macro mode.
  • the super macro mode is operated.
  • 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 for shooting when the zoom ratio is between 1x (1 ⁇ ) and 2x (2 ⁇ ).
  • the electronic device when the electronic device does not detect any user operation, 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 other words, the electronic device can automatically use the ultra-wide-angle camera as the main camera without detecting any operation.
  • the electronic device may include multiple cameras; for example, the multiple cameras may include a main camera camera and auxiliary camera; when the electronic device captures images, the image captured by the main camera is usually used 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 achieve the fusion of the images captured by the two cameras, and obtain the displayed image after processing, so as to achieve the functions of improving the shooting quality, background blur, optical zoom, etc.
  • the electronic device is in single-camera mode when capturing images, that is, the electronic device turns on one camera to capture images, the camera is the main camera.
  • the electronic device is in dual-camera mode when capturing images, that is, the electronic device turns on two cameras to capture images; one camera is the main camera and the other camera is the auxiliary camera; when capturing images, the image captured by the main camera is usually used 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 the fusion of the images captured by the two cameras and obtain the displayed image after processing, so as to improve the shooting quality, background blur, optical zoom and other functions.
  • the electronic device is in multi-camera mode when capturing images, for example, the electronic device is in triple-camera mode when capturing images, then three cameras can be turned on when the electronic device captures images; the three cameras include a main camera and two auxiliary cameras; when capturing images, the image captured by the main camera is usually used 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 the fusion of the images captured by the three cameras and obtain the displayed image after processing, so as to improve the shooting quality, background blur, optical zoom and other functions.
  • the electronic device can turn off the wide-angle camera; turn on the ultra-wide-angle camera, and use the ultra-wide-angle camera as the main camera.
  • the electronic device can use the ultra-wide-angle camera as the main camera, and the auxiliary camera can be fully or partially turned on.
  • the electronic device can determine whether to exit the super macro mode according to steps S430 to S437 as shown in FIG. 15 .
  • whether to operate the super macro mode can be determined based on a frame of image; for example, for a frame of image, if the brightness parameter is greater than the brightness threshold 2 and the zoom ratio is 1 and the object distance 1 meets the third preset threshold, the electronic device switches the camera to operate the super macro mode.
  • the electronic device may make a judgment based on multiple frames of images before switching the camera; for example, it may be judged whether the object distance 1 satisfies a first preset threshold, and the object distance 2 satisfies a second preset threshold for at least two consecutive frames of images; if the object distance 1 satisfies the first preset threshold, and the object distance 2 satisfies the second preset threshold for at least two consecutive frames of images, the electronic device switches the camera to exit the super macro mode.
  • the electronic device when determining whether to run the super macro mode, can also determine whether to run the super macro mode according to the brightness value of the shooting scene, the zoom ratio and the object distance 1; in a darker shooting scene, the focus accuracy is low, that is, the accuracy of the code value of the wide-angle camera is low, and it can be determined not to run the super macro mode; thereby improving the accuracy of running the super macro mode.
  • Step S554 Do not run the super macro mode.
  • not running the super macro mode may include the electronic device continuing to run the current shooting mode and not performing the super macro mode. Enter Super Macro mode.
  • the electronic device when the object distance 1 satisfies the first preset threshold and the object distance 2 satisfies the second preset threshold, the electronic device switches to using the wide-angle camera as the main camera and exits the super macro mode; since the object distance 2 is the object distance obtained according to the parameters of the ultra-wide-angle camera, and the object distance 1 is the object distance obtained according to the parameters of the wide-angle camera; therefore, in an embodiment of the present application, when judging whether to exit the super macro mode, it is determined whether to switch the camera based on dual restrictions; compared with the existing solution in which whether to switch the camera is determined only based on the parameters of the wide-angle camera, the method for switching cameras provided in the embodiment of the present application is more accurate, that is, the stability of the shooting mode in the electronic device is better.
  • the electronic device can determine whether to exit the super macro mode based on the brightness parameters of the shooting environment in which the electronic device is located; further, when the brightness parameters of the shooting scene do not meet the conditions for exiting the super macro mode, it can be determined whether to exit the super macro mode based on the zoom ratio; the method for switching cameras provided in the embodiment of the present application is more accurate, that is, the stability of the shooting mode in the electronic device is better.
  • steps S510 to S554 are described by taking the switching between a wide-angle camera and an ultra-wide-angle camera as an example; steps S510 to S554 can also be applied to switching between other types of cameras, and this application does not impose any limitation on the type of camera.
  • steps S510 to S554 may also be applicable to switching between a wide-angle camera and a telephoto camera, that is, the above method may also be applicable to running a super telephoto mode, exiting a super telephoto mode, or maintaining a super telephoto mode, which will not be described in detail here.
  • the electronic device may continue to execute the next judgment process; for example, the electronic device may include a timer, and when the timer reaches a preset moment (for example, 30S), the electronic device may continue to execute steps S402 to S403, and execute corresponding subsequent steps according to the result of step S403.
  • a preset moment for example, 30S
  • steps S401 to S414 are described by taking 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 impose any limitation on the type of camera.
  • the display interface shown in (a) of FIG. 20 may be the desktop 601 of the electronic device; when the electronic device detects that the user clicks on the control 602 of the camera application on the desktop 601, another display interface as shown in (b) of FIG. 20 may be displayed; the display interface 603 shown in (b) of FIG. 20 may be the display interface of the camera application, and the display interface 603 may include a smart control 604; the electronic device detects the operation of the smart control 604, as shown in (c) of FIG. 20; after the electronic device detects the operation of the smart control 604, the method for switching the camera provided in the embodiment of the present application runs the super macro mode and exits the super macro mode.
  • the electronic device is in non-super macro mode, based on obtaining the parameters and zoom ratio of the wide-angle camera; determining that the distance parameter and the zoom ratio meet the preset conditions, the electronic device switches to use the ultra-wide-angle camera as the main camera, that is, the electronic device enters the super macro mode, and displays a display interface 605 as shown in (d) of Figure 20.
  • the display interface 605 may include a control 606 indicating the shooting mode, and the current shooting mode is the super macro mode, as shown in (d) of Figure 20; if it is detected that the user clicks the “ ⁇ ” in “Super Macro ⁇ ”, the electronic device may turn off the super macro mode; optionally, after turning off the super macro mode, in the preview display interface, the electronic device Devices may no longer push Super Macro mode.
  • the field of view of the electronic device in the super macro mode is greater than the field of view of the electronic device in the non-super macro mode.
  • the currently turned on camera is used as the camera for capturing images; as shown in (d) in Figure 20, when the shooting mode of the electronic device is the super macro mode, the electronic device uses the ultra-wide-angle camera as the main camera to capture images.
  • the displayed zoom ratio may be a single zoom ratio (1 ⁇ ), and the ultra-wide-angle camera is used as the main camera to capture images; at this time, the actual zoom value of the camera application may be 0.99 ⁇ , or 0.98 ⁇ , or other zoom ratio values less than 1 ⁇ .
  • the actual zoom value of the camera application can be adjusted based on 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 ⁇ , the actual zoom value can be 0.99 ⁇ ; if the unit scale of the zoom axis is 0.02 ⁇ , the actual zoom value can be 0.98 ⁇ .
  • the display interface shown in (d) of FIG. 20 may not display the control 606 indicating the super macro mode; the present application does not impose any limitation on this.
  • the display interface shown in (a) of FIG. 21 may be a desktop 607 of an electronic device; when the electronic device detects that a user clicks a control 608 of a camera application on the desktop 607, another display interface as shown in (b) of FIG. 21 may be displayed; the display interface 609 shown in (b) of FIG. 21 may be a display interface of a camera application, and the display interface 609 may include a setting control 610; the electronic device detects an operation on the setting control 610, as shown in (c) of FIG.
  • a setting display interface may be displayed, and the setting display interface includes a control 611 indicating to turn on automatic camera switching, as shown in (d) of FIG. 21 21 (e); after the electronic device detects the operation of the control 611, the method for switching the camera provided in the embodiment of the present application is executed to run the super macro mode, exit the super macro mode, or maintain the super macro mode; for example, the electronic device enters the super macro mode and displays the display interface 612 shown in (f) of FIG.
  • the display interface 612 may include an icon 613 indicating the shooting mode, and the current shooting mode is the super macro mode; if it is detected that the user clicks the " ⁇ " in "super macro ⁇ ", the electronic device may turn off the super macro mode; optionally, after turning off the super macro mode, in the preview display interface, the electronic device may no longer push the super macro mode.
  • the relevant description in FIG. 20 is also applicable to FIG. 21, and will not be repeated here.
  • super macro can be turned on through a separate control in the camera application display interface, as shown in FIG22;
  • the display interface shown in (a) of FIG22 can be the desktop 614 of the electronic device; when the electronic device detects that the user clicks on the icon 615 of the camera application on the desktop 614, another display interface 616 as shown in (b) of FIG22 can be displayed;
  • the display interface 616 shown in (b) of FIG22 can be the display interface of the camera application, and the display interface 616 can include a control 617; as shown in (c) of FIG22, after the electronic device detects the operation of the setting control 617, the present application is executed.
  • the electronic device is in non-super macro mode, based on obtaining the distance parameter and zoom ratio of the camera module; determining that the distance parameter and the 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 the super macro mode, and displays a display interface 618 as shown in (d) in Figure 22.
  • the display interface 618 may include an icon 619 indicating the shooting mode, and the current shooting mode is the super macro mode; if it is detected that 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, In the preview display interface, the electronic device may no longer push the super macro mode.
  • the relevant description in FIG. 20 is also applicable to FIG. 22 and will not be repeated here.
  • a user may indicate in a setting display interface of an electronic device to turn on automatic camera switching, thereby causing the electronic device to execute the camera switching method provided in an embodiment of the present application.
  • the display interface shown in (a) of Figure 23 may be the desktop 620 of the electronic device; when the electronic device detects that the user clicks on the setting icon 621 on the desktop 620, another display interface as shown in (b) of Figure 23 may be displayed; the display interface shown in (b) of Figure 23 may be a setting display interface, and the setting display interface may include options such as wireless network, Bluetooth or camera; as shown in (c) of Figure 23, the electronic device detects that the camera option is clicked, enters the camera setting interface, and displays as shown in (d) of Figure 23; the camera setting interface may include a control 622 for automatically switching the camera; as shown in (e) of Figure 23, after the electronic device detects the operation of the control 622, it may execute the method for switching the camera provided in an embodiment of the present application; as shown in (f) of Figure 23, the electronic device detects that the user clicks on the camera on the desktop 620 23 (h), the display interface 627 may include an icon 628 indicating the shooting mode, and the current shooting mode is the super macro
  • the electronic device after the electronic device enters the display interface of the camera application, it can also directly display the display interface shown in (h) in Figure 23; that is, the electronic device can directly go from the display interface shown in (f) in Figure 23 to the display interface shown in (h) in Figure 23.
  • controls for more options in a camera application there are controls for more options in a camera application; the controls for more options include controls for a super macro module; when the electronic device detects a control for turning on a super macro mode, the electronic device can directly run the super macro mode.
  • the display interface shown in (a) of FIG. 24 may be a desktop 630 of the electronic device; after the electronic device detects that the user clicks on a control 631 of a camera application on the desktop 630, another display interface as shown in (b) of FIG. 24 may be displayed; the display interface 632 shown in (b) of FIG. 24 may be a display interface of the camera application, and the display interface 632 may include a control 633 for more options; the electronic device detects an operation on the control 633 for more options, as shown in (c) of FIG.
  • a more options interface may be displayed, which includes a control 634 indicating the start of the super macro mode, as shown in (d) in FIG. 24; the electronic device detects the operation of the control 634, as shown in (e) in FIG. 24; after the electronic device detects the operation of the control 634, the electronic device may directly run the super macro model and display a display interface 635 as shown in (f) in FIG.
  • the display interface 635 may include an icon 636 indicating the shooting mode, and the current shooting mode is the super macro mode; if it is detected that the user clicks the " ⁇ " in "Super Macro ⁇ ", Then the electronic device may 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.
  • the relevant description in FIG. 24 is also applicable to FIG. 20 and will not be repeated here.
  • FIG. 25 is a schematic diagram of a preview interface of a camera application provided in an embodiment of the present application.
  • FIG. 25 shows a preview image captured by using the wide-angle camera as the main camera
  • FIG. 25 shows a preview image captured when the electronic device is in super macro mode, that is, the electronic device captures a preview image using the ultra-wide-angle camera as the main camera
  • combining (a) in FIG. 25 with (b) in FIG. 25, it can be seen that in a scene in which the electronic device is shooting at a close distance, when the electronic device captures an image using the ultra-wide-angle camera as the main camera, both the image clarity and the field of view of the electronic device are improved.
  • FIG. 26 is a schematic diagram of a preview interface of a camera application provided in an embodiment of the present application.
  • FIG. 26 shows a preview image captured by using the wide-angle camera as the main camera;
  • FIG. 26 shows a preview image captured by the electronic device in super telephoto mode, that is, the electronic device captures the preview image using the telephoto camera as the main camera; combining the preview image shown in (a) in FIG. 26 with the preview image shown in (b) in FIG. 26 , it can be seen that, in a scene in which the electronic device is shooting at a long distance, when the electronic device captures the image using the telephoto camera as the main camera, the detail information of the image is improved.
  • Fig. 27 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
  • the electronic device 700 includes a processing module 710, a display module 720, a first camera and a second camera.
  • the processing module 710 is used to run the camera application in the electronic device; the display module 720 is used to display a first image, and the first image is obtained by the first camera acting as the main camera to capture images; the processing module 710 is also used to: determine whether the first distance and the second distance meet a first preset condition, wherein the first distance and the second distance are used to indicate the object distance between the electronic device and the photographed object, the first distance is the object distance obtained based on the parameters of the first camera, and the second distance is the object distance obtained based on the parameters of the second camera; the display module 720 is also used to: when the first distance and the second distance meet the first preset condition, display the second image, and the second image is obtained by the second camera acting as the main camera to capture images.
  • processing module 710 is specifically configured to:
  • the first distance is greater than a first preset threshold and the second distance is greater than a second preset threshold, wherein the first preset threshold is different from the second preset threshold.
  • the first preset threshold is a preset threshold obtained based on a first distance range
  • the first distance range is used to represent an effective distance range for focusing of the first camera.
  • the second preset threshold is a preset threshold obtained based on a second distance range, and the second distance range is used to represent an effective distance range for focusing of the second camera.
  • processing module 710 is further configured to:
  • determining whether a brightness parameter of a shooting scene in which the electronic device is located is less than or equal to a first brightness threshold
  • the second image is displayed.
  • the first brightness threshold is a preset threshold obtained based on a first brightness range
  • the first brightness range is used to represent an effective brightness range for focusing of the first camera.
  • the zoom ratio of the electronic device when displaying the first image is a first zoom ratio
  • the current zoom ratio of the electronic device is a second zoom ratio
  • the processing module 710 is further used to:
  • the second image is displayed.
  • the display module 720 is specifically used for:
  • the first image is displayed.
  • the second brightness threshold is a preset threshold obtained based on a second brightness range, and the second brightness range is used to represent an effective brightness range for focusing of the second camera.
  • the processing module 710 is further configured to:
  • the first distance is obtained.
  • the display module 720 is specifically used for:
  • the electronic device When the electronic device is in a super macro mode, the first image is displayed.
  • the display module 720 is specifically used for:
  • the first image is displayed on a first display interface of the electronic device, and the first display interface also includes a first icon, and the first icon is used to indicate the super macro mode.
  • the first icon includes a first control
  • the processing module 710 is further configured to:
  • the electronic device In response to the first operation, the electronic device exits the super macro mode.
  • the display module 720 is specifically used for:
  • the second image is displayed.
  • the first camera includes an ultra-wide-angle camera or a telephoto camera
  • the second camera includes a wide-angle camera
  • the position of the electronic device is the same.
  • the first image includes a first photographed object
  • the second image includes a second photographed object
  • the first photographed object and the second photographed object are located at the same position
  • the distance between the first photographed object and the electronic device is a third distance
  • the distance between the second photographed object and the electronic device is a third distance.
  • the third distance is smaller than the fourth distance
  • the first image and the second image include a third photographic object, and when the first image and the second image are displayed, the third photographic object is located at the same position; when the first image is captured, the distance between the third photographic object and the electronic device is a fifth distance; when the second image is captured, the distance between the third photographic object and the electronic device is a sixth distance, and the fifth distance is smaller than the sixth distance.
  • module can be implemented in the form of software and/or hardware, and is not specifically limited to this.
  • a “module” may be a software program, a hardware circuit, or a combination of the two that implements the above functions.
  • the hardware circuit may 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 combined logic circuit, and/or other suitable components that support the described functions.
  • ASIC application specific integrated circuit
  • processor such as a shared processor, a dedicated processor, or a group processor, etc.
  • memory for executing one or more software or firmware programs, a combined logic circuit, and/or other suitable components that support the described functions.
  • the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
  • Fig. 28 shows a schematic diagram of the structure of an electronic device provided by the present application.
  • the dotted lines in Fig. 28 indicate that the unit or the module is optional; the electronic device 800 can be used to implement the method described in the above method embodiment.
  • the electronic device 800 includes one or more processors 801, which can support the electronic device 800 to implement the method of switching cameras in the method embodiment.
  • the processor 801 can be a general-purpose processor or a special-purpose processor.
  • 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, transistor logic devices, or discrete hardware components.
  • the processor 801 may be used to control the electronic device 800, execute software programs, and process data of the software programs.
  • the electronic device 800 may also include a communication unit 805 to implement input (reception) and output (transmission) of signals.
  • the electronic device 800 may be a chip
  • the communication unit 805 may be an input and/or output circuit of the chip
  • the communication unit 805 may be a communication interface of the chip
  • the chip may be a component of a terminal device or other electronic devices.
  • the electronic device 800 may be a terminal device, and the communication unit 805 may be a transceiver of the terminal device, or the communication unit 805 may be a transceiver circuit of the terminal device.
  • the electronic device 800 may include one or more memories 802 on which a program 804 is stored.
  • the program 804 can be executed by the processor 801 to generate instructions 803, so that the processor 801 executes the method of switching cameras described in the above method embodiment according to the instructions 803.
  • data may also be stored in the memory 802 .
  • the processor 801 may also read data stored in the memory 802 .
  • the data may be stored at the same storage address as the program 804 , or may be stored at a different storage address from the program 804 .
  • the processor 801 and the memory 802 may be provided separately or integrated together, for example, integrated on a system on chip (SOC) of the terminal device.
  • SOC system on chip
  • the memory 802 can be used to store the related program 804 of the method for switching cameras provided in the embodiment of the present application
  • 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 in the embodiment of the present application; for example, run a camera application in an electronic device; display a first image, where the first image is obtained by the first camera acting as a main camera to capture an image; determine whether the first distance and the second distance meet a first preset condition, where the first distance and the second distance are used to indicate the object distance between the electronic device and the photographed object, where the first distance is the object distance obtained based on the parameters of the first camera, and the second distance is the object distance obtained based on the parameters of the second camera; when the first distance and the second distance meet the first preset condition, display the second image, where the second image is obtained by the second camera acting as the main camera to capture an image.
  • the present application also provides a computer program product, which, when executed by the processor 801, implements the method for switching cameras in any method embodiment of the present application.
  • the computer program product may be stored in the memory 802 , for example, a program 804 , which is converted into an executable target file that can be executed by the processor 801 after preprocessing, compiling, assembling, linking and other processing processes.
  • the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method for switching cameras described in any method embodiment of the present application is implemented.
  • the computer program can be a high-level language program or an executable target program.
  • the computer-readable storage medium is, for example, a memory 802.
  • the memory 802 may be a volatile memory or a nonvolatile memory, or the memory 802 may include both a volatile memory and a nonvolatile memory.
  • the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory.
  • the volatile memory may be a random access memory (RAM), which is used as an external cache.
  • RAM synchronous RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous link DRAM
  • DR RAM direct rambus RAM
  • the disclosed systems, devices and methods can be implemented in other ways.
  • the embodiments of the electronic device described above are only illustrative.
  • the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
  • Another point, The mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, which may be electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the size of the serial number of each process does not mean the order of execution.
  • the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
  • the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Environmental & Geological Engineering (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Studio Devices (AREA)

Abstract

本申请涉及终端领域,提供了一种切换摄像头的方法与电子设备,该方法应用于电子设备,电子设备包括摄像头模组,摄像头模组包括第一摄像头与第二摄像头,该方法包括:运行电子设备中的相机应用程序;显示第一图像;确定第一距离与第二距离是否满足第一预设条件,其中,第一距离与第二距离用于指示电子设备与拍摄对象之间的物距,第一距离为基于第一摄像头的参数得到的物距,第二距离为基于第二摄像头的参数得到的物距;在第一距离与第二距离满足第一预设条件的情况下,显示第二图像。基于本申请的技术方案,能够避免电子设备在超级微距模式中出现自动退出问题,提高电子设备中超级微距模式的稳定性;提高用户拍摄体验。

Description

切换摄像头的方法与电子设备
本申请要求于2022年10月24日提交国家知识产权局、申请号为202211303569.6、申请名称为“切换摄像头的方法与电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及终端领域,具体地,涉及一种切换摄像头的方法与电子设备。
背景技术
电子设备在拍摄时,为了采集清晰的图像,经常会面临自动切换摄像头的需求;例如,当电子设备拍摄远距离的景物时,可以切换至长焦摄像头;当电子设备拍摄近距离的景物时,可以切换至超广角摄像头。在电子设备中不包括激光传感器的情况下,电子设备可以基于广角摄像头的参数,进行不同摄像头的自动切换;例如,电子设备可以根据广角摄像头的参数识别电子设备与拍摄物体之间的距离较近时,可以自动切换至将超广角摄像头作为主摄摄像头,进入超级微距模式;但是,在电子设备与拍摄对象之间的距离较近的情况下,电子设备与拍摄对象之间的距离小于广角摄像头进行对焦的有效距离,导致广角摄像头的参数的准确性降低,使得电子设备在处于超级微距模式拍摄时可能会出现自动退出的问题,导致超级微距模式的稳定性较差。
因此,如何提高电子设备中拍摄模式(例如,超级微距模式或者超级远景模式)的稳定性成为一个亟需解决的问题。
发明内容
本申请提供了一种切换摄像头的方法与电子设备,能够提高电子设备中拍摄模式(例如,超级微距模式)的稳定性,提高用户的拍摄体验。
第一方面,提供了一种切换摄像头的方法,应用于电子设备,所述电子设备包括摄像头模组,所述摄像头模组包括第一摄像头与第二摄像头,所述方法包括:
运行所述电子设备中的相机应用程序;
显示第一图像,所述第一图像为所述第一摄像头作为主摄摄像头进行采集图像得到的;
确定第一距离与第二距离是否满足第一预设条件,其中,所述第一距离与所述第二距离用于指示所述电子设备与拍摄对象之间的物距,所述第一距离为基于所述第一摄像头的参数得到的物距,所述第二距离为基于所述第二摄像头的参数得到的物距;
在所述第一距离与所述第二距离满足所述第一预设条件的情况下,显示第二图像,所述第二图像为所述第二摄像头作为主摄摄像头进行采集图像得到的。
在本申请的实施例中,在第一距离与第二距离满足第一预设条件时,电子设备切换至将第二摄像头作为主摄摄像头,显示第二图像;由于第一距离为根据第一摄像头的参数得到的物距,第二距离为根据第二摄像头的参数得到的物距;因此,在本申请的实施例中, 在判断是否切换至第二摄像头作为主摄摄像头时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于第二摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的准确性更高,即电子设备中拍摄模式的稳定性更好。
结合第一方面,在第一方面的某些实现方式中,所述第一距离与第二距离满足第一预设条件,包括:
确定所述第一距离大于第一预设阈值,且所述第二距离大于第二预设阈值,其中,所述第一预设阈值与所述第二预设阈值不同。
结合第一方面,在第一方面的某些实现方式中,所述第一预设阈值为基于第一距离范围得到的预设阈值,所述第一距离范围用于表示所述第一摄像头进行对焦的有效距离范围。
结合第一方面,在第一方面的某些实现方式中,所述第二预设阈值为基于第二距离范围得到的预设阈值,所述第二距离范围用于表示所述第二摄像头进行对焦的有效距离范围。
结合第一方面,在第一方面的某些实现方式中,还包括:
在所述第一距离和/或所述第二距离不满足所述第一预设条件的情况下,确定所述电子设备所处拍摄场景的亮度参数是否小于或者等于第一亮度阈值;
在所述亮度参数小于或者等于所述第一亮度阈值的情况下,显示所述第二图像。
在本申请的实施例中,在第一距离和/或第二距离不满足预设条件的情况下,电子设备还可以进一步根据拍摄场景的亮度参数确定是否退出超级微距模式;由于在电子设备所处的拍摄场景较暗的情况下,第一摄像头采集的参数与第二摄像头采集的参数的准确性较低;由于第一摄像头采集的参数与第二摄像头采集的参数的准确性较低,则第一距离与第二距离的准确性较低;此时,电子设备可以直接退出超级微距模式。
结合第一方面,在第一方面的某些实现方式中,所述第一亮度阈值为基于第一亮度范围得到的预设阈值,所述第一亮度范围用于表示所述第一摄像头进行对焦的有效亮度范围。
结合第一方面,在第一方面的某些实现方式中,所述电子设备显示所述第一图像时的变焦倍率为第一变焦倍率,所述电子设备当前的变焦倍率为第二变焦倍率,还包括:
在所述亮度参数大于所述第一亮度阈值的情况下,确定所述第二变焦倍率与所述第一变焦倍率是否相同;
在所述第二变焦倍率与所述第一变焦倍率不相同的情况下,显示所述第二图像。
在本申请的实施例中,在第一距离和/或第二距离不满足预设条件,且电子设备所处的拍摄场景的亮度参数大于第一亮度阈值的情况下,可以确定电子设备的变焦倍率是否发生变化;若电子设备的变焦倍率发生变化,则电子设备退出超级微距模式;例如,电子设备的变焦倍率发生变化,则可能是用户对电子设备的变焦倍率进行了调整;此时,电子设备退出超级微距模式。
结合第一方面,在第一方面的某些实现方式中,所述显示第一图像,包括:
在所述电子设备所处的拍摄环境的亮度参数大于第二亮度阈值,且所述第二距离小于或者等于第三预设阈值的情况下,显示所述第一图像。
在本申请的实施例中,在电子设备进入超级微距模式时,可以根据电子设备的拍摄场 景的亮度与第二距离确定电子设备是否进入超级微距模式;与基于第二距离确定电子设备是否进入超级微距模式相比,本申请实施例中进入超级微距模式的准确性更高。
结合第一方面,在第一方面的某些实现方式中,所述第二亮度阈值为基于第二亮度范围得到的预设阈值,所述第二亮度范围用于表示所述第二摄像头进行对焦的有效亮度范围。
结合第一方面,在第一方面的某些实现方式中,在所述第一摄像头包括开环马达的情况下,还包括:
获取所述第一摄像头的参数;
基于所述第一摄像头的标定值对所述第一摄像头的参数进行补偿处理,得到处理后的参数;
基于所述处理后的参数,得到所述第一距离。
结合第一方面,在第一方面的某些实现方式中,所述显示第一图像,包括:
在所述电子设备处于超级微距模式的情况下,显示所述第一图像。
结合第一方面,在第一方面的某些实现方式中,所述在所述电子设备处于超级微距模式的情况下,显示所述第一图像,包括:
在所述电子设备的第一显示界面显示所述第一图像,所述第一显示界面中还包括第一图标,所述第一图标用于指示所述超级微距模式。
结合第一方面,在第一方面的某些实现方式中,所述第一图标中包括第一控件,还包括:
检测到对所述第一控件的第一操作;
响应于所述第一操作,所述电子设备退出所述超级微距模式。
结合第一方面,在第一方面的某些实现方式中,所述显示第二图像,包括:
在所述电子设备退出超级微距模式的情况下,显示所述第二图像。
结合第一方面,在第一方面的某些实现方式中,所述第一摄像头包括超广角摄像头或者长焦摄像头,和/或,所述第二摄像头包括广角摄像头。
在一个示例中,第一摄像头为超广角摄像头,第二摄像头为广角摄像头;在电子设备处于超级微距模式,以超广角摄像头作为主摄摄像头,电子设备显示第一图像;在电子设备退出超级微距模式,以广角摄像头作为主摄摄像头,电子设备显示第二图像。
在一个示例中,第一摄像头为长焦摄像头,第二摄像头为广角摄像头;在电子设备处于超级远景模式,以长焦摄像头作为主摄摄像头,电子设备显示第一图像;在电子设备退出超级远景模式,以广角摄像头作为主摄摄像头,电子设备显示第二图像。
结合第一方面,在第一方面的某些实现方式中,所述电子设备在显示所述第一图像与显示所述第二图像时,所述电子设备所处的位置相同。
在本申请的实施例中,在拍摄过程中电子设备的位置可以始终未改变,若电子设备的对焦对象从远景拍摄对象移动至近景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,进入超级微距模式;若电子设备的对焦对象从近景拍摄对象移动至远景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,退出超级微距模式;电子设备可以实现自动切换不同类型的摄像头作为主摄摄像头,从而确保采集图像的图像质 量。
结合第一方面,在第一方面的某些实现方式中,所述第一图像中包括第一拍摄对象,所述第二图像中包括第二拍摄对象,所述第一拍摄对象与所述第二拍摄对象所处的位置相同,所述第一拍摄对象与所述电子设备之间的距离为第三距离,所述第二拍摄对象与所述电子设备之间的距离为第四距离,所述第三距离小于所述第四距离。
在本申请的实施例中,在拍摄过程中电子设备的位置可以发生改变;比如,电子设备可以移动着拍摄不同拍摄对象(例如,第一拍摄对象与第二拍摄对象);在电子设备的对焦对象从近景拍摄对象移动至远景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,退出超级微距模式;电子设备可以实现自动切换不同类型的摄像头作为主摄摄像头,从而确保采集图像的图像质量。
结合第一方面,在第一方面的某些实现方式中,所述第一图像与所述第二图像中包括第三拍摄对象,在显示所述第一图像与所述第二图像时,所述第三拍摄对象所处的位置相同;在采集所述第一图像时,所述第三拍摄对象与所述电子设备之间的距离为第五距离;在采集所述第二图像时,所述第三拍摄对象与所述电子设备之间的距离为第六距离,所述第五距离小于所述第六距离。
在本申请的实施例中,在拍摄过程中电子设备的位置可以发生改变;比如,电子设备可以移动着拍摄同一拍摄对象(例如,第三拍摄对象);在电子设备的对焦对象从近景拍摄对象移动至远景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,退出超级微距模式;电子设备可以实现自动切换不同类型的摄像头作为主摄摄像头,从而确保采集图像的图像质量。
第二方面,提供了一种电子设备,包括用于执行第一方面或者第一方面中任一种切换摄像头的方法的模块/单元。
第三方面,提供了一种电子设备,所述电子设备包括一个或多个处理器、存储器与摄像头模组,所述摄像头模组包括第一摄像头与第二摄像头;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
运行所述电子设备中的相机应用程序;
显示第一图像,所述第一图像为所述第一摄像头作为主摄摄像头进行采集图像得到的;
确定第一距离与第二距离是否满足第一预设条件,其中,所述第一距离与所述第二距离用于指示所述电子设备与拍摄对象之间的物距,所述第一距离为基于所述第一摄像头的参数得到的物距,所述第二距离为基于所述第二摄像头的参数得到的物距;
在所述第一距离与所述第二距离满足所述第一预设条件的情况下,显示第二图像,所述第二图像为所述第二摄像头作为主摄摄像头进行采集图像得到的。
结合第三方面,在第三方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
确定所述第一距离大于第一预设阈值,且所述第二距离大于第二预设阈值,其中,所述第一预设阈值与所述第二预设阈值不同。
结合第三方面,在第三方面的某些实现方式中,所述第一预设阈值为基于第一距离范围得到的预设阈值,所述第一距离范围用于表示所述第一摄像头进行对焦的有效距离范 围。
结合第三方面,在第三方面的某些实现方式中,所述第二预设阈值为基于第二距离范围得到的预设阈值,所述第二距离范围用于表示所述第二摄像头进行对焦的有效距离范围。
结合第三方面,在第三方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
在所述第一距离和/或所述第二距离不满足所述第一预设条件的情况下,确定所述电子设备所处拍摄场景的亮度参数是否小于或者等于第一亮度阈值;
在所述亮度参数小于或者等于所述第一亮度阈值的情况下,显示所述第二图像。
结合第三方面,在第三方面的某些实现方式中,所述第一亮度阈值为基于第一亮度范围得到的预设阈值,所述第一亮度范围用于表示所述第一摄像头进行对焦的有效亮度范围。
结合第三方面,在第三方面的某些实现方式中,所述电子设备显示所述第一图像时的变焦倍率为第一变焦倍率,所述电子设备当前的变焦倍率为第二变焦倍率,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
在所述亮度参数大于所述第一亮度阈值的情况下,确定所述第二变焦倍率与所述第一变焦倍率是否相同;
在所述第二变焦倍率与所述第一变焦倍率不相同的情况下,显示所述第二图像。
结合第三方面,在第三方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
在所述电子设备所处的拍摄环境的亮度参数大于第二亮度阈值,且所述第二距离小于或者等于第三预设阈值的情况下,显示所述第一图像。
结合第三方面,在第三方面的某些实现方式中,所述第二亮度阈值为基于第二亮度范围得到的预设阈值,所述第二亮度范围用于表示所述第二摄像头进行对焦的有效亮度范围。
结合第三方面,在第三方面的某些实现方式中,在所述第一摄像头包括开环马达的情况下,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
获取所述第一摄像头的参数;
基于所述第一摄像头的标定值对所述第一摄像头的参数进行补偿处理,得到处理后的参数;
基于所述处理后的参数,得到所述第一距离。
结合第三方面,在第三方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
在所述电子设备处于超级微距模式的情况下,显示所述第一图像。
结合第三方面,在第三方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
在所述电子设备的第一显示界面显示所述第一图像,所述第一显示界面中还包括第一图标,所述第一图标用于指示所述超级微距模式。
结合第三方面,在第三方面的某些实现方式中,所述第一图标中包括第一控件,所 述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
检测到对所述第一控件的第一操作;
响应于所述第一操作,所述电子设备退出所述超级微距模式。
结合第三方面,在第三方面的某些实现方式中,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:
在所述电子设备退出超级微距模式的情况下,显示所述第二图像。
结合第三方面,在第三方面的某些实现方式中,所述第一摄像头包括超广角摄像头或者长焦摄像头,和/或,所述第二摄像头包括广角摄像头。
结合第三方面,在第三方面的某些实现方式中,所述电子设备在显示所述第一图像与显示所述第二图像时,所述电子设备所处的位置相同。
结合第三方面,在第三方面的某些实现方式中,所述第一图像中包括第一拍摄对象,所述第二图像中包括第二拍摄对象,所述第一拍摄对象与所述第二拍摄对象所处的位置相同,所述第一拍摄对象与所述电子设备之间的距离为第三距离,所述第二拍摄对象与所述电子设备之间的距离为第四距离,所述第三距离小于所述第四距离。
结合第三方面,在第三方面的某些实现方式中,所述第一图像与所述第二图像中包括第三拍摄对象,在显示所述第一图像与所述第二图像时,所述第三拍摄对象所处的位置相同;在采集所述第一图像时,所述第三拍摄对象与所述电子设备之间的距离为第五距离;在采集所述第二图像时,所述第三拍摄对象与所述电子设备之间的距离为第六距离,所述第五距离小于所述第六距离。
第四方面,提供一种电子设备,所述电子设备包括一个或多个处理器、存储器;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行第一方面或者第一方面中的任一种方法。
第五方面,提供了一种芯片系统,所述芯片系统应用于电子设备,所述芯片系统包括一个或多个处理器,所述处理器用于调用计算机指令以使得所述电子设备执行第一方面或第一方面中的任一种方法。
第六方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序代码,当所述计算机程序代码被电子设备运行时,使得该电子设备执行第一方面或第一方面中的任一种方法。
第七方面,提供了一种计算机程序产品,所述计算机程序产品包括:计算机程序代码,当所述计算机程序代码被电子设备运行时,使得该电子设备执行第一方面或第一面中的任一种方法。
在本申请的实施例中,在第一距离与第二距离满足第一预设条件时,电子设备切换至将第二摄像头作为主摄摄像头;由于第一距离为根据第一摄像头的参数得到的物距,第二距离为根据第二摄像头的参数得到的物距;因此,在本申请的实施例中,在判断是否切换至第二摄像头作为主摄摄像头时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于第二摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的稳定性更高。
附图说明
图1是一种适用于本申请的超级微距模式的拍摄场景的示意图;
图2是一种适用于本申请的超级微距模式的拍摄场景的侧视图;
图3是另一种适用于本申请的超级微距模式的拍摄场景的示意图;
图4是又一种适用于本申请的超级微距模式的拍摄场景的示意图;
图5是一种适用于本申请的超级远景模式的拍摄场景的示意图;
图6是一种适用于本申请的超级远景模式的拍摄场景的侧视图;
图7是另一种适用于本申请的超级微距模式的拍摄场景的示意图;
图8是又一种适用于本申请的超级微距模式的拍摄场景的示意图;
图9是一种适用于本申请的电子设备的硬件系统的示意图;
图10是一种适用于本申请的电子设备的软件系统的示意图;
图11是本申请实施例提供的一种多个摄像头在电子设备上的排布示意图;
图12是本申请实施例提供的一种不同类型的摄像头对应的变焦倍率的示意图;
图13是一种自动退出超级微距模式的图形用户界面的示意图;
图14是本申请实施例提供的一种切换摄像头的方法的示意性流程图;
图15是本申请实施例提供的另一种切换摄像头的方法的示意性流程图;
图16是本申请实施例提供的一种函数关系的示意图;
图17是本申请实施例摄像头处于不同位姿的示意图;
图18是本申请实施例提供的基于摄像头的不同位置的位姿差的示意图;
图19是本申请实施例提供的又一种切换摄像头的方法的示意性流程图;
图20是本申请实施例提供的一种图形用户界面的示意图;
图21是本申请实施例提供的另一种图形用户界面的示意图;
图22是本申请实施例提供的又一种图形用户界面的示意图;
图23是本申请实施例提供的又一种图形用户界面的示意图;
图24是本申请实施例提供的又一种图形用户界面的示意图;
图25为本申请实施例提供的相机应用程序的预览界面的示意图;
图26为本申请实施例提供的相机应用程序的预览界面的示意图;
图27是本申请实施例提供的一种电子设备的结构示意图;
图28是本申请实施例提供的一种电子设备的结构示意图。
具体实施方式
在本申请的实施例中,以下术语“第一”、“第二”等仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。在本实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。
为了便于对本申请实施例的理解,首先对本申请实施例中涉及的相关概念进行简要说明。
1、视场角(field of view,FOV)
视场角在光学工程中又称视场,视场角的大小决定了光学仪器的视野范围;电子设备 的视场角用于指示电子设备在对拍摄对象进行拍摄的过程中,摄像头所能拍摄到的最大角度。
应理解,视场角还可以被称为“视场范围”、“视野范围”、“视野区域”等。
2、距离参数
距离参数可以用于表示镜头与电子设备中传感器之间的距离信息;例如,距离参数越大,则表示镜头与传感器之间的距离越大,即可以表示电子设备与拍摄对象之间的距离越近;距离参数越小,则表示镜头与传感器之间的距离越小,即可以表示电子设备与拍摄对象之间的距离越远。应理解,距离参数可以被称为“code值”;或者,距离参数又可以被称为镜头位置(lens position)。
3、一次性编程(One Time Programmable,OTP)数据
OTP为MCU的一种存储器类型,用于表示一次性编程;多是采用融丝结构,编程过程是不可逆的破坏活动。
应理解,在本申请的实施例中,OTP数据为存储在摄像头的器件中的数据;OTP数据不会随着拍摄场景或者拍摄对象的改变而改变。
可选地,在本申请的实施例中,OTP数据中包括摄像头的code值与物距之间的映射关系;物距是指电子设备与拍摄对象之间的物距;code值用于表示电子设备中摄像头对焦时输出的马达的移动距离。
4、变焦倍率(zoom)
变焦倍率用于表示电子设备在拍摄时的变焦大小。
5、主摄摄像头与辅助摄像头
电子设备中可以包括多个摄像头;例如,多个摄像头中可以包括主摄摄像头与辅助摄像头;在电子设备采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理的过程中,可以提取辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对两个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
示例性地,若电子设备采集图像时为单摄模式,即电子设备开启一个摄像头采集图像,该摄像头即为主摄摄像头。
示例性地,若电子设备采集图像时为双摄模式,即电子设备开启两个摄像头采集图像;其中,一个摄像头为主摄摄像头,另一个摄像头为辅助摄像头;在采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理过程中,可以提取部分辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对两个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
在一个示例中,电子设备中的双摄可以为广角摄像头与长焦摄像头;其中,广角摄像头可以作为主摄摄像头,长焦摄像头可以作为辅助摄像头;将广角摄像头采集的图像作为基准,在对广角摄像头采集的图像进行处理的过程中,可以提取长焦摄像头采集的远处拍摄对象的图像信息,实现将广角摄像头与长焦摄像头采集的图像进行融合,通过长焦摄像头可以补充远处拍摄对象的细节信息;并经过处理后得到显示的图像,使得电子设备在拍摄时具有更远的光学变焦。
示例性地,电子设备中的双摄模式中还可以包括:广角摄像头与超广角摄像头、彩色摄像头与黑白摄像头、彩色摄像头与深度摄像头等。
示例性地,若电子设备采集图像时为多摄模式,例如电子设备采集图像时为三摄模式,则电子设备采集图像时可以开启三个摄像头;三个摄像头中包括一个主摄摄像头与两个辅助摄像头;在采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理过程中,可以提取两个辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对三个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
例如,电子设备中的多摄模式可以包括广角摄像头、黑白摄像头与近红外摄像头;其中,广角摄像头可以为主摄摄像头,黑白摄像头与近红外摄像头可以为辅助摄像头,通过广角摄像头获取主要的图像画面,通过黑白摄像头可以补充拍摄对象的暗光区域的图像的细节信息,通过近红外摄像头可以补充拍摄对象的远景的细节信息。
应理解,上述是对电子设备的单摄模式、双摄模式与多摄模式进行举例说明;本申请对单摄模式、双摄模式或者多摄模式中摄像头的类型不作任何限定。
6、超级微距模式
超级微距模式是指电子设备在1倍变焦倍率(1×)至2倍变焦倍率(2×)之间,电子设备自动切换至超广角摄像头作为主摄摄像头进行拍摄的拍摄模式。
示例性地,电子设备在由远至近的拍摄场景中;例如,在电子设备的位置保持不变的情况下,第一时刻电子设备的变焦中心为第一拍摄对象;第二时刻电子设备的变焦中心为第二拍摄对象,第一拍摄对象与电子设备距离较远,第二拍摄对象与电子设备距离较近;则在电子设备在拍摄第二拍摄对象时,电子设备可以自动将超广角摄像头作为主摄摄像头,进入超级微距模式从而增大电子设备拍摄时的视场角。
例如,如图1中的(a)所示,在同一拍摄场景中包括第一拍摄对象260与第二拍摄对象270,第一拍摄对象与电子设备之间的距离为d1,第二拍摄对象与电子设备之间的距离为d2,d2小于d1;图2为该拍摄场景的侧视图,电子设备100包括摄像模组272;在拍摄过程中,电子设备保持位置不变;电子设备开启相机应用程序,在第一时刻电子设备对准第一拍摄对象260进行对焦,电子设备可以显示显示界面280;此时,电子设备的变焦倍率为1×(可以理解的,也可以为1×到2×之间的任意值,也可以为其他值,本申请实施例不进行限定);如图1中的(b)所示,在第二时刻,电子设备保持1×(可以理解的,也可以为1×到2×之间的任意值,也可以为其他值,本申请实施例不进行限定)且改变拍摄对象;例如,电子设备对第二拍摄对象270进行对焦,此时电子设备识别到第二拍摄对象270与电子设备之间的距离较近,电子设备可以进入超级微距模式自动切换至超广角摄像头作为主摄摄像头进行对焦,显示显示界面290。
可选地,电子设备在由远及近的拍摄场景也可以是指电子设备拍摄同一拍摄对象,电子设备发生移动,电子设备与拍摄对象之间的距离逐渐变小。
示例性地,电子设备100在由远至近的拍摄场景中;例如,在拍摄对象的位置保持不变的情况下,电子设备100在拍摄过程中进行移动;拍摄对象与电子设备100之间的距离为由远及近,电子设备100可以基于摄像模组的参数识别电子设备与拍摄对象之间的距离较近时,电子设备可以自动将超广角摄像头作为主摄摄像头,进入超级微距模式从而增大 电子设备拍摄时的视场角。
例如,如图3中的(a)所示,在拍摄过程中第二拍摄对象270的位置保持不变;在第一时刻,电子设备100位于第一位置进行拍摄,电子设备与第二拍摄对象270之间的距离为d2;如图3中的(b)所示,电子设备100从第一位置移动至第二位置进行拍摄;此时,电子设备100与第二拍摄对象270之间的距离为d3,d3小于d2;电子设备100识别到第二拍摄对象270与电子设备100之间的距离较近,电子设备100可以自动将超广角摄像头作为主摄摄像头,进入超级微距模式从而增大电子设备拍摄时的视场角。
示例性地,电子设备在由远至近的拍摄场景中;例如,在电子设备的位置保持不变的情况下,电子设备的拍摄对象为移动拍摄对象;移动拍摄对象与电子设备100之间的距离为由远及近,电子设备100可以基于摄像模组的参数识别电子设备与拍摄对象之间的距离较近时,自动切换至超广角摄像头作为主摄摄像头的拍摄模式。
例如,如图4中的(a)所示,在电子设备的位置保持不变的情况下,在第一时刻,第三拍摄对象283位于第一位置,电子设备100对第三拍摄对象283进行拍摄;如图4中的(b)所示,第二时刻,电子设备100根据拍摄模组的参数识别到第三拍摄对象283移动至第二位置,在电子设备100识别到第三拍摄对象283与电子设备100之间的距离较近,电子设备100可以自动将超广角摄像头作为主摄摄像头,进入超级微距模式从而增大电子设备拍摄时的视场角。
7、超级远景模式
超级远景模式是指电子设备自动将长焦摄像头作为主摄摄像头采集图像的拍摄模式。
示例性地,电子设备在由近至远的拍摄场景中;例如,在电子设备的位置保持不变的情况下,第一时刻电子设备的变焦中心为第一拍摄对象;第二时刻电子设备的变焦中心为第四拍摄对象,第一拍摄对象与电子设备距离较近,第四拍摄对象与电子设备距离较近;在电子设备在拍摄第三拍摄对象时,电子设备可以自动将长焦摄像头作为主摄摄像头,进入超级远景模式从而增加远景拍摄对象的细节信息。
例如,如图5中的(a)所示,在同一拍摄场景中包括第一拍摄对象260与第四拍摄对象281,第一拍摄对象260与电子设备100之间的距离为d3,第四拍摄对象281与电子设备100之间的距离为d4,d3小于d4;图6为该拍摄场景的侧视图,电子设备100包括摄像模组272;在拍摄过程中,电子设备100保持位置不变;电子设备100开启相机应用程序,在第一时刻电子设备100对准第一拍摄对象260进行对焦,电子设备100可以显示显示界面282;此时,电子设备100的变焦倍率为单倍变焦倍率;如图5中的(b)所示,在第二时刻,电子设备100改变拍摄对象;例如,电子设备100对准第四拍摄对象281进行对焦,此时电子设备100识别到第四拍摄对象281与电子设备100之间的距离较远,电子设备100可以进入超级远景模式,即电子设备100可以自动切换至超长焦摄像头作为主摄摄像头进行对焦,显示显示界面291。
示例性地,电子设备100在由近至远的拍摄场景中;例如,在拍摄对象的位置保持不变的情况下,电子设备100在拍摄过程中进行移动;拍摄对象与电子设备100之间的距离为由近及远,电子设备100可以基于摄像模组的参数识别电子设备与拍摄对象之间的距离较远时,电子设备可以自动将长焦摄像头作为主摄摄像头,进入超级远景模式从而增加远景拍摄对象的细节信息。
例如,如图7中的(a)所示,在拍摄过程中第二拍摄对象270的位置保持不变;在第一时刻,电子设备100位于第二位置进行拍摄,电子设备100与第二拍摄对象270之间的距离为d3;如图7中的(b)所示,在第二时刻,电子设备100从第二位置移动至第一位置进行拍摄;此时,电子设备100与第二拍摄对象270之间的距离为d2,d2大于d3;电子设备100识别到第二拍摄对象270与电子设备100之间的距离较远,电子设备可以自动将长焦摄像头作为主摄摄像头,进入超级远景模式从而增加远景拍摄对象的细节信息。
示例性地,电子设备在由近至远的拍摄场景中;例如,在电子设备的位置保持不变的情况下,电子设备的拍摄对象为移动拍摄对象;移动拍摄对象与电子设备100之间的距离为由近及远,电子设备100可以基于摄像模组的参数识别电子设备与拍摄对象之间的距离较远时,电子设备可以自动将长焦摄像头作为主摄摄像头,进入超级远景模式从而增加远景拍摄对象的细节信息。
例如,如图8中的(a)所示,在电子设备的位置保持不变的情况下,在第一时刻,第三拍摄对象283位于第二位置,电子设备100对第三拍摄对象283进行拍摄;如图8中的(b)所示,在第二时刻,第三拍摄对象283移动至第一位置,电子设备100识别到第三拍摄对象283与电子设备100之间的距离较远,电子设备可以自动将长焦摄像头作为主摄摄像头,进入超级远景模式从而增加远景拍摄对象的细节信息。
8、自动对焦系统
电子设备上拍摄装置(例如,摄像头)通常会采用自动对焦系统进行对焦。自动对焦系统主要由镜头、马达、马达驱动芯片和感光芯片构成。其中,镜头和感光芯片是成像的主要器件,马达和马达驱动芯片是自动对焦的主要器件。镜头和感光芯片之间的距离别称为焦距。拍摄对象距离摄像头的位置不同,对应的成像位置不同,需要调整镜头和感光芯片的距离(焦距),使得感光芯片上可以获得清晰的成像。自动对焦系统通常是通过马达带动镜头移动来调整焦距的。
9、开环马达(open loop)
开环马达是指带动镜头移动的马达是根据输入的电流大小确定镜头的移动距离,在移动镜头的过程中没有反馈信号来修正所移动的距离。相当于输入开环马达的马达驱动芯片的是电流值,输出的是镜头的移动距离,马达驱动芯片不会根据镜头实际的移动距离调整输出的移动距离。因此,采用开环马达的定焦通常精度不高。
10、闭环马达(close loop)
与开环马达相比,闭环马达在镜头上加装霍尔芯片,通过霍尔芯片来感应四周磁铁的磁通量,进而推算出镜头实际的位置。闭环马达可以将镜头的实际位置作为反馈信号输入马达驱动芯片,马达驱动芯片根据该反馈信号调整输出的移动距离。也即是说,闭环马达可以将镜头实际的移动位置作为反馈信号,精确调整镜头的位置,成像质量高。
下面将结合附图,对本申请实施例中的切换摄像头的方法与电子设备进行描述。
图9示出了一种适用于本申请的电子设备的硬件系统。
电子设备100可以是手机、智慧屏、平板电脑、可穿戴电子设备、车载电子设备、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、投影仪等等,本申请实施例对电子设备100的具体类型 不作任何限制。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
需要说明的是,图9所示的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图9所示的部件更多或更少的部件,或者,电子设备100可以包括图9所示的部件中某些部件的组合,或者,电子设备100可以包括图9所示的部件中某些部件的子部件。图9示的部件可以以硬件、软件、或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元。例如,处理器110可以包括以下处理单元中的至少一个:应用处理器(application processor,AP)、调制解调处理器、图形处理器(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、控制器、视频编解码器、数字信号处理器(digital signal processor,DSP)、基带处理器、神经网络处理器(neural-network processing unit,NPU)。其中,不同的处理单元可以是独立的器件,也可以是集成的器件。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
示例性地,处理器110可以用于执行本申请实施例的切换摄像头的方法;例如,运行电子设备中的相机应用程序;显示第一图像,第一图像为第一摄像头作为主摄摄像头进行采集图像得到的;确定第一距离与第二距离是否满足第一预设条件,其中,第一距离与第二距离用于指示电子设备与拍摄对象之间的物距,第一距离为基于第一摄像头的参数得到的物距,第二距离为基于第二摄像头的参数得到的物距;在第一距离与第二距离满足第一预设条件的情况下,显示第二图像,第二图像为第二摄像头作为主摄摄像头进行采集图像得到的。
图9所示的各模块间的连接关系只是示意性说明,并不构成对电子设备100的各模块间的连接关系的限定。可选地,电子设备100的各模块也可以采用上述实施例中多种连接方式的组合。
电子设备100的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调处理器以及基带处理器等器件实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖 单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
电子设备100可以通过GPU、显示屏194以及应用处理器实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194可以用于显示图像或视频。
示例性地,在本申请的实施例中,显示屏194可以用于显示第二图像。
电子设备100可以通过ISP、摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过摄像头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP可以对图像的噪点、亮度和色彩进行算法优化,ISP还可以优化拍摄场景的曝光和色温等参数。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193(也可以称为镜头)用于捕获静态图像或视频。可以通过应用程序指令触发开启,实现拍照功能,如拍摄获取任意场景的图像。摄像头可以包括成像镜头、滤光片、图像传感器等部件。物体发出或反射的光线进入成像镜头,通过滤光片,最终汇聚在图像传感器上。成像镜头主要是用于对拍照视角中的所有物体(也可以称为待拍摄场景、目标场景,也可以理解为用户期待拍摄的场景图像)发出或反射的光汇聚成像;滤光片主要是用于将光线中的多余光波(例如除可见光外的光波,如红外)滤去;图像传感器可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。图像传感器主要是用于对接收到的光信号进行光电转换,转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。
在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
其中,摄像头193可以位于电子设备100的前面,也可以位于电子设备100的背面,摄像头的具体个数以及排布方式可以根据需求设置,本申请不做任何限制。
示例性的,电子设备100包括前置摄像头和后置摄像头。例如,前置摄像头或者后置摄像头,均可以包括1个或多个摄像头。以电子设备100具有4个后置摄像头为例,这样,电子设备100启动4个后置摄像头进行拍摄时,可以使用本申请实施例提供的切换摄像头的方法。
或者,摄像头设置于电子设备100的外置配件上,该外置配件可旋转的连接于手机的边框,该外置配件与电子设备100的显示屏194之间所形成的角度为0-360度之间的任意角度。比如,当电子设备100自拍时,外置配件带动摄像头旋转到朝向用户的位置。当然,手机具有多个摄像头时,也可以只有部分摄像头设置在外置配件上,剩余的摄像头设置在电子设备100本体上,本申请实施例对此不进行任何限制。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数 字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1、MPEG2、MPEG3和MPEG4。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x轴、y轴和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。例如,当快门被按下时,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航和体感游戏等场景。
加速度传感器180E可检测电子设备100在各个方向上(一般为x轴、y轴和z轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。加速度传感器180E还可以用于识别电子设备100的姿态,作为横竖屏切换和计步器等应用程序的输入参数。
距离传感器180F用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,例如在拍摄场景中,电子设备100可以利用距离传感器180F测距以实现快速对焦。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现解锁、访问应用锁、拍照和接听来电等功能。
触摸传感器180K,也称为触控器件。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,触摸屏也称为触控屏。触摸传感器180K用于检测作用于其上或其附近的触摸操作。触摸传感器180K可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,并且与显示屏194设置于不同的位置。
上文详细描述了电子设备100的硬件系统,下面介绍电子设备100的软件系统。
图10是本申请实施例提供的电子设备的软件系统的示意图。
如图10所示,系统架构中可以包括应用层210、应用框架层220、硬件抽象层230、驱动层240以及硬件层250。
应用层210可以包括相机应用程序、图库、日历、通话、地图、导航、WLAN、蓝牙、音乐、视频、短信息等应用程序。
应用框架层220为应用层的应用程序提供应用程序编程接口(application programming interface,API)和编程框架;应用框架层可以包括一些预定义的函数。
例如,应用框架层220可以包括相机访问接口;相机访问接口中可以包括相机管理与相机设备。其中,相机管理可以用于提供管理相机的访问接口;相机设备可以用于提供访 问相机的接口。
硬件抽象层230用于将硬件抽象化。比如,硬件抽象层可以包括相机抽象层以及其他硬件设备抽象层。
例如,硬件抽象层230中包括相机硬件抽象层与相机算法。相机硬件抽象层可以调用相机算法;相机算法中可以包括用于图像处理的软件算法。
示例性地,相机算法库中可以包括本申请实施例提供的切换摄像头的方法对应的算法。
示例性地,相机算法中的算法可以是指不依赖特定硬件实现;比如,通常可以在CPU中运行的代码等。
驱动层240用于为不同硬件设备提供驱动。例如,驱动层可以包括摄像头驱动。
硬件层250位于操作系统的最底层;如图10所示,硬件层250可以包括摄像头1、摄像头2、摄像头3等。其中,摄像头1、摄像头2、摄像头3可对应于电子设备上的多个摄像头。
为了便于理解,下面以电子设备100为具有上述软硬件结构的手机为例,先对本申请实施例提供的切换摄像头的方法所适用的电子设备100上的摄像头和界面先进行详细描述。
本申请实施例提供的切换摄像头的方法所适用的电子设备上至少具有多个摄像头193,例如,具有3种摄像头193;该3种摄像头分别为主摄摄像头(例如,广角摄像头)、超广角摄像头与长焦摄像头;该3种摄像头可以用于拍摄同一待拍摄场景。
可选地,电子设备100上还可以具有其他摄像头193,摄像头193的种类以及每种摄像头193的个数均可以根据需要进行设置,本申请实施例对此不进行任何限制。
示例性的,如图11所示以电子设备100可以具有3个摄像头193为例进行说明;3个摄像头的排布方式可以如图11中的(a)所示,或者如图11中的(b)所示;例如,该3个摄像头193可以为主摄摄像头1931(例如,广角摄像头)、超广角摄像头1932和长焦摄像头1933。
应理解,上述仅为两种排布方式的示例,也可以为其他的排布方式;具体排布方式可以根据需要进行设计和更改,本申请实施例对此不进行任何限制。
需要说明的是,上述3个摄像头在拍摄时,通常主摄摄像头1931对应的视场角范围大于长焦摄像头1933对应的视场角范围;而超广角摄像头1932对应的视场角范围大于主摄摄像头1931对应的视场角范围;超广角摄像头1932的视场角与主摄摄像头1931的视场角之间可能存在重叠;也就是说,超广角摄像头1932可以拍摄到主摄摄像头1931拍摄的场景内容及其周边的场景内容。
应理解,长焦摄像头1933对应的视场角范围小于主摄摄像头1931对应的视场角范围,主摄摄像头1931的视场角与长焦摄像头1933的视场角之间可能存在重叠;也就是说,主摄摄像头1931可以拍摄到长焦摄像头1933拍摄的场景内容及其周边的场景内容。超广角摄像头1932的视场角与长焦摄像头1933的视场角之间可能存在重叠的;也就是说,超广角摄像头1932可以拍摄到长焦摄像头1933拍摄的场景内容及其周边的场景内容。
其中,超广角摄像头1932由于对焦距离较小,所以适合拍摄近景;并且,顾名思义,超广角摄像头1932适合拍摄视场角比较大的场景;主摄摄像头1931,由于清晰度较高,比较适合拍摄肖像,而长焦摄像头1933比较适合拍摄远景特写。
示例性地,如图12所示,超广角摄像头的变焦倍数可以小于M倍变焦倍率;广角摄 像头即主摄摄像头的变焦倍数范围可以为[M,N);长焦摄像头的变焦倍数可以大于或者等于N倍变焦倍率。
例如,M可以为1,N可以为3.5;则超广角摄像头的变焦倍数为小于1倍变焦倍率(1×);广角摄像头的变焦倍率范围为1倍变焦倍率至3.5倍变焦倍率[1×~3.5×);长焦摄像头的变焦倍率为大于或者等于3.5倍变焦倍率。
应理解,在电子设备拍摄的过程中,变焦倍率越大,则对应的视场角越小。
目前,在电子设备中不包括激光传感器的情况下,电子设备可以基于广角摄像头的参数,进行不同摄像头的自动切换;例如,电子设备可以根据广角摄像头的参数识别电子设备与拍摄物体之间的距离较近时,可以自动切换至将超广角摄像头作为主摄摄像头,进入超级微距拍摄模式;但是,在电子设备与拍摄对象之间的距离较近的情况下,电子设备与拍摄对象之间的实际物距不在广角摄像头采集距离参数的有效范围内,导致广角摄像头的参数的准确性降低;使得电子设备在处于超级微距拍摄模式拍摄时容易出现自动退出超级微距拍摄模式的问题,导致超级微距拍摄模式的稳定性较差;例如,根据广角摄像头的参数映射出的有效物距范围为8cm~5m;若电子设备与拍摄对象之间的实际物距小于8cm,则基于广角摄像头采集的参数得到的电子设备与拍摄对象之间的距离不准确,或者,不稳定;因此,在电子设备与拍摄对象距离较近时,广角摄像头采集的参数可能存在误差,使得电子设备在处于超级微距拍摄模式拍摄时容易出现自动退出超级微距拍摄模式的问题;如图13中的(a)所示,电子设备处于超级微距模式;若拍摄对象移动至与电子设备更近的距离,由于广角摄像头采集的参数存在一定的误差,导致电子设备可能出现闪退现象;如图13中的(b)所示,电子设备可能自动退出超级微距模式。
有鉴于此,本申请实施例提供了一种切换摄像头的方法与电子设备,该方法应用于电子设备,电子设备包括摄像头模组,摄像头模组包括第一摄像头(例如,超广角摄像头)与第二摄像头(例如,广角摄像头),方法包括:运行电子设备中的相机应用程序;显示第一图像,第一图像为第一摄像头作为主摄摄像头进行采集图像得到的;确定第一距离与第二距离是否满足第一预设条件,其中,第一距离与第二距离用于指示电子设备与拍摄对象之间的物距,第一距离为基于第一摄像头的参数得到的物距,第二距离为基于第二摄像头的参数得到的物距;在第一距离与第二距离满足第一预设条件的情况下,显示第二图像,第二图像为第二摄像头作为主摄摄像头进行采集图像得到的。在本申请的实施例中,在第一距离与第二距离满足第一预设条件时,电子设备切换至将第二摄像头作为主摄摄像头;由于第一距离为根据第一摄像头的参数得到的物距,第二距离为根据第二摄像头的参数得到的物距;因此,在本申请的实施例中,在判断是否切换至第二摄像头作为主摄摄像头时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于第二摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的稳定性更高。
下面对本申请实施例提供的切换摄像头的方法的应用场景进行举例说明。
本申请实施例中的切换摄像头的方法可以应用于拍照场景(例如,单景拍照、双景拍照等)、预览场景、录制视频场景、或者视频通话场景等;通过本申请实施例中的切换摄像头的方法,能够在不依赖于电子设备中的激光传传感器的情况下,基于获取的镜头位置与zoom值,实现电子设备中不同摄像头的自动切换,提高用户的拍摄体验与图像质量。
示例性地,预览场景包括但不限于以下场景中:
拍照预览、光圈预览、夜景预览、人像预览、录像预览或者专业预览等。
应理解,预览场景可以是指电子设备在某个拍摄模式下,未点击指示拍摄的按钮之前电子设备采集图像的场景。
在一个示例中,电子设备进入相机应用程序后,可以开启默认的拍照相机模式;在拍照相机模式中,电子设备可以进入默认的拍摄模式,该默认的拍摄模式可以是指将广角摄像头作为主摄摄像头且变焦倍率为单倍变焦倍率(1×)的拍摄模式;该默认的拍摄模式为非超级微焦距模式,在非超级微距模式下,可以获取电子设备的距离参数(例如,code值)与变焦倍率(例如,zoom值),在距离参数满足第一预设阈值且变焦倍率满足第二预设范围的情况下,电子设备可以切换至超广角摄像头采集图像。
示例性地,本申请实施例中的切换摄像头的方法还可以应用于录制视频的场景,或者,视频通话场景中,其中,视频通话场景可以包括但不限于以下场景中:
视频通话、视频会议应用、长短视频应用、视频直播类应用、视频网课应用、人像智能运镜应用场景、系统相机录像功能录制视频、视频监控,或者智能猫眼等人像拍摄类场景等。
应理解,上述为对应用场景的举例说明,并不对本申请的应用场景作任何限定。
下面结合图14至图25对本申请实施例提供的切换摄像头的方法进行详细说明。
图14是本申请实施例提供的切换摄像头的方法的示意性流程图。该方法可以由图14所示的电子设备执行;该方法300包括步骤S310至步骤S340,下面分别对步骤S310至步骤S340进行详细的描述。
步骤S310、运行相机应用程序。
示例性地,用户可以通过单击“相机”应用程序的图标,指示电子设备运行相机应用。
示例性地,电子设备处于锁屏状态时,用户可以通过在电子设备的显示屏上向右滑动的手势,指示电子设备运行相机应用。又或者,电子设备处于锁屏状态,锁屏界面上包括相机应用程序的图标,用户通过点击相机应用程序的图标,指示电子设备运行相机应用程序。又或者,电子设备在运行其他应用时,该应用具有调用相机应用程序的权限;用户通过点击相应的控件可以指示电子设备运行相机应用程序。例如,电子设备正在运行即时通信类应用程序时,用户可以通过选择相机功能的控件,指示电子设备运行相机应用程序等。
应理解,上述为对运行相机应用程序的操作的举例说明;还可以通过语音指示操作,或者其它操作的指示电子设备运行相机应用程序;本申请对此不作任何限定。
还应理解,运行相机应用程序可以是指启动相机应用程序。
步骤S320、显示第一图像。
其中,第一图像为所述第一摄像头作为主摄摄像头进行采集图像得到的。
可选地,显示第一图像,包括:在电子设备处于超级微距模式的情况下,显示第一图像。
在本申请的实施例中,第一图像为在电子设备处于超级微距模式下显示的图像;在电子设备处于超级微距模式时,电子设备中的超广角摄像头作为主摄摄像头。
应理解,超级微距模式是指电子设备在1倍变焦倍率(1×)至2倍变焦倍率(2×)之间,电子设备自动切换至超广角摄像头作为主摄摄像头进行拍摄的拍摄模式。
可选地,在所述电子设备处于超级微距模式的情况下,显示第一图像,包括:
在电子设备的第一显示界面显示第一图像,第一显示界面中还包括第一图标,第一图标用于指示超级微距模式。
示例性地,第一显示界面如图20中的(d)所示;第一图标可以为图20中的(d)所示的图标606。
可选地,第一图标中包括第一控件,还包括:
检测到对第一控件的第一操作;响应于第一操作,电子设备退出超级微距模式。
示例性地,第一操作可以是指关闭超级微距模式;例如,如图20中的(d)所示,第一图标可以是指图标606,第一控件可以是指图标606中的“×”第一操作可以是指点击“超级微距×”中的“×”,则电子设备可以关闭超级微距模式;可选地,在关闭超级微距模式后,在该预览显示界面中,电子设备可以不再推送超级微距模式。
可选地,显示第一图像,包括:
在电子设备所处的拍摄环境的亮度参数大于第二亮度阈值,且第二距离参数小于或者等于第三预设阈值的情况下,显示第一图像。
示例性地,在电子设备未进入超级微距模式时,则电子设备中的广角摄像头作为主摄摄像头;在电子设备检测到拍摄环境的亮度参数大于第二亮度阈值的情况下,表示电子设备所处的拍摄环境不是较暗的拍摄场景;第二距离参数小于或者等于第三预设阈值,则基于广角摄像头采集的参数的得到电子设备与拍摄对象之间的距离较近;此时,电子设备可以进入超级微距模式,显示第一图像。
在本申请的实施例中,在电子设备进入超级微距模式时,可以根据电子设备的拍摄场景的亮度与第二距离确定电子设备是否进入超级微距模式;与基于第一距离确定电子设备是否进入超级微距模式相比,本申请实施例中进入超级微距模式的准确性更高。
可选地,第二亮度阈值为基于第二亮度范围得到的预设阈值,第二亮度范围用于表示第二摄像头进行对焦的有效亮度范围。
例如,第二摄像头进行有效对焦的亮度范围为[L1,L2],则第二亮度阈值大于或者等于L1。
步骤S330、确定第一距离与第二距离是否满足第一预设条件。
其中,第一距离与第二距离用于指示电子设备与拍摄对象之间的物距,第一距离为基于第一摄像头的参数得到的物距,第二距离为基于第二摄像头的参数得到的物距。
可选地,第一距离与第二距离满足第一预设条件,包括:
第一距离大于第一预设阈值,且第二距离大于第二预设阈值,其中,第一预设阈值与第二预设阈值不同。
应理解,在本申请的实施例中,电子设备包括摄像模组,摄像模组中包括第一摄像头与第二摄像头;根据第一摄像头参数的参数可以得到电子设备与拍摄对象之间的第一距离;根据第二摄像头采集的参数可以得到电子设备与拍摄对象之间的第二距离。
可选地,第一距离可以为根据超广角摄像头采集的code值得到的电子设备与拍摄对象之间的距离。
可选地,第二距离可以为根据广角摄像头采集的code值得到的电子设备与拍摄对象之间的code值。
应理解,code值用于表示电子设备值摄像头对焦时输出的马达的移动距离;根据code值可以映射得到电子设备与拍摄对象之间的物距。
可选地,第一预设阈值为基于第一距离范围得到的预设阈值,第一距离范围用于表示第一摄像头进行对焦的有效距离范围。
示例性地,第一摄像头的有效对焦距离范围为[X1,X2],则第一预设阈值大于或者等于X1。
可选地,第二预设阈值为基于第二距离范围得到的预设阈值,第二距离范围用于表示第二摄像头进行对焦的有效距离范围。
示例性地,第二摄像头的有效对焦距离范围为[X3,X4],则第二预设阈值大于或者等于X3。
可选地,在第一摄像头包括开环马达的情况下,还包括:
获取第一摄像头的参数;基于第一摄像头的标定值对第一摄像头的参数进行补偿处理,得到处理后的参数;基于处理后的参数,得到所述第一距离。具体实现方式可以参见后续图15中的S432与S433的相关描述;或者,参见后续图17与图18的相关描述;或者,参见图19中的S532与S533的相关描述,此处不再赘述。
在本申请的实施例中,在电子设备的第一摄像头(例如,超广角摄像头)包括开环马达的情况下,可以对第一摄像头的参数进行补偿处理;例如,可以对超广角摄像头输出的code值进行补偿处理,使得code值的准确性跟高;在code值准确性更高的情况下,得到的电子设备与拍摄对象之间的第一距离更准确。
步骤S340、在第一距离与第二距离满足第一预设条件的情况下,显示第二图像。
其中,第二图像为第二摄像头作为主摄摄像头进行采集图像得到的。
在本申请的实施例中,在第一距离与第二距离满足预设条件的情况下,电子设备会将第二摄像头作为主摄摄像头显示第二图像;由于第一距离为根据第一摄像头的参数得到的物距,第二距离为根据第二摄像头的参数得到的物距;因此,在本申请的实施例中,在判断是否切换至第二摄像头作为主摄摄像头时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于第二摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的稳定性更高。
示例性地,在电子设备处于超级微距模式的情况下,电子设备可以将超广角摄像头(第一摄像头的一个示例)作为主摄摄像头显示第一图像;在电子设备确定基于超广角摄像头的参数得到的电子设备与拍摄对象之间的第一距离,与基于广角摄像头(第二摄像头的一个示例)的参数得到的电子设备与拍摄对象之间的第二距离满足预设条件的情况下,电子设备退出超级微距模式;例如,电子设备根据第一距离与第二距离确定电子设备与拍摄对象之间的距离较远时,电子设备退出超级微距模式;若根据第一距离和/或第二距离不满足预设条件,则电子设备保持超级微距模式;在本申请的实施例中,电子设备可以基于超广角摄像头的参数与广角摄像头的参数确定是否退出超级微距模式,在一定程度上能够避免在广角摄像头采集的参数存在一定的误差,导致电子设备可能出现超级微距模式的闪退现象;从而提高超级微距模式的稳定性,即提 高电子设备切换摄像头的稳定性。
可选地,还包括:
在第一距离和/或所述第二距离不满足第一预设条件的情况下,确定电子设备所处拍摄场景的亮度参数是否小于或者等于第一亮度阈值;在亮度参数小于或者等于第一亮度阈值的情况下,显示第二图像。
在本申请的实施例中,在第一距离和/或第二距离不满足预设条件的情况下,电子设备还可以进一步根据拍摄场景的亮度参数确定是否退出超级微距模式;由于在电子设备所处的拍摄场景较暗的情况下,第一摄像头采集的参数与第二摄像头采集的参数的准确性较低;由于第一摄像头采集的参数与第二摄像头采集的参数的准确性较低,则第一距离与第二距离的准确性较低;此时,电子设备可以直接退出超级微距模式。
可选地,第一亮度阈值为基于第一亮度范围得到的预设阈值,第一亮度范围用于表示第一摄像头进行对焦的有效亮度范围。
示例性地,第一亮度阈值位于第一摄像头进行对焦的有效亮度范围。
可选地,电子设备显示所述第一图像时的变焦倍率为第一变焦倍率,电子设备当前的变焦倍率为第二变焦倍率,还包括:
在亮度参数大于第一亮度阈值的情况下,确定第二变焦倍率与第一变焦倍率是否相同;在第二变焦倍率与第一变焦倍率不相同的情况下,显示第二图像。
在本申请的实施例中,在第一距离和/或第二距离不满足预设条件,且电子设备所处的拍摄场景的亮度参数大于第一亮度阈值的情况下,可以确定电子设备的变焦倍率是否发生变化;若电子设备的变焦倍率发生变化,则电子设备退出超级微距模式;例如,电子设备的变焦倍率发生变化,则可能是用户对电子设备的变焦倍率进行了调整;此时,电子设备退出超级微距模式。
可选地,第一摄像头包括超广角摄像头或者长焦摄像头,和/或,第二摄像头包括广角摄像头。
在一个示例中,第一摄像头为超广角摄像头,第二摄像头为广角摄像头;在电子设备处于超级微距模式,以超广角摄像头作为主摄摄像头,电子设备显示第一图像;在电子设备退出超级微距模式,以广角摄像头作为主摄摄像头,电子设备显示第二图像。
在一个示例中,第一摄像头为长焦摄像头,第二摄像头为广角摄像头;在电子设备处于超级远景模式,以长焦摄像头作为主摄摄像头,电子设备显示第一图像;在电子设备退出超级远景模式,以广角摄像头作为主摄摄像头,电子设备显示第二图像。
可选地,电子设备在显示所述第一图像与显示第二图像时,电子设备所处的位置相同。
示例性地,如图1中的(a)与图1中的(b)所示的场景,此处不再赘述。
在本申请的实施例中,在拍摄过程中电子设备的位置可以始终未改变,若电子设备的对焦对象从远景拍摄对象移动至近景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,进入超级微距模式;若电子设备的对焦对象从近景拍摄对象移动至远景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,退出超级微距模式;电子设备可以实现自动切换不同类型的摄像头作为主摄摄像头,从而确保采集图像的图像质量。
可选地,第一图像中包括第一拍摄对象,第二图像中包括第二拍摄对象,第一拍摄对 象与第二拍摄对象所处的位置相同,第一拍摄对象与电子设备之间的距离为第三距离,第二拍摄对象与电子设备之间的距离为第四距离,第三距离小于第四距离。
在本申请的实施例中,在拍摄过程中电子设备的位置可以发生改变;比如,电子设备可以移动着拍摄不同拍摄对象(例如,第一拍摄对象与第二拍摄对象);在电子设备的对焦对象从近景拍摄对象移动至远景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,退出超级微距模式;电子设备可以实现自动切换不同类型的摄像头作为主摄摄像头,从而确保采集图像的图像质量。
可选地,第一图像与第二图像中包括第三拍摄对象,在显示第一图像与第二图像时,第三拍摄对象所处的位置相同;在采集第一图像时,第三拍摄对象与电子设备之间的距离为第五距离;在采集第二图像时,第三拍摄对象与电子设备之间的距离为第六距离,第五距离小于第六距离。
在本申请的实施例中,在拍摄过程中电子设备的位置可以发生改变;比如,电子设备可以移动着拍摄同一拍摄对象(例如,第三拍摄对象);在电子设备的对焦对象从近景拍摄对象移动至远景拍摄对象,电子设备可以自动识别电子设备与拍摄对象之间的距离,退出超级微距模式;电子设备可以实现自动切换不同类型的摄像头作为主摄摄像头,从而确保采集图像的图像质量。
在本申请的实施例中,在第一距离与第二距离满足第一预设条件时,电子设备切换至将第二摄像头作为主摄摄像头,显示第二图像;由于第一距离为根据第一摄像头的参数得到的物距,第二距离为根据第二摄像头的参数得到的物距;因此,在本申请的实施例中,在判断是否切换至第二摄像头作为主摄摄像头时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于第二摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的准确性更高,即电子设备中拍摄模式的稳定性更好。
图15是本申请实施例提供的切换摄像头的方法的示意性流程图。该方法可以由图9所示的电子设备执行;该方法400包括步骤S410至步骤S444,下面分别对步骤S410至步骤S444进行详细的描述。
步骤S410、运行相机应用程序。
示例性地,用户可以通过单击“相机”应用程序的图标,指示电子设备运行相机应用。或者,电子设备处于锁屏状态时,用户可以通过在电子设备的显示屏上向右滑动的手势,指示电子设备运行相机应用程序。又或者,电子设备处于锁屏状态,锁屏界面上包括相机应用程序的图标,用户通过点击相机应用程序的图标,指示电子设备运行相机应用程序。又或者,电子设备在运行其他应用时,该应用具有调用相机应用程序的权限;用户通过点击相应的控件可以指示电子设备运行相机应用程序。例如,电子设备正在运行即时通信类应用程序时,用户可以通过选择相机功能的控件,指示电子设备开启相机应用程序等。
应理解,上述为对运行相机应用程序的操作的举例说明;还可以通过语音指示操作,或者其它操作的指示电子设备运行相机应用程序;本申请对此不作任何限定。
步骤S420、判断电子设备是否处于超级微距模式;若电子设备处于超级微距模式,则执行步骤S430;若电子设备不处于超级微距模式,则执行步骤S440。
应理解,超级微距模式可以是电子设备的一种拍摄模式;超级微距拍摄模式是指 电子设备在1倍变焦倍率(1×)至2倍变焦倍率(2×)之间,电子设备自动切换至超广角摄像头作为主摄摄像头进行拍摄的拍摄模式。
可选地,可以获取电子设备当前拍摄模式的标签,根据拍摄模式的标签确定电子设备是否处于超级微距模式。
示例性地,非超级微距模式对应的标签可以为flag=1,超级微距模式对应的标签可以为flag=0,在电子设备切换至超广角摄像头作为主摄摄像头后,可以将拍摄模式对应的标签更新为flag=0。
步骤S430、获取超广角摄像头与广角摄像头的数据。
应理解,在超级微距模式下超广角摄像头作为主摄摄像头进行拍摄;此时,广角摄像头也可以处于运行状态,但广角摄像头采集的数据不用于送显。
可选地,超广角摄像头的数据可以包括函数关系1与code值;其中,函数关系1用于表示参数1(物距2)与参数2(超广角摄像头采集的code值)之间的映射关系。
可选地,可以获取超广角摄像头的OTP数据,OTP数据为存储在超广角摄像头器件中的数据,OTP数据包括函数关系1;例如,函数关系1如图16所示;图16为距离(物距)与code值之间的曲线关系的示意图。
可选地,广角摄像头的数据可以包括函数关系2与code值;其中,函数关系2用于表示参数3(物距1)与参数4(广角摄像头采集的code值)之间的映射关系。
可选地,可以获取超广角摄像头的OTP数据,超广角摄像头的OTP数据为存储在超广角摄像头器件中的数据,OTP数据包括函数关系1。
可选地,可以获取广角摄像头的OTP数据,广角摄像头的OTP数据为存储在广角摄像头器件中的数据,OTP数据包括函数关系1。
可选地,在本申请的实施例中,code值可以包括音圈马达(Voice Coil Motor,VCM)code值。
应理解,OTP数据为一种存储器类型的数据,即存储在器件中无法改变的数据。
步骤S431、判断超广角摄像头是否包括开环马达;若超广角摄像头包括开环马达,则执行步骤S432;若超广角摄像头不包括开环马达,则执行步骤S434。
应理解,由于开环马达中的驱动芯片不会根据镜头实际的移动距离调整输出的移动距离;因此,开环马达输出的镜头的移动距离的准确性较低;在镜头的移动距离的准确性较低的情况下,得到的电子设备与拍摄对象之间的物距地准确性也较低;在本申请的实施例中,若摄像头包括开环马达,则可以对开环马达输出的镜头距离进行修正,即执行步骤S442;提高电子设备与拍摄对象之间物距地准确性。
步骤S432、对超广角摄像头的code值进行补偿处理。
示例性地,如图17中的(a)所示,摄像头中的镜头处于向上位姿;如图17中的(b)所示,摄像头中的镜头处于水平位姿;如图17中的(c)所示,摄像头中的镜头处于向下位姿;例如,对于电子设备与拍摄对象之间的同一物距,按理来说图17中的(a)、图17中的(b)与图17中的(c)中镜头移动的距离相同;但是,由于重力作用,使得在相同物距的情况下,镜头的水平位姿与向上位姿,或者向下位姿之间存在差异,如图18所示。因此,在摄像头包括开环马达的情况下,可以根据摄像头的不同位姿对摄像头的参数进行补偿处理。
示例性地,图17中所示的F1用于表示电磁力;F2用于表示重力;F3用于表示弹片作用力;对于如图17中的(a)所示位姿的摄像头,NBI1L=K*X1+mg;对于如图17中的(b)所示位姿的摄像头,NBI2L=K*X2;对于如图17中的(c)所示位姿的摄像头,NBI3L=K*X3-mg;取I1=I2=I3,X2-X1=X3-X2=mg/K;即表示对于不同位姿的摄像头,在电流相同时摄像头的行程(例如,移动距离)存在差异值;如图18所示,对于同一电流,若摄像头处于水平位姿则对应曲线中的B点;若摄像头处于向下位姿,则对应曲线中的C点;若摄像头处于向上位姿,则对应曲线中的A点。
例如,若摄像头的位置如图17中的(a)所示,则对摄像头输出的镜头移动距离叠加一个正补偿值;若摄像头的位置如图17中的(b)所示,则对摄像头输出的镜头移动距离叠加一个负补偿值;其中,该正补偿值或者负补偿值,可以通过预先对同一摄像头进行不同物距的数据标定,得到多组预选标定的补偿值;在实际拍摄过程中,可以根据摄像头的位置(例如,摄像头朝上或者摄像头朝下),对超广角摄像头输出的镜头移动距离即code值进行补偿处理。
在一个示例中,标定数据中包括Δ1与Δ2;其中,Δ1用于在同一物距下,镜头处于水平与镜头处于朝上位置时,镜头移动处理的差值;Δ2用于在同一物距下,镜头处于水平与镜头处于朝下位置时,镜头移动处理的差值;若当前拍摄时,电子设备的镜头处于朝上位置,则通过Δ1对code值进行补偿;若当前拍摄时,电子设备的镜头处于朝下位置,则通过Δ2对code值进行补偿;其中,Δ1为正数,Δ2可以为负数。
步骤S433、根据补偿处理后的code值与函数关系1,得到电子设备与拍摄对象之间的物距2。
在本申请的实施例中,在电子设备的超广角摄像头包括开环马达的情况下,可以对超广角摄像头的参数进行补偿处理;例如,可以对超广角摄像头输出的code值进行补偿处理,使得code值的准确性跟高;在code值准确性更高的情况下,得到的电子设备与拍摄对象之间的物距2更准确。
可选地,在超广角摄像头包括开环马达的情况下,可以根据以下公式对超广角摄像头的code值进行补偿处理:
其中,code2表示补偿处理后的code值;code1表示超广角摄像头的code值;cosθ用于确定摄像头的位姿;x用于表示标定值;gx表示重力传感器在x轴的数据;gy表示重力传感器在y轴的数据;gz表示重力传感器在z轴的数据。
示例性地,x可以表示Lens Sag Compensation(镜头姿势差补偿);Lens Sag Compensation是指器件在竖直向上和竖直向下时,与水平方向的Code的差值;若gz<0,使用竖直向上的Lens Sag Compensation;即使用正补偿值进行补偿;若gz≥0,使用竖直向下的Lens Sag Compensation;即使用负补偿值进行补偿。
例如,cosθ大于0表示摄像头处于向上位姿;cosθ小于0表示摄像头处于向下位姿。
步骤S434、在超广角摄像头不包括开环马达的情况下,根据code值与函数关系1,得到电子设备与拍摄对象之间的物距2。
示例性地,在超广角摄像头包括闭环马达的情况下,无需对超广角摄像头的code值进行补偿处理;可以根据超广角摄像头的code值与函数关系1,直接得到电子设备与拍摄对象之间的物距2。
需要说明的是,闭环马达可以将镜头的实际位置作为反馈信号输入马达驱动芯片,马达驱动芯片根据该反馈信号调整输出的移动距离。也就是说,闭环马达可以将镜头实际的移动位置作为反馈信号,精确调整镜头的位置;因此,在超广角摄像头包括闭环马达的情况下,超广角摄像头的code值的准确性较高,无需对超广角摄像头的code值进行补偿处理。
步骤S435、判断物距1是否满足第一预设阈值,且物距2是否满足第二预设阈值;若物距1满足第一预设阈值,且物距2满足第二预设阈值,则执行步骤S436;若物距1不满足第一预设阈值,和/或,物距2不满足第二预设阈值,则执行步骤S437。
可选地,第一预设阈值可以为广角摄像头对应的阈值;第二预设阈值可以为超广角摄像头对应的阈值。
示例性地,物距1是否满足第一预设阈值,且物距2是否满足第二预设阈值可以是指物距1大于第一预设阈值,且物距2大于第二预设阈值。
步骤S436、退出超级微距模式。
应理解,退出超级微距模式可以是指将超广角作为主摄摄像头切换为其他摄像头作为主摄摄像头。
示例性地,在物距1满足第一预设阈值,且物距2满足第二预设阈值的情况下,电子设备可以退出超级微距模式;例如,在物距1大于第一预设阈值,且物距2大于第二预设阈值的情况下,退出超级微距模式。
需要说明的是,由于在电子设备与拍摄对象之间的物距较近时,获取的广角摄像头的code值的准确度降低;因此,在本申请的实施例中,为了避免根据广角摄像头的code值判断是否退出超级微距模式导致出现闪退问题,在判断是否退出超级微距模式时,采用与广角摄像头相关的第一预设阈值,和与超广角摄像头相关的第二预设阈值同时进行判断,从而进一步提高退出超级微距的准确性;避免出现超级微距模式的闪退问题,提高超级微距模式的稳定性与鲁棒性。
可选地,可以基于一帧图像判断是否退出超级微距模式;例如,对于一帧图像,若物距1满足第一预设阈值,且物距2满足第二预设阈值,则电子设备切换摄像头退出超级微距模式。
可选地,为了确保电子设备采集图像的稳定性,电子设备在切换摄像头之前,可以基于多帧图像进行判断;例如,可以判断对于至少连续两帧图像是否物距1满足第一预设阈值,且物距2满足第二预设阈值;若对于至少连续两帧图像物距1满足第一预设阈值,且物距2满足第二预设阈值,则电子设备切换摄像头退出超级微距模式。
在本申请的实施例中,通过第一预设阈值与第二预设阈值,为了更加准确地判断电子设备与拍摄对象之间的物距较远;在电子设备与拍摄对象之间的物距较远的情况下,电子设备可以退出超级微距模式;由于在本申请的实施例中,在退出超级微距模式时,采用了第一预设阈值与第二预设阈值双重阈值;其中,第一预设阈值为广角摄像头的阈值,第二预设阈值为超广角摄像头的阈值;通过两个预设阈值判断是否退出 超级微距模式,与采用广角摄像头的单个预设阈值确定是否退出超级微距模式相比;在本申请的实施例中,超级微距模式的稳定性更好。
可选地,在电子设备退出超级微距模式之后,电子设备可以根据如图15所示的步骤S440至步骤S444确定是否再次运行超级微距模式。
步骤S437、保持超级微距模式。
示例性地,在物距1不满足第一预设阈值,和/或,物距2不满足第二预设阈值的情况下,电子设备可以保持超级微距模式;例如,在物距1小于或者等于第一预设阈值,和/或,物距2小于或者等于第二预设阈值时,电子设备保持超级微距模式。
应理解,保持超级微距模式可以是不退出超级微距模式。
步骤S440、获取广角摄像头的数据。
可选地,广角摄像头的数据可以包括函数关系2与code值;其中,函数关系2用于表示参数3(物距1)与参数4(广角摄像头采集的code值)之间的映射关系。
可选地,可以获取广角摄像头的OTP数据,广角摄像头的OTP数据为存储在广角摄像头器件中的数据,OTP数据包括函数关系2。
应理解,OTP数据为一种存储器类型的数据,即存储在器件中无法改变的数据。
步骤S441、根据广角摄像头的code值与函数关系2,得到电子设备与拍摄对象之间的物距1。
示例性地,根据广角摄像头的code值与函数关系2,可以确定code值对应的物距1。
步骤S442、判断物距1是否满足第三预设阈值;若物距1满足第三预设阈值,则执行步骤S443;若物距1不满足第三预设阈值,则执行步骤S444。
可选地,第三预设阈值可以为10厘米。例如,物距1满足第三预设阈值可以是指物距1大于第三预设阈值,物距1不满足预设阈值可以是指物距1小于或者等于第三预设阈值。
在本申请的实施例中,由于电子设备中不包括激光传感器,因此无法通过激光传感器获取电子设备与拍摄对象之间的距离信息;通过获取广角摄像头的code值,得到电子设备与拍摄对象之间的物距1;基于电子设备与拍摄对象之间的物距1可以进行判断是否对电子设备的摄像头进行切换;例如,若电子设备与拍摄对象之间的距离较近,则电子设备可以将超广角摄像头作为主摄摄像头。
可选地,在本申请的实施例中,在电子设备判断是否运行超级微距模式时,电子设备可以根据物距1与拍摄场景的亮度值;若物距1大于第三预设阈值,且拍摄场景的亮度值大于预设亮度阈值,则可以执行步骤S443;若物距1小于或者等于第三预设阈值,和/或,拍摄场景的亮度值小于或者等于预设亮度值,则执行步骤S444。
在本申请的实施例中,电子设备在确定是否运行超级微距模式时,还可以根据拍摄场景的亮度值确定是否运行超级微距模式;在较暗拍摄场景中,对焦的准确性较低即广角摄像头的code值的准确性较低,此时可以确定不运行超级微距模式;从而能够提高运行超级微距模式的准确性。
可选地,在本申请的实施例中,在电子设备判断是否运行超级微距模式时,电子设备可以根据物距1与拍摄场景的亮度值;若物距1大于第三预设阈值,且拍摄场景 的亮度值大于预设亮度阈值,且当前的变焦倍率为1倍变焦倍率,则可以执行步骤S443;若物距1小于或者等于第三预设阈值,和/或,拍摄场景的亮度值小于或者等于预设亮度值,和/或,当前的变焦倍率不是1倍变焦倍率,则执行步骤S444。具体实现方式,参见图19所示的步骤S552。
步骤S443、运行超级微距模式。
示例性地,在物距1满足第三预设阈值的情况下,运行超级微距模式。
应理解,超级微距模式是指电子设备在1倍变焦倍率(1×)至2倍变焦倍率(2×)之间,电子设备自动切换至超广角摄像头作为主摄摄像头进行拍摄的拍摄模式。
示例性地,在电子设备在未检测到用户的操作的情况下,电子设备可以从广角摄像头作为主摄摄像头切换至超广角摄像头作为主摄摄像头;换而言之,电子设备可以在未检测到任何操作的情况下,自动将超广角摄像头作为主摄摄像头。
应理解,电子设备中可以包括多个摄像头;例如,多个摄像头中可以包括主摄摄像头与辅助摄像头;在电子设备采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理的过程中,可以提取辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对两个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。示例性地,若电子设备采集图像时为单摄模式,即电子设备开启一个摄像头采集图像,该摄像头即为主摄摄像头。
示例性地,若电子设备采集图像时为双摄模式,即电子设备开启两个摄像头采集图像;其中,一个摄像头为主摄摄像头,另一个摄像头为辅助摄像头;在采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理过程中,可以提取部分辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对两个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
示例性地,若电子设备采集图像时为多摄模式,例如电子设备采集图像时为三摄模式,则电子设备采集图像时可以开启三个摄像头;三个摄像头中包括一个主摄摄像头与两个辅助摄像头;在采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理过程中,可以提取两个辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对三个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
情况1
若电子设备为单摄模式,则电子设备可以关闭广角摄像头;开启超广角摄像头,将超广角摄像头作为主摄摄像头。
情况2
若电子设备为多摄模式(例如,包括双摄模式或者三摄模式),则电子设备可以将超广角摄像头作为主摄摄像头,辅助摄像头可以全部或者部分开启。
可选地,在电子设备运行超级微距模式之后,可以根据如图15所示的步骤S430至步骤S437确定是否退出超级微距模式。
步骤S444、不运行超级微距模式。
可选地,不运行超级微距模式可以包括电子设备继续运行当前的拍摄模式且不进入超级微距模式。
在本申请的实施例中,在物距1满足第一预设阈值且物距2满足第二预设阈值时,电子设备切换至将广角摄像头作为主摄摄像头,退出超级微距模式;由于物距2为根据超广角摄像头的参数得到的物距,物距1为根据广角摄像头的参数得到的物距;因此,在本申请的实施例中,在判断是否退出超级微距模式时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于广角摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的准确性更高,即电子设备中拍摄模式的稳定性更好。
应理解,上述步骤S401至步骤S444是以广角摄像头与超广角摄像头之间的切换为例进行描述;步骤S401至步骤S444还可以适用于其他类型的摄像头之间的切换,本申请对摄像头的类型不作任何限定。可选地,步骤S401至步骤S444还可以适用于广角摄像头与长焦摄像头之间的切换,即如图15所示的方法也可以适用于运行超级远景模式、退出超级远景模式或者保持超级远景模式,此处不再赘述。
例如,对于广角摄像头与长焦摄像头之间的切换,上述图15所示的步骤S420中的“是否处于超级微距模式”可以更改为“判断是否处于超级远景模式”,超级远景模式的显示界面可以如后续图25中的(b)所示;步骤S442中的“物距1是否满足第六预设阈值”可以更改为“物距1是否满足第四预设阈值”;步骤S443中的“运行超级微距模式”可以更改为“运行超级远景模式”;步骤S444中的“不运行超级微距模式”可以更改为“不运行超级远景模式”;步骤S430中的“获取广角摄像头与超广角摄像头的数据”可以更改为“获取广角摄像头和长焦摄像头的数据”;步骤S435中的“物距1满足第一预设阈值,且物距2满足第二预设阈值”可以更改为“物距1满足第四预设阈值,且物距2满足第五预设阈值”;步骤S436中的“退出超级微距模式”可以更改为“退出超级远景模式”;步骤S437中的“保持超级微距模式”更改为“保持超级远景模式”。
其中,超级远景模式是指电子设备自动切换将长焦摄像作为主摄摄像头采集图像的拍摄模式;第四预设阈值与第五预设阈值用于判断电子设备与拍摄对象之间的物距是否较近,从而确定退出超级远景模式,或者,保持超级远景模式;第四预设阈值与第一预设阈值可以不相等;同理,第五预设范围与第二预设范围不相等。此外,第三预设阈值与第六预设阈值不相等,基于物距1与第六预设阈值可以确定是否将长焦摄像头作为主摄摄像头;例如,若物距1值大于第六预设阈值,则电子设备可以从将长焦摄像头作为主摄摄像头切换到将广角摄像头作为主摄摄像头采集图像。
应理解,超级微距模式适用于近景拍摄;超级远景模式适用于远景拍摄;基于本申请实施例的切换摄像头的方法,能够避免在电子设备处于超级微距模式时,由于电子设备与拍摄对象之间的物距较近,使得电子设备出现超级微距模式闪退问题;或者,避免在电子设备处于超级远景模式时,由于电子设备与拍摄对象之间的物距较远,使得电子设备出现超级远景模式闪退问题;提升超级微距模式或者超级远景模式的稳定性。
可选地,在本申请的实施例中,还可以根据拍摄场景的亮度值和/或电子设备当前 的变焦倍率确定是否退出超级微距模式;从而进一步提高超级微距模式的稳定性。
在一个示例中,在物距1不满足第一预设阈值,和/或,物距2不满足第二预设阈值的情况下,可以根据拍摄场景的亮度值和电子设备当前的变焦倍率确定是否退出超级微距模式,如图19所示。
图19是本申请实施例提供的切换摄像头的方法的示意性流程图。该方法可以由图9所示的电子设备执行;该方法500包括步骤S510至步骤S554,下面分别对步骤S410至步骤S554进行详细的描述。
步骤S510、运行相机应用程序。
步骤S520、判断是否处于超级微距模式;若电子设备处于超级微距模式,则执行步骤S530;若电子设备不处于超级微距模式,则执行步骤S550。
步骤S530、获取超广角摄像头的数据。
步骤S531、判断超广角摄像头是否包括开环马达;若超广角摄像头包括开环马达,则执行步骤S532;若超广角摄像头不包括开环马达,则执行步骤S534。
步骤S533、根据补偿处理后的code值与函数关系1,得到电子设备与拍摄对象之间的物距2。
步骤S534、在超广角摄像头不包括开环马达的情况下,根据code值与函数关系1,得到电子设备与拍摄对象之间的物距2。
步骤S535、判断物距1是否满足第一预设阈值,且物距2是否满足第二预设阈值;若物距1满足第一预设阈值,且物距2满足第二预设阈值,则执行步骤S536;若物距1不满足第一预设阈值,和/或,物距2不满足第二预设阈值,则执行步骤S537。
步骤536、退出超级微距模式。
步骤S537、判断亮度参数是否小于或者等于亮度阈值1。若亮度参数小于或者等于亮度阈值1,则执行步骤538;若亮度阈值大于亮度阈值1,则执行步骤S539。
在本申请的实施例中,在电子设备处于超级微距模式的情况下,在判断是否需要退出超级微距模式时,可以根据电子设备所处拍摄场景的亮度参数进行判断;若电子设备所处的拍摄场景的亮度值较低,即拍摄场景的亮度参数小于或者等于亮度阈值1,由于在亮度较低的拍摄场景中超广角摄像头的参数与广角摄像头的参数的准确性较低,因此可以直接退出超级微距模式。
可选地,在电子设备处于超级微距模式时,电子设备中的超广角摄像头为主摄摄像头,此时的亮度阈值1可以为超广角摄像头对应的亮度阈值。
步骤S538、退出超级微距模式。
示例性地,在亮度参数小于或者等于亮度阈值1的情况下,退出超级微距模式。
步骤S539、判断变焦倍率是否变化;若变焦倍率变化,则执行步骤S540;若变焦倍率未改变,则执行中不S541。
可选地,在电子设备运行超级微距模式时,变焦倍率为第一变焦倍率;电子设备的当前变焦倍率为第二变焦倍率;若第二变焦倍率与第一变焦倍率不同,则表示电子设备的变焦倍率变化,则执行步骤S540;若第二变焦倍率与第一变焦倍率相同,则表示电子设备的变焦倍率未发生变化,则执行步骤S541。
可选地,在电子设备检测到调整变焦倍率的操作,则执行步骤S540;若电子设备 未检测到调整变焦倍率的操作,则执行步骤S541。
在本申请的实施例中,在电子设备运行超级微距模式的情况下,可以根据电子设备当前的变焦倍率确定是否退出超级微距模式;从能够进一步增加超级微距模式的稳定性。
步骤S540、退出超级微距模式。
可选地,在电子设备的变焦倍率大于1倍变焦倍率的情况下,可以退出超级微距模式。
示例性地,若电子设备检测到用户调整变焦倍率的操作(例如,倍率调整至大于1倍变焦);响应于用户的操作,电子设备可以退出超级微距模式。
步骤S541、保持超级微距模式。
步骤S550、获取广角摄像头的数据。
步骤S551、根据广角摄像头的code值与函数关系2,得到电子设备与拍摄对象之间的物距1。
步骤S552、判断亮度参数是否满足亮度阈值2,且变焦倍率是否等于倍率1,且物距1是否满足第三预设阈值;若是,则执行步骤S553;若否,则执行步骤S554。
应理解,由于步骤S550至步骤S562是在电子设备未处于超级微距模式的情况下执行的步骤,因此,步骤S562中的亮度阈值2是与广角摄像头相关的亮度阈值。
可选地,亮度参数满足亮度阈值2可以是指亮度参数大于亮度阈值2;物距1满足第三预设阈值可以是指物距1小于或者等于第三预设阈值。
可选地,亮度参数可以包括照度值,或者,亮度值。
可选地,在本申请的实施例中,在运行超级微距模式的情况下,可以通过超广角摄像头获取照度值(例如,Lux index);若照度值大于亮度阈值2时,则表示电子设备所处的拍摄环境为低亮拍摄环境。
应理解,通常情况下照度值越大,表示拍摄环境的亮度越低。
可选地,在本申请的实施例中,可以获取电子设备的亮度值;若亮度值小于亮度阈值2的情况下,则表示电子设备所处的拍摄环境为夜景拍摄环境。
例如,亮度值的具体计算公式如下:
其中,Exposure为曝光时间;Aperture为光圈大小;Iso为感光度;Luma为图像在XYZ颜色空间中,Y的平均值。
步骤S553、运行超级微距模式。
示例性地,在物距1满足第三预设阈值的情况下,运行超级微距模式。
应理解,超级微距模式是指电子设备在1倍变焦倍率(1×)至2倍变焦倍率(2×)之间,电子设备自动切换至超广角摄像头作为主摄摄像头进行拍摄的拍摄模式。
示例性地,在电子设备在未检测到用户的操作的情况下,电子设备可以从广角摄像头作为主摄摄像头切换至超广角摄像头作为主摄摄像头;换而言之,电子设备可以在未检测到任何操作的情况下,自动将超广角摄像头作为主摄摄像头。
应理解,电子设备中可以包括多个摄像头;例如,多个摄像头中可以包括主摄摄 像头与辅助摄像头;在电子设备采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理的过程中,可以提取辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对两个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。示例性地,若电子设备采集图像时为单摄模式,即电子设备开启一个摄像头采集图像,该摄像头即为主摄摄像头。
示例性地,若电子设备采集图像时为双摄模式,即电子设备开启两个摄像头采集图像;其中,一个摄像头为主摄摄像头,另一个摄像头为辅助摄像头;在采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理过程中,可以提取部分辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对两个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
示例性地,若电子设备采集图像时为多摄模式,例如电子设备采集图像时为三摄模式,则电子设备采集图像时可以开启三个摄像头;三个摄像头中包括一个主摄摄像头与两个辅助摄像头;在采集图像时,通常以主摄摄像头采集的图像作为基准,对主摄摄像头采集的图像进行处理;在处理过程中,可以提取两个辅助摄像头采集的部分图像信息对主摄摄像头采集的图像进行补偿,实现对三个摄像头采集的图像进行融合,并经过处理后得到显示的图像,来达到从而提升拍摄质量、背景虚化、光学变焦等功能。
情况1
若电子设备为单摄模式,则电子设备可以关闭广角摄像头;开启超广角摄像头,将超广角摄像头作为主摄摄像头。
情况2
若电子设备为多摄模式(例如,包括双摄模式或者三摄模式),则电子设备可以将超广角摄像头作为主摄摄像头,辅助摄像头可以全部或者部分开启。
可选地,在电子设备运行超级微距模式之后,可以根据如图15所示的步骤S430至步骤S437确定是否退出超级微距模式。
可选地,可以基于一帧图像判断是否运行超级微距模式;例如,对于一帧图像,若亮度参数大于亮度阈值2且变焦倍率为倍率1且物距1满足第三预设阈值,则电子设备切换摄像头运行超级微距模式。
可选地,为了确保电子设备采集图像的稳定性,电子设备在切换摄像头之前,可以基于多帧图像进行判断;例如,可以判断对于至少连续两帧图像是否物距1满足第一预设阈值,且物距2满足第二预设阈值;若对于至少连续两帧图像物距1满足第一预设阈值,且物距2满足第二预设阈值,则电子设备切换摄像头退出超级微距模式。
在本申请的实施例中,电子设备在确定是否运行超级微距模式时,还可以根据拍摄场景的亮度值、变焦倍率与物距1确定是否运行超级微距模式;在较暗拍摄场景中,对焦的准确性较低即广角摄像头的code值的准确性较低,此时可以确定不运行超级微距模式;从而能够提高运行超级微距模式的准确性。
步骤S554、不运行超级微距模式。
可选地,不运行超级微距模式可以包括电子设备继续运行当前的拍摄模式且不进 入超级微距模式。
在本申请的实施例中,在物距1满足第一预设阈值且物距2满足第二预设阈值时,电子设备切换至将广角摄像头作为主摄摄像头,退出超级微距模式;由于物距2为根据超广角摄像头的参数得到的物距,物距1为根据广角摄像头的参数得到的物距;因此,在本申请的实施例中,在判断是否退出超级微距模式时,会根据双重限制条件确定是否切换摄像头;与现有的方案中,只基于广角摄像头的参数判断是否切换摄像头相比,本申请实施例提供的切换摄像头的方法的准确性更高,即电子设备中拍摄模式的稳定性更好。
此外,在物距1不满足第一预设阈值和/或物距2不满足第二预设阈值的情况下,电子设备可以根据电子设备所处的拍摄环境的亮度参数确定是否退出超级微距模式;进一步地,在拍摄场景的亮度参数不满足退出超级微距模式的情况下,可以根据变焦倍率确定是否退出超级微距模式;基于本申请实施例提供的切换摄像头的方法的准确性更高,即电子设备中拍摄模式的稳定性更好。
应理解,上述步骤S510至步骤S554是以广角摄像头与超广角摄像头之间的切换为例进行描述;步骤S510至步骤S554还可以适用于其他类型的摄像头之间的切换,本申请对摄像头的类型不作任何限定。
可选地,步骤S510至步骤S554还可以适用于广角摄像头与长焦摄像头之间的切换,即上述方法也可以适用于运行超级远景模式、退出超级远景模式或者保持超级远景模式,此处不再赘述。
在一个示例中,在到达预设时间时,电子设备可以继续执行下一次判断流程;例如,电子设备中可以包括定时器,在定时器到达预设时刻(例如,30S)时,电子设备可以继续执行步骤S402至步骤S403,并根据步骤S403的结果执行对应的后续步骤。
应理解,上述步骤S401至步骤S414是以广角摄像头与超广角摄像头之间的切换为例进行描述;步骤S401至步骤S414还可以适用于其他类型的摄像头之间的切换,本申请对摄像头的类型不作任何限定。
下面结合图20至图26对电子设备执行本申请实施例的切换摄像头的方法的界面示意图进行举例描述。
在一个示例中,如图20所示,图20中的(a)所示的显示界面可以为电子设备的桌面601;当电子设备检测到用户点击桌面601上的相机应用程序的控件602之后,可以显示如图20中的(b)所示的另一显示界面;图20中的(b)所示的显示界面603可以是相机应用程序的显示界面,在该显示界面603中可以包括智能控件604;电子设备检测到对智能控件604的操作,如图20中的(c)所示;在电子设备检测到对智能控件604的操作之后,根据本申请实施例提供的切换摄像头的方法运行超级微距模式,退出超级微距模式,或者,保持超级微距模式;例如,电子设备处于非超级微距模式,基于获取广角摄像头的参数与变焦倍率;确定距离参数与变焦倍率满足预设条件,则电子设备切换将超广角摄像头作为主摄摄像头,即电子设备进入超级微距模式,显示如图20中的(d)所示的显示界面605,显示界面605中可以包括指示拍摄模式的控件606,当前的拍摄模式为超级微距模式,如图20中的(d)所示;若检测到用户点击“超级微距×”中的“×”,则电子设备可以关闭超级微距模式;可选地,在关闭超级微距模式后,在该预览显示界面中,电子 设备可以不再推送超级微距模式。
示例性地,结合图20中的(c)与图20中的(d)可以看出,电子设备处于超级微距模式的视场角大于电子设备处于非超级微距模式的视场角。
可选地,在电子设备检测到指示拍照的操作后,当前开启的摄像头作为采集图像的摄像头;如图20中的(d)所示,在电子设备的拍摄模式为超级微距模式时,电子设备将超广角摄像头作为主摄摄像头采集图像。
应理解,如图20中的(d)所示的显示界面,在电子设备处于超级微距模式时,显示的变焦倍率可以为单倍变焦倍率(1×),将超广角摄像作为主摄摄像头采集图像;此时,相机应用程序的实际zoom值可以为0.99×,或者0.98×,或者其他小于1×的变焦倍率值。
可选地,相机应用程序的实际zoom值可以是基于相机应用程序的变焦指示轴的单位刻度进行调整得到的;例如,若变焦轴的单位刻度为0.01×,则此时实际zoom值可以为0.99×;若变焦轴的单位刻度为0.02×,则此时实际zoom值可以为0.98×。
可选地,图20中的(d)中所示的显示界面中也可以不显示指示超级微距模式的控件606;本申请对此不作任何限定。
在一个示例中,如图21所示,图21中的(a)所示的显示界面可以为电子设备的桌面607;当电子设备检测到用户点击桌面607上的相机应用程序的控件608之后,可以显示如图21中的(b)所示的另一显示界面;图21中的(b)所示的显示界面609可以是相机应用程序的显示界面,在该显示界面609中可以包括设置控件610;电子设备检测到对设置控件610的操作,如图21中的(c)所示;在电子设备检测到对设置控件610的操作之后,可以显示设置显示界面,设置显示界面中包括指示开启自动切换摄像头的控件611,如图21中的(d)所示;电子设备检测到对控件611的操作,如图21中的(e)所示;在电子设备检测到对控件611的操作之后,执行本申请实施例提供的切换摄像头的方法,运行超级微距模式、退出超级微距模式,或者保持超级微距模式;例如,电子设备进入超级微距模式,显示如图21中的(f)所示的显示界面612,显示界面612中可以包括指示拍摄模式的图标613,当前的拍摄模式为超级微距模式;若检测到用户点击“超级微距×”中的“×”,则电子设备可以关闭超级微距模式;可选地,在关闭超级微距模式后,在该预览显示界面中,电子设备可以不再推送超级微距模式。可选地,图20中的相关描述同样适用于图21,此处不再赘述。
在一个示例中,可以通过相机应用程序显示界面中的一个单独控件开启超级微距,如图22所示;图22中的(a)所示的显示界面可以为电子设备的桌面614;当电子设备检测到用户点击桌面614上的相机应用程序的图标615之后,可以显示如图22中的(b)所示的另一显示界面616;图22中的(b)所示的显示界面616可以是相机应用程序的显示界面,在该显示界面616中可以包括控件617;如图22中的(c)所示,电子设备检测到对设置控件617的操作之后,执行本申请实施例提供的切换摄像头的方法;例如,电子设备处于非超级微距模式,基于获取摄像头模组的距离参数与变焦倍率;确定距离参数与变焦倍率满足第一预设条件,则电子设备切换将超广角摄像头作为主摄摄像头,即电子设备进入超级微距模式,显示如图22中的(d)所示的显示界面618,显示界面618中可以包括指示拍摄模式的图标619,当前的拍摄模式为超级微距模式;若检测到用户点击“超级微距×”中的“×”,则电子设备可以关闭超级微距模式;可选地,在关闭超级微距模式后, 在该预览显示界面中,电子设备可以不再推送超级微距模式。可选地,图20中的相关描述同样适用于图22,此处不再赘述。
应理解,图22与图20所示的显示界面的区别在于,在图20中是通过智能控件604指示开启/关闭自动切换摄像头;在图22中是通过一个独立于智能控件的控件开启/关闭自动切换摄像头。
在一个示例中,如图23所示,用户可以通过在电子设备的设置显示界面中指示开启自动切换摄像头,从而使得电子设备执行本申请实施例提供的切换摄像头的方法。
示例性地,图23中的(a)所示的显示界面可以为电子设备的桌面620;当电子设备检测到用户点击桌面620上的设置的图标621之后,可以显示如图23中的(b)所示的另一显示界面;图23中的(b)所示的显示界面可以是设置显示界面,在设置的显示界面中可以包括无线网络、蓝牙或者相机等选项;如图23中的(c)所示,电子设备检测到点击相机选项,进入相机的设置界面,显示如图23中的(d)所示;在相机设置界面中可以包括自动切换摄像头的控件622;如图23中的(e)所示,电子设备检测到对控件622的操作之后,可以执行本申请实施例提供的切换摄像头的方法;如图23中的(f)所示,电子设备检测到用户点击桌面620上的相机应用程序的图标625,进入相机应用程序;在进入相机应用程序之后,可以显示如图23中的(g)所示的另一显示界面626,此时电子设备可以处于非超级微距模式;电子设备可以基于获取摄像头模组的距离参数与变焦倍率;确定距离参数与变焦倍率满足第一预设条件,则电子设备切换将超广角摄像头作为主摄摄像头,即电子设备进入超级微距模式,显示如图23中的(h)所示的显示界面627,显示界面627中可以包括指示拍摄模式的图标628,当前的拍摄模式为超级微距模式;若检测到用户点击“超级微距×”中的“×”,则电子设备可以关闭超级微距模式;可选地,在关闭超级微距模式后,在该预览显示界面中,电子设备可以不再推送超级微距模式。
可选地,图20中的相关描述同样适用于图23,此处不再赘述。
可选地,在电子设备进入相机应用程序的显示界面后,也可以直接显示如图23中的(h)所示的显示界面;即电子设备可以从如图23中的(f)所示的显示界面直接至如图23中的(h)所示的显示界面。
在一个示例中,在相机应用程序中的更多选项的控件;在更多选项的控件中包括超级微距模块的控件;在电子设备检测到开启超级微距模式的控件的情况下,电子设备可以直接运行超级微距模式。
示例性地,如图24所示,图24中的(a)所示的显示界面可以为电子设备的桌面630;当电子设备检测到用户点击桌面630上的相机应用程序的控件631之后,可以显示如图24中的(b)所示的另一显示界面;图24中的(b)所示的显示界面632可以是相机应用程序的显示界面,在该显示界面632中可以包括更多选项的控件633;电子设备检测到对更多选项的控件633的操作,如图24中的(c)所示;在电子设备检测到对更多选项的控件633的操作之后,可以显示更多选项界面,更多选项界面中包括指示开启超级微距模式的控件634,如图24中的(d)所示;电子设备检测到对控件634的操作,如图24中的(e)所示;在电子设备检测到对控件634的操作之后,电子设备可以直接运行超级微距模型,显示如图24中的(f)所示的显示界面635,显示界面635中可以包括指示拍摄模式的图标636,当前的拍摄模式为超级微距模式;若检测到用户点击“超级微距×”中的“×”, 则电子设备可以关闭超级微距模式;可选地,在关闭超级微距模式后,在该预览显示界面中,电子设备可以不再推送超级微距模式。可选地,图24中的相关描述同样适用于图20,此处不再赘述。
图25为本申请实施例提供的相机应用程序的预览界面的示意图。
示例性地,对于电子设备在近距离拍摄的场景中,图25中的(a)所示的为以广角摄像头作为主摄摄像头采集的预览图像;图25中的(b)为电子设备处于超级微距模式采集的预览图像,即电子设备将超广角摄像头作为主摄摄像头采集的预览图像;结合图25中的(a)与图25中的(b)可以看出,在近距离拍摄的场景中,电子设备通过将超广角摄像头作为主摄摄像头采集的图像时,图像的清晰度与电子设备的视场角均得到了提升。
图26为本申请实施例提供的相机应用程序的预览界面的示意图。
示例性地,对于电子设备在远距离拍摄的场景中,图26中的(a)所示的为以广角摄像头作为主摄摄像头采集的预览图像;图26中的(b)所示的为电子设备处于超级远景模式采集的预览图像,即电子设备将长焦摄像头作为主摄摄像头采集的预览图像;结合图26中的(a)所示的预览图像与图26中的(b)所示的预览图像可以看出,在远距离拍摄的场景中,电子设备通过将长焦摄像头作为主摄摄像头采集的图像时,图像的细节信息得到了提升。
应理解,上述举例说明是为了帮助本领域技术人员理解本申请实施例,而非要将本申请实施例限于所例示的具体数值或具体场景。本领域技术人员根据所给出的上述举例说明,显然可以进行各种等价的修改或变化,这样的修改或变化也落入本申请实施例的范围内。
上文结合图1至图26详细描述了本申请实施例提供的切换摄像头的方法;下面将结合图27至图28详细描述本申请的装置实施例。应理解,本申请实施例中的装置可以执行前述本申请实施例的各种方法,即以下各种产品的具体工作过程,可以参考前述方法实施例中的对应过程。
图27是本申请实施例提供的一种电子设备的结构示意图。该电子设备700包括处理模块710、显示模块720、第一摄像头与第二摄像头。
其中,处理模块710用于运行所述电子设备中的相机应用程序;显示模块720用于显示第一图像,所述第一图像为所述第一摄像头作为主摄摄像头进行采集图像得到的;处理模块710还用于:确定第一距离与第二距离是否满足第一预设条件,其中,所述第一距离与所述第二距离用于指示所述电子设备与拍摄对象之间的物距,所述第一距离为基于所述第一摄像头的参数得到的物距,所述第二距离为基于所述第二摄像头的参数得到的物距;显示模块720还用于:在所述第一距离与所述第二距离满足所述第一预设条件的情况下,显示第二图像,所述第二图像为所述第二摄像头作为主摄摄像头进行采集图像得到的。
可选地,作为一个实施例,所述处理模块710具体用于:
确定所述第一距离大于第一预设阈值,且所述第二距离大于第二预设阈值,其中,所述第一预设阈值与所述第二预设阈值不同。
可选地,作为一个实施例,所述第一预设阈值为基于第一距离范围得到的预设阈值,所述第一距离范围用于表示所述第一摄像头进行对焦的有效距离范围。
可选地,作为一个实施例,所述第二预设阈值为基于第二距离范围得到的预设阈值,所述第二距离范围用于表示所述第二摄像头进行对焦的有效距离范围。
可选地,作为一个实施例,所述处理模块710还用于:
在所述第一距离和/或所述第二距离不满足所述第一预设条件的情况下,确定所述电子设备所处拍摄场景的亮度参数是否小于或者等于第一亮度阈值;
在所述亮度参数小于或者等于所述第一亮度阈值的情况下,显示所述第二图像。
可选地,作为一个实施例,所述第一亮度阈值为基于第一亮度范围得到的预设阈值,所述第一亮度范围用于表示所述第一摄像头进行对焦的有效亮度范围。
可选地,作为一个实施例,所述电子设备显示所述第一图像时的变焦倍率为第一变焦倍率,所述电子设备当前的变焦倍率为第二变焦倍率,所述处理模块710还用于:
在所述亮度参数大于所述第一亮度阈值的情况下,确定所述第二变焦倍率与所述第一变焦倍率是否相同;
在所述第二变焦倍率与所述第一变焦倍率不相同的情况下,显示所述第二图像。
可选地,作为一个实施例,所述显示模块720具体用于:
在所述电子设备所处的拍摄环境的亮度参数大于第二亮度阈值,且所述第二距离小于或者等于第三预设阈值的情况下,显示所述第一图像。
可选地,作为一个实施例,所述第二亮度阈值为基于第二亮度范围得到的预设阈值,所述第二亮度范围用于表示所述第二摄像头进行对焦的有效亮度范围。
可选地,作为一个实施例,在所述第一摄像头包括开环马达的情况下,所述处理模块710还用于:
获取所述第一摄像头的参数;
基于所述第一摄像头的标定值对所述第一摄像头的参数进行补偿处理,得到处理后的参数;
基于所述处理后的参数,得到所述第一距离。
可选地,作为一个实施例,所述显示模块720具体用于:
在所述电子设备处于超级微距模式的情况下,显示所述第一图像。
可选地,作为一个实施例,所述显示模块720具体用于:
在所述电子设备的第一显示界面显示所述第一图像,所述第一显示界面中还包括第一图标,所述第一图标用于指示所述超级微距模式。
可选地,作为一个实施例,所述第一图标中包括第一控件,所述处理模块710还用于:
检测到对所述第一控件的第一操作;
响应于所述第一操作,所述电子设备退出所述超级微距模式。
可选地,作为一个实施例,所述显示模块720具体用于:
在所述电子设备退出超级微距模式的情况下,显示所述第二图像。
可选地,作为一个实施例,所述第一摄像头包括超广角摄像头或者长焦摄像头,和/或,所述第二摄像头包括广角摄像头。
可选地,作为一个实施例,所述电子设备在显示所述第一图像与显示所述第二图像时,所述电子设备所处的位置相同。
可选地,作为一个实施例,所述第一图像中包括第一拍摄对象,所述第二图像中包括第二拍摄对象,所述第一拍摄对象与所述第二拍摄对象所处的位置相同,所述第一拍摄对象与所述电子设备之间的距离为第三距离,所述第二拍摄对象与所述电子设备之间的距离 为第四距离,所述第三距离小于所述第四距离。
可选地,作为一个实施例,所述第一图像与所述第二图像中包括第三拍摄对象,在显示所述第一图像与所述第二图像时,所述第三拍摄对象所处的位置相同;在采集所述第一图像时,所述第三拍摄对象与所述电子设备之间的距离为第五距离;在采集所述第二图像时,所述第三拍摄对象与所述电子设备之间的距离为第六距离,所述第五距离小于所述第六距离。
需要说明的是,上述电子设备700以功能模块的形式体现。这里的术语“模块”可以通过软件和/或硬件形式实现,对此不作具体限定。
例如,“模块”可以是实现上述功能的软件程序、硬件电路或二者结合。所述硬件电路可能包括应用特有集成电路(application specific integrated circuit,ASIC)、电子电路、用于执行一个或多个软件或固件程序的处理器(例如共享处理器、专有处理器或组处理器等)和存储器、合并逻辑电路和/或其它支持所描述的功能的合适组件。
因此,在本申请的实施例中描述的各示例的单元,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
图28示出了本申请提供的一种电子设备的结构示意图。图28中的虚线表示该单元或该模块为可选的;电子设备800可以用于实现上述方法实施例中描述的方法。
电子设备800包括一个或多个处理器801,该一个或多个处理器801可支持电子设备800实现方法实施例中的切换摄像头的方法。处理器801可以是通用处理器或者专用处理器。例如,处理器801可以是中央处理器(central processing unit,CPU)、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或者其它可编程逻辑器件,如分立门、晶体管逻辑器件或分立硬件组件。
处理器801可以用于对电子设备800进行控制,执行软件程序,处理软件程序的数据。电子设备800还可以包括通信单元805,用以实现信号的输入(接收)和输出(发送)。
例如,电子设备800可以是芯片,通信单元805可以是该芯片的输入和/或输出电路,或者,通信单元805可以是该芯片的通信接口,该芯片可以作为终端设备或其它电子设备的组成部分。
又例如,电子设备800可以是终端设备,通信单元805可以是该终端设备的收发器,或者,通信单元805可以是该终端设备的收发电路。
电子设备800中可以包括一个或多个存储器802,其上存有程序804,程序804可被处理器801运行,生成指令803,使得处理器801根据指令803执行上述方法实施例中描述的切换摄像头的方法。
可选地,存储器802中还可以存储有数据。
可选地,处理器801还可以读取存储器802中存储的数据,该数据可以与程序804存储在相同的存储地址,该数据也可以与程序804存储在不同的存储地址。
处理器801和存储器802可以单独设置,也可以集成在一起,例如,集成在终端设备的系统级芯片(system on chip,SOC)上。
示例性地,存储器802可以用于存储本申请实施例中提供的切换摄像头的方法的相关程序804,处理器801可以用于在执行切换摄像头的方法时调用存储器802中存储的切换摄像头的方法的相关程序804,执行本申请实施例的切换摄像头的方法;例如,运行电子设备中的相机应用程序;显示第一图像,第一图像为第一摄像头作为主摄摄像头进行采集图像得到的;确定第一距离与第二距离是否满足第一预设条件,其中,第一距离与第二距离用于指示电子设备与拍摄对象之间的物距,第一距离为基于第一摄像头的参数得到的物距,第二距离为基于第二摄像头的参数得到的物距;在第一距离与第二距离满足第一预设条件的情况下,显示第二图像,第二图像为第二摄像头作为主摄摄像头进行采集图像得到的。
本申请还提供了一种计算机程序产品,该计算机程序产品被处理器801执行时实现本申请中任一方法实施例的切换摄像头的方法。
该计算机程序产品可以存储在存储器802中,例如是程序804,程序804经过预处理、编译、汇编和链接等处理过程最终被转换为能够被处理器801执行的可执行目标文件。
本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被计算机执行时实现本申请中任一方法实施例所述的切换摄像头的方法。该计算机程序可以是高级语言程序,也可以是可执行目标程序。
该计算机可读存储介质例如是存储器802。存储器802可以是易失性存储器或非易失性存储器,或者,存储器802可以同时包括易失性存储器和非易失性存储器。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的电子设备的实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点, 所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
应理解,在本申请的各种实施例中,各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请的实施例的实施过程构成任何限定。
另外,本文中的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准总之,以上所述仅为本申请技术方案的较佳实施例而已,并非用于限定本申请的保护范围。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (19)

  1. 一种切换摄像头的方法,其特征在于,应用于电子设备,所述电子设备包括摄像头模组,所述摄像头模组包括第一摄像头与第二摄像头,所述方法包括:
    启动所述电子设备中的相机应用程序;
    显示第一图像,所述第一图像为所述第一摄像头采集得到的图像;
    基于所述第一摄像头的参数获取第一距离,并基于所述第二摄像头的参数获取第二距离;所述第一距离与所述第二距离用于指示所述电子设备与拍摄对象之间的物距;
    在所述第一距离大于第一预设阈值,且所述第二距离大于第二预设阈值的情况下,显示第二图像,所述第二图像为所述第二摄像头采集得到的图像;
    其中,所述第一预设阈值与所述第二预设阈值不同;所述第一预设阈值为基于所述第一摄像头的对焦参数得到的阈值;所述第二预设阈值为基于所述第二摄像头的对焦参数得到的阈值。
  2. 如权利要求1所述的方法,其特征在于,
    所述第一摄像头的对焦参数为对焦距离范围[X1,X2],所述第一预设阈值大于或者等于X1;
    所述第二摄像头的对焦参数为对焦距离范围[X3,X4],所述第二预设阈值大于或者等于X3。
  3. 如权利要求1所述的方法,其特征在于,还包括:
    在所述第一距离小于或等于所述第一预设阈值,和/或所述第二距离小于或等于所述第二预设阈值的情况下,确定所述电子设备所处拍摄场景的亮度参数是否小于或者等于第一亮度阈值;
    在所述亮度参数小于或者等于所述第一亮度阈值的情况下,显示所述第二图像;
    其中,所述第一亮度阈值为基于第一亮度范围得到的预设阈值,所述第一亮度范围用于表示所述第一摄像头进行对焦的有效亮度范围。
  4. 如权利要求3所述的方法,其特征在于,所述电子设备显示所述第一图像时的变焦倍率为第一变焦倍率,所述电子设备当前的变焦倍率为第二变焦倍率,还包括:
    在所述亮度参数大于所述第一亮度阈值的情况下,确定所述第二变焦倍率与所述第一变焦倍率是否相同;
    在所述第二变焦倍率与所述第一变焦倍率不相同的情况下,显示所述第二图像。
  5. 如权利要求1至4中任一项所述的方法,其特征在于,所述显示第一图像,包括:
    在所述电子设备所处的拍摄环境的亮度参数大于第二亮度阈值,且所述第二距离小于或者等于第三预设阈值的情况下,显示所述第一图像。
  6. 如权利要求5所述的方法,其特征在于,所述第二亮度阈值为基于第二亮度范围得到的预设阈值,所述第二亮度范围用于表示所述第二摄像头进行对焦的有效亮度范围。
  7. 如权利要求1至4、或6中任一项所述的方法,其特征在于,在所述第一摄像头包括开环马达的情况下,还包括:
    获取所述第一摄像头的参数;
    基于所述第一摄像头的标定值对所述第一摄像头的参数进行补偿处理,得到处理后的参数;
    基于所述处理后的参数,得到所述第一距离。
  8. 如权利要求1至4、或6中任一项所述方法,其特征在于,所述显示第一图像,包括:
    在所述电子设备处于超级微距模式的情况下,显示所述第一图像。
  9. 如权利要求8所述的方法,其特征在于,所述在所述电子设备处于超级微距模式的情况下,显示所述第一图像,包括:
    在所述电子设备的第一显示界面显示所述第一图像,所述第一显示界面中还包括第一图标,所述第一图标用于指示所述超级微距模式。
  10. 如权利要求9所述的方法,其特征在于,所述第一图标中包括第一控件,还包括:
    检测到对所述第一控件的第一操作;
    响应于所述第一操作,所述电子设备退出所述超级微距模式。
  11. 如权利要求1至4、6、9、或10中任一项所述方法,其特征在于,所述显示第二图像,包括:
    在所述电子设备退出超级微距模式的情况下,显示所述第二图像。
  12. 如权利要求1至4、6、9、或10中任一项所述的方法,其特征在于,
    所述第一摄像头包括超广角摄像头,所述第二摄像头包括广角摄像头;或者,
    所述第一摄像头包括广角摄像头,所述第二摄像头包括长焦摄像头。
  13. 如权利要求1至4、6、9、或10中任一项所述的方法,其特征在于,所述电子设备在显示所述第一图像与显示所述第二图像时,所述电子设备所处的位置相同。
  14. 如权利要求1至4、6、9、或10中任一项所述的方法,其特征在于,所述第一图像中包括第一拍摄对象,所述第二图像中包括第二拍摄对象,所述第一拍摄对象与所述第二拍摄对象所处的位置相同,所述第一拍摄对象与所述电子设备之间的距离为第三距离,所述第二拍摄对象与所述电子设备之间的距离为第四距离,所述第三距离小于所述第四距离。
  15. 如权利要求1至4、6、9、或10中任一项所述的方法,其特征在于,所述第一图像与所述第二图像中包括第三拍摄对象,在显示所述第一图像与所述第二图像时,所述第三拍摄对象所处的位置相同;在采集所述第一图像时,所述第三拍摄对象与所述电子设备之间的距离为第五距离;在采集所述第二图像时,所述第三拍摄对象与所述电子设备之间的距离为第六距离,所述第五距离小于所述第六距离。
  16. 一种电子设备,其特征在于,包括:
    一个或多个处理器和存储器;
    所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行如权利要求1至15中任一项所述的方法。
  17. 一种芯片系统,其特征在于,所述芯片系统应用于电子设备,所述芯片系统 包括一个或多个处理器,所述处理器用于调用计算机指令以使得所述电子设备执行如权利要求1至15中任一项所述的方法。
  18. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储了计算机程序,当所述计算机程序被处理器执行时,使得处理器执行权利要求1至15中任一项所述的方法。
  19. 一种计算机程序产品,其特征在于,所述计算机程序产品包括计算机程序代码,当所述计算机程序代码被电子设备运行时,使得所述电子设备执行权利要求1至15中任一项所述的方法。
PCT/CN2023/112634 2022-10-24 2023-08-11 切换摄像头的方法与电子设备 WO2024087804A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211303569.6 2022-10-24
CN202211303569.6A CN115802158B (zh) 2022-10-24 2022-10-24 切换摄像头的方法与电子设备

Publications (1)

Publication Number Publication Date
WO2024087804A1 true WO2024087804A1 (zh) 2024-05-02

Family

ID=85433550

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/112634 WO2024087804A1 (zh) 2022-10-24 2023-08-11 切换摄像头的方法与电子设备

Country Status (2)

Country Link
CN (2) CN115802158B (zh)
WO (1) WO2024087804A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115802158B (zh) * 2022-10-24 2023-09-01 荣耀终端有限公司 切换摄像头的方法与电子设备
CN117135420B (zh) * 2023-04-07 2024-05-07 荣耀终端有限公司 图像同步方法及其相关设备
CN117354624A (zh) * 2023-12-06 2024-01-05 荣耀终端有限公司 摄像头切换方法、设备以及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110099211A (zh) * 2019-04-22 2019-08-06 联想(北京)有限公司 视频拍摄方法和电子设备
JP2020109560A (ja) * 2019-01-04 2020-07-16 日産自動車株式会社 信号機認識方法及び信号機認識装置
CN113747028A (zh) * 2021-06-15 2021-12-03 荣耀终端有限公司 一种拍摄方法及电子设备
CN114422687A (zh) * 2020-10-28 2022-04-29 北京小米移动软件有限公司 预览图像切换方法及装置、电子设备及存储介质
CN115802158A (zh) * 2022-10-24 2023-03-14 荣耀终端有限公司 切换摄像头的方法与电子设备

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110248081A (zh) * 2018-10-12 2019-09-17 华为技术有限公司 图像捕捉方法及电子设备
CN110708463B (zh) * 2019-10-09 2021-08-24 Oppo广东移动通信有限公司 对焦方法、装置、存储介质及电子设备
CN113099102A (zh) * 2019-12-23 2021-07-09 中兴通讯股份有限公司 一种对焦方法、对焦装置及存储介质、电子装置
EP4030745A1 (en) * 2021-01-14 2022-07-20 Beijing Xiaomi Mobile Software Co., Ltd. A multiple camera system and a method for operating the multiple camera system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2020109560A (ja) * 2019-01-04 2020-07-16 日産自動車株式会社 信号機認識方法及び信号機認識装置
CN110099211A (zh) * 2019-04-22 2019-08-06 联想(北京)有限公司 视频拍摄方法和电子设备
CN114422687A (zh) * 2020-10-28 2022-04-29 北京小米移动软件有限公司 预览图像切换方法及装置、电子设备及存储介质
CN113747028A (zh) * 2021-06-15 2021-12-03 荣耀终端有限公司 一种拍摄方法及电子设备
CN115802158A (zh) * 2022-10-24 2023-03-14 荣耀终端有限公司 切换摄像头的方法与电子设备

Also Published As

Publication number Publication date
CN115802158A (zh) 2023-03-14
CN115802158B (zh) 2023-09-01
CN117939289A (zh) 2024-04-26

Similar Documents

Publication Publication Date Title
WO2022262260A1 (zh) 一种拍摄方法及电子设备
WO2021093793A1 (zh) 一种拍摄方法及电子设备
WO2024087804A1 (zh) 切换摄像头的方法与电子设备
US11532076B2 (en) Image processing method, electronic device and storage medium
WO2021147482A1 (zh) 一种长焦拍摄的方法及电子设备
US20230156144A1 (en) Framing Method for Multi-Channel Video Recording, Graphical User Interface, and Electronic Device
KR20130069123A (ko) 촬상장치, 촬상 구도 제공 방법 및 컴퓨터 판독가능 기록매체
WO2022057723A1 (zh) 一种视频的防抖处理方法及电子设备
US20230188826A1 (en) Photographing Method, Graphical User Interface, and Electronic Device
CN113660408B (zh) 一种视频拍摄防抖方法与装置
US20230018004A1 (en) Photographing method and apparatus
WO2024045670A1 (zh) 生成高动态范围视频的方法和电子设备
EP4376433A1 (en) Camera switching method and electronic device
US20240056685A1 (en) Image photographing method, device, storage medium, and program product
WO2022083325A1 (zh) 拍照预览方法、电子设备以及存储介质
WO2023142830A1 (zh) 切换摄像头的方法与电子设备
WO2021185374A1 (zh) 一种拍摄图像的方法及电子设备
CN114531539B (zh) 拍摄方法及电子设备
WO2022228259A1 (zh) 一种目标追踪方法及相关装置
WO2023185127A1 (zh) 图像处理方法与电子设备
CN116055855B (zh) 图像处理方法及其相关设备
CN118138876A (zh) 切换摄像头的方法与电子设备
WO2020174911A1 (ja) 画像表示装置、画像表示方法、及びプログラム

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2023841480

Country of ref document: EP

Effective date: 20240125