Lens switching method and device, electronic equipment and storage medium

By switching mobile phone lenses in real-time camera data, the problem of poor imaging effects of fixed-focus lenses under wide angle and telephoto is solved, and the imaging quality and user experience are improved.

CN119031240APending Publication Date: 2024-11-26BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310596027.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-24
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Due to the size and weight limitations of mobile phone lenses, they can only use fixed-focus lenses, which leads to blurry pictures when shooting closer objects under wide-angle lenses. The picture is dark due to aperture or sensitivity differences under telephoto lenses, which affects the imaging effect and user experience.

Method used

By obtaining real-time camera data from the camera application, determine whether the preset data of the second lens is met and switch the lens when conditions are met, such as switching from a wide-angle lens to an ultra-wide-angle lens, or switching from an ultra-wide-angle lens to a wide-angle lens to better adapt Actual camera data to avoid the limitations of the fixed-focus lens.

Benefits of technology

It achieves better imaging effects, improves the user's shooting experience, and avoids the problem of poor picture effects caused by the fixed-focus lens.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119031240A_ABST
    Figure CN119031240A_ABST
Patent Text Reader

Abstract

The invention relates to a lens switching method and device, electronic equipment and a storage medium. The lens switching method comprises the following steps: acquiring real-time camera shooting data of a first lens currently used by a camera shooting application program; determining whether the real-time camera data satisfies preset camera data corresponding to a second lens; and switching from the first lens to the second lens under the condition that the real-time shooting data meets the preset shooting data corresponding to the second lens. By adopting the method provided by the embodiment of the invention, the imaging effect can be improved, so that the imaging experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of terminal technology, and in particular to a lens switching method, device, electronic device and storage medium. Background Art

[0002] In the related art, mobile phone lenses are usually limited to fixed-focus lenses due to size, weight and other factors. In order to improve the imaging capabilities of mobile phones, ultra-wide-angle, wide-angle, telephoto or ultra-wide-angle, wide-angle macro lens combinations are usually used, and spatial alignment transformation algorithms are used between lenses for smoothing to achieve an effect similar to optical zoom. However, due to the limitations of fixed-focus lenses, when shooting closer objects with a wide-angle lens, the picture will appear completely blurred due to out-of-focus, and the picture will be darker due to differences in aperture or sensitivity with a telephoto lens. This will result in poor imaging effects and affect the user's imaging experience. Summary of the invention

[0003] The present disclosure provides a lens switching method, device, electronic device and storage medium. The technical solution of the present disclosure is as follows:

[0004] According to a first aspect of an embodiment of the present disclosure, a lens switching method is provided, comprising:

[0005] Obtain real-time camera data of the first lens currently used by the camera application;

[0006] Determining whether the real-time camera data satisfies preset camera data corresponding to the second lens;

[0007] When the real-time camera data meets the preset camera data corresponding to the second lens, the first lens is switched to the second lens.

[0008] In a possible implementation manner, the real-time camera data includes a focus state; the first lens includes a wide-angle lens, and the second lens includes an ultra-wide-angle lens;

[0009] The determining whether the real-time camera data satisfies preset camera data corresponding to the second lens includes:

[0010] When the duration of the wide-angle lens being in the focusing state reaches a preset duration, determining that the current focusing distance is less than a first preset focusing distance of the wide-angle lens;

[0011] Determining whether the current focus distance satisfies a second preset focus distance corresponding to the ultra-wide-angle lens;

[0012] When the real-time camera data satisfies preset camera data corresponding to the second camera, switching from the first camera to the second camera includes:

[0013] When the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens, the wide-angle lens is switched to the ultra wide-angle lens.

[0014] In a possible implementation, the switching from the wide-angle lens to the ultra-wide-angle lens includes:

[0015] In the case where the captured image includes a face frame, mapping the face frame in the image captured by the ultra-wide-angle lens to the field of view coordinates corresponding to the shooting application;

[0016] Calculate the size of the face frame in the wide-angle lens after mapping to the field of view coordinates corresponding to the shooting application program according to the zoom ratio corresponding to the wide-angle lens;

[0017] Based on the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application, the face frame is switched from the wide-angle lens to the ultra-wide-angle lens.

[0018] In a possible implementation manner, the real-time camera data further includes a zoom ratio; the zoom ratio corresponds to the first lens;

[0019] In the case where the current focus distance satisfies the second preset focus distance corresponding to the ultra wide-angle lens, after switching from the wide-angle lens to the ultra wide-angle lens, the method further includes:

[0020] determining whether the wide-angle lens can focus normally under the zoom ratio;

[0021] When the wide-angle lens can focus normally, switch from the ultra-wide-angle lens to the wide-angle lens.

[0022] In a possible implementation manner, the real-time camera data further includes an exposure brightness value;

