Lens switching method and device, camera equipment and storage medium
During the lens switching process, image zoom conversion and target distortion parameters of the current frame image of the camera device are gradually adjusted, which solves the problem of lag in the display image of the camera device during lens switching, and achieves a smoother lens switching effect.
Patent Information
- Application Number
- CN202311634720.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-30
- Publication Date
- 2025-05-30
AI Technical Summary
During the lens switching process, the display screen of the camera device is prone to stuttering because the degree of image distortion between the current frame image and the zoom image is quite different.
By obtaining the device internal parameters and target distortion parameters of the camera device, the image zoom conversion is performed on the current frame image, and the zoom conversion image is obtained, and the target distortion parameters are gradually adjusted to achieve the preset distortion parameters of the second camera lens, thereby realizing lens switching.
During the lens switching process, the image distortion degree is adjusted by gradient type to avoid a significant change in the image distortion degree of the zoom conversion image of adjacent frames, thereby reducing the stuttering of the display screen of the camera device during lens switching.
Smart Images

Figure CN120075608A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of optical imaging, and in particular, to a lens switching method, apparatus, imaging device, storage medium, and computer program product. Background Art
[0002] With the development of optical imaging technology, dual cameras have emerged, and the switching between a telephoto lens and a short-focus lens can be autonomously performed on the dual camera.
[0003] In the traditional technology, during the lens switching process, usually according to the fisheye camera model and the current frame image of the lens to be switched, the zoomed image after the change of the camera focal length is directly calculated for display, so that the user can perceive the lens switching process on the camera display screen.
[0004] However, since the distortion of the captured image of the telephoto lens is usually small, and the distortion of the captured image of the short-focus lens is usually large, this will result in a large difference in the degree of image distortion between the current frame image and the zoomed image. Therefore, when directly switching and displaying the current frame image and the zoomed image on the camera display screen, it is easy to cause the camera display screen to freeze. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide a lens switching method, apparatus, imaging device, computer-readable storage medium, and computer program product that can reduce the freeze of the display screen of the imaging device during lens switching.
[0006] In a first aspect, the present application provides a lens switching method. The method includes:
[0007] Obtain a current frame image captured by a first imaging lens of the imaging device;
[0008] Perform image zoom conversion on the current frame image according to the internal parameters of the device and the target distortion parameter corresponding to the first imaging lens, to obtain a zoom-converted image, where the target distortion parameter is used to control the degree of image distortion of the zoom-converted image;
[0009] Display the zoom-converted image, and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than a preset adjustment range;
[0010] Return to execute the steps: obtain a current frame image captured by the first imaging lens of the imaging device, until the target distortion parameter reaches a preset distortion parameter corresponding to a second imaging lens;
[0011] Switch the first imaging lens to the second imaging lens.
[0012] In one embodiment, performing an image zoom conversion on the current frame image according to the internal parameters of the imaging device and the target distortion parameters corresponding to the first imaging lens, to obtain a zoom-converted image, includes:
[0013] Obtaining the calibrated distortion parameters corresponding to the imaging device; determining the target distortion parameters according to the distortion parameter coefficient corresponding to the first imaging lens and the calibrated distortion parameters, where the distortion parameter coefficient is used to control the magnitude of the target distortion parameters; performing cropping and zooming on the current frame image according to the internal parameters of the device and the target distortion parameters, to obtain a zoom-converted image.
[0014] In one embodiment, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient; determining the target distortion parameters according to the distortion parameter coefficient corresponding to the first imaging lens and the calibrated distortion parameters, includes:
[0015] If the first imaging lens is a telephoto lens, obtaining the first parameter coefficient, and determining the target distortion parameters according to the first parameter coefficient and the calibrated distortion parameters, where the first parameter coefficient gradually increases during the lens switching process; if the first imaging lens is a wide-angle lens, obtaining the second parameter coefficient, and determining the target distortion parameters according to the second parameter coefficient and the calibrated distortion parameters, where the second parameter coefficient gradually decreases during the lens switching process.
[0016] In one embodiment, obtaining the first parameter coefficient, includes:
[0017] Obtaining the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculating the ratio of the current cropping and zooming frame number to the maximum cropping and zooming frame number, to obtain the first parameter coefficient.
[0018] In one embodiment, obtaining the second parameter coefficient, includes:
[0019] Obtaining the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculating the ratio of the difference between the current cropping and zooming frame number and the maximum cropping and zooming frame number to the maximum cropping and zooming frame number, to obtain the second parameter coefficient.
[0020] In one embodiment, adjusting the target distortion parameters, includes:
[0021] If the first imaging lens is a telephoto lens, increasing the target distortion parameters by increasing the first parameter coefficient; if the first imaging lens is a wide-angle lens, reducing the target distortion parameters by reducing the second parameter coefficient.
[0022] In one embodiment, cropping and zooming the current frame image according to the internal parameters of the device and the target distortion parameters to obtain a zoom-converted image includes:
[0023] Obtain the exit angle of the current frame image on the first camera lens, and determine the equivalent incident angle of the current frame image on the second camera lens according to the exit angle and the target distortion parameters; locate the coordinate positions of each pixel point in the current frame image in the cropped and zoomed camera device according to the equivalent incident angle and the exit angle to obtain camera device coordinate position information; transform the camera device coordinate position information into corresponding pixel coordinate position information according to the internal parameters of the device; crop and zoom the current frame image according to the pixel coordinate position information to obtain a zoom-converted image.
[0024] In a second aspect, the present application further provides a lens switching device. The device includes:
[0025] An acquisition module, configured to acquire a current frame image captured by a first camera lens of a camera device;
[0026] A zoom conversion module, configured to perform image zoom conversion on the current frame image according to the internal parameters of the camera device and the target distortion parameters determined by a parameter adjustment module to obtain a zoom-converted image, where the target distortion parameters are used to control the image distortion degree of the zoom-converted image;
[0027] An image display module, configured to display the zoom-converted image;
[0028] The parameter adjustment module is configured to adjust the target distortion parameters until the target distortion parameters reach the preset distortion parameters corresponding to the second camera lens, where the adjustment range of the target distortion parameters is less than the preset adjustment range;
[0029] A lens switching module, configured to switch the first camera lens to the second camera lens when the target distortion parameters reach the preset distortion parameters corresponding to the second camera lens.
[0030] In a third aspect, the present application further provides a camera device. The camera device includes a memory and a processor, the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0031] Obtain the current frame image captured by the first camera lens of the camera device; perform image zoom conversion on the current frame image according to the device internal parameters of the camera device and the target distortion parameter corresponding to the first camera lens to obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image; display the zoom-converted image and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than a preset adjustment range; return to execute the steps: obtain the current frame image captured by the first camera lens of the camera device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens; switch the first camera lens to the second camera lens.
[0032] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, and when the computer program is executed by a processor, the following steps are implemented:
[0033] Obtain the current frame image captured by the first camera lens of the camera device; perform image zoom conversion on the current frame image according to the device internal parameters of the camera device and the target distortion parameter corresponding to the first camera lens to obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image; display the zoom-converted image and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than a preset adjustment range; return to execute the steps: obtain the current frame image captured by the first camera lens of the camera device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens; switch the first camera lens to the second camera lens.
[0034] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0035] Obtain the current frame image captured by the first camera lens of the camera device; perform image zoom conversion on the current frame image according to the device internal parameters of the camera device and the target distortion parameter corresponding to the first camera lens to obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image; display the zoom-converted image and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than a preset adjustment range; return to execute the steps: obtain the current frame image captured by the first camera lens of the camera device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens; switch the first camera lens to the second camera lens.
[0036] The above-mentioned shot switching method, device, imaging device, storage medium, and computer program product obtain the current frame image captured by the first imaging lens of the imaging device, perform image zoom conversion on the current frame image according to the internal parameters of the device and the target distortion parameter corresponding to the first imaging lens, and obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image, display the zoom-converted image, and adjust the target distortion parameter. Since the adjustment amplitude of the target distortion parameter is less than the preset adjustment amplitude, the image distortion degree between the zoom-converted image of the next frame of visual image captured by the first imaging lens and the zoom-converted image of the current frame will not differ greatly. Thus, it returns to execute the step of obtaining the current frame image captured by the first imaging lens of the imaging device until the target distortion parameter reaches the preset distortion parameter corresponding to the second imaging lens, and switches the first imaging lens to the second imaging lens. In this way, during the entire shot switching process, the image distortion degree of the zoom-converted image displayed on the display screen of the imaging device can be gradually and dynamically adjusted, avoiding a large change in the image distortion degree of adjacent frames of zoom-converted images, and thus reducing the jitter of the display screen of the imaging device when switching shots. Description of the Drawings
[0037] Figure 1 It is an application environment diagram of the shot switching method in an embodiment;
[0038] Figure 2 It is a schematic diagram of the lens setting method of the imaging device in a dual-camera in an embodiment;
[0039] Figure 3 It is a comparative schematic diagram of the shooting effects of a telephoto lens and a wide-angle lens in an embodiment;
[0040] Figure 4 It is a comparative schematic diagram of the shooting views of a telephoto lens and a wide-angle lens in an embodiment;
[0041] Figure 5 It is a schematic flowchart of performing image zoom conversion on the current frame image in an embodiment;
[0042] Figure 6 It is a structural block diagram of the shot switching device in an embodiment;
[0043] Figure 7 It is an internal structure diagram of the imaging device in an embodiment. Detailed Embodiments
[0044] In order to make the objectives, technical solutions and advantages of the present application more clear and understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] Currently, a telephoto lens and a short-focus lens (wide-angle lens) are usually set in a camera device. By switching between the telephoto lens and the short-focus lens, captured images with different shooting effects can be obtained. During the process of switching between the telephoto lens and the short-focus lens, it is usually relied on a fish-eye camera model to directly calculate the zoomed image corresponding to the current frame image after the focal length of the camera device changes. In this way, while the lens is switched, the current frame image is directly switched to the zoomed image, so that the user can perceive the lens switching process on the display screen of the camera device. However, since the distortion of the captured image of the telephoto lens is usually small, and the distortion of the captured image of the short-focus lens is usually large, if the current frame image is directly switched to the zoomed image on the display screen of the camera device, due to the excessive difference in the image distortion degree between the current frame image and the zoomed image, it will cause the display screen of the camera device perceived by the user to freeze.
[0046] The present application proposes a lens switching method, which can gradually adjust the image distortion degree of the captured image displayed on the display screen of the camera device during the lens switching process, so that the image distortion degree between the captured images displayed on adjacent frames of the display screen of the camera device is not too large. Therefore, it is possible to reduce the freezing of the display screen of the camera device and improve the smoothness of the display screen of the camera device during lens switching.
[0047] In one embodiment, as Figure 1 shown, a lens switching method is provided. In this embodiment, taking the application of this method to a camera device as an example, it can be understood that this method can also be applied to a terminal equipped with a camera device or a camera. In this embodiment, the method includes the following steps:
[0048] Step 202, obtain the current frame image captured by the first camera lens of the camera device.
[0049] Among them, the camera device can be a dual-camera, or a surveillance camera equipped with multiple camera lenses. The camera device is provided with a first camera lens and a second camera lens, and the focal lengths of the first camera lens and the second camera lens are different; during the switching process of switching the first camera lens to the second camera lens, since a certain amount of time is consumed during the switching process, the first camera lens can capture the external space during the lens switching process and obtain multiple continuously captured images; the current frame image is the image captured by the first camera lens at the current frame during the lens switching process.
[0050] Refer toFigure 2 , Figure 2 is a schematic diagram of the lens setting method of the imaging device in a dual camera in an embodiment. The first imaging lens and the second imaging lens on the dual camera can be arranged horizontally ( Figure 2 left side view), vertically ( Figure 2 middle view) or diagonally ( Figure 2 right side view), etc.
[0051] As an example, if the first imaging lens can be a telephoto lens, the second imaging lens can be a short - focus lens (wide - angle lens); if the first imaging lens can be a short - focus lens (wide - angle lens), the second imaging lens can be a telephoto lens. Among them, the middle area of the short - focus lens is usually relatively blurred, and there are obvious distortions in the peripheral area, while the telephoto lens is usually relatively clear as a whole and has no distortion. Refer to Figure 3 , Figure 3 which is a schematic diagram comparing the shooting effects of the telephoto lens and the short - focus lens.
[0052] As an example, the middle area of the short - focus lens can be the co - viewing area between the short - focus lens and the telephoto lens. Refer to Figure 4 , Figure 4 which is a schematic diagram comparing the shooting views of the telephoto lens and the short - focus lens. Figure 4 The middle blurred area of the short - focus lens in
[0053] Step 204, perform image zoom conversion on the current frame image according to the internal parameters of the imaging device and the target distortion parameter corresponding to the first imaging lens, and obtain a zoom - converted image, where the target distortion parameter is used to control the image distortion degree of the zoom - converted image.
[0054] Among them, by calibrating the imaging device, the actual distortion parameter of the imaging device, that is, the calibration distortion parameter, can be determined. The calibration distortion parameter is used to determine the image distortion degree of the image captured by the imaging device; the target distortion parameter in this embodiment is a distortion parameter set according to the calibration distortion parameter, and the target distortion parameter is less than the calibration distortion parameter, which can ensure that the image distortion degree of the zoom - converted image is less than the image distortion degree of the image directly captured by the short - focus lens of the imaging device; Zoom conversion refers to converting the current frame captured image into an image captured by a lens at another focal length, and the image distortion degrees of the captured images at different focal lengths are different, that is, the shooting effects are different.
[0055] As an example, the internal parameters of the device are the orientation elements and the lens optical distortion coefficients of the imaging device, specifically, they can be collinearity parameters, radial distortion parameters, decentering distortion parameters, and in - image - plane affine distortion parameters, etc., which are used to realize the transformation between the camera coordinate system and the image - plane coordinate system.
[0056] As an example, assume that the focal length of the first camera lens is f1 and the focal length of the second camera lens is f2. Then, during the lens switching process, in order to enable the user to perceive the lens switching process, in this embodiment, a series of zoom images may be displayed on the display screen of the imaging device. These zoom images are equivalent to being captured by camera lenses with different focal lengths, and the focal lengths of these camera lenses are between f1 and f2. For example, the focal lengths corresponding to these zoom images may be distributed in a stepwise increasing or decreasing manner between f1 and f2. In this way, the distortion degree of these zoom images will also be distributed in a stepwise increasing or decreasing manner, making the distortion degree of the imaging device display image on the display screen of the imaging device change gradually rather than abruptly.
[0057] As an example, step 204 includes: obtaining the target distortion parameter corresponding to the first camera lens, and performing image zoom conversion on the current frame image according to the target distortion parameter, the internal parameters of the imaging device, and a preset fisheye camera model to obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image.
[0058] As an example, the way of zoom conversion may be zoom cropping.
[0059] Step 206: Display the zoom-converted image and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than a preset adjustment range.
[0060] As an example, step 206 includes: displaying the zoom-converted image on the display screen of the imaging device; if the first camera lens is a telephoto lens, increasing the target distortion parameter, and if the first camera lens is a wide-angle lens, decreasing the target distortion parameter, where the increase or decrease range of the target distortion parameter is less than a preset adjustment range, so as to ensure that the image distortion degrees between adjacent frames of zoom-converted images do not differ too much.
[0061] As an example, if the first camera lens is a telephoto lens and the second camera lens is a wide-angle lens, in this embodiment, during the lens switching process, it is necessary to gradually increase the displayed image in the display screen of the imaging device. Therefore, it is necessary to increase the target distortion parameter to increase the image distortion degree of the displayed image in the display screen of the imaging device, and the increase range of the target distortion parameter is less than the preset adjustment range to ensure that the image distortion degree of the displayed images of adjacent frames in the display screen of the imaging device does not change suddenly; if the first camera lens is a wide-angle lens and the second camera lens is a telephoto lens, in this embodiment, during the lens switching process, it is necessary to gradually decrease the displayed image in the display screen of the imaging device. Therefore, it is necessary to decrease the target distortion parameter to decrease the image distortion degree of the displayed image in the display screen of the imaging device, and the decrease range of the target distortion parameter is less than the preset adjustment range to ensure that the image distortion degree of the displayed images of adjacent frames in the display screen of the imaging device does not change suddenly.
[0062] Step 208, return and execute the step of obtaining the current frame image captured by the first camera lens of the imaging device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens.
[0063] Step 210, switch the first camera lens to the second camera lens.
[0064] Among them, during the lens switching process, as time goes by, every time the first camera lens captures a current frame image, in this embodiment, the current frame image will be zoom-converted into a zoom-converted image and displayed on the display screen of the imaging device. And during the entire lens switching process, by continuously adjusting the distortion parameter, and the adjustment range of the target distortion parameter is less than the preset adjustment range, a gradual adjustment of the distortion degree of the displayed image in the display screen of the imaging device is realized during the entire lens switching process until it is detected that the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens, which means that at this time, the zoom-converted image obtained by zoom-conversion based on the target distortion parameter has the same image distortion degree as the captured image of the second camera lens. At this time, when switching the lens, the first camera lens can be smoothly switched to the second camera lens without causing stuttering on the display screen of the imaging device.
[0065] In addition, it should be noted that the shooting angle of view of a wide-angle lens is usually large, so the image angle of view of the captured image of a wide-angle lens is also large, while the shooting angle of view of a telephoto lens is usually small, so the image angle of view of the captured image of a telephoto lens is also small. Therefore, this will cause a large difference in the image angle of view between the current frame image and the zoom image. Therefore, when directly switching and displaying the current frame image and the zoom image on the display screen of the imaging device, due to the sudden change in the size of the displayed image angle of view, it is also easy to cause stuttering on the display screen of the imaging device.
[0066] As an example, the preset distortion parameter of the second camera lens can be set to the calibrated distortion parameter of the second camera lens; alternatively, the difference between the preset distortion parameter and the calibrated distortion parameter of the second camera lens can be set to be less than a preset difference threshold. This can ensure that the image distortion degree difference between the captured image of the second camera lens and the last displayed zoom conversion image is small, meeting the requirement of gradually adjusting the image distortion degree during the lens switching process.
[0067] In this embodiment, during the lens switching process, current frame images are continuously captured over time. Each current frame image is zoom-converted into a zoom conversion image with a gradually changing distortion degree, and the image perspectives of these zoom conversion images also gradually change. The image perspectives of adjacent frame zoom conversion images do not differ greatly. In this way, by displaying each zoom conversion image frame by frame on the display screen of the imaging device during the lens switching process, rather than directly switching and displaying the current frame image and the zoom image on the display screen of the imaging device, the stuttering of the display screen of the imaging device can be reduced.
[0068] In the above lens switching method, by obtaining the current frame image captured by the first camera lens of the imaging device, and according to the internal parameters of the device and the target distortion parameter corresponding to the first camera lens, performing image zoom conversion on the current frame image to obtain a zoom conversion image, where the target distortion parameter is used to control the image distortion degree of the zoom conversion image, displaying the zoom conversion image, and adjusting the target distortion parameter. Since the adjustment amplitude of the target distortion parameter is less than the preset adjustment amplitude, the image distortion degree difference between the zoom conversion image of the next visual image captured by the first camera lens and the zoom conversion image of the current frame image will not be too large. Thus, return to execute the step: obtaining the current frame image captured by the first camera lens of the imaging device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens, and switching the first camera lens to the second camera lens. This can gradually and dynamically adjust the image distortion degree of the zoom conversion image displayed on the display screen of the imaging device during the entire lens switching process, avoiding a large change in the image distortion degree of adjacent frame zoom conversion images, and thus reducing the stuttering of the display screen of the imaging device during lens switching.
[0069] In one embodiment, as Figure 5 shown, performing image zoom conversion on the current frame image according to the internal parameters of the device and the target distortion parameter corresponding to the first camera lens to obtain a zoom conversion image includes:
[0070] Step 302, obtaining the calibrated distortion parameter corresponding to the imaging device.
[0071] Among them, the calibration distortion parameters can be obtained by calibrating the lens of the imaging device. After the calibration of the imaging device is completed, the calibration distortion parameters remain unchanged. Using the calibration distortion parameters, the captured images of the telephoto lens of the imaging device and the captured images of the wide-angle lens of the imaging device can be zoom-converted, that is, the captured images of the telephoto lens of the imaging device can be transformed into the captured images of the wide-angle lens of the imaging device, or the captured images of the wide-angle lens of the imaging device can be transformed into the captured images of the telephoto lens of the imaging device.
[0072] Step 304: Determine the target distortion parameters according to the distortion parameter coefficient corresponding to the first imaging lens and the calibration distortion parameters, where the distortion parameter coefficient is used to control the magnitude of the target distortion parameters.
[0073] Among them, in this embodiment, a distortion parameter coefficient is set for the calibration distortion parameters, and the distortion parameter coefficient can be used to control the magnitude of the target distortion parameters.
[0074] As an example, step 304 includes: obtaining the distortion parameter coefficient corresponding to the first imaging lens, and weighting the calibration distortion parameters according to the distortion parameter coefficient to obtain the target distortion parameters, where the weighting method can be multiplication or division.
[0075] Step 306: Crop and zoom the current frame image according to the device internal parameters and the target distortion parameters to obtain a zoom-converted image.
[0076] As an example, step 306 includes: locating the coordinate positions of each pixel point in the current frame image in the imaging device after cropping and zooming according to the imaging device coordinates, the target distortion parameters, and the preset fisheye camera model of each pixel point in the current frame image to obtain the imaging device coordinate position information; converting the imaging device coordinate position information into pixel coordinate position information according to the device internal parameters; cropping and zooming the current frame image according to the pixel coordinate position information to obtain a zoom-converted image, that is, cropping the current frame image into a zoom-converted image.
[0077] In one embodiment, cropping and zooming the current frame image according to the device internal parameters and the target distortion parameters to obtain a zoom-converted image includes:
[0078] Obtaining the exit angle of the current frame image in the first imaging lens, determining the equivalent incident angle of the current frame image in the second imaging lens according to the exit angle and the target distortion parameters; locating the coordinate positions of each pixel point in the current frame image in the imaging device after cropping and zooming according to the equivalent incident angle and the exit angle to obtain the imaging device coordinate position information; transforming the imaging device coordinate position information into the corresponding pixel coordinate position information according to the device internal parameters; cropping and zooming the current frame image according to the pixel coordinate position information to obtain a zoom-converted image.
[0079] Specifically, obtain the camera device coordinates of each pixel point in the current frame image. According to the camera device coordinates of each pixel point and the focal length of the camera device, calculate the exit angle corresponding to each pixel point in the current frame image; according to each exit angle and the target distortion parameter, calculate the equivalent incident angle of each pixel point in the current frame image on the second camera lens through a preset fisheye camera model; according to each equivalent incident angle and each exit angle, locate the camera device coordinate position of each pixel point in the current frame image after cropping and zooming to obtain the camera device coordinate position information; according to the internal parameters of the device, transform the camera device coordinate position information into the corresponding pixel coordinate position information; according to the pixel coordinate position information, crop and zoom the current frame image to obtain a zoom conversion image.
[0080] It should be noted that the exit angle refers to the viewing angle formed between the lens and the captured scene. The exit angle determines the range of scenery that the camera device can see, that is, the width of the field of view; the incident angle refers to the angle at which light enters the camera device lens. The incident angle determines how the light is captured by the lens and forms an image on the photosensitive element of the camera device.
[0081] As an example, the calculation formula for calculating the equivalent incident angle of each pixel point in the current frame image on the second camera lens through a preset fisheye camera model according to each exit angle and the target distortion parameter is as follows:
[0082] θ d = θ(1 + βk 1 θ 2 + βk 2 θ 4 + βk 3 θ 6 + βk 4 θ 8 )
[0083] Among them, θ d is the exit angle, θ is the equivalent incident angle, β is the distortion parameter coefficient, k 1 , k 2 , k 3 , k 4 are the calibrated distortion parameters.
[0084] As an example, the calculation formula for locating the camera device coordinate position of each pixel point in the current frame image after cropping and zooming according to each equivalent incident angle and each exit angle is as follows:
[0085] r = tan(θ)
[0086]
[0087] Among them, θ dis the exit angle, θ is the equivalent incident angle, r is the distance from the pixel point to the optical axis of the imaging device in the xy plane where the pixel point is located, (x′, y′) are the imaging device coordinates of each pixel point in the current frame image, and (a, b) are the imaging device coordinates of each pixel point in the current frame image after cropping and zooming.
[0088] In this embodiment, by forming target distortion parameters for each calibration distortion parameter target distortion parameter coefficient in the preset fisheye camera model, the optimization of the preset fisheye camera model is realized. In this way, the optimized preset fisheye camera model and the device internal parameters can be used to perform frame-by-frame zoom conversion on multiple current frame images captured by the first imaging lens during the imaging device switching process to obtain multiple zoom-converted images. Since the adjustment range of the target distortion parameters is less than the preset adjustment range, it can ensure that the image distortion degrees between adjacent frame images in the multiple zoom-converted images will not differ too much, laying a foundation for reducing the jitter during lens switching.
[0089] In one embodiment, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient; determining the target distortion parameter according to the distortion parameter coefficient and the calibration distortion parameter corresponding to the first imaging lens includes:
[0090] If the first imaging lens is a telephoto lens, obtain the first parameter coefficient, and determine the target distortion parameter according to the first parameter coefficient and the calibration distortion parameter, where the first parameter coefficient gradually increases during the lens switching process; if the first imaging lens is a wide-angle lens, obtain the second parameter coefficient, and determine the target distortion parameter according to the second parameter coefficient and the calibration distortion parameter, where the second parameter coefficient gradually decreases during the lens switching process.
[0091] Among them, during the process of switching from a telephoto lens to a wide-angle lens, since the image distortion degree of the images captured by the telephoto lens is smaller and the image distortion degree of the images captured by the wide-angle lens is larger, the target distortion parameter should be controlled to gradually increase during the lens switching process; during the process of switching from a wide-angle lens to a telephoto lens, since the image distortion degree of the images captured by the telephoto lens is smaller and the image distortion degree of the images captured by the wide-angle lens is larger, the target distortion parameter should be controlled to gradually decrease during the lens switching process.
[0092] Specifically, if the first imaging lens is a telephoto lens, obtain the first parameter coefficient, where the first parameter coefficient gradually increases during the lens switching process, and calculate the product between the first parameter coefficient and the calibration distortion parameter to obtain the target distortion parameter; if the first imaging lens is a wide-angle lens, obtain the second parameter coefficient, where the second parameter coefficient gradually decreases during the lens switching process, and calculate the product between the second parameter coefficient and the calibration distortion parameter to obtain the target distortion parameter.
[0093] As an example, in this embodiment, the first parameter coefficient and the second parameter coefficient can also be uniformly represented by using the third parameter coefficient.
[0094] As an example, assuming that the third parameter coefficient is α, the first parameter coefficient β can be set 1 = α, and the second parameter coefficient β 2 = 1 - α. At this time, according to each exit angle and the target distortion parameter, the calculation formula for the equivalent incident angle of each pixel point in the current frame image on the second camera lens through the preset fisheye camera model can be deformed as follows:
[0095] When the telephoto lens is switched to the wide-angle lens:
[0096] θ d = θ(1 + αk 1 θ 2 + αk 2 θ 4 + αk 3 θ 6 + αk 4 θ 8 )
[0097] When the wide-angle lens is switched to the telephoto lens:
[0098] θ d = θ(1 + (1 - α)k 1 θ 2 + (1 - α)k 2 θ 4 + (1 - α)k 3 θ 6 + (1 - α)k 4 θ 8 )
[0099] As an example, during the lens switching process, the third parameter coefficient α can be set to gradually change from 0 to 1, so that the first parameter coefficient also gradually changes from 0 to 1, while the second parameter coefficient gradually changes from 1 to 0.
[0100] In one embodiment, adjusting the target distortion parameter includes:
[0101] If the first camera lens is a telephoto lens, the target distortion parameter is increased by increasing the first parameter coefficient; if the first camera lens is a wide-angle lens, the target distortion parameter is reduced by reducing the second parameter coefficient.
[0102] Among them, during the process of switching from a telephoto lens to a short - focal - length lens, by gradually increasing the first parameter coefficient, the target distortion parameter can be controlled to gradually increase, so as to ensure that the adjustment range of the target distortion parameter is less than the preset adjustment range, realizing a gradual increase in the distortion degree of the displayed image in the display screen of the imaging device during the process of switching from a telephoto lens to a short - focal - length lens; during the process of switching from a short - focal - length lens to a telephoto lens, by gradually decreasing the second parameter coefficient, the target distortion parameter can be controlled to gradually decrease, so as to ensure that the adjustment range of the target distortion parameter is less than the preset adjustment range, realizing a gradual decrease in the distortion degree of the displayed image in the display screen of the imaging device during the process of switching from a short - focal - length lens to a telephoto lens.
[0103] As an example, the target distortion parameter can also be increased by adding a preset parameter value to the target distortion parameter, and decreased by subtracting a preset parameter value from the target distortion parameter. There can be various ways to adjust the target distortion parameter as described above, which are not limited herein.
[0104] In this embodiment, by setting the first parameter coefficient and the second parameter coefficient, by controlling the first parameter coefficient to gradually increase, a gradual increase in the distortion degree of the displayed image in the display screen of the imaging device can be realized during the process of switching from a telephoto lens to a short - focal - length lens. By controlling the second parameter coefficient to gradually decrease, a gradual decrease in the distortion degree of the displayed image in the display screen of the imaging device can be realized during the process of switching from a short - focal - length lens to a telephoto lens. In this way, whether switching from a telephoto lens to a short - focal - length lens or from a short - focal - length lens to a telephoto lens, a gradual adjustment of the distortion degree of the displayed image on the display screen of the imaging device can be achieved, laying a foundation for reducing the lag of the display screen of the imaging device.
[0105] During the lens - switching process, the first imaging lens continuously captures external images, obtaining multiple continuously captured images, that is, as time goes by, multiple continuously captured current - frame images are obtained. Since the lens - switching process is a finite - time process, the number of current - frame images captured during the imaging - device switching process is also finite. Therefore, there are a maximum cropping - zoom frame number and a current cropping - zoom frame number. The maximum cropping - zoom frame number is the maximum number of images that the first imaging lens can capture during the lens - switching process, and the current cropping - zoom frame number is the frame - sorting size when capturing the current - frame image during the lens - switching process. For example, assume that the first imaging lens can capture 10 images during the imaging - device switching process, then the maximum cropping - zoom frame number is 10. If the current - frame image is the 5th captured image, then the current cropping - zoom frame number is 5.
[0106] In one embodiment, obtaining the first parameter coefficient includes:
[0107] Obtain the current cropping and zooming frame number corresponding to the current frame image and the maximum cropping and zooming frame number; calculate the ratio of the current cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the first parameter coefficient.
[0108] Specifically, obtain the current cropping and zooming frame number corresponding to the current frame image and the maximum cropping and zooming frame number, calculate the ratio between the current cropping and zooming frame number and the maximum cropping and zooming frame number, and use this ratio as the first parameter coefficient.
[0109] In this embodiment, the first parameter coefficient can be associated with the image shooting timing during the switching process of the imaging device. In this way, during the process of switching from a telephoto lens to a wide-angle lens, as the first imaging lens continuously takes pictures, the first parameter coefficient can be automatically selected according to the frame sorting size of the current frame image obtained by shooting, so that the first parameter coefficient gradually changes with the shooting time sequence of the captured images, laying a foundation for the gradual adjustment of the target distortion parameter during the process of switching from a telephoto lens to a wide-angle lens.
[0110] In one embodiment, obtaining the second parameter coefficient includes:
[0111] Obtain the current cropping and zooming frame number corresponding to the current frame image and the maximum cropping and zooming frame number; calculate the ratio of the difference between the current cropping and zooming frame number and the maximum cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the second parameter coefficient.
[0112] Specifically, obtain the current cropping and zooming frame number corresponding to the current frame image and the maximum cropping and zooming frame number; calculate the difference between the current cropping and zooming frame number and the maximum cropping and zooming frame number, and use the ratio between this difference and the maximum cropping and zooming frame number as the second parameter coefficient.
[0113] In this embodiment, the second parameter coefficient can be associated with the image shooting timing during the switching process of the imaging device. In this way, during the process of switching from a wide-angle lens to a telephoto lens, as the first imaging lens continuously takes pictures, the second parameter coefficient can be automatically selected according to the frame sorting size of the current frame image obtained by shooting, so that the second parameter coefficient gradually changes with the shooting time sequence of the captured images, laying a foundation for the gradual adjustment of the target distortion parameter during the process of switching from a wide-angle lens to a telephoto lens.
[0114] In one embodiment, the current frame image captured by the first camera lens of the camera device and the calibrated distortion parameters corresponding to the camera device are obtained; the distortion parameter coefficient corresponding to the first camera lens is obtained, and according to the distortion parameter coefficient, the calibrated distortion parameters are weighted to obtain target distortion parameters, where the weighting method can be multiplication or division; the camera device coordinates of each pixel point in the current frame image are obtained, and according to each camera device coordinate and the focal length of the camera device, the exit angle corresponding to each pixel point in the current frame image is calculated; according to each exit angle and the target distortion parameters, the equivalent incident angle of each pixel point in the current frame image in the second camera lens is calculated through a preset fisheye camera model; according to each equivalent incident angle and each exit angle, the camera device coordinate position of each pixel point in the current frame image after cropping and zooming is located to obtain the camera device coordinate position information; according to the internal parameters of the device, the camera device coordinate position information is transformed into the corresponding pixel coordinate position information; according to the pixel coordinate position information, the current frame image is cropped and zoomed to obtain a zoom conversion image, so that the current frame image captured by the first camera lens can be zoom-converted into a zoom conversion image that can be displayed in the display screen of the camera device.
[0115] Further, after obtaining the zoom conversion image, the zoom conversion image is displayed on the display screen of the camera device; if the first camera lens is a telephoto lens, the target distortion parameters are increased, and if the first camera lens is a wide-angle lens, the target distortion parameters are decreased, where the increase or decrease range of the target distortion parameters is less than a preset adjustment range, so that the image distortion degree between adjacent frame zoom conversion images can be ensured not to differ too much; return to execute the steps: obtain the current frame image captured by the first camera lens of the camera device until the target distortion parameters reach the preset distortion parameters corresponding to the second camera lens, so that during the entire lens switching process, the image distortion degree of the zoom conversion image displayed on the display screen of the camera device can be gradually and dynamically adjusted, avoiding a large change in the image distortion degree of adjacent frame zoom conversion images, and thus the stuttering of the display screen of the camera device during lens switching can be reduced.
[0116] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least a part of other steps or steps or stages in other steps.
[0117] Based on the same inventive concept, an embodiment of the present application further provides a lens switching device for implementing the above-mentioned lens switching method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the following lens switching devices can refer to the limitations on the lens switching method in the above text and will not be repeated here.
[0118] In one embodiment, as Figure 6 shown, a lens switching device is provided, including: an acquisition module 602, a zoom conversion module 604, an image display module 606, a parameter adjustment module 608, and a lens switching module 610, where:
[0119] The acquisition module 602 is configured to acquire the current frame image captured by the first camera lens of the imaging device.
[0120] The zoom conversion module 604 is configured to perform image zoom conversion on the current frame image according to the internal parameters of the imaging device and the target distortion parameter determined by the parameter adjustment module 608 to obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image.
[0121] The image display module 606 is configured to display the zoom-converted image.
[0122] The parameter adjustment module 608 is configured to adjust the target distortion parameter until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens, where the adjustment range of the target distortion parameter is less than the preset adjustment range.
[0123] The lens switching module 610 is configured to switch the first camera lens to the second camera lens when the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens.
[0124] In one embodiment, the zoom conversion module 604 is further configured to:
[0125] acquire the calibrated distortion parameter corresponding to the imaging device; determine the target distortion parameter according to the distortion parameter coefficient corresponding to the first camera lens and the calibrated distortion parameter, where the distortion parameter coefficient is used to control the magnitude of the target distortion parameter; perform cropping zoom on the current frame image according to the internal parameters of the device and the target distortion parameter to obtain a zoom-converted image.
[0126] In one embodiment, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient; the zoom conversion module 604 is further configured to:
[0127] If the first camera lens is a telephoto lens, obtain a first parameter coefficient, and determine the target distortion parameter according to the first parameter coefficient and the calibrated distortion parameter, where the first parameter coefficient gradually increases during the lens switching process; if the first camera lens is a short - focus lens, obtain a second parameter coefficient, and determine the target distortion parameter according to the second parameter coefficient and the calibrated distortion parameter, where the second parameter coefficient gradually decreases during the lens switching process.
[0128] In one embodiment, the zoom conversion module 604 is further configured to:
[0129] Obtain the current cropped zoom frame number and the maximum cropped zoom frame number corresponding to the current frame image; calculate the ratio of the current cropped zoom frame number to the maximum cropped zoom frame number to obtain the first parameter coefficient.
[0130] In one embodiment, the zoom conversion module 604 is further configured to:
[0131] Obtain the current cropped zoom frame number and the maximum cropped zoom frame number corresponding to the current frame image; calculate the ratio of the difference between the current cropped zoom frame number and the maximum cropped zoom frame number to the maximum cropped zoom frame number to obtain the second parameter coefficient.
[0132] In one embodiment, the parameter adjustment module 608 is further configured to:
[0133] If the first camera lens is a telephoto lens, increase the target distortion parameter by increasing the first parameter coefficient; if the first camera lens is a short - focus lens, reduce the target distortion parameter by reducing the second parameter coefficient.
[0134] In one embodiment, the zoom conversion module 604 is further configured to:
[0135] Obtain the exit angle of the current frame image in the first camera lens, determine the equivalent incident angle of the current frame image in the second camera lens according to the exit angle and the target distortion parameter; locate the coordinate positions of each pixel point in the current frame image in the cropped and zoomed camera device according to the equivalent incident angle and the exit angle to obtain camera device coordinate position information; transform the camera device coordinate position information into corresponding pixel coordinate position information according to the camera internal parameters; crop and zoom the current frame image according to the pixel coordinate position information to obtain a zoom - converted image.
[0136] Each module in the above lens switching device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of the imaging device in hardware form or be independent of it, or can be stored in the memory of the imaging device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.
[0137] In one embodiment, an imaging device is provided. The imaging device can be a terminal equipped with an imaging unit, such as a camera or a mobile phone, etc. Its internal structure diagram can be as Figure 7 shown. The imaging device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the imaging device is used to provide computing and control capabilities. The memory of the imaging device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the imaging device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a lens switching method. Those skilled in the art can understand that Figure 7 the structure shown in
[0138] is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the imaging device to which the solution of this application is applied. The specific imaging device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0139] Obtain the current frame image captured by the first imaging lens of the imaging device; perform image zoom conversion on the current frame image according to the internal parameters of the device and the target distortion parameters corresponding to the first imaging lens to obtain a zoom-converted image, where the target distortion parameters are used to control the image distortion degree of the zoom-converted image; display the zoom-converted image, and adjust the target distortion parameters, where the adjustment amplitude of the target distortion parameters is less than a preset adjustment amplitude; return to execute the step: obtain the current frame image captured by the first imaging lens of the imaging device until the target distortion parameters reach the preset distortion parameters corresponding to the second imaging lens; switch the first imaging lens to the second imaging lens.
[0140] In one embodiment, when the processor executes the computer program, it also implements the following steps:
[0141] Obtain the calibration distortion parameters corresponding to the imaging device; determine the target distortion parameters according to the distortion parameter coefficient corresponding to the first imaging lens and the calibration distortion parameters, where the distortion parameter coefficient is used to control the magnitude of the target distortion parameters; perform cropping and zooming on the current frame image according to the device internal parameters and the target distortion parameters to obtain a zoom-converted image.
[0142] In one embodiment, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient; when the processor executes the computer program, the following steps are further implemented:
[0143] If the first imaging lens is a telephoto lens, obtain the first parameter coefficient, and determine the target distortion parameters according to the first parameter coefficient and the calibration distortion parameters, where the first parameter coefficient gradually increases during the lens switching process; if the first imaging lens is a wide-angle lens, obtain the second parameter coefficient, and determine the target distortion parameters according to the second parameter coefficient and the calibration distortion parameters, where the second parameter coefficient gradually decreases during the lens switching process.
[0144] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0145] Obtain the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculate the ratio of the current cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the first parameter coefficient.
[0146] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0147] Obtain the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculate the ratio of the difference between the current cropping and zooming frame number and the maximum cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the second parameter coefficient.
[0148] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0149] If the first imaging lens is a telephoto lens, increase the target distortion parameters by increasing the first parameter coefficient; if the first imaging lens is a wide-angle lens, reduce the target distortion parameters by reducing the second parameter coefficient.
[0150] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0151] Obtain the exit angle of the current frame image in the first camera lens. According to the exit angle and the target distortion parameter, determine the equivalent incident angle of the current frame image in the second camera lens. According to the equivalent incident angle and the exit angle, locate the coordinate positions of each pixel point in the current frame image in the cropped and zoomed camera device to obtain the camera device coordinate position information. According to the internal parameters of the device, transform the camera device coordinate position information into the corresponding pixel coordinate position information. According to the pixel coordinate position information, crop and zoom the current frame image to obtain the zoom conversion image.
[0152] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0153] Obtain the current frame image captured by the first camera lens of the camera device. Perform image zoom conversion on the current frame image according to the internal parameters of the camera device and the target distortion parameter corresponding to the first camera lens to obtain a zoom conversion image, where the target distortion parameter is used to control the image distortion degree of the zoom conversion image. Display the zoom conversion image and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than the preset adjustment range. Return to execute the step: Obtain the current frame image captured by the first camera lens of the camera device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens. Switch the first camera lens to the second camera lens.
[0154] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0155] Obtain the calibrated distortion parameter corresponding to the camera device. Determine the target distortion parameter according to the distortion parameter coefficient corresponding to the first camera lens and the calibrated distortion parameter, where the distortion parameter coefficient is used to control the size of the target distortion parameter. Crop and zoom the current frame image according to the internal parameters of the device and the target distortion parameter to obtain a zoom conversion image.
[0156] In one embodiment, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient. When the computer program is executed by a processor, the following steps are further implemented:
[0157] If the first camera lens is a telephoto lens, obtain a first parameter coefficient, and determine the target distortion parameter according to the first parameter coefficient and the calibrated distortion parameter, where the first parameter coefficient gradually increases during the lens switching process; if the first camera lens is a wide-angle lens, obtain a second parameter coefficient, and determine the target distortion parameter according to the second parameter coefficient and the calibrated distortion parameter, where the second parameter coefficient gradually decreases during the lens switching process.
[0158] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0159] Obtain the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculate the ratio of the current cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the first parameter coefficient.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0161] Obtain the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculate the ratio of the difference between the current cropping and zooming frame number and the maximum cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the second parameter coefficient.
[0162] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0163] If the first camera lens is a telephoto lens, increase the target distortion parameter by increasing the first parameter coefficient; if the first camera lens is a wide-angle lens, reduce the target distortion parameter by reducing the second parameter coefficient.
[0164] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0165] Obtain the exit angle of the current frame image from the first camera lens, determine the equivalent incident angle of the current frame image from the second camera lens according to the exit angle and the target distortion parameter; locate the coordinate positions of each pixel point in the current frame image in the cropped and zoomed camera device according to the equivalent incident angle and the exit angle to obtain camera device coordinate position information; transform the camera device coordinate position information into corresponding pixel coordinate position information according to the device internal parameters; crop and zoom the current frame image according to the pixel coordinate position information to obtain a zoomed conversion image.
[0166] In one embodiment, a computer program product is provided, including a computer program, which when executed by a processor, implements the following steps:
[0167] Obtain the current frame image captured by the first camera lens of the camera device; perform image zoom conversion on the current frame image according to the internal parameters of the device of the camera device and the target distortion parameter corresponding to the first camera lens to obtain a zoom-converted image, where the target distortion parameter is used to control the image distortion degree of the zoom-converted image; display the zoom-converted image and adjust the target distortion parameter, where the adjustment range of the target distortion parameter is less than a preset adjustment range; return to execute the step: obtain the current frame image captured by the first camera lens of the camera device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens; switch the first camera lens to the second camera lens.
[0168] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0169] Obtain the calibrated distortion parameter corresponding to the camera device; determine the target distortion parameter according to the distortion parameter coefficient corresponding to the first camera lens and the calibrated distortion parameter, where the distortion parameter coefficient is used to control the size of the target distortion parameter; perform cropping and zooming on the current frame image according to the internal parameters of the device and the target distortion parameter to obtain a zoom-converted image.
[0170] In one embodiment, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient; when the computer program is executed by a processor, the following steps are further implemented:
[0171] If the first camera lens is a telephoto lens, obtain the first parameter coefficient, and determine the target distortion parameter according to the first parameter coefficient and the calibrated distortion parameter, where the first parameter coefficient gradually increases during the lens switching process; if the first camera lens is a wide-angle lens, obtain the second parameter coefficient, and determine the target distortion parameter according to the second parameter coefficient and the calibrated distortion parameter, where the second parameter coefficient gradually decreases during the lens switching process.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0173] Obtain the current cropping and zooming frame number and the maximum cropping and zooming frame number corresponding to the current frame image; calculate the ratio of the current cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the first parameter coefficient.
[0174] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0175] Obtain the current cropping and zooming frame number corresponding to the current frame image and the maximum cropping and zooming frame number; calculate the ratio of the difference between the current cropping and zooming frame number and the maximum cropping and zooming frame number to the maximum cropping and zooming frame number to obtain the second parameter coefficient.
[0176] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
[0177] If the first camera lens is a telephoto lens, increase the target distortion parameter by increasing the first parameter coefficient; if the first camera lens is a wide-angle lens, reduce the target distortion parameter by reducing the second parameter coefficient.
[0178] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
[0179] Obtain the exit angle of the current frame image from the first camera lens, determine the equivalent incident angle of the current frame image on the second camera lens according to the exit angle and the target distortion parameter; locate the coordinate positions of each pixel point in the current frame image in the cropped and zoomed camera device according to the equivalent incident angle and the exit angle to obtain the camera device coordinate position information; transform the camera device coordinate position information into the corresponding pixel coordinate position information according to the internal parameters of the device; perform cropping and zooming on the current frame image according to the pixel coordinate position information to obtain the zoom conversion image.
[0180] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.
[0181] The technical features of the above embodiments can be combined arbitrarily. For the sake of concise description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0182] The above-described embodiments only represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A lens switching method, characterized in that, the method includes: Obtain the current frame image captured by the first camera lens of the imaging device; According to the internal parameters of the imaging device and the target distortion parameter corresponding to the first camera lens, perform image zoom conversion on the current frame image to obtain a zoom-converted image, wherein the target distortion parameter is used to control the image distortion degree of the zoom-converted image; Display the zoom-converted image and adjust the target distortion parameter, wherein the adjustment range of the target distortion parameter is less than a preset adjustment range; Return to execute the step: Obtain the current frame image captured by the first camera lens of the imaging device until the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens of the imaging device; Switch the first camera lens to the second camera lens.
2. The method according to claim 1, characterized in that, the performing image zoom conversion on the current frame image according to the internal parameters of the imaging device and the target distortion parameter corresponding to the first camera lens to obtain a zoom-converted image includes: Obtain the calibrated distortion parameter corresponding to the imaging device; Determine the target distortion parameter according to the distortion parameter coefficient corresponding to the first camera lens and the calibrated distortion parameter, wherein the distortion parameter coefficient is used to control the size of the target distortion parameter; Perform cropping zoom on the current frame image according to the internal parameters of the device and the target distortion parameter to obtain a zoom-converted image.
3. The method according to claim 2, characterized in that, the distortion parameter coefficient includes a first parameter coefficient and a second parameter coefficient; the determining the target distortion parameter according to the distortion parameter coefficient corresponding to the first camera lens and the calibrated distortion parameter includes: If the first camera lens is a telephoto lens, obtain the first parameter coefficient, and determine the target distortion parameter according to the first parameter coefficient and the calibrated distortion parameter, wherein the first parameter coefficient gradually increases during the lens switching process; If the first camera lens is a wide-angle lens, obtain the second parameter coefficient, and determine the target distortion parameter according to the second parameter coefficient and the calibrated distortion parameter, wherein the second parameter coefficient gradually decreases during the lens switching process.
4. The method according to claim 3, characterized in that, the obtaining the first parameter coefficient includes: Obtain the current cropping zoom frame number and the maximum cropping zoom frame number corresponding to the current frame image; Calculate the ratio of the current cropping zoom frame number to the maximum cropping zoom frame number to obtain the first parameter coefficient.
5. The method according to claim 3, characterized in that, the obtaining the second parameter coefficient includes: Obtain the current cropping zoom frame number and the maximum cropping zoom frame number corresponding to the current frame image; Calculate the ratio of the difference between the current cropping zoom frame number and the maximum cropping zoom frame number to the maximum cropping zoom frame number to obtain the second parameter coefficient.
6. The method according to claim 3, characterized in that, the adjusting the target distortion parameter includes: If the first camera lens is a telephoto lens, the target distortion parameter is increased by increasing the first parameter coefficient; If the first camera lens is a wide-angle lens, the target distortion parameter is reduced by reducing the second parameter coefficient.
7. The method according to claim 2, wherein, the cropping and zooming the current frame image according to the internal parameters of the device and the target distortion parameter to obtain a zoom-converted image includes: obtaining the exit angle of the current frame image in the first camera lens, and determining the equivalent incident angle of the current frame image in the second camera lens according to the exit angle and the target distortion parameter; locating the coordinate positions of each pixel point in the current frame image in the cropped and zoomed camera device according to the equivalent incident angle and the exit angle to obtain camera device coordinate position information; transforming the camera device coordinate position information into corresponding pixel coordinate position information according to the internal parameters of the device; cropping and zooming the current frame image according to the pixel coordinate position information to obtain a zoom-converted image.
8. A lens switching device, wherein, the device includes: an acquisition module, configured to acquire a current frame image captured by a first camera lens of a camera device; a zoom conversion module, configured to perform image zoom conversion on the current frame image according to the internal parameters of the camera device and the target distortion parameter determined by a parameter adjustment module to obtain a zoom-converted image, wherein the target distortion parameter is used to control the image distortion degree of the zoom-converted image; an image display module, configured to display the zoom-converted image; the parameter adjustment module, configured to adjust the target distortion parameter until the target distortion parameter reaches a preset distortion parameter corresponding to a second camera lens, wherein the adjustment range of the target distortion parameter is less than a preset adjustment range; a lens switching module, configured to switch the first camera lens to the second camera lens when the target distortion parameter reaches the preset distortion parameter corresponding to the second camera lens.
9. A camera device, comprising a camera unit, a memory, and a processor, the memory stores a computer program, wherein, when the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, wherein, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.