[0023] When the wide-angle lens can focus normally, switching from the ultra-wide-angle lens to the wide-angle lens comprises:

[0024] When the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

[0025] In a possible implementation manner, the real-time camera data further includes an exposure brightness value; the first lens includes an ultra-wide-angle lens, and the second lens includes a wide-angle lens;

[0026] When the real-time camera data satisfies preset camera data corresponding to the second camera, switching from the first camera to the second camera includes:

[0027] When the exposure brightness value is less than a preset brightness value corresponding to the ultra wide-angle lens, the ultra wide-angle lens is switched to the wide-angle lens.

[0028] In a possible implementation, the first lens includes a telephoto lens; the second lens includes a wide-angle lens; the real-time camera data also includes whether it is in a cropping state inside the lens;

[0029] The determining whether the real-time camera data satisfies the preset camera data corresponding to the second lens also includes:

[0030] When the wide-angle lens is in a lens internal cropping state, determining whether a difference between an initial focal length of the telephoto lens and a lens internal cropping focal length of the wide-angle lens is less than a preset difference;

[0031] When the real-time camera data satisfies preset camera data corresponding to the second camera, switching from the first camera to the second camera includes:

[0032] When the difference between the initial focal length of the telephoto lens and the internal cropped focal length of the wide-angle lens is less than a preset difference, the telephoto lens is switched to the wide-angle lens.

[0033] According to a second aspect of an embodiment of the present disclosure, there is provided a lens switching device, comprising:

[0034] A data acquisition module, used to acquire real-time camera data of a first lens currently used by a camera application;

[0035] A data determination module, used to determine whether the real-time camera data satisfies the preset camera data corresponding to the second lens;

[0036] The first lens switching module is used to switch from the first lens to the second lens when the real-time camera data meets the preset camera data corresponding to the second lens.

[0037] In a possible implementation manner, the real-time camera data includes a focus state; the first lens includes a wide-angle lens, and the second lens includes an ultra-wide-angle lens;

[0038] The data determination module comprises:

[0039] A first distance determination unit, configured to determine that a current focus distance is less than a first preset focus distance of the wide-angle lens when the duration of the wide-angle lens being in a focus state reaches a preset duration;

[0040] A second distance determination unit, used to determine whether the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens;

[0041] The first lens switching module is used to:

[0042] When the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens, the wide-angle lens is switched to the ultra wide-angle lens.

[0043] In a possible implementation, the first lens switching module includes:

[0044] A mapping unit, configured to map the face frame in the image captured by the telephoto lens to the field of view coordinates corresponding to the shooting application program when the face frame is included in the captured image;

[0045] A calculation unit, configured to calculate the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application program, based on the zoom ratio corresponding to the wide-angle lens;

[0046] The lens switching unit is used to switch the face frame from the wide-angle lens to the ultra-wide-angle lens based on the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application.

[0047] In a possible implementation manner, the real-time camera data further includes a zoom ratio; the zoom ratio corresponds to the first lens;

[0048] The device further comprises:

[0049] A focus determination module, used to determine whether the wide-angle lens can focus normally under the zoom ratio;

[0050] The second lens switching module is used to switch from the ultra wide-angle lens to the wide-angle lens when the wide-angle lens can focus normally.

[0051] In a possible implementation manner, the real-time camera data further includes an exposure brightness value;

[0052] The second lens switching module is used to:

[0053] When the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

[0054] In a possible implementation manner, the real-time camera data further includes an exposure brightness value; the first lens includes an ultra-wide-angle lens, and the second lens includes a wide-angle lens;

[0055] The first lens switching module is used to:

[0056] When the exposure brightness value is less than a preset brightness value corresponding to the ultra wide-angle lens, the ultra wide-angle lens is switched to the wide-angle lens.

[0057] In a possible implementation, the first lens includes a telephoto lens; the second lens includes a wide-angle lens; the real-time camera data also includes whether it is in a cropping state inside the lens;

[0058] The data determination module further includes:

[0059] a difference determination unit, configured to determine whether a difference between an initial focal length of the telephoto lens and an internal cropped focal length of the wide-angle lens is less than a preset difference when the wide-angle lens is in an internal cropped state;

[0060] The first lens switching module is used to:

[0061] When the difference between the initial focal length of the telephoto lens and the internal cropped focal length of the wide-angle lens is less than a preset difference, the telephoto lens is switched to the wide-angle lens.

[0062] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:

[0063] processor;

[0064] a memory for storing instructions executable by the processor;

[0065] The processor is configured to execute the instructions to implement the method as described in any one of the first aspects.

[0066] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute a method as described in any one of the first aspects.

[0067] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method according to any one of the first aspects is implemented.

[0068] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0069] In the disclosed embodiment, the real-time camera data of the first lens currently used by the camera application is obtained; it is determined whether the real-time camera data satisfies the preset camera data corresponding to the second lens; when the real-time camera data satisfies the preset camera data corresponding to the second lens, the first lens is switched to the second lens. In this way, the lens switching can be realized based on the real-time camera data, so as to switch to a lens that is more consistent with the actual camera data for imaging, so as to avoid the problem of poor imaging picture effect caused by the limitation of the fixed-focus lens, improve the imaging effect, and thus improve the user imaging experience.

[0070] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0072] Figure 1 The figure is a flow chart of a lens switching method according to an exemplary embodiment.

[0073] Figure 2 The figure is a schematic diagram of a working focal length of a lens according to an exemplary embodiment.

[0074] Figure 3 The figure is a schematic diagram of a lens picture size according to an exemplary embodiment.

[0075] Figure 4 The figure is a block diagram of a lens switching device according to an exemplary embodiment.

[0076] Figure 5 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0077] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0078] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0079] The lens switching method, device, electronic device and storage medium provided by the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.

[0080] Figure 1 1 is a flowchart of a lens switching method according to an exemplary embodiment. The lens switching method can be applied to an electronic device, for example, a mobile phone, a tablet computer, etc. The electronic device can be provided with at least two different fixed-focus lenses. Figure 1 As shown, the lens switching method may include the following steps.

[0081] In step S101, real-time camera data of a first lens currently used by a camera application is acquired.

[0082] In an embodiment of the present disclosure, when a user uses a camera application (such as a camera) of an electronic device, the user can control the electronic device to start the camera application and enter the preview interface. The user can also operate the electronic device to adjust the zoom ratio and lens. After the user starts the camera application of the electronic device, if the user does not operate the electronic device to adjust the lens, the first lens can be the lens that is started by default after the camera application is started; if the user operates the electronic device to adjust the lens, the first lens can be the lens that is started after the user adjusts it. After the first lens currently used by the camera application is started, real-time shooting data of the first lens can be obtained. It can be understood that the real-time shooting data can be used to describe the shooting parameters and lens status of the first lens, etc.

[0083] In step S102, it is determined whether the real-time camera data satisfies the preset camera data corresponding to the second lens.

[0084] In the disclosed embodiment, after obtaining the real-time camera data of the first lens currently used by the camera application, it can be determined whether the real-time camera data satisfies the preset camera data corresponding to the other lens (i.e., the second lens) except the first lens. The preset camera data can be, for example, the range of camera data corresponding to when the second lens can normally form an image. It can be understood that if the real-time camera data satisfies the preset shooting data corresponding to the second lens, the image based on the aforementioned real-time camera data under the first lens is usually not clear enough or cannot be formed.

[0085] In step S103, when the real-time camera data meets the preset camera data corresponding to the second lens, the first lens is switched to the second lens.

[0086] In the embodiment of the present disclosure, after determining whether the real-time camera data meets the preset camera data corresponding to the second lens, if the real-time camera data meets the preset camera data corresponding to the second lens, it can be considered that the imaging effect using the second lens is better, and at this time, the first lens can be switched to the second lens to use the second lens to perform imaging preview or capture images of the object or person to be photographed. In this way, the imaging effect can be better, thereby better satisfying the user experience.

[0087] In the disclosed embodiment, the real-time camera data of the first lens currently used by the camera application is obtained; it is determined whether the real-time camera data satisfies the preset camera data corresponding to the second lens; when the real-time camera data satisfies the preset camera data corresponding to the second lens, the first lens is switched to the second lens. In this way, the lens switching can be realized based on the real-time camera data, so as to switch to a lens that is more consistent with the actual camera data for imaging, so as to avoid the problem of poor imaging picture effect caused by the limitation of the fixed-focus lens, improve the imaging effect, and thus improve the user imaging experience.

[0088] In a possible implementation, the electronic device may be provided with a wide-angle lens and an ultra-wide-angle lens. The real-time camera data may include a focus state; the first lens may be a wide-angle lens of the electronic device, and the second lens may be an ultra-wide-angle lens of the electronic device;

[0089] At this time, the specific implementation method of the above step of determining whether the real-time camera data meets the preset camera data corresponding to the second lens can be:

[0090] When the duration of the wide-angle lens being in the focusing state reaches a preset duration, determining that the current focusing distance is less than a first preset focusing distance of the wide-angle lens;

[0091] Determining whether the current focus distance satisfies a second preset focus distance corresponding to the ultra-wide-angle lens;

[0092] Correspondingly, in the above step, when the real-time camera data meets the preset camera data corresponding to the second lens, the specific implementation method of switching from the first lens to the second lens can be:

[0093] When the current focus distance satisfies the second preset focus distance corresponding to the ultra-wide-angle lens, the wide-angle lens is switched to the ultra-wide-angle lens.

[0094] In the disclosed embodiment, the electronic device may be provided with a wide-angle lens and an ultra-wide-angle lens. Considering that in actual use, the default lens of the camera application is usually a wide-angle lens, and the lens commonly used by the user is also often a wide-angle lens, therefore, the first lens may be a wide-angle lens. In the case where the first lens is a wide-angle lens, the real-time camera data may include the focus state of the wide-angle lens. It can be determined whether the wide-angle lens is in a focus state and the duration reaches a preset duration. The preset duration can be set according to actual needs, for example, it can be set to 3 seconds, 2 seconds, 1 second, etc. If the duration of the wide-angle lens being in the focus state reaches a preset duration, it can be considered that the focus distance is too small when the wide-angle lens is always in the focus state, that is, the current focus distance is less than the preset focus distance of the wide-angle lens (i.e., the first preset focus distance) and needs to be switched to a lens that can be imaged at a small focus distance. The preset focus distance of the wide-angle lens is the focus distance range in which the wide-angle lens can normally image. Then, it can be determined whether the current focus distance meets the preset focus distance corresponding to the ultra-wide-angle lens (i.e., the second preset focus distance). The second preset focus distance corresponding to the ultra-wide-angle lens is the focus distance range in which the ultra-wide-angle lens can normally image. It can be understood that the current focus distance can be a specific value or a value range. For example, the minimum focus distance of the wide-angle lens is usually 0.2 meters, then the current focus distance can be 'less than 0.2 meters'. When the current focus distance meets the second preset focus distance corresponding to the ultra-wide-angle lens, switch from the wide-angle lens to the ultra-wide-angle lens. In this way, lens switching can be achieved according to the focus state, so that the switched lens is more in line with the actual focus distance, thereby further improving the imaging effect and improving the user experience.

[0095] In a possible implementation manner, the above step of switching from a wide-angle lens to an ultra-wide-angle lens may include:

[0096] In the case where the captured image includes a face frame, mapping the face frame in the image captured by the telephoto wide-angle lens to the field of view coordinates corresponding to the shooting application;

[0097] Calculate the size of the face frame in the wide-angle lens after mapping to the field of view coordinates corresponding to the shooting application program using the zoom ratio corresponding to the wide-angle lens;

[0098] Based on the size of the face frame mapped to the field of view coordinates corresponding to the shooting application program, the face frame is switched from the wide-angle lens to the ultra-wide-angle lens.

[0099] In the disclosed embodiment, if a face frame is included in the captured image, the face frame conversion can be performed when switching from a wide-angle lens to an ultra-wide-angle lens to prevent the face frame from shifting. Exemplarily, when switching from a wide-angle lens to an ultra-wide-angle lens and the captured image includes a face frame, the face frame in the captured image of the long wide-angle lens can be mapped to the field of view coordinates corresponding to the shooting application. Then, the position of the face frame in the wide-angle lens after mapping to the field of view coordinates corresponding to the shooting application can be calculated based on the zoom ratio corresponding to the wide-angle lens, that is, the size of the face frame of the actual picture is calculated based on the zoom ratio relationship of the wide-angle lens. For example, based on the W lens (i.e., wide-angle lens), the face of the UW lens (i.e., ultra-wide-angle lens) is mapped to the FOV coordinates (i.e., field of view coordinates) defined by the camera application in the spatial alignment stage, and finally the size of the face frame of the actual picture is calculated based on the zoom ratio (i.e., zoom ratio) relationship of the W lens. For example, if the coordinates of the W lens are 4000x3000, the coordinates of the UW lens are 3264*2464, the FOV relationship between the UW lens and the W lens is 0.68, the magnification defined by the camera application is 0.6x, and the coordinate mapping relationship of the UW lens is 3264=4000 / 0.6=6666.7. The face frame of the UW lens is converted to the W lens at a ratio of 3264:6666.7. Afterwards, the face frame can be switched from the wide-angle lens to the ultra-wide-angle lens based on the size of the face frame mapped to the field of view coordinates corresponding to the shooting application. In this way, the face frame offset when switching from the wide-angle lens to the ultra-wide-angle lens can be effectively avoided, thereby further improving the imaging effect and user experience.

[0100] In a further possible implementation, the real-time camera data may further include a zoom ratio; the zoom ratio corresponds to the first lens; at this time, switching from an ultra-wide-angle lens to a wide-angle lens may also be achieved.

[0101] In the above steps, when the current focus distance satisfies the second preset focus distance corresponding to the ultra-wide-angle lens, after switching from the wide-angle lens to the ultra-wide-angle lens, the following steps may also be performed:

[0102] Determine whether the wide-angle lens can focus normally under the zoom ratio;

[0103] If the wide-angle lens can focus normally, switch from the ultra-wide-angle lens to the wide-angle lens.

[0104] In the disclosed embodiment, considering that the real-time camera data usually also includes the zoom ratio of the lens, the lens switching can also be implemented according to the zoom ratio. Exemplarily, when the current focus distance satisfies the second preset focus distance corresponding to the ultra-wide-angle lens, after switching from the wide-angle lens to the ultra-wide-angle lens, it can also be determined whether the wide-angle lens can focus normally under the aforementioned zoom ratio. If the wide-angle lens can focus normally under the aforementioned zoom ratio, you can switch from the ultra-wide-angle lens to the wide-angle lens. For example, assuming the zoom ratio is 2.0, if the wide-angle lens can focus normally at a zoom ratio of 2.0, it is necessary to switch to the wide-angle lens. In this way, since the aperture value of the wide-angle lens is larger and the quality of the image sensor is generally better than that of the ultra-wide-angle lens, when the wide-angle lens can focus normally, switching back to the wide-angle lens for shooting can further improve the imaging effect.

[0105] In a possible implementation, the real-time camera data may further include an exposure brightness value; accordingly, in the above steps, when the wide-angle lens can focus normally, a specific implementation method of switching from the ultra-wide-angle lens to the wide-angle lens may be:

[0106] When the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

[0107] In the disclosed embodiment, considering that in addition to the focusing distance, the exposure brightness value will also affect the imaging effect, therefore, the exposure brightness value can be taken into consideration when switching lenses. For example, considering that when the exposure brightness value is low, that is, when the exposure brightness value is less than the minimum exposure brightness value (that is, the preset brightness value) corresponding to the ultra-wide-angle lens, the imaging effect of the wide-angle lens is usually better than that of the ultra-wide-angle lens. Therefore, when the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, it is possible to switch from the ultra-wide-angle lens to the wide-angle lens, wherein the preset brightness value can be set according to actual needs, for example, it can be set to f / 22, f / 21, etc. In this way, the imaging effect can be further improved, thereby further improving the user experience.

[0108] In a possible implementation, the real-time camera data may further include an exposure brightness value; the first lens may include an ultra-wide-angle lens, and the second lens may include a wide-angle lens;

[0109] In the above steps, when the real-time camera data meets the preset camera data corresponding to the second lens, the specific implementation method of switching from the first lens to the second lens can be:

[0110] When the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

[0111] In the disclosed embodiment, considering that when the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, the imaging effect of the wide-angle lens is generally better than that of the ultra-wide-angle lens. Therefore, when the exposure brightness value is detected to be low, that is, when the environment is dark, that is, when the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, the ultra-wide-angle lens can be switched to the wide-angle lens. In this way, the imaging effect of the camera application can be further improved.

[0112] In a possible implementation, switching between a telephoto lens and a wide-angle lens can also be implemented. Exemplarily, the first lens may include a telephoto lens; the second lens may include a wide-angle lens; the real-time camera data may also include whether it is in a cropping state inside the lens;

[0113] Correspondingly, the above step of determining whether the real-time camera data satisfies the preset camera data corresponding to the second lens may further include:

[0114] When the wide-angle lens is in a lens internal cropping state, determining whether a difference between an initial focal length of the telephoto lens and a lens internal cropping focal length of the wide-angle lens is less than a preset difference;

[0115] In the above step, when the real-time camera data meets the preset camera data corresponding to the second lens, the specific implementation method of switching from the first lens to the second lens may include:

[0116] When the difference between the initial focal length of the telephoto lens and the internal cropped focal length of the wide-angle lens is less than a preset difference, the telephoto lens is switched to the wide-angle lens.

[0117] In the disclosed embodiment, the first lens may be a telephoto lens, and the second lens may be a wide-angle lens. At this time, it may also be determined whether the wide-angle lens is in a cropped state inside the lens. If the wide-angle lens is in a cropped state inside the lens, the difference between the initial focal length of the telephoto lens and the cropped focal length inside the lens of the wide-angle lens may be calculated to determine whether the difference is less than a preset difference. The specific value of the preset difference may be set according to actual needs. If the difference between the initial focal length of the telephoto lens and the cropped focal length inside the lens of the wide-angle lens is less than the preset difference, that is, when the initial focal length of the telephoto lens and the cropped focal length inside the lens of the wide-angle lens are slightly different, it is possible to switch from the telephoto lens to the wide-angle lens. In this way, the imaging effect may be further improved.

[0118] To make the lens switching method provided by the embodiment of the present disclosure clearer, the following is a detailed description of the lens switching method provided by the embodiment of the present disclosure. Figure 2-4 Provide explanation.

[0119] The lens switching method provided in the embodiment of the present disclosure can be based on the MediaTek platform to enable multiple cameras to automatically switch to the optimal lens for preview shooting under different exposure brightness, focus distance and module status, thereby enhancing the user's imaging experience.

[0120] Take the lens combination of ultra wide-angle lens-wide-angle lens-telephoto lens as an example. Figure 2 As shown in the figure, the ultrawide (UW) lens can be set to work at a focal length of 0.6x-1.0x, the wide-angle (W) lens can be set to work at a focal length of 1.0x-5.0x, and the telephoto (T) lens can be set to work at a focal length of 5.0x or more. The FOV (Field of view) relationship between different lenses is generally UW lens>W lens>T lens. The spatial alignment algorithm ensures that the same zoom ratio can be converted to the zoom ratio of the parent lens when switching lenses, such as Figure 3 As shown, the 5.0x image of the W lens is equivalent to the 1.0x image of the T lens, thereby ensuring that the image size is consistent. The focus distance of the W lens is usually greater than the focus distance of the UW lens, and the aperture value of the W lens is usually greater than the aperture value of the UW lens. The focus distance of the T lens is usually greater than the focus distance of the W lens, but the aperture value of the T lens is usually smaller than the aperture value of the W lens. Based on the hardware characteristics of each lens, the method provided in the embodiment of the present disclosure may include the following processing:

[0121] (1) The APP (application) obtains the user's operation status, which may be, for example, the user's actual operation on the electronic device, and sends the zoom ratio through the meta tag defined by Android, where metatag is an element in HTML (Hyper Text Markup Language) used to describe the metadata of a document.

[0122] (2) The software layer obtains the zoom ratio, AE (Auto Exposure) brightness value, AF (Auto Focus) status, focus distance and lens status of each lens sent by the APP, and determines which lens is actually needed. For example, when the zoom ratio is 2.0x, theoretically only the W lens can be used to output the image. At this time, the focus status of the W lens can be determined. If it is always in the focus state, it means that the focus distance is too small and it is necessary to switch to the UW lens. When 2.0x is in the UW lens, it is necessary to switch to the W lens when it is determined that the focus state of the W lens is normal or the exposure brightness is dark (that is, the exposure brightness value is less than the preset brightness value), because the aperture value of the W lens is larger and the quality of the image sensor is generally better than that of the UW lens. In addition, when the WT lens focal length is used, it is also necessary to determine whether the W lens is in the ISZ (ISZ In Sensor Zoom) state. When the initial focal length of the T lens is not much different from the ISZ focal length of the W lens, it can be switched to the W lens.

[0123] (3) Through the spatial alignment operation, the two lenses that need to be switched are aligned to output the offset and rotation between the lenses to reduce the sense of change in the picture. It can be understood that the lens switching occurs between two lenses, such as UW lens-W lens, W lens-T lens, to maintain the logical continuity of the picture in the focal length. When the user clicks the zoom button or uses two fingers to adjust the zoom ratio to switch to a different focal length, the two lenses will be turned on at the same time. In the spatial alignment operation part, one lens can be selected to output the image (hereinafter referred to as master), and the other lens is in the background open state (hereinafter referred to as slave). The slave will be turned off after a period of time to reduce the power consumption of the mobile phone. The spatial alignment operation is similar to the relevant technology and will not be repeated here.

[0124] (4) Output the final image of the lens and notify the APP of the ID (Identity document) of the current lens to ensure that the same lens is used for preview and photo taking. This process is similar to the related technology and will not be described in detail here.

[0125] In this way, by extracting information such as the lens' exposure brightness value, focus status, and lens status, the lens can be automatically switched in special scenes, so that higher-quality mobile phone lenses can be used to achieve image formation, improve imaging effects, and thus enhance the user's photo-taking experience.

[0126] Based on the same inventive concept, the embodiment of the present disclosure also provides a lens switching device, such as Figure 4 As shown, Figure 4 is a block diagram of a lens switching device according to an exemplary embodiment. Figure 4 , the lens switching device 400 may include:

[0127] The data acquisition module 410 is used to acquire real-time camera data of the first lens currently used by the camera application;

[0128] A data determination module 420, used to determine whether the real-time camera data meets the preset camera data corresponding to the second lens;

[0129] The first lens switching module 430 is configured to switch from the first lens to the second lens when the real-time camera data satisfies the preset camera data corresponding to the second lens.

[0130] In a possible implementation manner, the real-time camera data includes a focus state; the first lens includes a wide-angle lens, and the second lens includes an ultra-wide-angle lens;

[0131] The data determination module 420 includes:

[0132] A first distance determination unit, configured to determine that a current focus distance is less than a first preset focus distance of the wide-angle lens when the duration of the wide-angle lens being in a focus state reaches a preset duration;

[0133] A second distance determination unit, used to determine whether the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens;

[0134] The first lens switching module 430 is used to:

[0135] When the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens, the wide-angle lens is switched to the ultra wide-angle lens.

[0136] In a possible implementation, the first lens switching module 430 includes:

[0137] A mapping unit, configured to map the face frame in the image captured by the telephoto lens to the field of view coordinates corresponding to the shooting application program when the face frame is included in the captured image;

[0138] A calculation unit, configured to calculate the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application program, based on the zoom ratio corresponding to the wide-angle lens;

[0139] The lens switching unit is used to switch the face frame from the wide-angle lens to the ultra-wide-angle lens based on the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application.

[0140] In a possible implementation manner, the real-time camera data further includes a zoom ratio; the zoom ratio corresponds to the first lens;

[0141] The device 400 further includes:

[0142] A focus determination module, used to determine whether the wide-angle lens can focus normally under the zoom ratio;

[0143] The second lens switching module is used to switch from the ultra wide-angle lens to the wide-angle lens when the wide-angle lens can focus normally.

[0144] In a possible implementation manner, the real-time camera data further includes an exposure brightness value;

[0145] The second lens switching module is used to:

[0146] When the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

[0147] In a possible implementation manner, the real-time camera data further includes an exposure brightness value; the first lens includes an ultra-wide-angle lens, and the second lens includes a wide-angle lens;

[0148] The first lens switching module 430 is used to:

[0149] When the exposure brightness value is less than a preset brightness value corresponding to the ultra wide-angle lens, the ultra wide-angle lens is switched to the wide-angle lens.

[0150] In a possible implementation, the first lens includes a telephoto lens; the second lens includes a wide-angle lens; the real-time camera data also includes whether it is in a cropping state inside the lens;

[0151] The data determination module 420 further includes:

[0152] a difference determination unit, configured to determine whether a difference between an initial focal length of the telephoto lens and an internal cropped focal length of the wide-angle lens is less than a preset difference when the wide-angle lens is in an internal cropped state;

[0153] The first lens switching module is used to:

[0154] When the difference between the initial focal length of the telephoto lens and the internal cropped focal length of the wide-angle lens is less than a preset difference, the telephoto lens is switched to the wide-angle lens.

[0155] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0156] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a storage medium and a computer program product.

[0157] Figure 5A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device 500 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0158] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0159] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0160] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as the lens switching method. For example, in some embodiments, the lens switching method may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the lens switching method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the lens switching method in any other appropriate manner (e.g., by means of firmware).

[0161] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0162] The program code of the computer program product for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.

[0163] In the context of the present disclosure, a storage medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A storage medium may be a machine-readable signal medium or a machine-readable storage medium. Storage media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specific examples of storage media may include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0164] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0165] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0166] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0167] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0168] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A lens switching method, It is characterized in that include: Obtain real-time camera data of the first lens currently used by the camera application; Determining whether the real-time camera data satisfies preset camera data corresponding to the second lens; When the real-time camera data meets the preset camera data corresponding to the second lens, the first lens is switched to the second lens.

2. The lens switching method according to claim 1, It is characterized in that The real-time camera data includes a focus state; the first lens includes a wide-angle lens, and the second lens includes an ultra-wide-angle lens; The determining whether the real-time camera data satisfies preset camera data corresponding to the second lens includes: When the duration of the wide-angle lens being in the focusing state reaches a preset duration, determining that the current focusing distance is less than a first preset focusing distance of the wide-angle lens; Determining whether the current focus distance satisfies a second preset focus distance corresponding to the ultra-wide-angle lens; When the real-time camera data satisfies preset camera data corresponding to the second camera, switching from the first camera to the second camera includes: When the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens, the wide-angle lens is switched to the ultra wide-angle lens.

3. The lens switching method according to claim 2, It is characterized in that The switching from the wide-angle lens to the ultra-wide-angle lens comprises: In the case where the captured image includes a face frame, mapping the face frame in the image captured by the ultra-wide-angle lens to the field of view coordinates corresponding to the shooting application; Calculate the size of the face frame in the wide-angle lens after mapping to the field of view coordinates corresponding to the shooting application program according to the zoom ratio corresponding to the wide-angle lens; Based on the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application, the face frame is switched from the wide-angle lens to the ultra-wide-angle lens.

4. The lens switching method according to claim 2, It is characterized in that The real-time camera data also includes a zoom ratio; the zoom ratio corresponds to the first lens; In the case where the current focus distance satisfies the second preset focus distance corresponding to the ultra wide-angle lens, after switching from the wide-angle lens to the ultra wide-angle lens, the method further includes: determining whether the wide-angle lens can focus normally under the zoom ratio; When the wide-angle lens can focus normally, switch from the ultra-wide-angle lens to the wide-angle lens.

5. The lens switching method according to claim 4, It is characterized in that The real-time camera data also includes an exposure brightness value; When the wide-angle lens can focus normally, switching from the ultra-wide-angle lens to the wide-angle lens comprises: When the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

6. The lens switching method according to claim 1, It is characterized in that The real-time camera data also includes an exposure brightness value; the first lens includes an ultra-wide-angle lens, and the second lens includes a wide-angle lens; When the real-time camera data satisfies preset camera data corresponding to the second camera, switching from the first camera to the second camera includes: When the exposure brightness value is less than a preset brightness value corresponding to the ultra wide-angle lens, the ultra wide-angle lens is switched to the wide-angle lens.

7. The lens switching method according to claim 1, It is characterized in that The first lens includes a telephoto lens; the second lens includes a wide-angle lens; the real-time camera data also includes whether it is in a cropping state inside the lens; The determining whether the real-time camera data satisfies the preset camera data corresponding to the second lens also includes: When the wide-angle lens is in a lens internal cropping state, determining whether a difference between an initial focal length of the telephoto lens and a lens internal cropping focal length of the wide-angle lens is less than a preset difference; When the real-time camera data satisfies preset camera data corresponding to the second camera, switching from the first camera to the second camera includes: When the difference between the initial focal length of the telephoto lens and the internal cropped focal length of the wide-angle lens is less than a preset difference, the telephoto lens is switched to the wide-angle lens.

8. A lens switching device, It is characterized in that include: A data acquisition module, used to acquire real-time camera data of a first lens currently used by a camera application; A data determination module, used to determine whether the real-time camera data satisfies the preset camera data corresponding to the second lens; The first lens switching module is used to switch from the first lens to the second lens when the real-time camera data meets the preset camera data corresponding to the second lens.

9. The lens switching device according to claim 8, It is characterized in that The real-time camera data includes a focus state; the first lens includes a wide-angle lens, and the second lens includes an ultra-wide-angle lens; The data determination module comprises: A first distance determination unit, configured to determine that a current focus distance is less than a first preset focus distance of the wide-angle lens when the duration of the wide-angle lens being in a focus state reaches a preset duration; A second distance determination unit, used to determine whether the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens; The first lens switching module is used to: When the current focus distance satisfies a second preset focus distance corresponding to the ultra wide-angle lens, the wide-angle lens is switched to the ultra wide-angle lens.

10. The lens switching device according to claim 9, It is characterized in that The first lens switching module includes: A mapping unit, configured to map the face frame in the image captured by the telephoto lens to the field of view coordinates corresponding to the shooting application program when the face frame is included in the captured image; A calculation unit, configured to calculate the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application program, based on the zoom ratio corresponding to the wide-angle lens; The lens switching unit is used to switch the face frame from the wide-angle lens to the ultra-wide-angle lens based on the size of the face frame in the wide-angle lens after being mapped to the field of view coordinates corresponding to the shooting application.

11. The lens switching device according to claim 9, It is characterized in that The real-time camera data also includes a zoom ratio; the zoom ratio corresponds to the first lens; The device further comprises: A focus determination module, used to determine whether the wide-angle lens can focus normally under the zoom ratio; The second lens switching module is used to switch from the ultra wide-angle lens to the wide-angle lens when the wide-angle lens can focus normally.

12. The lens switching device according to claim 11, It is characterized in that The real-time camera data also includes an exposure brightness value; The second lens switching module is used to: When the wide-angle lens can focus normally and the exposure brightness value is less than the preset brightness value corresponding to the ultra-wide-angle lens, switch from the ultra-wide-angle lens to the wide-angle lens.

13. The lens switching device according to claim 8, It is characterized in that The real-time camera data also includes an exposure brightness value; the first lens includes an ultra-wide-angle lens, and the second lens includes a wide-angle lens; The first lens switching module is used to: When the exposure brightness value is less than a preset brightness value corresponding to the ultra wide-angle lens, the ultra wide-angle lens is switched to the wide-angle lens.

14. The lens switching device according to claim 8, It is characterized in that The first lens includes a telephoto lens; the second lens includes a wide-angle lens; the real-time camera data also includes whether it is in a cropping state inside the lens; The data determination module further includes: a difference determination unit, configured to determine whether a difference between an initial focal length of the telephoto lens and an internal cropped focal length of the wide-angle lens is less than a preset difference when the wide-angle lens is in an internal cropped state; The first lens switching module is used to: When the difference between the initial focal length of the telephoto lens and the internal cropped focal length of the wide-angle lens is less than a preset difference, the telephoto lens is switched to the wide-angle lens.

15. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the lens switching method as described in any one of claims 1 to 7. 16 . A storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the lens switching method according to any one of claims 1 to 7.

17. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the shot switching method according to any one of claims 1 to 7 is implemented.